Class FugacityJacobian
java.lang.Object
neqsim.thermo.util.derivatives.FugacityJacobian
- All Implemented Interfaces:
Serializable
Container for Jacobian matrix of fugacity coefficients.
Stores derivatives of log fugacity coefficients (ln φ) for all components with respect to:
- Temperature: ∂(ln φ_i)/∂T
- Pressure: ∂(ln φ_i)/∂P
- Composition: ∂(ln φ_i)/∂n_j (moles) or ∂(ln φ_i)/∂x_j (mole fractions)
These derivatives are fundamental for:
- Flash calculation convergence (Newton methods)
- Implicit differentiation through equilibrium
- Stability analysis
- Since:
- 3.0
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]Component names.private final double[][]Derivatives w.r.t. moles: ∂(ln φ_i)/∂n_j [1/mol].private final double[]Derivatives w.r.t. pressure: ∂(ln φ_i)/∂P [1/bar].private final double[]Derivatives w.r.t. temperature: ∂(ln φ_i)/∂T [1/K].private final double[]Log fugacity coefficients ln(φ_i).private final intNumber of components.private final intPhase index (0 = liquid-like, 1 = vapor-like).private final StringPhase type description.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionFugacityJacobian(int phaseIndex, String phaseType, double[] lnPhi, double[] dlnPhidT, double[] dlnPhidP, double[][] dlnPhidn, String[] componentNames) Constructor for FugacityJacobian. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckSymmetry(double[] moles, double tolerance) Check thermodynamic consistency (symmetry of composition Jacobian).doubledirectionalDerivative(int componentIndex, double deltaT, double deltaP, double[] deltaN) Compute directional derivative of ln(φ_i) along a perturbation.String[]Get component names.double[][]Get full composition Jacobian matrix.doublegetDlnPhidn(int i, int j) Get derivative of ln(φ_i) w.r.t. moles of component j.double[]getDlnPhidnRow(int componentIndex) Get row of composition Jacobian (derivatives of ln(φ_i) w.r.t. all component moles).double[]Get all pressure derivatives.doublegetDlnPhidP(int componentIndex) Get derivative of ln(φ_i) w.r.t. pressure.double[]Get all temperature derivatives.doublegetDlnPhidT(int componentIndex) Get derivative of ln(φ_i) w.r.t. temperature.double[]getLnPhi()Get all log fugacity coefficients.doublegetLnPhi(int componentIndex) Get log fugacity coefficient for a component.intGet number of components.intGet phase index.Get phase type description.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
phaseIndex
private final int phaseIndexPhase index (0 = liquid-like, 1 = vapor-like). -
phaseType
Phase type description. -
numberOfComponents
private final int numberOfComponentsNumber of components. -
lnPhi
private final double[] lnPhiLog fugacity coefficients ln(φ_i). -
dlnPhidT
private final double[] dlnPhidTDerivatives w.r.t. temperature: ∂(ln φ_i)/∂T [1/K]. -
dlnPhidP
private final double[] dlnPhidPDerivatives w.r.t. pressure: ∂(ln φ_i)/∂P [1/bar]. -
dlnPhidn
private final double[][] dlnPhidnDerivatives w.r.t. moles: ∂(ln φ_i)/∂n_j [1/mol]. Matrix is [component][d/dn_component]. -
componentNames
Component names.
-
-
Constructor Details
-
FugacityJacobian
public FugacityJacobian(int phaseIndex, String phaseType, double[] lnPhi, double[] dlnPhidT, double[] dlnPhidP, double[][] dlnPhidn, String[] componentNames) Constructor for FugacityJacobian.- Parameters:
phaseIndex- phase indexphaseType- phase type descriptionlnPhi- log fugacity coefficientsdlnPhidT- derivatives w.r.t. temperaturedlnPhidP- derivatives w.r.t. pressuredlnPhidn- derivatives w.r.t. moles (Jacobian matrix)componentNames- component names
-
-
Method Details
-
getPhaseIndex
public int getPhaseIndex()Get phase index.- Returns:
- phase index
-
getPhaseType
-
getNumberOfComponents
public int getNumberOfComponents()Get number of components.- Returns:
- number of components
-
getLnPhi
public double getLnPhi(int componentIndex) Get log fugacity coefficient for a component.- Parameters:
componentIndex- component index- Returns:
- ln(φ_i)
-
getLnPhi
public double[] getLnPhi()Get all log fugacity coefficients.- Returns:
- array of ln(φ_i)
-
getDlnPhidT
public double getDlnPhidT(int componentIndex) Get derivative of ln(φ_i) w.r.t. temperature.- Parameters:
componentIndex- component index- Returns:
- ∂(ln φ_i)/∂T [1/K]
-
getDlnPhidT
public double[] getDlnPhidT()Get all temperature derivatives.- Returns:
- array of ∂(ln φ_i)/∂T
-
getDlnPhidP
public double getDlnPhidP(int componentIndex) Get derivative of ln(φ_i) w.r.t. pressure.- Parameters:
componentIndex- component index- Returns:
- ∂(ln φ_i)/∂P [1/bar]
-
getDlnPhidP
public double[] getDlnPhidP()Get all pressure derivatives.- Returns:
- array of ∂(ln φ_i)/∂P
-
getDlnPhidn
public double getDlnPhidn(int i, int j) Get derivative of ln(φ_i) w.r.t. moles of component j.- Parameters:
i- component index for fugacityj- component index for differentiation- Returns:
- ∂(ln φ_i)/∂n_j [1/mol]
-
getDlnPhidnRow
public double[] getDlnPhidnRow(int componentIndex) Get row of composition Jacobian (derivatives of ln(φ_i) w.r.t. all component moles).- Parameters:
componentIndex- component index- Returns:
- array of ∂(ln φ_i)/∂n_j for all j
-
getDlnPhidn
public double[][] getDlnPhidn()Get full composition Jacobian matrix.- Returns:
- matrix [i][j] = ∂(ln φ_i)/∂n_j
-
getComponentNames
-
checkSymmetry
public boolean checkSymmetry(double[] moles, double tolerance) Check thermodynamic consistency (symmetry of composition Jacobian).For a thermodynamically consistent model: n_i * ∂(ln φ_i)/∂n_j = n_j * ∂(ln φ_j)/∂n_i
- Parameters:
moles- mole numberstolerance- relative tolerance for symmetry check- Returns:
- true if consistent within tolerance
-
directionalDerivative
public double directionalDerivative(int componentIndex, double deltaT, double deltaP, double[] deltaN) Compute directional derivative of ln(φ_i) along a perturbation.- Parameters:
componentIndex- component indexdeltaT- temperature perturbationdeltaP- pressure perturbationdeltaN- mole perturbations- Returns:
- directional derivative of ln(φ_i)
-
toString
-