Class AttractiveTermSoreideWhitson
- All Implemented Interfaces:
Serializable, Cloneable, AttractiveTermInterface
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 Summary
FieldsModifier and TypeFieldDescriptionprivate doubleStores the salinity value for use in alpha and derivative calculations.private static final longFields inherited from class AttractiveTermBaseClass
logger, m, parameters, parametersSolid -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for AttractiveTermSoreideWhitson. -
Method Summary
Modifier and TypeMethodDescriptiondoublealpha(double temperature) alpha.doublediffalphaT(double temperature) Calculates the first derivative of the alpha function with respect to temperature.doublediffdiffalphaT(double temperature) Calculates the second derivative of the alpha function with respect to temperature.private doubleGets the salinity value set for calculations.voidsetSalinityFromPhase(double salinity) Sets the salinity value to be used in calculations.Methods inherited from class AttractiveTermPr1978
clone, init, setmMethods inherited from class AttractiveTermPr
aT, diffaT, diffdiffaTMethods inherited from class AttractiveTermBaseClass
equals, getComponent, getm, getParameters, setComponent, setParameters
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
salinityFromPhase
private double salinityFromPhaseStores the salinity value for use in alpha and derivative calculations.
-
-
Constructor Details
-
AttractiveTermSoreideWhitson
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^2where:
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:
alphain interfaceAttractiveTermInterface- Overrides:
alphain classAttractiveTermPr- 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/dTwhere:
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:
diffalphaTin interfaceAttractiveTermInterface- Overrides:
diffalphaTin classAttractiveTermPr- 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)^2with:
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:
diffdiffalphaTin interfaceAttractiveTermInterface- Overrides:
diffdiffalphaTin classAttractiveTermPr- Parameters:
temperature- a double- Returns:
- a double
-