Class AttractiveTermSoreideWhitson

All Implemented Interfaces:
Serializable, Cloneable, AttractiveTermInterface

public class AttractiveTermSoreideWhitson extends AttractiveTermPr1978

AttractiveTermSoreideWhitson class.

Implements the modified alpha function for the Søreide-Whitson method specifically tailored for water in systems where salinity is a factor. This attractive term modifies the standard Peng-Robinson 1978 alpha function for water based on reduced temperature and salinity.

The alpha function is defined as: alpha = A^2 where: A(Tr) = 1.0 + 0.453 * (1.0 - Tr * (1.0 - 0.0103 * salinity^1.1)) + 0.0034 * (Tr^(-3) - 1.0) and Tr = T / Tc (Reduced Temperature).

This class extends AttractiveTermPr1978 and overrides its methods for water component.

Version:
$Id: $Id
Author:
Even Solbraa, (corrected by) NeqSim developers
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • salinityFromPhase

      private double salinityFromPhase
      Stores the salinity value for use in alpha and derivative calculations.
  • Constructor Details

    • AttractiveTermSoreideWhitson

      public AttractiveTermSoreideWhitson(ComponentEosInterface component)

      Constructor for AttractiveTermSoreideWhitson.

      Parameters:
      component - The component to which this attractive term is associated.
  • Method Details

    • setSalinityFromPhase

      public void setSalinityFromPhase(double salinity)
      Sets the salinity value to be used in calculations.
      Parameters:
      salinity - the salinity value to set
    • getSalinityFromPhase

      private double getSalinityFromPhase()
      Gets the salinity value set for calculations.
      Returns:
      the salinity value, or 0.0 if not set
    • alpha

      public double alpha(double temperature)

      alpha.

      Calculates the alpha function value for the Søreide-Whitson attractive term.

      This override applies only if the component is "water". For other components, it delegates to the superclass's `alpha` method (Peng-Robinson 1978). The formula for water is:

      alpha = A^2

      where:

      A(Tr) = 1.0 + 0.453 * (1.0 - Tr * (1.0 - 0.0103 * salinity^1.1)) + 0.0034 * (Tr^(-3) - 1.0)

      and Tr = T / Tc (Reduced Temperature).

      Specified by:
      alpha in interface AttractiveTermInterface
      Overrides:
      alpha in class AttractiveTermPr
      Parameters:
      temperature - a double
      Returns:
      a double
    • diffalphaT

      public double diffalphaT(double temperature)

      Calculates the first derivative of the alpha function with respect to temperature.

      This override applies only if the component is "water". For other components, it delegates to the superclass's `diffalphaT` method. The derivative is calculated using the chain rule:

      d(alpha)/dT = d(A^2)/dT = 2 * A * dA/dT

      where:

      dA/dT = (dA/dTr) * (dTr/dT)

      and

      dA/dTr = -0.453 * (1.0 - 0.0103 * salinity^1.1) - 3.0 * 0.0034 * Tr^(-4) dTr/dT = 1 / Tc
      Specified by:
      diffalphaT in interface AttractiveTermInterface
      Overrides:
      diffalphaT in class AttractiveTermPr
      Parameters:
      temperature - a double
      Returns:
      a double
    • diffdiffalphaT

      public double diffdiffalphaT(double temperature)

      Calculates the second derivative of the alpha function with respect to temperature.

      This override applies only if the component is "water". For other components, it delegates to the superclass's `diffdiffalphaT` method. The second derivative is calculated using the product and chain rules:

      d^2(alpha)/dT^2 = d^2(A^2)/dT^2 = 2 * (dA/dT)^2 + 2 * A * (d^2A/dT^2)

      where:

      dA/dT = dAlpha_dTr * dTrdT (from `diffalphaT`)

      and:

      d^2A/dT^2 = (d^2A/dTr^2) * (dTr/dT)^2

      with:

      d^2A/dTr^2 = d/dTr [ -0.453 * S_term - 3.0 * 0.0034 * Tr^(-4) ] = 12.0 * 0.0034 * Tr^(-5) dTr/dT = 1 / Tc
      Specified by:
      diffdiffalphaT in interface AttractiveTermInterface
      Overrides:
      diffdiffalphaT in class AttractiveTermPr
      Parameters:
      temperature - a double
      Returns:
      a double