Cape Thermo Material WrapperCalc And Get Ln Phi Method
Definition
Assembly: CapeOpen (in CapeOpen.dll) Version: 1.0.0.0 (1.0.0.0)
public void CalcAndGetLnPhi(
string phaseLabel,
double temperature,
double pressure,
double[] moleNumbers,
int fFlags,
ref double[] lnPhi,
ref double[] lnPhiDT,
ref double[] lnPhiDP,
ref double[] lnPhiDn
)Public Sub CalcAndGetLnPhi (
phaseLabel As String,
temperature As Double,
pressure As Double,
moleNumbers As Double(),
fFlags As Integer,
ByRef lnPhi As Double(),
ByRef lnPhiDT As Double(),
ByRef lnPhiDP As Double(),
ByRef lnPhiDn As Double()
)Parameters
- phaseLabel String
- Phase label of the Phase for which the properties are to be calculated. The Phase label must be one of the strings returned by the GetPhaseList method on the ICapeThermoPhases interface.
- temperature Double
- The temperature (K) for the calculation.
- pressure Double
- The pressure (Pa) for the calculation.
- moleNumbers Double
- Number of moles of each Compound in the mixture.
- fFlags Int32
- Code indicating whether natural logarithm of the fugacity coefficients and/or derivatives should be calculated (see notes).
- lnPhi Double
- Natural logarithm of the fugacity coefficients (if requested).
- lnPhiDT Double
- Derivatives of natural logarithm of the fugacity coefficients w.r.t. temperature (if requested).
- lnPhiDP Double
- Derivatives of natural logarithm of the fugacity coefficients w.r.t. pressure (if requested).
- lnPhiDn Double
- Derivatives of natural logarithm of the fugacity coefficients w.r.t. mole numbers (if requested).
Remarks
This method is provided to allow the natural logarithm of the fugacity coefficient, which is the most commonly used thermodynamic property, to be calculated and returned in a highly efficient manner.
The temperature, pressure and composition (mole numbers) for the calculation are specified by the arguments and are not obtained from the Material Object by a separate request. Likewise, any quantities calculated are returned through the arguments and are not stored in the Material Object. The state of the Material Object is not affected by calling this method. It should be noted however, that prior to calling CalcAndGetLnPhi a valid Material Object must have been defined by calling the SetMaterial method on the ICapeThermoMaterialContext interface of the component that implements the ICapeThermoPropertyRoutine interface. The compounds in the Material Object must have been identified and the number of values supplied in the moleNumbers argument must be equal to the number of Compounds in the Material Object.
The fugacity coefficient information is returned as the natural logarithm of the fugacity coefficient. This is because thermodynamic models naturally provide the natural logarithm of this quantity and also a wider range of values may be safely returned.
The quantities actually calculated and returned by this method are controlled by an integer code fFlags. The code is formed by summing contributions for the property and each derivative required using the enumerated constants eCapeCalculationCode (defined in the Thermo version 1.1 IDL) shown in the following table. For example, to calculate log fugacity coefficients and their T-derivatives the fFlags argument would be set to CAPE_LOG_FUGACITY_COEFFICIENTS + CAPE_T_DERIVATIVE.
| Calculation Type | Enumeration Value | Numerical Value |
|---|---|---|
| no calculation | CAPE_NO_CALCULATION | 0 |
| log fugacity coefficients | CAPE_LOG_FUGACITY_COEFFICIENTS | 1 |
| T-derivative | CAPE_T_DERIVATIVE | 2 |
| P-derivative | CAPE_P_DERIVATIVE | 4 |
| mole number derivatives | CAPE_MOLE_NUMBERS_DERIVATIVES | 8 |
If CalcAndGetLnPhi is called with fFlags set to CAPE_NO_CALCULATION no property values are returned.
A typical sequence of operations for this method when implemented by a Property Package component would be:
- Check that the phaseLabel specified is valid.
- Check that the moleNumbers array contains the number of values expected
(should be consistent with the last call to the SetMaterial method).
- Calculate the requested properties/derivatives at the T/P/composition specified in the argument list.
- Store values for the properties/derivatives in the corresponding arguments.
Note that this calculation can be carried out irrespective of whether the Phase actually exists in the Material Object.
Exceptions
| ECapeNoImpl | The operation is “not” implemented even if this method can be called for reasons of compatibility with the CAPE-OPEN standards. That is to say that the operation exists, but it is not supported by the current implementation. |
| ECapeLimitedImpl | Would be raised if the one or more of the properties requested cannot be returned because the calculation is not implemented. |
| ECapeBadInvOrder | The necessary pre-requisite operation has not been called prior to the operation request. For example, the ICapeThermoMaterial interface has not been passed via a SetMaterial call prior to calling this method. |
| ECapeFailedInitialisation | The pre-requisites for the Property Calculation are not valid. Forexample, the composition of the phase is not defined, the number of Compounds in the Material Object is zero or not consistent with the moleNumbers argument or any other necessary input information is not available. |
| ECapeThrmPropertyNotAvailable | At least one item in the requested properties cannot be returned. This could be because the property cannot be calculated at the specified conditions or for the specified Phase. If the property calculation is not implemented then ECapeLimitedImpl should be returned. |
| ECapeSolvingError | One of the property calculations has failed. For example if one of the iterative solution procedures in the model has run out of iterations, or has converged to a wrong solution. |
| ECapeInvalidArgument | To be used when an invalid argument value is passed, for example an unrecognised value, or UNDEFINED for the phaseLabel argument. |
| ECapeUnknown | The error to be raised when other error(s), specified for this operation, are not suitable. |