ICapeThermoPropertyRoutineCalcAndGetLnPhi Method

This method is used to calculate the natural logarithm of the fugacity coefficients (and optionally their derivatives) in a single Phase mixture. The values of temperature, pressure and composition are specified in the argument list and the results are also returned through the argument list.

Definition

Namespace: CapeOpen
Assembly: CapeOpen (in CapeOpen.dll) Version: 1.0.0.0 (1.0.0.0)
[DispIdAttribute(1)]
void CalcAndGetLnPhi(
	string phaseLabel,
	double temperature,
	double pressure,
	Object moleNumbers,
	int fFlags,
	out Object lnPhi,
	out Object lnPhiDT,
	out Object lnPhiDP,
	out Object lnPhiDn
)

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  Object
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  Object
Natural logarithm of the fugacity coefficients (if requested).
lnPhiDT  Object
Derivatives of natural logarithm of the fugacity coefficients w.r.t. temperature (if requested).
lnPhiDP  Object
Derivatives of natural logarithm of the fugacity coefficients w.r.t. pressure (if requested).
lnPhiDn  Object
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 TypeEnumeration ValueNumerical Value
no calculationCAPE_NO_CALCULATION0
log fugacity coefficientsCAPE_LOG_FUGACITY_COEFFICIENTS1
T-derivativeCAPE_T_DERIVATIVE2
P-derivativeCAPE_P_DERIVATIVE4
mole number derivativesCAPE_MOLE_NUMBERS_DERIVATIVES8

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

ECapeNoImplThe 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.
ECapeLimitedImplWould be raised if the one or more of the properties requested cannot be returned because the calculation is not implemented.
ECapeBadInvOrderThe 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.
ECapeFailedInitialisationThe 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.
ECapeThrmPropertyNotAvailableAt 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.
ECapeSolvingErrorOne 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.
ECapeInvalidArgumentTo be used when an invalid argument value is passed, for example an unrecognised value, or UNDEFINED for the phaseLabel argument.
ECapeUnknownThe error to be raised when other error(s), specified for this operation, are not suitable.

See Also