Legacy API¶
Warning
The functions in this legacy application program interface (API) have all been deprecated and will be removed in some future release. Please use the High-Level API:
Function Listing¶
ABFL1dll()
ABFL2dll()
AGdll()
B12dll()
BLCRVdll()
CSTARdll()
CHEMPOTdll()
CP0dll()
CRITPdll()
CRTPNTdll()
CSATKdll()
CSTARdll()
CV2PKdll()
CVCPdll()
DBDTdll()
DBFL1dll()
DEFL1dll()
DEFLSHdll()
DERVPVTdll()
DHD1dll()
DHFL1dll()
DHFLSHdll()
DIELECdll()
DLSATKdll()
DPDD2dll()
DPTSATKdll()
DQFL2dll()
DSD1dll()
DSFL1dll()
DSFLSHdll()
DVSATKdll()
ENTHALdll()
ENTROdll()
ESFLSHdll()
EXCESSdll()
FGCTY2dll()
FGCTYdll()
FPVdll()
FUGCOFdll()
GERG04dll()
GERG08dll()
GETFIJdll()
GETKTVdll()
GETMODdll()
GETREFDIRdll()
GIBBSdll()
HEATFRMdll()
HEATdll()
HMXORDERdll()
HSFL1dll()
HSFLSHdll()
IDCRVdll()
INFOdll()
JICRVdll()
JTCRVdll()
LIMITKdll()
LIMITSdll()
LIMITXdll()
LIQSPNDLdll()
MASSFLUXdll()
MAXPdll()
MAXTdll()
MELTKdll()
MELTPdll()
MELTTdll()
MLTH2Odll()
NAMEdll()
PASSCMNdll()
PDFL1dll()
PDFLSHdll()
PEFL1dll()
PEFLSHdll()
PHFL1dll()
PHFLSHdll()
PHI0dll()
PHIDERVdll()
PHIHMXdll()
PHIKdll()
PHIMIXdll()
PHIXdll()
PQFLSHdll()
PREOSdll()
PRESSdll()
PSATKdll()
PSFL1dll()
PSFLSHdll()
PUREFLDdll()
QMASSdll()
QMOLEdll()
RDXHMXdll()
REDXdll()
RESIDUALdll()
RIEMdll()
RMIX2dll()
SATDdll()
SATESTdll()
SATEdll()
SATGUESSdll()
SATGVdll()
SATHdll()
SATPdll()
SATSPLNdll()
SATSdll()
SATTPdll()
SATTdll()
SETAGAdll()
SETKTVdll()
SETMIXdll()
SETMODdll()
SETNCdll()
SETREFDIRdll()
SETREFdll()
SETUPdll()
SPLNROOTdll()
SPLNVALdll()
STNdll()
SUBLPdll()
SUBLTdll()
SURFTdll()
SURTENdll()
TDFLSHdll()
TEFL1dll()
TEFLSHdll()
THERM0dll()
THERM2dll()
THERM3dll()
THERMdll()
THFL1dll()
THFLSHdll()
TPFL2dll()
TPFLSHdll()
TPRHOPRdll()
TPRHOdll()
TQFLSHdll()
TRNPRPdll()
TSATDdll()
TSATPdll()
TSFL1dll()
TSFLSHdll()
UNSETAGAdll()
VAPSPNDLdll()
VIRBAdll()
VIRBCD12dll()
VIRBCDdll()
VIRBdll()
VIRCAdll()
VIRCdll()
VIRTAUdll()
WMOLIdll()
WMOLdll()
XMASSdll()
XMOLEdll()
Function Documentation¶
-
subroutine
ABFL1dll
(a, b, z, kph, ab, Dmin, Dmax, T, P, D, ierr, herr, ab_length, herr_length)¶ General single-phase flash routine given two inputs and composition. Valid input properties are temperature, pressure, density, energy, enthalpy, or entropy. The character string ab specifies the inputs, which can be T, P, D, E, H, S. An input of ‘EH’ (or ‘HE’) is not supported. The letters in this string must be uppercase.
Care must be taken when sending inputs of T, P, or D, so that the same variable is not sent twice. For example, the following would be wrong:
call ABFL1 ('TH',T,H,z,kph,0,0,Dmin,Dmax,T,P,D,ierr,herr)
- Rather, the following are examples of correct inputs::
- call ABFL1 (‘TH’,T,H,z,kph,0,Dmin,Dmax,tt,P, D,ierr,herr) call ABFL1 (‘TP’,T,P,z,kph,0,Dmin,Dmax,tt,pp,D,ierr,herr) call ABFL1 (‘DS’,D,S,z,kph,0,Dmin,Dmax,T, P,dd,ierr,herr)
- When calling the ABFL1dll routine, the inputs are different::
- call ABFL1dll (a,b,z,kph,ab,Dmin,Dmax,T,P,D,ierr,herr)
- The examples above are repeated below for this call::
- call ABFL1dll (T,H,z,kph,’TH’,Dmin,Dmax,tt,P, D,ierr,herr) call ABFL1dll (T,P,z,kph,’TP’,Dmin,Dmax,tt,pp,D,ierr,herr) call ABFL1dll (D,S,z,kph,’DS’,Dmin,Dmax,T, P,dd,ierr,herr)
This routine accepts only single-phase inputs, it is intended primarily for use with the more general flash routine ABFLSH, but can be called independently for increased calculation speed if the inputs are known to be single-phase. This will avoid the call to the flash routines to determine the phase of the inputs. If this routine is called, but the inputs are 2-phase, either an incorrect root or a metastable state will be returned (which is OK if the metastable state is desired).
However! This routine is not necessary because all flash calls can be made through a call to ABFLSH or ABFLSHdll. It is recommended to use either the REFPROP or ABFLSH routines for all flash calculations even for single phase calls when it is not necessary to check the phase of the input properties. For example, the TH call above for a known liquid phase state could be called like this:
iFlag=10 !Indicates that the input state is in the liquid. !Use iFlag=20 for vapor phase states. call ABFLSHdll ('TH',T,H,z,iFlag,tt,P,D,Dl,Dv, & x,y,q,e,hh,s,Cv,Cp,w,ierr,herr)
Further information is given in the comments under the ABFLSH and REFPROP subroutines.
Parameters: - a [double ,in] :: First property (either temperature, pressure, density, entropy)
- b [double ,in] :: Second property (pressure, density, energy, enthalpy, or entropy) Possible inputs for these two variables are
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Phase flag
- ab [char ,in] :: Character*2 string defining the inputs, e.g., ‘TH’ or ‘PS’ Valid characters are T, P, D, E, H, S
- Dmin [double ,in] :: Lower bound on density [mol/L] (for T inputs)
- Dmax [double ,in] :: Upper bound on density [mol/L] (for T inputs)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Molar density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- ab_length [int ] :: length of variable
ab
(default: 2) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Liquid (kph is only needed for TP inputs) 2: Vapor ierr
flags0: Successful 248: Single-phase iteration did not converge
-
subroutine
ABFL2dll
(a, b, z, kq, ksat, ab, Tbub, Tdew, Pbub, Pdew, Dlbub, Dvdew, ybub, xdew, T, P, Dl, Dv, x, y, q, ierr, herr, ab_length, herr_length)¶ General flash calculation given two inputs and composition. Valid properties for the first input are temperature, pressure, and density. Valid properties for the second are pressure, density, energy, enthalpy, entropy, or quality. The character string ab specifies the inputs.
This routine accepts only two-phase states as inputs; it is intended primarily for use by the general flash routines such as THFLSH or TSFLSH. It may be called independently if the state is known to be two-phase. But beware - this routine does not check limits, and it will be significantly faster than TSFLSH, etc., when the bubble and dew point limits can be provided (ksat=1 option).
This routine calls TPFL2 within a secant-method iteration to find a solution. Initial guesses are based on the liquid density at the bubble point and the vapor density at the dew point.
Parameters: - a [double ,in] :: First property (either temperature, pressure, or density)
- b [double ,in] :: Second property (pressure, density, energy, enthalpy, entropy, or quality)
- z (20) [double ,in] :: Overall composition (array of mole fractions)
- kq [int ,in] :: Flag specifying units for input quality when b=quality
- ksat [int ,in] :: Flag for bubble and dew point limits
- ab [char ,in] :: Character*2 string defining the inputs, e.g., ‘TD’ or ‘PQ’
- Tbub [double ,in] :: Bubble point temperature [K] at (P and x=z)
- Tdew [double ,in] :: Dew point temperature [K] at (P and y=z) For temperature inputs
- Pbub [double ,in] :: Bubble point pressure [kPa] at (T and x=z)
- Pdew [double ,in] :: Dew point pressure [kPa] at (T and y=z) For either case
- Dlbub [double ,in] :: Liquid density [mol/L] at bubble point
- Dvdew [double ,in] :: Vapor density [mol/L] at dew point
- ybub (20) [double ,in] :: Vapor composition (array of mole fractions) at bubble point
- xdew (20) [double ,in] :: Liquid composition (array of mole fractions) at dew point
- T [double ,out] :: Temperature [K] (if not an input)
- P [double ,out] :: Pressure [kPa] (if not an input)
- Dl [double ,out] :: Liquid density [mol/L] at bubble point
- Dv [double ,out] :: Vapor density [mol/L] at dew point
- x (20) [double ,out] :: Liquid composition (array of mole fractions)
- y (20) [double ,out] :: Vapor composition (array of mole fractions)
- q [double ,out] :: Vapor quality, the definitions of the values for q are given in the ABFLSH routine.
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- ab_length [int ] :: length of variable
ab
(default: 2) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kq
flags1: Quality on molar basis (moles vapor/total moles) 2: Quality on mass basis (mass vapor/total mass) ksat
flags0: Dew and bubble point limits computed here 1: Must provide values for the following: For pressure and density inputs ierr
flags0: Successful 223: Bubble point calculation did not converge 224: Dew point calculation did not converge 226: 2-phase iteration did not converge
-
subroutine
AGdll
(T, D, z, a, g)¶ Compute Helmholtz and Gibbs energies as functions of temperature, density, and composition. These are not residual values (those are calculated by GIBBS). See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- a [double ,out] :: Helmholtz energy [J/mol]
- g [double ,out] :: Gibbs free energy [J/mol]
-
subroutine
B12dll
(T, z, B)¶ Compute B12 as a function of temperature and composition for a binary mixture.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- B [double ,out] :: B12 [L/mol]
-
subroutine
BLCRVdll
(D, z, T, ierr, herr, herr_length)¶ Calculate the temperature along the Boyle curve for the input density. This line starts at zero density at the temperature where B=0, and passes into the liquid phase without crossing the two-phase. It ends at a saturated liquid state very close to the critical point. The argument z in this routine is an array with the mole fractions of the mixture. If the input T is non-zero, it is used as the initial guess.
Parameters: - D [double ,in] :: Density [mol/l]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Iteration failed to converge
-
subroutine
CSTARdll
(T, P, v, z, Cs, Ts, Ds, Ps, ws, ierr, herr, herr_length)¶ Calculate the critical flow factor, C*, for nozzle flow of a gas (subroutine was originally named CCRIT).
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- v [double ,in] :: Plenum velocity [m/s] (Should generally be set to 0 for calculating stagnation conditions.)
- z (20) [double ,in] :: Composition (array of mole fractions)
- Cs [double ,out] :: Critical flow factor [dimensionless]
- Ts [double ,out] :: Nozzle throat temperature [K]
- Ds [double ,out] :: Nozzle throat molar density [mol/L]
- Ps [double ,out] :: Nozzle throat pressure [kPa]
- ws [double ,out] :: Nozzle throat speed of sound [m/s]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: CSTAR did not converge
-
subroutine
CHEMPOTdll
(T, D, z, u, ierr, herr, herr_length)¶ Compute the chemical potentials for each of the nc components of a mixture.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- u (20) [double ,out] :: Array (1..nc) of the chemical potentials [J/mol]
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
CP0dll
(T, z, Cp)¶ Calculate Cp0 for a mixture given temperature and composition.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition array (array of mole fractions)
- Cp [double ] :: XXXXXXXXXX
-
subroutine
CRITPdll
(z, Tc, Pc, Dc, ierr, herr, herr_length)¶ Calculate critical parameters as a function of composition. The critical parameters are estimates based on polynomial fits to the binary critical lines. For 3 or more components, combining rules are applied to the constituent binaries.
If SATSPLN has been called and the input composition sent here is the same as that sent to SATSPLN, the values calculated from the splines are returned, which are nearly exact. During the call to SATSPLN, the true critical point, maximum pressure point, and maximum temperature point along the saturation lines are determined. Without the splines and for a system with three or more components, the values from this routine are only rough estimates.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- Tc [double ,out] :: Critical temperature [K]
- Pc [double ,out] :: Critical pressure [kPa]
- Dc [double ,out] :: Critical density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful (See subroutine CRTHMX for error numbers.)
-
subroutine
CRTPNTdll
(z, Tc, Pc, Dc, ierr, herr, herr_length)¶ Subroutine for the determination of the true critical point of a mixture with the use of the method of Michelsen (1984).
The routine requires good initial guess values of Pc and Tc.
On convergence, the values of bb and cc should be close to zero and dd > 0 for a two-phase critical point. bb=0, cc=0, and dd <= 0 for an unstable critical point.
Parameters: - z (20) [double ,in] :: Composition [array of mole fractions]
- Tc [double ,out] :: Critical temperature [K]
- Pc [double ,out] :: Critical pressure [kPa]
- Dc [double ,out] :: Critical density [mol/l]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
CSATKdll
(icomp, T, kph, P, D, Csat, ierr, herr, herr_length)¶ Compute the heat capacity along the saturation line as a function of temperature for a given component.
Csat can be calculated in several ways Csat = T*(dS/dT[sat]) Csat = Cp - T*(dV/dT)(dP/dT[sat]) with dVdT at constant pressure Csat = Cp - beta/D*hvap/(vliq - vvap) where beta is the volume expansivity
Parameters: - icomp [int ,in] :: Component number in mixture (1..nc); 1 for pure fluid
- T [double ,in] :: Temperature [K]
- kph [int ,in] :: Phase flag
- P [double ,out] :: Saturated pressure [kPa]
- D [double ,out] :: Saturated molar density [mol/L]
- Csat [double ,out] :: Saturated heat capacity [J/mol-K]
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Liquid calculation 2: Vapor calculation
-
subroutine
CSTARdll
(T, P, v, z, Cs, Ts, Ds, Ps, ws, ierr, herr, herr_length) Calculate the critical flow factor, C*, for nozzle flow of a gas (subroutine was originally named CCRIT).
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- v [double ,in] :: Plenum velocity [m/s] (Should generally be set to 0 for calculating stagnation conditions.)
- z (20) [double ,in] :: Composition (array of mole fractions)
- Cs [double ,out] :: Critical flow factor [dimensionless]
- Ts [double ,out] :: Nozzle throat temperature [K]
- Ds [double ,out] :: Nozzle throat molar density [mol/L]
- Ps [double ,out] :: Nozzle throat pressure [kPa]
- ws [double ,out] :: Nozzle throat speed of sound [m/s]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: CSTAR did not converge
-
subroutine
CV2PKdll
(icomp, T, D, Cv2p, Csat, ierr, herr, herr_length)¶ Compute the isochoric heat capacity in the two phase (liquid+vapor) region.
Parameters: - icomp [int ,in] :: Component number in mixture (1..nc); 1 for pure fluid
- T [double ,in] :: Temperature [K]
- D [double ,in] :: Density [mol/L] if known If D=0, then a saturated liquid state is assumed.
- Cv2p [double ,out] :: Isochoric two-phase heat capacity [J/mol-K]
- Csat [double ,out] :: Saturation heat capacity [J/mol-K] (Although there is already a Csat routine in Refprop, it is also returned here. However, the calculation speed is slower than Csat.)
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
CVCPdll
(T, D, z, Cv, Cp)¶ Parameters: - T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- Cv [double ,in] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
-
subroutine
DBDTdll
(T, z, dBT)¶ Compute the 1st derivative of B [dBT (L/mol-K)] as a function of temperature T (K) and composition x (array of mole fractions). This routine approximates dBT. For pure fluids, the routine VIRBCD is exact.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- dBT [double ,out] :: 1st derivative of B with respect to T [L/(mol-K)]
-
subroutine
DBFL1dll
(D, b, z, hab, T, P, ierr, herr, hab_length, herr_length)¶ General single-phase calculation given density, composition, and either pressure, energy, enthalpy, or entropy. The character string ab specifies the inputs. This routine should ONLY be called by ABFL1.
Parameters: - D [double ,in] :: Molar density [mol/L]
- b [double ,in] :: Second property (pressure, energy, enthalpy, or entropy)
- z (20) [double ,in] :: Composition (array of mole fractions)
- hab [char ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hab_length [int ] :: length of variable
hab
(default: 2) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 207: Density or pressure equal to zero, no solution available 208: Iteration did not converge
-
subroutine
DEFL1dll
(D, e, z, T, ierr, herr, herr_length)¶ Iterate for single-phase temperature as a function of density, energy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DEFLSHdll
(D, e, z, T, P, Dl, Dv, x, y, q, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given density, energy, and bulk composition. (See subroutines ABFLSH or DBFLSH for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DERVPVTdll
(T, D, z, dPdD, dPdT, d2PdD2, d2PdT2, d2PdTD, dDdP, dDdT, d2DdP2, d2DdT2, d2DdPT, dTdP, dTdD, d2TdP2, d2TdD2, d2TdPD)¶ Compute 1st and 2nd order derivatives of temperature, pressure, and density from core functions for Helmholtz energy equations only. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- dPdD [double ,out] :: dP/dD at constant T [kPa/(mol/dm^3)]
- dPdT [double ,out] :: dP/dT at constant D [kPa/K]
- d2PdD2 [double ,out] :: d^2P/dD^2 at constant T [kPa/(mol/dm^3)^2]
- d2PdT2 [double ,out] :: d^2P/dT^2 at constant D [kPa/K^2]
- d2PdTD [double ,out] :: d^2P/dTdD [J/mol-K] [kPa/K/(mol/dm^3)]
- dDdP [double ,out] :: dD/dP at constant T [mol/(dm^3-kPa)]
- dDdT [double ,out] :: dD/dT at constant P [mol/(dm^3-K)]
- d2DdP2 [double ,out] :: d^2D/dP^2 at constant T [(mol/dm^3)/kPa^2]
- d2DdT2 [double ,out] :: d^2D/dT^2 at constant P [(mol/dm^3)/K^2]
- d2DdPT [double ,out] :: d^2D/dPdT [J/mol-K] [(mol/dm^3)/(kPa-K)]
- dTdP [double ,out] :: dT/dP at constant D [K/kPa]
- dTdD [double ,out] :: dT/dD at constant P [K/(mol/dm^3)]
- d2TdP2 [double ,out] :: d^2T/dP^2 at constant D [K/kPa^2]
- d2TdD2 [double ,out] :: d^2T/dD^2 at constant P [K/(mol/dm^3)^2]
- d2TdPD [double ,out] :: d^2T/dPdD [J/mol-K] [K/kPa/(mol/dm^3)]
-
subroutine
DHD1dll
(T, D, z, dhdt_d, dhdt_p, dhdd_t, dhdd_p, dhdp_t, dhdp_d)¶ Compute partial derivatives of enthalpy w.r.t. T, P, or D at constant T, P, or D as a function of temperature, density, and composition. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- dhdt_d [double ,out] :: DH/dT at constant density [J/mol-K]
- dhdt_p [double ,out] :: dH/dT at constant pressure [J/mol-K]
- dhdd_t [double ,out] :: dH/dD at constant temperature [(J/mol)/(mol/L)]
- dhdd_p [double ,out] :: dH/dD at constant pressure [(J/mol)/(mol/L)]
- dhdp_t [double ,out] :: dH/dP at constant temperature [J/(mol-kPa)]
- dhdp_d [double ,out] :: dH/dP at constant density [J/(mol-kPa)]
-
subroutine
DHFL1dll
(D, h, z, T, ierr, herr, herr_length)¶ Iterate for single-phase temperature as a function of density, enthalpy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DHFLSHdll
(D, h, z, T, P, Dl, Dv, x, y, q, e, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given density, enthalpy, and bulk composition. (See subroutines ABFLSH or DBFLSH for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DIELECdll
(T, D, z, de)¶ Compute dielectric constant as a function of temperature, density, and composition.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- de [double ,out] :: Dielectric constant [-]
-
subroutine
DLSATKdll
(icomp, T, D, ierr, herr, herr_length)¶ Compute pure fluid saturated liquid density with appropriate equation.
Parameters: - icomp [int ,in] :: Component i
- T [double ,in] :: Temperature [K]
- D [double ,out] :: Saturated liquid density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 121: Temperature greater than critical point temperature 501: No equation available
-
subroutine
DPDD2dll
(T, D, z, d2PdD2)¶ Compute second partial derivative of pressure w.r.t. density at constant temperature as a function of temperature, density, and composition. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- d2PdD2 [double ,out] :: d^2P/dD^2 [kPa-L^2/mol^2]
-
subroutine
DPTSATKdll
(icomp, T, kph, P, D, Csat, dPdT, ierr, herr, herr_length)¶ Compute the heat capacity and dP/dT along the saturation line as a function of temperature for a given component. See also subroutine CSATK.
Parameters: - icomp [int ,in] :: Component number in mixture (1..nc); 1 for pure fluid
- T [double ,in] :: Temperature [K]
- kph [int ,in] :: Phase flag
- P [double ,out] :: Saturated pressure [kPa]
- D [double ,out] :: Saturated molar density [mol/L]
- Csat [double ,out] :: Saturated heat capacity [J/mol-K] (same as that called from CSATK)
- dPdT [double ,out] :: dP/dT along the saturation line [kPa/K] (this is not dP/dT at the saturation line for the single phase state, but the change in saturated vapor pressure as the saturation temperature changes.)
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Liquid calculation 2: Vapor calculation
-
subroutine
DQFL2dll
(D, q, z, kq, T, P, Dl, Dv, x, y, ierr, herr, herr_length)¶ Flash calculation given bulk density, quality, and composition. (See subroutine ABFL2 for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- q [double ,in] :: Vapor quality [mol/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kq [int ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DSD1dll
(T, D, z, dsdt_d, dsdt_p, dsdd_t, dsdd_p, dsdp_t, dsdp_d)¶ Compute partial derivatives of entropy w.r.t. T, P, or D at constant T, P, or D as a function of temperature, density, and composition. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- dsdt_d [double ,out] :: dS/dT at constant density [J/mol-K^2]
- dsdt_p [double ,out] :: dS/dT at constant pressure [J/mol-K^2]
- dsdd_t [double ,out] :: dS/dD at constant temperature [(J/mol-K)/(mol/L)]
- dsdd_p [double ,out] :: dS/dD at constant pressure [(J/mol-K)/(mol/L)]
- dsdp_t [double ,out] :: dS/dP at constant temperature [J/(mol-K-kPa)]
- dsdp_d [double ,out] :: dS/dP at constant density [J/(mol-K-kPa)]
-
subroutine
DSFL1dll
(D, s, z, T, ierr, herr, herr_length)¶ Iterate for single-phase temperature as a function of density, entropy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DSFLSHdll
(D, s, z, T, P, Dl, Dv, x, y, q, e, h, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given density, entropy, and bulk composition. (See subroutines ABFLSH or DBFLSH for the description of all variables.)
Parameters: - D [double ,in] :: Density [mol/L]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
DVSATKdll
(icomp, T, D, ierr, herr, herr_length)¶ Compute pure fluid saturated vapor density with appropriate equation.
Parameters: - icomp [int ,in] :: Component i
- T [double ,in] :: Temperature [K]
- D [double ,out] :: Saturated vapor density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 121: Temperature greater than critical point temperature 501: No equation available
-
subroutine
ENTHALdll
(T, D, z, h)¶ Parameters: - T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- h [double ,out] :: Enthalpy [J/mol]
-
subroutine
ENTROdll
(T, D, z, s)¶ Parameters: - T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- s [double ,out] :: Entropy [J/mol-K]
-
subroutine
ESFLSHdll
(e, s, z, T, P, D, Dl, Dv, x, y, q, h, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given bulk energy, entropy, and composition. (See subroutines ABFLSH or DBFLSH for the description of all variables.)
Parameters: - e [double ,in] :: Internal energy [J/mol]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- h [double ,out] :: Enthalpy [J/mol]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
EXCESSdll
(T, P, z, kph, D, vE, eE, hE, sE, aE, gE, ierr, herr, herr_length)¶ Compute excess properties as a function of temperature, pressure, and composition.
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Phase flag
- D [double ,out] :: Molar density [mol/L] (Send a negative density to the routine to use it as an initial guess.)
- vE [double ,out] :: Excess volume [L/mol]
- eE [double ,out] :: Excess energy [J/mol]
- hE [double ,out] :: Excess enthalpy [J/mol]
- sE [double ,out] :: Excess entropy [J/mol-K]
- aE [double ,out] :: Excess Helmholtz energy [J/mol]
- gE [double ,out] :: Excess Gibbs energy [J/mol]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Liquid 2: Vapor 0: Stable phase
-
subroutine
FGCTY2dll
(T, D, z, f, ierr, herr, herr_length)¶ Compute fugacity for each of the nc components of a mixture by analytical differentiation of the dimensionless residual Helmholtz energy. These are based on derivations in the GERG-2004 document for natural gas.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- f (20) [double ,out] :: Array (1..nc) of fugacities [kPa]
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
FGCTYdll
(T, D, z, f)¶ Old routine to compute fugacity for each of the nc components of a mixture by numerical differentiation (with central differences) of the dimensionless residual Helmholtz energy.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- f (20) [double ,out] :: Array (1..nc) of fugacities [kPa]
-
subroutine
FPVdll
(T, D, P, z, Fpvx)¶ Compute the supercompressibility factor, Fpv.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- Fpvx [double ,out] :: Fpv = SQRT[Z(60 F, 14.73 psia)/Z(T,P)]
-
subroutine
FUGCOFdll
(T, D, z, phi, ierr, herr, herr_length)¶ Compute the fugacity coefficient for each of the nc components of a mixture.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- phi (20) [double ,out] :: Array (1..nc) of the fugacity coefficients [-]
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
GERG04dll
(ncomp, iFlag, ierr, herr, herr_length)¶ This is a duplicate of the GERG08 routine below, and is meant only for use with older versions of Refprop.
Parameters: - ncomp [int ,in] :: Number of components (no longer used)
- iFlag [int ,in] :: Set to 1 to load the GERG 2008 equations, set to 0 for defaults
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) (returned from SETMOD)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
GERG08dll
(ncomp, iFlag, ierr, herr, herr_length)¶ Use the GERG 2008 formulation for all pure fluid and mixture calculations.
This subroutine must be called before SETUP; it need not be called at all if the default (NIST-recommended) models are desired. To turn off the GERG settings, call this routine again with iFlag=0, and then call the SETUP routine to reset the parameters of the equations of state. Once this routine is called, it need not be called again to keep the GERG08 model active, even when calling SETUP.
Parameters: - ncomp [int ,in] :: Number of components (no longer used)
- iFlag [int ,in] :: Set to 1 to load the GERG 2008 equations, set to 0 for defaults
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) (returned from SETMOD)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
GETFIJdll
(hmodij, fij, hfij, hmxrul, hmodij_length, hfij_length, hmxrul_length)¶ Retrieve parameter info for a specified mixing rule.
Parameters: - hmodij [char ,in] :: Mixing rule for the binary pair i,j (e.g., LJ6 or KW0) (character*3)
- fij (6) [double ,out] :: Binary mixture parameters (array of dimension nmxpar; currently nmxpar is set to 6). The parameters will vary depending on hmodij.
- hfij [char ,out] :: Description of the binary mixture parameters (character*8 array of dimension nmxpar)
- hmxrul [char ,out] :: Description of the mixing rule (character*255)
- hmodij_length [int ] :: length of variable
hmodij
(default: 3) - hfij_length [int ] :: length of variable
hfij
(default: 255) - hmxrul_length [int ] :: length of variable
hmxrul
(default: 255)
-
subroutine
GETKTVdll
(icomp, jcomp, hmodij, fij, hFmix, hfij, hbinp, hmxrul, hmodij_length, hFmix_length, hfij_length, hbinp_length, hmxrul_length)¶ Retrieve mixture model and parameters for a specified binary mixture. This subroutine should not be called until after SETUP has been called. The order of icomp and jcomp do not matter, the routine returns the parameters as stored in the HMX.BNC file. To determine if the compositions are backwards, call HMXORDER. If calling SETMIX with the same parameters, an error will be returned if the components are backwards.
Kunz-Wagner model (KW0) Lemmon-Jacobsen model (LJ6) fij(1) = betaT fij(1) = zeta fij(2) = gammaT fij(2) = xi fij(3) = betaV fij(3) = Fij fij(4) = gammaV fij(4) = beta fij(5) = Fij fij(5) = gamma fij(6) = ‘not used’ fij(6) = ‘not used’ Parameters: - icomp [int ,in] :: Component i
- jcomp [int ,in] :: Component j
- hmodij [char ,out] :: Mixing rule for the binary pair i,j (e.g., KW0, LJ6, XR0, or LIN) (character*3)
- fij (6) [double ,out] :: Binary mixture parameters (array of dimension nmxpar; currently nmxpar is set to 6); the parameters will vary depending on hmodij;
- hFmix [char ,out] :: File name (character*255) containing parameters for the binary mixture model
- hfij [char ,out] :: Description of the binary mixture parameters (character*8 array of dimension nmxpar) The parameters will vary depending on hmodij.
- hbinp [char ,out] :: Documentation for the binary parameters (character*255)
- hmxrul [char ,out] :: Description of the mixing rule (character*255)
- hmodij_length [int ] :: length of variable
hmodij
(default: 3) - hFmix_length [int ] :: length of variable
hFmix
(default: 255) - hfij_length [int ] :: length of variable
hfij
(default: 255) - hbinp_length [int ] :: length of variable
hbinp
(default: 255) - hmxrul_length [int ] :: length of variable
hmxrul
(default: 255)
-
subroutine
GETMODdll
(icomp, htype, hcode, hcite, htype_length, hcode_length, hcite_length)¶ Retrieve citation information for the property models used.
Parameters: - icomp [int ,in] :: Pointer specifying component number; zero and negative values are used for ECS reference fluid(s)
- htype [char ,in] :: Flag indicating which model is to be retrieved (character*3)
- hcode [char ,out] :: Component model used for property specified in htype (character*3)
- hcite [char ,out] :: Component model used for property specified in htype; the first 3 characters repeat the model designation of hcode and the remaining are the citation for the source (character*255)
- htype_length [int ] :: length of variable
htype
(default: 3) - hcode_length [int ] :: length of variable
hcode
(default: 3) - hcite_length [int ] :: length of variable
hcite
(default: 255)
Flags : htype
flags‘EOS’: Equation of state ‘CP0’: Ideal-gas heat capacity ‘ETA’: Viscosity ‘TCX’: Thermal conductivity ‘TKK’: Thermal conductivity critical enhancement ‘STN’: Surface tension ‘DE ‘: Dielectric constant ‘MLT’: Melting line (i.e., freezing line) ‘SBL’: Sublimation line ‘PS ‘: Vapor pressure equation ‘DL ‘: Saturated liquid density equation ‘DV ‘: Saturated vapor density equation hcode
flags‘FEQ’: Helmholtz energy model ‘ECS’: Extended corresponding states (all fluids) ‘VS1’: The ‘composite’ model for R134a, R152a, NH3, etc. ‘VS2’: Younglove-Ely model for hydrocarbons ‘VS4’: Generalized friction theory of Quinones-Cisneros and Dieters ‘VS5’: Chung et al. model ‘VS6’: Vesovic form of VS1 model ‘VS7’: Polynomial/exponential model ‘TC1’: The ‘composite’ model for R134a, R152a, etc. ‘TC2’: Younglove-Ely model for hydrocarbons ‘TC5’: Predictive model of Chung et al. (1988) ‘ST1’: surface tension as f(tau); tau = 1 - T/Tc
-
subroutine
GETREFDIRdll
(hpth, hpth_length)¶ Get the path where the original fluid files are located. See SETREFDIR for more information.
Parameters: - hpth [char ,out] :: Location of the original fluid files (character*255)
- hpth_length [int ] :: length of variable
hpth
(default: 255)
-
subroutine
GIBBSdll
(T, D, z, ar, gr)¶ Compute residual Helmholtz and Gibbs energies as functions of temperature, density, and composition from core functions, calculated as:
G(T,D) - G0(T,P*) = G(T,D) - G0(T,D) + RTln(RTD/P*)
where G0 is the ideal-gas state and P* is a reference pressure that is equal to the current pressure of interest. Since Gr is used only as a difference in phase equilibria calculations where the temperature and pressure of the phases are equal, the (RT/P*) part of the log term will cancel and is omitted. Normal (not residual) A and G are computed by subroutine AG.
See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- ar [double ,out] :: Residual Helmholtz energy [J/mol]
- gr [double ,out] :: Residual Gibbs free energy [J/mol]
-
subroutine
HEATFRMdll
(T, D, z, hFrm, ierr, herr, herr_length)¶ Compute the heat of formation.
The heat of formation is the heat required to form a compound from its constituent elements, with the standard state defined as 298.15 K for the ideal gas.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L] (not used)
- z (20) [double ,in] :: Composition (array of mole fractions)
- hFrm [double ,out] :: Heat of formation [J/mol]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 662: Not all heating values available 664: Unknown species in chemical formula 665: Error in chemical formula
-
subroutine
HEATdll
(T, D, z, hg, hn, ierr, herr, herr_length)¶ Compute the ideal-gas gross and net heating values.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- hg [double ,out] :: Gross (or superior) heating value [J/mol]
- hn [double ,out] :: Net (or inferior) heating value [J/mol]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 662: Not all heating values available 665: Error in chemical formula
-
subroutine
HMXORDERdll
(i, j, hcasi, hcasj, iFlag, ierr, herr, hcasi_length, hcasj_length, herr_length)¶ Return the ID numbers in the order given in the HMX.BNC file, and a flag that indicates if the loaded fluids are in the same order.
Parameters: - i [int ,in] :: Component i
- j [int ,in] :: Component j
- hcasi [char ] :: XXXXXXXXXX
- hcasj [char ] :: XXXXXXXXXX
- iFlag [int ,out] :: Flag to indicate if loaded fluids are in the same order as the i,j pair
- ierr [int ,out] :: Error number, not currently used here
- herr [char ,out] :: Error message, not currently used here (character*255)
- hcasi_length [int ] :: length of variable
hcasi
(default: 255) - hcasj_length [int ] :: length of variable
hcasj
(default: 255) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : iflag
flags0: Pair is backwards 1: Pair is in correct order (or if i=j) 2: Pair is not in HMX.BNC
-
subroutine
HSFL1dll
(h, s, z, Dmin, Dmax, T, D, ierr, herr, herr_length)¶ Iterate for single-phase temperature and density as a function of enthalpy, entropy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - h [double ,in] :: Enthalpy [J/mol]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- Dmin [double ,in] :: Lower bound on density [mol/L]
- Dmax [double ,in] :: Upper bound on density [mol/L]
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
HSFLSHdll
(h, s, z, T, P, D, Dl, Dv, x, y, q, e, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given bulk enthalpy, entropy, and composition.
Parameters: - h [double ,in] :: Overall enthalpy [J/mol]
- s [double ,in] :: Overall entropy [J/mol-K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Overall molar density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,in] :: Overall internal energy [J/mol] But only if iflag in common blocks has been set to 1, in which case the value of the internal energy should be sent in h, and the value of the enthalpy will be returned in e.
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) (See subroutine ABFLSH for the description of all other output variables.)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 260: Iterative routine is not available to find a solution.
-
subroutine
IDCRVdll
(D, z, T, ierr, herr, herr_length)¶ Calculate the temperature at the input density where the compressibility factor crosses from less than 1 to greater than 1 (i.e., Z=1). This line starts at zero density at the temperature where B=0, and passes into the liquid phase without crossing the two-phase. The argument z in this routine is an array with the mole fractions of the mixture. If the input T is non-zero, it is used as the initial guess.
Parameters: - D [double ,in] :: Density [mol/l]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Iteration failed to converge
-
subroutine
INFOdll
(icomp, wmm, Ttrp, Tnbpt, Tc, Pc, Dc, Zc, acf, dip, Rgas)¶ Provides fluid constants for the specified component.
Parameters: - icomp [int ,in] :: Component number in mixture; 1 for pure fluid
- wmm [double ,out] :: Molar mass (molecular weight) [g/mol]
- Ttrp [double ,out] :: Triple point temperature [K]
- Tnbpt [double ,out] :: Normal boiling point temperature [K]
- Tc [double ,out] :: Critical temperature [K]
- Pc [double ,out] :: Critical pressure [kPa]
- Dc [double ,out] :: Critical density [mol/L]
- Zc [double ,out] :: Compressibility factor at critical point [Pc/(Rgas*Tc*Dc)]
- acf [double ,out] :: Acentric factor [-]
- dip [double ,out] :: Dipole moment [debye]
- Rgas [double ,out] :: Gas constant [J/mol-K]
-
subroutine
JICRVdll
(D, z, T, ierr, herr, herr_length)¶ Calculate the temperature along the Joule-Inversion curve for the input density. This line starts at zero density at the temperature where B is at a maximum, and passes into the liquid phase without crossing the two-phase. It ends at very high pressures. The argument z in this routine is an array with the mole fractions of the mixture. If the input T is non-zero, it is used as the initial guess.
JI is equal to d(Z)/d(T) at constant D del*d^2(alphar)/d(del)/d(T) -del*tau*d^2(alphar)/d(del)/d(tau)/T (can ignore the /T for finding JI=0)
- d(JI)/dT -> tau**2*del*d^3(alphar)/d(del)/d(tau)**2/T**2
- (One of the /T must be removed to match the one removed in the function.)
Parameters: - D [double ,in] :: Density [mol/l]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Iteration failed to converge
-
subroutine
JTCRVdll
(D, z, T, ierr, herr, herr_length)¶ Calculate the temperature along the Joule-Thomson curve for the input density. This line starts at zero density at the temperature where the Joule-Thomson property (dH/dT) is zero, and passes into the liquid phase without crossing the two-phase. It ends at a saturated liquid state far from the critical point. The argument z in this routine is an array with the mole fractions of the mixture. If the input T is non-zero, it is used as the initial guess.
Only the top part in the calculation of hjt is required, the other parts do not go to zero and thus do not contribute to finding JT=0.
Parameters: - D [double ,in] :: Density [mol/l]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Iteration failed to converge
-
subroutine
LIMITKdll
(htyp, icomp, T, D, P, Tmin, Tmax, Dmax, Pmax, ierr, herr, htyp_length, herr_length)¶ This function is deprecated. Use subroutine LIMITX instead.
Parameters: - htyp [char ] :: XXXXXXXXXX
- icomp [int ] :: XXXXXXXXXX
- T [double ] :: XXXXXXXXXX
- D [double ] :: XXXXXXXXXX
- P [double ] :: XXXXXXXXXX
- Tmin [double ] :: XXXXXXXXXX
- Tmax [double ] :: XXXXXXXXXX
- Dmax [double ] :: XXXXXXXXXX
- Pmax [double ] :: XXXXXXXXXX
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- htyp_length [int ] :: length of variable
htyp
(default: 3) - herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
LIMITSdll
(htyp, z, Tmin, Tmax, Dmax, Pmax, htyp_length)¶ Returns limits of a property model as a function of composition. Pure fluid limits were read in from the *.fld files; for mixtures, a simple mole fraction weighting in reduced variables is used.
Parameters: - htyp [char ,in] :: Flag indicating which models are to be checked (character*3) ‘EOS’ - Equation of state for thermodynamic properties ‘ETA’ - Viscosity ‘TCX’ - Thermal conductivity ‘STN’ - Surface tension
- z (20) [double ,in] :: Composition array (array of mole fractions)
- Tmin [double ,out] :: Minimum temperature for model specified by htyp [K]
- Tmax [double ,out] :: Maximum temperature [K]
- Dmax [double ,out] :: Maximum density [mol/L]
- Pmax [double ,out] :: Maximum pressure [kPa]
- htyp_length [int ] :: length of variable
htyp
(default: 3)
-
subroutine
LIMITXdll
(htyp, T, D, P, z, Tmin, Tmax, Dmax, Pmax, ierr, herr, htyp_length, herr_length)¶ Returns limits of a property model as a function of composition and/or checks inputs T, D, and P against those limits.
Pure fluid limits are read in from the *.fld files; for mixtures, a simple mole fraction weighting of the reduced variables is used.
Attempting calculations below the minimum temperature and/or above the maximum density may result in an error. These will often correspond to a physically unreasonable state; also many equations of state do not extrapolate reliably to lower T’s and higher D’s.
A warning is issued if the temperature is above the maximum but below 1.5 times the maximum. Pressures up to twice the maximum result in only a warning. Most equations of state may be extrapolated to higher T’s and P’s. Temperatures and/or pressures outside these extended limits will result in an error.
When calling with an unknown temperature, set T to -1 to avoid performing the melting line check. If inputs are not available, use T=300, P=0, and D=0.
If multiple inputs are outside limits, ierr=SUM(ABS(ierr)), with a positive sign if any error greater than zero (calculations not possible), or a negative sign for warnings only.
Parameters: - htyp [char ,in] :: Flag indicating the model to check (character*3)
- T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Composition array (array of mole fractions)
- Tmin [double ,out] :: Minimum temperature for model specified by htyp [K]
- Tmax [double ,out] :: Maximum temperature [K]
- Dmax [double ,out] :: Maximum density [mol/L]
- Pmax [double ,out] :: Maximum pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- htyp_length [int ] :: length of variable
htyp
(default: 3) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : htyp
flags‘EOS’: Equation of state ‘ETA’: Viscosity ‘TCX’: Thermal conductivity ‘STN’: Surface tension ierr
flags0: All inputs within limits -1: 1.5*Tmax > T > Tmax 1: T < Tmin or T > 1.5*Tmax 2: D > Dmax or D < 0 -4: 2*Pmax > P > Pmax 4: P < 0 or P > 2*Pmax 8: Component composition < 0 or > 1 and/or composition sum <> 1 16: P>Pmelt -16: T<Ttrp (important for water)
-
subroutine
LIQSPNDLdll
(T, z, D, ierr, herr, herr_length)¶ Find the liquid spinodal density for a given temperature. If no spinodal exists, return the point of zero curvature. This only happens with a few of the older equations, these being argon, ethane, nitrogen, R22, and R124.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- D [double ,out] :: Density at liquid spinodal [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 121: T>Tc 633: Failed to converge -638: Spinodal not found, point of zero curvature returned
-
subroutine
MASSFLUXdll
(Tm, P, z, beta, rf, fluxm, Cs, T0, P0, xMach, u, Ts, Ps, ierr, herr, herr_length)¶ Calculate the theoretical mass flux for a CFV (critical flow venturi) of a gas. This is required for high beta; CSTAR can be used for low beta.
Parameters: - Tm [double ,in] :: Measured temperature [K]
- P [double ,in] :: Upstream (static) pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- beta [double ,in] :: Ratio of throat diameter to pipe diameter [-]
- rf [double ,in] :: Recovery factor [(Tm-T)/(T0-T)] (T is static temperature, T0 is the stagnation temperature)
- fluxm [double ,out] :: Theoretical mass flux [kg/(m^2-s)]
- Cs [double ,out] :: Critical flow factor [-]
- T0 [double ,out] :: Stagnation temperature [K]
- P0 [double ,out] :: Stagnation pressure [kPa]
- xMach [double ,out] :: Mach number (u/speed of sound) [-]
- u [double ,out] :: Average axial velocity in approach pipe upstream of the CFV [m/s]
- Ts [double ,out] :: Temperature at throat [K]
- Ps [double ,out] :: Pressure at throat [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Iteration failed to converge
-
subroutine
MAXPdll
(z, Tm, Pm, Dm, ierr, herr, herr_length)¶ Calculate values at the maximum pressure along the saturation line; these are returned from the call to SATSPLN and apply only to the composition in the z() array sent to SATSPLN.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- Tm [double ,out] :: Temperature [K]
- Pm [double ,out] :: Pressure [kPa]
- Dm [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 331: Splines not available for calculation -362: Maximum pressure not known
-
subroutine
MAXTdll
(z, Tm, Pm, Dm, ierr, herr, herr_length)¶ Calculate values at the maximum temperature along the saturation line; these are returned from the call to SATSPLN and apply only to the composition in the z() array sent to SATSPLN.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- Tm [double ,out] :: Temperature [K]
- Pm [double ,out] :: Pressure [kPa]
- Dm [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 331: Splines not available for calculation -361: Maximum temperature not known
-
subroutine
MELTKdll
(icomp, T, P, ierr, herr, herr_length)¶ Compute melting line with appropriate core model.
Parameters: - icomp [int ,in] :: Component i (for water and heavy water, send -icomp to obtain the root with the lower pressure at T<Ttrp)
- T [double ,in] :: Temperature [K]
- P [double ,out] :: Melting line pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) There are two functional forms for the melting line, labeled in the fluid files as ML1 and ML2: ML1: P=Pred*Pr ML2: P=Pred*Exp(Pr) where: Pr=Sum[Nk*Tr^tk]+Sum[Nk*(Tr-1)^tk]+Sum[Nk*(Log Tr)^tk] Tr=T/Tred In the fluid file, Tred and Pred (the reducing values) are given first, followed by the number of terms in each of the summations, and then followed by the coefficients Nk and exponents tk (one term with Nk and tk listed per line).
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 1: T<Ttrp -4: P<Ptrp (for MELTP routine) 501: No equation available 502: Unknown melting line equation
-
subroutine
MELTPdll
(P, z, T, ierr, herr, herr_length)¶ Compute the melting line temperature as a function of pressure and composition.
Parameters: - P [double ,in] :: Melting line pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful -4: Pressure below triple point pressure 501: No equation available
-
subroutine
MELTTdll
(T, z, P, ierr, herr, herr_length)¶ Compute the melting line pressure as a function of temperature and composition.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P [double ,out] :: Melting line pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 501: No equation available
-
subroutine
MLTH2Odll
(T, P1, P2)¶ Compute melting line of water, see fluid file for reference.
Parameters: - T [double ,in] :: Temperature [K]
- P1 [double ,out] :: Higher melting line pressure [kPa]
- P2 [double ,out] :: Lower melting line pressure [kPa] Above 273.16 K, only P1 returns a physical answer. Between 251.165 and 273.16 K, two pressures are returned. If flags of -998 or -999 are sent for the temperature, the value of the lowest temperature possible (251.165 K) is sent back in T, the pressure at that point is sent back in P1, and the density at that point is sent back in P2 if the flag -998 is used.
-
subroutine
NAMEdll
(icomp, hnam, hn80, hcasn, hnam_length, hn80_length, hcasn_length)¶ Provides name information for the specified component.
Parameters: - icomp [int ,in] :: Component number in mixture; 1 for pure fluid
- hnam [char ,out] :: Component name (character*12) (send icomp+1000 to get the fluid hash)
- hn80 [char ,out] :: Component name - long form (character*80) To return the file name used when SETUP was called (without path), send -icomp. If path is also needed, use PASSCMN. For example: call PASSCMN (‘hdir’,0,1,0,hfl,i,xx,arr,ierr,herr)
- hcasn [char ,out] :: ID (Chemical Abstracts Service) number (character*12)
- hnam_length [int ] :: length of variable
hnam
(default: 12) - hn80_length [int ] :: length of variable
hn80
(default: 80) - hcasn_length [int ] :: length of variable
hcasn
(default: 12)
-
subroutine
PASSCMNdll
(hvr, iset, icomp, jcomp, hstr, ilng, dbl, arr, ierr, herr, hvr_length, hstr_length, herr_length)¶ Get or set values of variables in the common blocks.
Examples (in FORTRAN):
call PASSCMN ('txeos', 0,3,0, h,i, tmx,z, ierr,herr) ! get Tmax of component 3 call PASSCMN ('dxeos', 1,2,0, h,i, dmx,z, ierr,herr) ! set Dmax of component 2 call PASSCMN ('tz', 0,1,0, h,i, Tc, z, ierr,herr) ! get reducing temperature of component 1 call PASSCMN ('ntermf', 0,1,0, h,nt,v, z, ierr,herr) ! get number of terms in the Helmholtz equation for component 1 call PASSCMN ('coefhmx',1,1,0, h,i, v, cf, ierr,herr) ! set the coefficients in the Helmholtz equation for component 1 call PASSCMN ('acp0', 1,5,0, h,i, v, cp0, ierr,herr) ! set the coefficients in the cp0 equation for component 5 call PASSCMN ('fPRkij', 1,1,2, h,i, v, fpr, ierr,herr) ! set the PR coefficient for the 1,2 binary
Parameters: - hvr [char ,in] :: Character string with the common variable’s name
- iset [int ,in] :: Flag to indicate the get/set condition
- icomp [int ,in] :: Component number
- jcomp [int ,in] :: Second component number for binary mixture variables
- hstr [char ,out] :: Input or output for a character string
- ilng [int ,out] :: Input or output for a long variable
- dbl [double ,out] :: Input or output for a double precision variable
- arr (100) [double ,out] :: Input or output for a double precision array
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hvr_length [int ] :: length of variable
hvr
(default: 255) - hstr_length [int ] :: length of variable
hstr
(default: 255) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : iset
flags0: Get variable value 1: Set variable value ierr
flags0: Successful 113: Inputs out of bounds 601: Variable name not recognized
-
subroutine
PDFL1dll
(P, D, z, T, ierr, herr, herr_length)¶ Iterate for single-phase temperature as a function of pressure, density, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- D [double ,in] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PDFLSHdll
(P, D, z, T, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given density, pressure, and bulk composition. This routine accepts both single-phase and two-phase states as inputs; for single-phase calculations, the subroutine PDFL1 is faster. (See subroutines ABFLSH or TPDFLSH for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- D [double ,in] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PEFL1dll
(P, e, z, kph, T, D, ierr, herr, herr_length)¶ Iterate for single-phase temperature and density as a function of pressure, energy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kph [int ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PEFLSHdll
(P, e, z, T, D, Dl, Dv, x, y, q, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given pressure, bulk energy, and bulk composition. (See subroutines ABFLSH or PBFLSH for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PHFL1dll
(P, h, z, kph, T, D, ierr, herr, herr_length)¶ Iterate for single-phase temperature and density as a function of pressure, enthalpy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kph [int ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PHFLSHdll
(P, h, z, T, D, Dl, Dv, x, y, q, e, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given pressure, bulk enthalpy, and bulk composition. (See subroutines ABFLSH or PBFLSH for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PHI0dll
(itau, idel, T, D, z, phi00)¶ Compute the ideal-gas part of the reduced Helmholtz energy or its derivatives as functions of temperature and density for a mixture.
While the real-gas part of the Helmholtz energy is calculated in terms of dimensionless temperature and density, the ideal- gas part is calculated in terms of absolute temperature and density. (This distinction is necessary for mixtures.)
The Helmholtz energy consists of ideal-gas and residual (real-gas) terms; this routine calculates only the ideal part.
Parameters: - itau [int ,in] :: Flag specifying the order of the temperature derivative
- idel [int ,in] :: Flag specifying the order of the density derivative (The density derivatives are not used in the calculation of any property.) when itau = 0 and idel = 0, compute A0/RT when itau = 1 and idel = 0, compute 1st temperature derivative when itau = 2 and idel = 0, compute 2nd temperature derivative when itau = 0 and idel = 1, compute 1st density derivative (actually the derivatives are with respect to the dimensionless quantities tau and del)
- T [double ,in] :: Temperature [K]
- D [double ,in] :: Density [mol/L]
- z (20) [double ,in] :: Composition array (array of mole fractions)
- phi00 [double ,out] :: Ideal-gas part of the reduced Helmholtz energy (A/RT); derivatives (as specified by itau and idel) are multiplied by the corresponding power of tau or del; i.e., when itau = 1, the quantity returned is tau*[d(PHI0)/d(tau)] when itau = 2, the quantity returned is tau^2*[d^2(PHI0)/d(tau)^2] when itau = 3, the quantity returned is tau^3*d^3(ph0cpp)/d(tau)^3 where tau=Tc/T and del=D/Dc are evaluated for each component. Similarly, the del derivatives (as specified by idel) are multiplied by the corresponding power of del (the derivatives usually appear with this factor and this approach neatly avoids a possible divide by zero).
-
subroutine
PHIDERVdll
(iderv, T, D, z, dadn, dnadn, ierr, herr, herr_length)¶ Calculate various derivatives required in the calculation of VLE for mixtures. Most of these are based on equations in the GERG-2004 document for natural gas, and are given below on the lines where the code corresponds directly to the equation in that document.
Only the partials of alpha or alpha*n with respect to mole number are returned here. All others are stored in the PHIDR common block for access by subroutine SATGV.
Parameters: - iderv [int ,in] :: Set to 1 for first order derivatives only (dadn and dnadn) Set to 2 for full calculations
- T [double ,in] :: Temperature [K]
- D [double ,in] :: Density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- dadn (20) [double ,out] :: n*partial(alphar)/partial(ni) Eq. 7.16
- dnadn (20) [double ,out] :: partial(n*alphar)/partial(ni) Eq. 7.15
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) The outputs below are stored in the PHIDR common block, and can be obtained by a call to PASSCMN. :text:
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful Error numbers are not set here, but are returned from either the PHIDERVPR (when Peng-Robinson is active) or RDXHMX routines.
-
subroutine
PHIHMXdll
(itau, idel, tau, delta, z, phi)¶ Compute reduced Helmholtz energy or its derivative as functions of dimensionless temperature and density for the mixture Helmholtz equation of state.
See notes in function PHIMIX.
Parameters: - itau [int ,in] :: Flag specifying the order of the temperature derivative
- idel [int ,in] :: Flag specifying the order of the density derivative when itau = 0 and idel = 0, compute A/RT when itau = 0 and idel = 1, compute 1st density derivative when itau = 1 and idel = 1, compute cross derivative etc.
- tau [double ,in] :: Dimensionless temperature (Tr/T)
- delta [double ,in] :: Dimensionless density (D/Dr)
- z (20) [double ,in] :: Composition array (mole fractions)
- phi [double ,out] :: Residual (real-gas) part of the Helmholtz energy, or one of its derivatives (as specified by itau and idel), in reduced form (A/RT)
-
subroutine
PHIKdll
(icomp, itau, idel, tau, delta, phi)¶ Compute reduced Helmholtz energy or a derivative as functions of dimensionless temperature and density.
The Helmholtz energy consists of ideal and residual (real-gas) terms; this routine calculates only the residual part.
This function computes pure component properties only; call PHIX instead for mixtures.
The reducing parameters Tr and Dr are often, but not necessarily, equal to the critical temperature and density for pure fluids.
Parameters: - icomp [int ,in] :: Pointer specifying component (1..nc)
- itau [int ,in] :: Flag specifying the order of the temperature derivative
- idel [int ,in] :: Flag specifying the order of the density derivative When itau = 0 and idel = 0, compute A/RT. When itau = 0 and idel = 1, compute 1st density derivative. When itau = 1 and idel = 1, compute cross derivative. etc.
- tau [double ,in] :: Dimensionless temperature (Tr/T)
- delta [double ,in] :: Dimensionless density (D/Dr)
- phi [double ,out] :: Residual (real-gas) part of the Helmholtz energy, or one of its derivatives (as specified by itau and idel), in reduced form (A/RT)
-
subroutine
PHIMIXdll
(i, j, itau, idel, tau, delta, z, phi)¶ Compute reduced Helmholtz energy of mixing (or its derivatives) for the binary interaction of components i and j as a function of composition and dimensionless temperature and density for the mixture Helmholtz equation of state.
The Helmholtz energy consists of ideal-gas and residual (real-gas) terms. The residual term consists of ideal-solution and mixing terms. This routine calculates only the residual term.
Parameters: - i [int ] :: XXXXXXXXXX
- j [int ] :: XXXXXXXXXX
- itau [int ,in] :: Flag specifying the order of the temperature derivative
- idel [int ,in] :: Flag specifying the order of the density derivative when itau = 0 and idel = 0, compute Amix/RT when itau = 0 and idel = 1, compute 1st density derivative when itau = 1 and idel = 1, compute cross derivative etc.
- tau [double ,in] :: Dimensionless temperature (Tr/T)
- delta [double ,in] :: Dimensionless density (D/Dr)
- z (20) [double ,in] :: Composition array (mole fractions)
- phi [double ,out] :: Mixture interaction (excess) part of the Helmholtz energy, or one of its derivatives (as specified by itau and idel), in reduced form (Amix/RT)
-
subroutine
PHIXdll
(itau, idel, tau, delta, z, phixx)¶ Compute reduced Helmholtz energy or a derivative as functions of dimensionless temperature and density by calling the appropriate mixture model.
The Helmholtz energy consists of ideal-gas and residual (real- gas) terms. The residual term consists of ideal-solution and mixing terms. This routine calculates only the residual term.
Parameters: - itau [int ,in] :: Flag specifying the order of the temperature derivative
- idel [int ,in] :: Flag specifying the order of the density derivative When itau = 0 and idel = 0, compute A/RT. When itau = 0 and idel = 1, compute 1st density derivative. When itau = 1 and idel = 1, compute cross derivative. etc.
- tau [double ,in] :: Dimensionless temperature (Tr/T)
- delta [double ,in] :: Dimensionless density (D/Dr)
- z (20) [double ,in] :: Composition (array of mole fractions)
- phixx [double ,out] :: Residual (real-gas) part of the Helmholtz energy, or one of its derivatives (as specified by itau and idel), in reduced form (A/RT)
-
subroutine
PQFLSHdll
(P, q, z, kq, T, D, Dl, Dv, x, y, e, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given pressure, quality, and bulk composition. This routine accepts saturation or two-phase states as inputs. (See subroutines ABFLSH or AQFLSH for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- q [double ,in] :: Vapor quality [mol/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kq [int ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PREOSdll
(i)¶ Turn on or off the use of the PR cubic equation. Should be called after calling SETUP.
Parameters: i [int ,in] :: Flag specifying use of PR
Flags : i
flags0: Use full equation of state (Peng-Robinson off) 1: Use full equation of state with Peng-Robinson for sat. conditions (not currently working) 2: Use Peng-Robinson equation for all calculations 3: Peng-Robinson with translation term deactivated if i=-1, then i is returned with the current status of the PR EOS. A value of zero indicates that it is not in use. When in use, a 2 or 3 will be returned, depending on which option above was previously selected.
-
subroutine
PRESSdll
(T, D, z, P)¶ Compute pressure as a function of temperature, density, and composition. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P [double ,out] :: Pressure [kPa]
-
subroutine
PSATKdll
(icomp, T, P, ierr, herr, herr_length)¶ Compute pure fluid vapor or liquid pressures with the appropriate ancillary equation.
Parameters: - icomp [int ,in] :: Component i. For liquid pressure equations (pseudo-pure fluids only), send -i.
- T [double ,in] :: Temperature [K]
- P [double ,out] :: Vapor or liquid pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 121: Temperature greater than critical point temperature
-
subroutine
PSFL1dll
(P, s, z, kph, T, D, ierr, herr, herr_length)¶ Iterate for single-phase temperature and density as a function of pressure, entropy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kph [int ] :: XXXXXXXXXX
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PSFLSHdll
(P, s, z, T, D, Dl, Dv, x, y, q, e, h, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given pressure, bulk entropy, and bulk composition. (See subroutines ABFLSH or PBFLSH for the description of all variables.)
Parameters: - P [double ,in] :: Pressure [kPa]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
PUREFLDdll
(icomp)¶ Change the standard mixture setup so that the properties of one fluid can be calculated as if SETUP had been called for a pure fluid. Calling this routine will disable all mixture calculations. To reset the mixture setup, call this routine with icomp=0.
Parameters: icomp [int ,in] :: fluid number in a mixture to use as a pure fluid (set to zero to reset)
-
subroutine
QMASSdll
(qmol, xl, xv, qkg, xlkg, xvkg, wliq, wvap, ierr, herr, herr_length)¶ Converts quality and composition on a molar basis to a mass basis.
Parameters: - qmol [double ,in] :: Molar quality (moles of vapor/total moles) qmol = 0 indicates saturated liquid qmol = 1 indicates saturated vapor 0 < qmol < 1 indicates a two-phase state qmol < 0 or qmol > 1 are not allowed and will result in warning
- xl (20) [double ,in] :: Composition of liquid phase (array of mole fractions)
- xv (20) [double ,in] :: Composition of vapor phase (array of mole fractions)
- qkg [double ,out] :: Quality on mass basis (mass of vapor/total mass)
- xlkg (20) [double ,out] :: Mass composition of liquid phase (array of mass fractions)
- xvkg (20) [double ,out] :: Mass composition of vapor phase (array of mass fractions)
- wliq [double ,out] :: Molar mass of liquid phase [g/mol]
- wvap [double ,out] :: Molar mass of vapor phase [g/mol]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: All inputs within limits -19: Input q < 0 or > 1
-
subroutine
QMOLEdll
(qkg, xlkg, xvkg, qmol, xl, xv, wliq, wvap, ierr, herr, herr_length)¶ Converts quality and composition on a mass basis to a molar basis.
Parameters: - qkg [double ,in] :: Quality on mass basis (mass of vapor/total mass) qkg = 0 indicates saturated liquid qkg = 1 indicates saturated vapor 0 < qkg < 1 indicates a two-phase state qkg < 0 or qkg > 1 are not allowed and will result in warning
- xlkg (20) [double ,in] :: Mass composition of liquid phase (array of mass fractions)
- xvkg (20) [double ,in] :: Mass composition of vapor phase (array of mass fractions)
- qmol [double ,out] :: Quality on molar basis (moles of vapor/total mass)
- xl (20) [double ,out] :: Molar composition of liquid phase (array of mole fractions)
- xv (20) [double ,out] :: Molar composition of vapor phase (array of mole fractions)
- wliq [double ,out] :: Molar mass of liquid phase [g/mol]
- wvap [double ,out] :: Molar mass of vapor phase [g/mol]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: All inputs within limits -19: Input q < 0 or > 1
-
subroutine
RDXHMXdll
(ix, icmp, icmp2, z, Tred, Dred, ierr, herr, herr_length)¶ Returns reducing parameters and their derivatives associated with the mixture Helmholtz EOS; these are used to calculate the ‘tau’ and ‘del’ that are the independent variables in the EOS.
Parameters: - ix [int ,in] :: Flag specifying the order of the composition derivative to calculate, when ix = 0, compute T(red) and D(red) for icmp2=0 when ix = 1, compute 1st derivative with respect to z(icmp) or z(icmp2) when ix = 2, compute 2nd derivative with respect to z(icmp) or z(icmp2) for icmp<>0 and icmp2<>0 when ix = 11, compute cross derivative with respect to z(icmp) and z(icmp2)
- icmp [int ,in] :: Component number for which derivative will be calculated
- icmp2 [int ,in] :: Second component number for which derivative will be calculated
- z (20) [double ,in] :: Composition array (array of mole fractions)
- Tred [double ,out] :: Reducing temperature [K] or derivative
- Dred [double ,out] :: Reducing molar density [mol/L] or derivative of reducing volume [L/mol] (ix=0 - Dc; ix=1 - dVc/dxi; ix=2 - d^2Vc/dxi^2; ix=11 - d^2Vc/dxidxj)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 301: Mixing rule not found for i,j 191: Derivative not available
-
subroutine
REDXdll
(z, Tred, Dred)¶ Returns the reducing parameters associated with mixture EOS; used to calculate the ‘tau’ and ‘del’, which are the independent variables in the EOS.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- Tred [double ,out] :: Reducing temperature [K]
- Dred [double ,out] :: Reducing molar density [mol/L]
-
subroutine
RESIDUALdll
(T, D, z, Pr, er, hr, sr, Cvr, Cpr, ar, gr)¶ Compute the residual quantities as a function of temperature, density, and composition (where the residual is the total property minus the ideal gas portion).
This routine is the same as THERM2, except it only calculates the residual portions at any temperature and density.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- Pr [double ,out] :: Residual pressure [kPa] (P-D*Rxgas*T)
- er [double ,out] :: Residual internal energy [J/mol]
- hr [double ,out] :: Residual enthalpy [J/mol]
- sr [double ,out] :: Residual entropy [J/mol-K]
- Cvr [double ,out] :: Residual isochoric heat capacity [J/mol-K]
- Cpr [double ,out] :: Residual isobaric heat capacity [J/mol-K]
- ar [double ,out] :: Residual Helmholtz energy [J/mol]
- gr [double ,out] :: Residual Gibbs free energy [J/mol]
-
subroutine
RIEMdll
(T, D, z, riemc)¶ RIEM is the thermodynamic curvature in cubic nanometers/molecule. It has the magnitude of the correlation volume, is negative for attractive interactions, and positive for repulsive interactions, except when its magnitude gets smaller than the molecular volume.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- riemc [double ,out] :: RIEM [cubic nanometers/molecule]
-
subroutine
RMIX2dll
(z, Rgas)¶ Mimic RMIX but return the gas constant as a parameter for use in the DLL.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- Rgas [double ] :: XXXXXXXXXX
-
subroutine
SATDdll
(D, z, kph, kr, T, P, Dl, Dv, x, y, ierr, herr, herr_length)¶ Iterate for temperature and pressure given density along the saturation boundary (including the sublimation and melting lines) and the composition.
Either (Dl,x) or (Dv,y) will correspond to the input state with the other pair corresponding to the other phase in equilibrium with the input state.
The flag kph is for use only with water at densities near the triple point (between 0 and 4 C).
Parameters: - D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Flag specifying desired root for multi-valued inputs (typically only water)
- kr [int ,out] :: Phase flag
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of saturated liquid [mol/L]
- Dv [double ,out] :: Molar density of saturated vapor [mol/L]
- x (20) [double ,out] :: Liquid phase composition (array of mole fractions)
- y (20) [double ,out] :: Vapor phase composition (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags0,1: Return upper root -1: Return middle root 3: Return melting line kr
flags1: Input state is liquid in equilibrium with vapor. 2: Input state is vapor in equilibrium with liquid. 3: Input state is liquid in equilibrium with solid. (only for pure fluids) 4: Input state is vapor in equilibrium with solid. (only for pure fluids) ierr
flags0: Successful 2: D>Dtrp of the liquid 3: D<Dtrp of the vapor 160: SATD did not converge (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATESTdll
(iFlash, T, P, z, x, y, ierr, herr, herr_length)¶ Estimate temperature, pressure, and compositions to be used as initial guesses to SATTP.
Parameters: - iFlash [int ,in] :: Phase flag
- T [double ,out] :: Temperature [K] (input or output)
- P [double ,out] :: Pressure [kPa] (input or output)
- z (20) [double ,in] :: Composition (array of mole fractions) The composition for the known x or y array should be sent in this z array, not in the output arrays shown below.
- x (20) [double ,out] :: Liquid phase composition (array of mole fractions)
- y (20) [double ,out] :: Vapor phase composition (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : iflash
flags0: Flash calculation (T and P known) 1: T and x known, P and y returned 2: T and y known, P and x returned 3: P and x known, T and y returned 4: P and y known, T and x returned If this value is negative, the retrograde point will be returned. ierr
flags0: Successful 999: Unsuccessful
-
subroutine
SATEdll
(e, z, kph, nroot, k1, T1, P1, D1, k2, T2, P2, D2, ierr, herr, herr_length)¶ Iterate for temperature, pressure, and density given energy along the saturation boundary and the composition.
Parameters: - e [double ,in] :: Molar energy [J/mol]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Flag specifying desired root
- nroot [int ] :: XXXXXXXXXX
- k1 [int ] :: XXXXXXXXXX
- T1 [double ] :: XXXXXXXXXX
- P1 [double ] :: XXXXXXXXXX
- D1 [double ] :: XXXXXXXXXX
- k2 [int ] :: XXXXXXXXXX
- T2 [double ] :: XXXXXXXXXX
- P2 [double ] :: XXXXXXXXXX
- D2 [double ] :: XXXXXXXXXX
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags0: Return all roots along the liquid-vapor line 1: Return only the liquid VLE root 2: Return only the vapor VLE roots 3: Return liquid SLE root (melting line) 4: Return vapor SVE root (sublimation line)
-
subroutine
SATGUESSdll
(kph, iprop, x, T, P, D, h, s, Dy, y, ierr, herr, herr_length)¶ For a pure fluid, call the ancillary equations to obtain close estimates for the saturation boundaries. The difference between these values and those from SATT, SATP, etc., depend on how well the ancillary equation was fitted, but generally they are within 0.1%, except for the saturation densities within several degrees of the critical temperature.
For a mixture, calculate approximate values from the spline curves for the saturation boundary. Subroutine SATSPLN must be called in order for this to work.
The input property should be placed in the corresponding variable for T, P, D, h, or s. Inputs of h and s only work for mixtures when SATSPLN has been called.
Parameters: - kph [int ,in] :: Input phase; 1-liquid, 2-vapor When maximum in the property does not occur near the critical point, then kph=1 returns the root at the higher density and kph=2 returns the root at the lower density.
- iprop [int ,in] :: Input property
- x (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- h [double ,out] :: Enthalpy or energy [J/mol] (not returned for a pure fluid)
- s [double ,out] :: Entropy [J/mol-K] (not returned for a pure fluid)
- Dy [double ,out] :: Equilibrium phase density [mol/L]
- y (20) [double ,out] :: Equilibrium phase composition (array of mole fractions) (h, s, and y are only returned when splines are used to calculate values.)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : iprop
flags1: Temperature 2: Pressure 3: Density 4: Enthalpy 5: Entropy 6: Energy (currently only working for pure fluids) 11 to 15: 1st derivative of the property (for iprop-10) returned in Dy with respect to density (only for iFlag=0) 21 to 25: 2nd derivative of the property (for iprop-20) returned in Dy with respect to density (only for iFlag=0) 101: Check if the x array is identical to those sent to SATSPLN (only for iFlag=0) (for negative values of 1 to 5, find the location of zero slope of the property with respect to D) (only for iFlag=0) iflag
flags0: Use default and best methods, generally ancillary equations for pure fluids and splines (calculated from call to SATSPLN) for mixtures 11: Use Rackett technique to get density from T and P (value of kph and iprop ignored) 12: Use initial guess equations of Lemmon ierr
flags0: Successful 331: Splines not available for saturation calculations 332: Initialize variable d72l first before calling SATGUESS -311: Compositions not identical to that used in the call to SATSPLN
-
subroutine
SATGVdll
(T, P, z, vf, b, ipv, ityp, isp, Dx, Dy, x, y, ierr, herr, herr_length)¶ Calculates the bubble or dew point state with the entropy or density method of GV. The calculation method is similar to the volume based algorithm of GERG. The cricondenbar and cricondentherm are estimated with the method in Michelsen, Saturation Point Calculations, Fluid Phase Equilibria, 23:181, 1985.
Equations to be solved simultaneously are
Pressure based:
- f(1:n) - LOG(y/x)-LOG((fxi/nxi)/(fyi/nyi))=0
- f(n+1) - SUM(y(i)-x(i))=0
- f(n+2) - b/binput-1=0, where b = P, T, D, or s
Volume based:
- f(1:n) - LOG(y/x)-LOG((fxi/nxi)/(fyi/nyi))=0
- f(n+1) - SUM(y(i)-x(i))=0
- f(n+2) - py=px
- f(n+3) - b/binput-1=0, where b = P, T, D, or s
Variables:
- 1 to nc - LOG(k(i))
- nc+1 - LOG(T)
- nc+2 - LOG(P) or LOG(Dx)
- nc+3 - LOG(Dy)
Parameters: - T [double ,out] :: Temperature [K]
- P [double ,out] :: Pressure [kPa]
- z (20) [double ,in] :: Overall composition (array of mole fractions)
- vf [double ,in] :: Vapor fraction (0>=vf>=1; the input value of density can be in either state and does not affect the outputs in Dx, Dy, x, and y)
- b [double ,in] :: Input value, either entropy [J/mol-K] or density [mol/L]
- ipv [int ,in] :: Pressure or volume based algorithm
- ityp [int ,in] :: Input values
- isp [int ,in] :: Use values from Splines as initial guesses if set to 1
- Dx [double ,out] :: Density of x phase [mol/L]
- Dy [double ,out] :: Density of y phase [mol/L]
- x (20) [double ,out] :: Composition of the x array (array of mole fractions)
- y (20) [double ,out] :: Composition of the y array (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : vf
flagsvf=0,ityp=0,1: Dew phase inputs, state in equilibrium returned in Dy and y vf=1,ityp=0,1: Liquid phase inputs, state in equilibrium returned in Dx and x vf=0,ityp=6: Inputs are returned in Dx and the x array Outputs are returned in Dy and the y array vf=1,ityp=6: Inputs are returned in Dy and the y array Outputs are returned in Dx and the x array ipv
flags1: Pressure based 2: Volume based ityp
flags0: Given P, calculate T 1: Given T, calculate P 2: Cricondentherm condition, calculate T,P (ipv=1 only) 3: Cricondenbar condition, calculate T,P (ipv=1 only) 5: Given entropy, calculate T,P 6: Given density, calculate T,P ierr
flags0: Successful 2: Input D<=0 151: No convergence 172: vf<0 or vf>1 191: Derivatives are not available in PR or RDXHMX 321: Trivial solution 200: Density out of range (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATHdll
(h, z, kph, nroot, k1, T1, P1, D1, k2, T2, P2, D2, ierr, herr, herr_length)¶ Iterate for temperature, pressure, and density given enthalpy along the saturation boundary and the composition.
The second root is always set as the root in the vapor at temperatures below the maximum enthalpy on the vapor saturation line. If kph is set to 2, and only one root is found in the vapor (this occurs when h<hcrit) the state point will be placed in k2,T2,P2,D2. If kph=0 and this situation occurred, the first root (k1,T1,P1,d1) would be in the liquid (k1=1, k2=2).
Parameters: - h [double ,in] :: Molar enthalpy [J/mol]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Flag specifying desired root
- nroot [int ,out] :: Number of roots. Value is set to one for kph=1,3,4 if ierr=0
- k1 [int ,out] :: Phase of first root (1-liquid, 2-vapor, 3-melt, 4-subl) For mixtures where the saturation line goes infinite in pressure, k1=-1 if h>hmax (where hmax was found in the vapor phase)
- T1 [double ,out] :: Temperature of first root [K]
- P1 [double ,out] :: Pressure of first root [kPa]
- D1 [double ,out] :: Molar density of first root [mol/L]
- k2 [int ,out] :: Phase of second root (1-liquid, 2-vapor, 3-melt, 4-subl)
- T2 [double ,out] :: Temperature of second root [K]
- P2 [double ,out] :: Pressure of second root [kPa]
- D2 [double ,out] :: Molar density of second root [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags0: Return all roots along the liquid-vapor line 1: Return only liquid VLE root 2: Return only vapor VLE roots 3: Return liquid SLE root (melting line) 4: Return vapor SVE root (sublimation line) kph = 3,4 presently working only for pure components ierr
flags0: Successful 181: SATH did not converge for one of the roots 54: h < hmin 55: h > hmax 56: h > htrp (for sublimation inputs) (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATPdll
(P, z, kph, T, Dl, Dv, x, y, ierr, herr, herr_length)¶ Iterate for saturated liquid and vapor states given pressure and the composition of one phase.
All variables should be initialized before calling this routine because they will be used as initial values if T<0.
Parameters: - P [double ,in] :: Pressure [kPa] If T is negative, all other variables are used as initial guesses at ABS(T).
- z (20) [double ,in] :: Composition (array of mole fractions) (phase specified by kph)
- kph [int ,in] :: Phase flag
- T [double ,out] :: Temperature [K]
- Dl [double ,out] :: Molar density of saturated liquid [mol/L]
- Dv [double ,out] :: Molar density of saturated vapor [mol/L] For a pseudo pure fluid, the density of the equilibrium phase is not returned. Call SATP twice, once with kph=1 to get Tliq and Dl, and once with kph=2 to get Tvap and Dv.
- x (20) [double ,out] :: Liquid phase composition (array of mole fractions)
- y (20) [double ,out] :: Vapor phase composition (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Input z is liquid composition (bubble point) 2: Input z is vapor composition (dew point) 3: Input z is liquid composition (freezing point) 4: Input z is vapor composition (sublimation point) ierr
flags0: Successful 141: P > Pcrit 144: Pure fluid iteration did not converge (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATSPLNdll
(z, ierr, herr, herr_length)¶ Calculates the phase boundary of a mixture at a given composition, along with the critical point, cricondentherm, and cricondenbar.
Parameters: - z (20) [double ,in] :: Composition (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 355: Saturation routine failed
-
subroutine
SATSdll
(s, z, kph, nroot, k1, T1, P1, D1, k2, T2, P2, D2, k3, T3, P3, D3, ierr, herr, herr_length)¶ Iterate for temperature, pressure, and density given entropy along the saturation boundary and the composition.
The second root is always set as the root in the vapor at temperatures below the maximum entropy on the vapor saturation line. If kph is set to 2, and only one root is found in the vapor (this occurs when s<scrit) the state point will be placed in k2,T2,P2,D2. If kph=0 and this situation occurred, the first root (k1,T1,P1,D1) would be in the liquid (k1=1, k2=2).
The third root is the root with the lowest temperature. For fluids with multiple roots, when only one root is found in the vapor phase (this happens only at very low temperatures past the region where three roots are located), the value of the root is still placed in k3,T3,P3,D3. For fluids that never have more than one root (when there is no maximum entropy along the saturated vapor line), the value of the root is always placed in k1,T1,P1,D1.
Parameters: - s [double ,in] :: Molar entropy [J/mol-K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Flag specifying desired root
- nroot [int ,out] :: Number of roots. Set to one for kph=1,3,4 if ierr=0
- k1 [int ,out] :: Phase of first root (1-liquid, 2-vapor, 3-melt, 4-subl)
- T1 [double ,out] :: Temperature of first root [K]
- P1 [double ,out] :: Pressure of first root [kPa]
- D1 [double ,out] :: Molar density of first root [mol/L]
- k2 [int ,out] :: Phase of second root (1-liquid, 2-vapor, 3-melt, 4-subl)
- T2 [double ,out] :: Temperature of second root [K]
- P2 [double ,out] :: Pressure of second root [kPa]
- D2 [double ,out] :: Molar density of second root [mol/L]
- k3 [int ,out] :: Phase of third root (1-liquid, 2-vapor, 3-melt, 4-subl)
- T3 [double ,out] :: Temperature of third root [K]
- P3 [double ,out] :: Pressure of third root [kPa]
- D3 [double ,out] :: Molar density of third root [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags0: Return all roots along the liquid-vapor line 1: Return only liquid VLE root 2: Return only vapor VLE roots 3: Return liquid SLE root (melting line) 4: Return vapor SVE root (sublimation line) kph = 3,4 presently working only for pure components ierr
flags0: Successful 192: SATS did not converge for one or more roots 66: s < smin 67: s > smax 68: s > strp (for sublimation inputs) (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATTPdll
(T, P, z, iFlsh, iGuess, D, Dl, Dv, x, y, q, ierr, herr, herr_length)¶ Calculate saturation properties for bubble, dew, or 2-phase states with the use of analytical derivatives of the Helmholtz energy with respect to composition.
Parameters: - T [double ,in] :: Temperature [K] (input or output)
- P [double ,in] :: Pressure [kPa] (input or output)
- z (20) [double ,in] :: Composition (array of mole fractions)
- iFlsh [int ,in] :: Phase flag
- iGuess [int ,in] :: If set to 1, the parameters Dl, Dv, x, and y are used as initial guesses for the calculation. If Dl and Dv are set to zero when iGuess=1, then the densities are obtained from the first call to TPRHO. If Dl and Dv are not zero when iGuess=1, those values are used as initial values. If set to 2 and splines have been calculated, use inputs rather than spline values.
- D [double ,out] :: Overall density [mol/L]
- Dl [double ,out] :: Molar density of saturated liquid [mol/L]
- Dv [double ,out] :: Molar density of saturated vapor [mol/L]
- x (20) [double ,out] :: Liquid phase composition (array of mole fractions)
- y (20) [double ,out] :: Vapor phase composition (array of mole fractions)
- q [double ,out] :: Quality
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : iflsh
flags0: Flash calculation (T and P known) 1: T and x known, P and y returned 2: T and y known, P and x returned 3: P and x known, T and y returned 4: P and y known, T and x returned If this value is negative, the retrograde point will be returned. ierr
flags0: Successful 121: T>Tmax (maxcondentherm) 141: P>Pmax (maxcondenbar) 151: Iteration failed 156: Probable Type III mixture with no liquid solution 159: Wrong input value for iFlsh (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SATTdll
(T, z, kph, P, Dl, Dv, x, y, ierr, herr, herr_length)¶ Iterate for saturated liquid and vapor states given temperature and the composition of one phase.
All variables should be initialized before calling this routine because they will be used as initial values if T<0.
Parameters: - T [double ,in] :: Temperature [K] If T is negative, all other variables are used as initial guesses at ABS(T).
- z (20) [double ,in] :: Composition (array of mole fractions) (phase specified by kph)
- kph [int ,in] :: Phase flag
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of saturated liquid [mol/L]
- Dv [double ,out] :: Molar density of saturated vapor [mol/L] For a pseudo pure fluid, the density of the equilibrium phase is not returned. Call SATT twice, once with kph=1 to get Pliq and Dl, and once with kph=2 to get Pvap and Dv.
- x (20) [double ,out] :: Liquid phase composition (array of mole fractions)
- y (20) [double ,out] :: Vapor phase composition (array of mole fractions)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Input z is liquid composition (bubble point) -1: Force calculation in the liquid phase even if T<Ttrp 2: Input z is vapor composition (dew point) -2: Force calculation in the vapor phase even if T<Ttrp 3: Input z is liquid composition along the freezing line (melting line) 4: Input z is vapor composition along the sublimation line ierr
flags0: Successful 121: T > Tcrit 124: Pure fluid iteration did not converge (See subroutine LIMITX for other possible error numbers.)
-
subroutine
SETAGAdll
(ierr, herr, herr_length)¶ Set up working arrays for use with AGA8 equation of state.
Parameters: - ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 108: Error (e.g. fluid not found)
-
subroutine
SETKTVdll
(icomp, jcomp, hmodij, fij, hFmix, ierr, herr, hmodij_length, hFmix_length, herr_length)¶ Set mixture model and/or parameters.
This subroutine must be called after SETUP, but before any call to SETREF (for cases where energy, enthalpy, entropy, Gibbs energy, or the Helmholtz energy are required); it need not be called at all if the default mixture parameters (those read in by SETUP) are to be used.
The component numbers icomp and jcomp must match the order that is found in the HMX.BNC file for each binary pair, or, in the case where no interaction parameters are available in the HMX.BNC file, icomp and jcomp must be in the same order as was used in the call to SETUP. If the numbers in these two integers are backwards, an error number and message will be returned, and nothing will be changed. In this situation, switch the numbers and call this routine again.
Kunz-Wagner model (KW0) Lemmon-Jacobsen model (LJ6) fij(1) = betaT fij(1) = zeta fij(2) = gammaT fij(2) = xi fij(3) = betaV fij(3) = Fij fij(4) = gammaV fij(4) = beta fij(5) = Fij fij(5) = gamma fij(6) = ‘not used’ fij(6) = ‘not used’ Parameters: - icomp [int ,in] :: Component i
- jcomp [int ,in] :: Component j
- hmodij [char ,in] :: Mixing rule for the binary pair i,j (e.g. LJ6, KW0, XR0, or LIN) (character*3) If hmodij is ‘RST’, reset all pairs to values from the original call to SETUP (all other inputs are ignored)
- fij (6) [double ,in] :: Binary mixture parameters (array of dimension nmxpar; currently nmxpar is set to 6) The parameters will vary depending on hmodij (see above)
- hFmix [char ,in] :: No longer used. Info from previous versions: File name (character*255) containing generalized parameters for the binary mixture model; this will usually be the same as the corresponding input to SETUP (e.g.,’HMX.BNC’)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hmodij_length [int ] :: length of variable
hmodij
(default: 3) - hFmix_length [int ] :: length of variable
hFmix
(default: 255) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 111: Error in opening mixture file 902: Routine not value for a pure fluid 903: Illegal i,j specification (i=j or i>nc or j>nc) 904: Order of fluids is backwards from that in HMX.BNC
-
subroutine
SETMIXdll
(hMixNme, hFmix, hrf, ncc, hFiles, z, ierr, herr, hMixNme_length, hFmix_length, hrf_length, hFiles_length, herr_length)¶ Open a mixture file (e.g., R410A.mix) and read constituents and mole fractions.
Parameters: - hMixNme [char ,in] :: Mixture file name (character*255)
- hFmix [char ,in] :: File containing mixture coefficients (character*255)
- hrf [char ,in] :: Reference state (character*3); See subroutine SETUP for specifics.
- ncc [int ,out] :: Number of fluids in mixture
- hFiles [char ,out] :: Array of file names specifying mixture components that were used to call setup (character*255)
- z (20) [double ,out] :: Array of mole fractions for the specified mixture
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hMixNme_length [int ] :: length of variable
hMixNme
(default: 255) - hFmix_length [int ] :: length of variable
hFmix
(default: 255) - hrf_length [int ] :: length of variable
hrf
(default: 3) - hFiles_length [int ] :: length of variable
hFiles
(default: 10000) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 101: Error in opening file -102: Mixture file contains mixing parameters 805: Sum of compositions not equal to one
-
subroutine
SETMODdll
(ncomp, htype, hmix, hcomp, ierr, herr, htype_length, hmix_length, hcomp_length, herr_length)¶ Set model(s) other than the NIST-recommended (‘NBS’) ones.
This subroutine must be called before SETUP; it need not be called at all if the default (NIST-recommended) models are desired.
Parameters: - ncomp [int ,in] :: Number of components (1 for pure fluid) (integer)
- htype [char ,in] :: Flag indicating which model to set (character*3)
- hmix [char ,in] :: Mixture model for the property specified in htype (character*3) (ignored if number of components = 1)
- hcomp [char ,in] :: Component model(s) for property specified in htype [array (1..ncomp) of character*3]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- htype_length [int ] :: length of variable
htype
(default: 3) - hmix_length [int ] :: length of variable
hmix
(default: 3) - hcomp_length [int ] :: length of variable
hcomp
(default: 60) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : htype
flags‘NBS’: Reset all of the above model types to ‘NBS’ (values of hmix and hcomp are ignored) ‘EOS’: Equation of state ‘ETA’: Viscosity ‘TCX’: Thermal conductivity ‘STN’: Surface tension hmix
flags‘NBS’: Use NIST recommendation for specified fluid/mixture ‘HMX’: Mixture Helmholtz model for thermodynamic properties ‘ECS’: Extended corresponding states for viscosity or therm. cond. ‘STX’: Surface tension mixture model hcomp
flags‘NBS’: NIST recommendation for specified fluid/mixture ‘FEQ’: Helmholtz energy model ‘BWR’: Pure fluid modified Benedict-Webb-Rubin (MBWR) ‘ECS’: Extended corresponding states (all fluids) ‘PRT’: Peng-Robinson (PRT model from fluid file) ‘VS1’: The ‘composite’ model for R134a, R152a, NH3, etc. ‘VS2’: Younglove-Ely model for hydrocarbons ‘VS4’: Generalized friction theory of Quinones-Cisneros and Deiters ‘VS5’: Chung et al. (1988) predictive model ‘VS6’: Vesovic form of VS1 model ‘VS7’: Polynomial/exponential model ‘TC1’: The ‘composite’ model for R134a, R152a, etc. ‘TC2’: Younglove-Ely model for hydrocarbons ‘TC5’: Chung et al. (1988) predictive model ‘ST1’: Surface tension as f(tau); tau = 1 - T/Tc ierr
flags0: Successful 113: ncomp outside of bounds
-
subroutine
SETNCdll
(ncomp)¶ Allow the user to modify the value of nc (the number of components in a mixture) so that a subset of the loaded mixtures can be used. For example, a 4 component mixture could be set up, but nc could be set to 3 to calculate properties of the mixture of the first three components. The last component can then be used as a pure fluid. For example, SETUP could be called to load four fluids, R32.fld, R125.fld, R134a.fld, and R407C.ppf, followed by a call to SETNC(3) so that the 4th component is not used in mixture calculations. The pseudo-pure fluid equation in R407C.ppf can be accessed by calling PUREFLD(4) to get single-phase thermodynamic properties, and VLE states or transport properties that require the first three components can be obtained by calling PUREFLD(0) and setting the composition array z with the appropriate values.
Parameters: ncomp [int ,in] :: number of components in the mixture
-
subroutine
SETREFDIRdll
(hpth, hpth_length)¶ Set a path to the location of original fluid files so that a user can specify where their fluid file is located, but the reference files needed for transport properties, etc., such as nitrogen.fld, can be found.
Parameters: - hpth [char ,in] :: Location of the fluid files (character*255) The path does not need to contain the ending “”. For example: hpth=’C:Program FilesRefpropfluids’
- hpth_length [int ] :: length of variable
hpth
(default: 255)
-
subroutine
SETREFdll
(hrf, ixflag, x0, h0, s0, T0, P0, ierr, herr, hrf_length, herr_length)¶ Set reference state enthalpy and entropy.
This subroutine must be called after SETUP; it need not be called at all if the reference state specified in the call to SETUP is to be used.
Parameters: - hrf [char ,in] :: Reference state for thermodynamic calculations (character*3)
- ixflag [int ,in] :: Composition flag
- x0 (20) [double ,in] :: Composition for which h0 and s0 apply; array(1:nc) (array of mole fractions) This is useful for mixtures of a predefined composition, e.g., refrigerant blends such as R410A. Only has meaning if ixflag = 2
- h0 [double ,in] :: Reference state enthalpy at T0, P0, and x0 [J/mol] (only has meaning if hrf = ‘OTH’ or ‘OT0’)
- s0 [double ,in] :: Reference state entropy at T0, P0, and x0 [J/mol-K] (only has meaning if hrf = ‘OTH’ or ‘OT0’)
- T0 [double ,in] :: Reference state temperature [K] (only has meaning if hrf = ‘OTH’ or ‘OT0’) T0 = -1 indicates saturated liquid at normal boiling point (bubble point for a mixture)
- P0 [double ,in] :: Reference state pressure [kPa] (only has meaning if hrf = ‘OTH’ or ‘OT0’) P0 = -1 indicates saturated liquid at T0 (and x0) P0 = -2 indicates saturated vapor at T0 (and x0)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hrf_length [int ] :: length of variable
hrf
(default: 3) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : hrf
flags‘NBP’: h,s = 0 at normal boiling point(s) ‘ASH’: h,s = 0 for saturated liquid at -40 C (ASHRAE convention) ‘IIR’: h = 200 kJ/kg, s = 1 kJ/kg-K for sat. liquid at 0 C (IIR convention) ‘DEF’: Default reference state as specified in fluid file ‘OTH’: Other, as specified by h0, s0, T0, P0 (real gas state) ‘OT0’: Other, as specified by h0, s0, T0, P0 (ideal-gas state) ‘TD0’: h,s = 0 at zero temperature and density ‘NA’: Not applicable, do not set up the reference state. The values of e, h, and s will have a random reference state. Do not use except for EOS testing. ‘???’: Set hrf to the value of the current reference state and exit ixflag
flags1: Reference state applied to pure components 2: Reference state applied to mixture x0 In order for option 2 to work, each fluid in the mixture must use the same reference state. ierr
flags0: Successful 22: Tmin > Tref for IIR reference state 23: Tcrit < Tref for IIR reference state 24: Tmin > Tref for ASHRAE reference state 25: Tcrit < Tref for ASHRAE reference state 26: Tmin > Tnbp for NBP reference state -28: Can’t apply ‘DEF’ to mixture; will apply to pure components -29: Unknown reference state specified; will use ‘DEF’ 119: Convergence failure in calculating reference state
-
subroutine
SETUPdll
(ncomp, hFiles, hFmix, hrf, ierr, herr, hFiles_length, hFmix_length, hrf_length, herr_length)¶ Define models and initialize arrays.
Parameters: - ncomp [int ,in] :: Number of components (1 for pure fluid) (integer) If called with ncomp=-1, the version number*10000 will be returned in ierr.
- hFiles [char ,in] :: Array of file names specifying the fluid or the mixture components (character*255); e.g., ‘fluidsr134a.fld’ (DOS) ‘:fluids:r134a.fld’ (Mac) ‘[full_path]/fluids/r134a.fld’ (UNIX)
- hFmix [char ,in] :: Name of file containing mixture coefficients (character*255); e.g., ‘fluidsHMX.BNC’
- hrf [char ,in] :: Reference state for thermodynamic calculations (character*3). Other choices are possible, see SETREF
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- hFiles_length [int ] :: length of variable
hFiles
(default: 10000) - hFmix_length [int ] :: length of variable
hFmix
(default: 255) - hrf_length [int ] :: length of variable
hrf
(default: 3) - herr_length [int ] :: length of variable
herr
(default: 255)
Flags : hrf
flags‘DEF’: default reference state as specified in fluid file ‘NBP’: h,s = 0 at pure component normal boiling point ‘ASH’: h,s = 0 for sat. liquid at -40 C (ASHRAE convention) ‘IIR’: h = 200 kJ/kg and s = 1 kJ/kg-K for sat. liquid at 0 C (IIR convention) ierr
flags0: Successful 101: Error in opening file 102: Error in file or premature end of file -107: Unknown model encountered in file 105: Specified model not found -105: Must use routine SETREF for (OTH) reference state choice 111: Error in opening mixture file 112: Mixture file of wrong type 114: nc not equal to the nc sent to SETMOD -117: Binary pair not found, all parameters will be estimated 117: Mixture parameters not available, mixture is outside the range of the model and calculations will not be made
-
subroutine
SPLNROOTdll
(isp, iderv, f, a, ierr, herr, herr_length)¶ Calculates the root of a given value of a spline function
Parameters: - isp [int ,in] :: Indicator for which spline to use 1 to nc - Composition nc+1 - Temperature nc+2 - Pressure nc+3 - Density nc+4 - Enthalpy or Energy (depending on the value of ieflag). nc+5 - Entropy
- iderv [int ,in] :: Values of -1 and -2 return lower and upper root values, a value of 0 returns the spline root, a value of 1 returns the root where the derivative of the spline with respect to D is equal to the the value of f (set f=0 to find maximum or minimum).
- f [double ,in] :: Value of spline function
- a [double ,out] :: Root value (initial value required since some splines can be doubled valued)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 151: Routine did not converge.’
-
subroutine
SPLNVALdll
(isp, iderv, a, f, ierr, herr, herr_length)¶ Calculates the value of a spline or the derivative of the spline at the specified value.
Parameters: - isp [int ,in] :: Indicator for which spline to use
- iderv [int ,in] :: Values of -1 and -2 return lowest and highest density values of the splines, a value of 0 returns spline function value, a value of 1 returns the derivative of the spline with respect to the input value, and a value of 2 returns the 2nd derivative.
- a [double ,in] :: Input value (molar density of the known phase)
- f [double ,out] :: Desired output value
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : isp
flags0: Molar density of the known phase 1 to nc: Composition of the incipient phase nc+1: Temperature nc+2: Pressure nc+3: Molar density of the equilibrium phase nc+4: Enthalpy nc+5: Entropy
-
subroutine
STNdll
(T, Dl, Dv, x, y, sigma, ierr, herr, herr_length)¶ Compute surface tension with appropriate core model. For mixtures, this routine requires that the saturation densities and vapor compositions be sent as inputs. If these are not available, call SURFT.
The critical temperature used is that of the current equation of state. This may differ slightly from that used in the original correlation of the surface tension; this change is necessary to give proper behavior of surface tension near the critical point and to avoid possible numerical crashes.
Parameters: - T [double ,in] :: Temperature [K]
- Dl [double ,in] :: Molar density of liquid phase [mol/L]
- Dv [double ,in] :: Molar density of vapor phase [mol/L]
- x (20) [double ,in] :: Composition of liquid phase (array of mole fractions)
- y (20) [double ,in] :: Composition of vapor phase (array of mole fractions)
- sigma [double ,out] :: Surface tension [N/m]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 1: T > Tcrit 502: Unknown model 151: Failed to converge
-
subroutine
SUBLPdll
(P, z, T, ierr, herr, herr_length)¶ Compute the sublimation line temperature as a function of pressure and composition.
Parameters: - P [double ,in] :: Sublimation line pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful -4: Pressure above triple point pressure 501: No equation available
-
subroutine
SUBLTdll
(T, z, P, ierr, herr, herr_length)¶ Compute the sublimation line pressure as a function of temperature and composition.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P [double ,out] :: Sublimation line pressure [kPa]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 501: No equation available
-
subroutine
SURFTdll
(T, Dl, z, sigma, ierr, herr, herr_length)¶ Compute surface tension as a function of T. SATT is called to obtain the liquid density. If this is already known then your calling routines should use subroutine STN to greatly reduce the time needed in the calculation of the surface tension.
Parameters: - T [double ,in] :: Temperature [K]
- Dl [double ,out] :: Molar density of liquid phase [mol/L] (only returned for mixtures)
- z (20) [double ,in] :: Composition of liquid phase (array of mole fractions)
- sigma [double ,out] :: Surface tension [N/m]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful Other error messages returned from SATT or STN
-
subroutine
SURTENdll
(T, Dl, Dv, x, y, sigma, ierr, herr, herr_length)¶ With version 10 of Refprop, this routine should no longer be used, and STN or SURFT should be used instead.
(See subroutine STN for the description of all variables.)
Parameters: - T [double ] :: XXXXXXXXXX
- Dl [double ] :: XXXXXXXXXX
- Dv [double ] :: XXXXXXXXXX
- x (20) [double ] :: XXXXXXXXXX
- y (20) [double ] :: XXXXXXXXXX
- sigma [double ] :: XXXXXXXXXX
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TDFLSHdll
(T, D, z, P, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, bulk density, and bulk composition. This routine accepts both single-phase and two-phase states as inputs; for single-phase calculations, the subroutine THERM is much faster. (See subroutines ABFLSH or TPDFLSH for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Density [mol/L]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- P [double ,out] :: Pressure [kPa]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TEFL1dll
(T, e, z, Dmin, Dmax, D, ierr, herr, herr_length)¶ Iterate for single-phase density as a function of temperature, energy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- Dmin [double ,in] :: Lower bound on density [mol/L]
- Dmax [double ,in] :: Upper bound on density [mol/L]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TEFLSHdll
(T, e, z, kr, P, D, Dl, Dv, x, y, q, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, bulk energy, and bulk composition. (See subroutines ABFLSH or TBFLSH for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- e [double ,in] :: Internal energy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kr [int ] :: XXXXXXXXXX
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
THERM0dll
(T, D, z, P0, e0, h0, s0, Cv0, Cp00, w0, a0, g0)¶ Compute ideal-gas thermal quantities as a function of temperature, density, and composition from core functions.
This routine is the same as THERM, except it only calculates ideal gas properties (Z=1) at any temperature and density.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P0 [double ,out] :: Pressure [kPa]
- e0 [double ,out] :: Internal energy [J/mol]
- h0 [double ,out] :: Enthalpy [J/mol]
- s0 [double ,out] :: Entropy [J/mol-K]
- Cv0 [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp00 [double ,out] :: Isobaric heat capacity [J/mol-K]
- w0 [double ,out] :: Speed of sound [m/s]
- a0 [double ,out] :: Helmholtz energy [J/mol]
- g0 [double ,out] :: Gibbs free energy [J/mol]
-
subroutine
THERM2dll
(T, D, z, P, e, h, s, Cv, Cp, w, zz, hjt, a, g, xkappa, beta, dPdD, d2PdD2, dPdT, dDdT, dDdP, d2PdT2, d2PdTD, spare3, spare4)¶ Compute thermal quantities as a function of temperature, density, and composition. This routine is the simply the combination of several others. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P [double ] :: XXXXXXXXXX
- e [double ] :: XXXXXXXXXX
- h [double ] :: XXXXXXXXXX
- s [double ] :: XXXXXXXXXX
- Cv [double ] :: XXXXXXXXXX
- Cp [double ] :: XXXXXXXXXX
- w [double ] :: XXXXXXXXXX
- zz [double ,out] :: Compressibility factor (= PV/RT) [-] (See subroutines THERM, THERM3, AG, and DERVPVT for the description of all variables.)
- hjt [double ] :: XXXXXXXXXX
- a [double ,out] :: Helmholtz energy [J/mol]
- g [double ,out] :: Gibbs free energy [J/mol]
- xkappa [double ] :: XXXXXXXXXX
- beta [double ] :: XXXXXXXXXX
- dPdD [double ] :: XXXXXXXXXX
- d2PdD2 [double ] :: XXXXXXXXXX
- dPdT [double ] :: XXXXXXXXXX
- dDdT [double ] :: XXXXXXXXXX
- dDdP [double ] :: XXXXXXXXXX
- d2PdT2 [double ] :: XXXXXXXXXX
- d2PdTD [double ] :: XXXXXXXXXX
- spare3 [double ] :: XXXXXXXXXX
- spare4 [double ] :: XXXXXXXXXX
-
subroutine
THERM3dll
(T, D, z, xkappa, beta, xisenk, xkt, betas, bs, xkkt, thrott, pi, spht)¶ Compute miscellaneous thermodynamic properties. See warning in subroutines THERM or ALLPROPS.
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- xkappa [double ,out] :: Isothermal compressibility [1/kPa]
- beta [double ,out] :: Volume expansivity [1/K]
- xisenk [double ,out] :: Isentropic expansion coefficient [-]
- xkt [double ,out] :: Isothermal expansion coefficient [-]
- betas [double ,out] :: Adiabatic compressibility [1/kPa]
- bs [double ,out] :: Adiabatic bulk modulus [kPa]
- xkkt [double ,out] :: Isothermal bulk modulus [kPa]
- thrott [double ,out] :: Isothermal throttling coefficient [L/mol]
- pi [double ,out] :: Internal pressure [kPa]
- spht [double ,out] :: Specific heat input [J/mol]
-
subroutine
THERMdll
(T, D, z, P, e, h, s, Cv, Cp, w, hjt)¶ Compute thermal quantities as a function of temperature, density, and composition from core functions (Helmholtz energy, ideal gas heat capacity, and various derivatives and integrals).
Warning
Do NOT call this routine for two-phase states, otherwise it will return a metastable state if near the phase boundary or complete nonsense at other conditions. The value of q that is returned from the flash routines will indicate a two phase state by returning a value between 0 and 1. In such a situation, properties can only be calculated for the saturated liquid and vapor states. For example, when calling PHFLSH:
call PHFLSH (P,h,z,T,D,Dl,Dv,x,y,q,e,s,Cv,Cp,w,ierr,herr)
If q>0 and q<1, then values of the liquid compositions will be returned in the x and y arrays, and the properties of the liquid and vapor states can be calculated, for example, as:
call ENTRO (T,Dl,x,sliq) call ENTRO (T,Dv,x,svap)
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- P [double ,out] :: Pressure [kPa]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- hjt [double ,out] :: Isenthalpic Joule-Thomson coefficient [K/kPa]
-
subroutine
THFL1dll
(T, h, z, Dmin, Dmax, D, ierr, herr, herr_length)¶ Iterate for single-phase density as a function of temperature, enthalpy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- Dmin [double ,in] :: Lower bound on density [mol/L]
- Dmax [double ,in] :: Upper bound on density [mol/L]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
THFLSHdll
(T, h, z, kr, P, D, Dl, Dv, x, y, q, e, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, bulk enthalpy, and bulk composition. Often in the liquid, two solutions exist, one of them in the two phase. If this is the case, call THFLSH with kr=2 to get the single-phase state. (See subroutines ABFLSH or TBFLSH for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- h [double ,in] :: Enthalpy [J/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kr [int ] :: XXXXXXXXXX
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TPFL2dll
(T, P, z, Dl, Dv, x, y, q, ierr, herr, herr_length)¶ Flash calculation given temperature, pressure, and bulk composition. This routine accepts only two-phase states as inputs; if the phase is not known use TPFLSH. Use TPRHO for single-phase states.
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Overall composition (array of mole fractions)
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality on a MOLAR basis (moles vapor/total moles)
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 213: TPRHO did not converge 226: Iteration did not converge
-
subroutine
TPFLSHdll
(T, P, z, D, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, pressure, and bulk composition. This routine accepts both single-phase and two-phase states as inputs; for single-phase calculations, the subroutine TPRHO is much faster.
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Overall composition (array of mole fractions)
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole or mass fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole or mass fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255) (See subroutine ABFLSH for the description of all other output variables.)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 213: Density calculation did not converge 215: Supercritical density calculation did not converge 223: Bubble point did not converge 224: Dew point did not converge
-
subroutine
TPRHOPRdll
(T, P, z, D1, D2)¶ Compute density with a volume-translated modification of the Peng-Robinson equation of state:
P=RT/(v+c+b)-a/((v+c)*(v+c+b)+b(v+c+b))
c is a translation constant, as given in Peneloux and Rauzy, Fluid Phase Equilib. 8:7-23, 1982.
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- D1 [double ,out] :: Largest density root [mol/L]
- D2 [double ,out] :: Smallest density root [mol/L]
-
subroutine
TPRHOdll
(T, P, z, kph, kguess, D, ierr, herr, herr_length)¶ Iterate for density as a function of temperature, pressure, and composition of a specified phase.
Parameters: - T [double ,in] :: Temperature [K]
- P [double ,in] :: Pressure [kPa]
- z (20) [double ,in] :: Composition (array of mole fractions)
- kph [int ,in] :: Phase flag
- kguess [int ,in] :: Guess flag
- D [double ,out] :: Molar density [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : kph
flags1: Liquid phase 2: Vapor phase 0: Any single phase state when T>Tc or P>Pc. For T<Tc or P<Pc, this option is not allowed and TPFLSH should be used instead. TPFLSH is required in order to find the saturation state, which is then used to determine if the state is liquid or vapor. However, if an initial guess is supplied for D then kph=0 can be used and the routine will determine the phase by checking if D<Dc or D>Dc. -1: Force the search in the liquid phase (for metastable points) -2: Force the search in the vapor phase (for metastable points) kguess
flags0: No first guess for D provided 1: First guess for D provided ierr
flags0: Successful 201: Illegal input (kph <= 0) 202: Liquid-phase iteration did not converge 203: Vapor-phase iteration did not converge
-
subroutine
TQFLSHdll
(T, q, z, kq, P, D, Dl, Dv, x, y, e, h, s, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, quality, and bulk composition. This routine accepts saturation or two-phase states as inputs. (See subroutines ABFLSH or AQFLSH for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- q [double ,in] :: Vapor quality [mol/mol]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kq [int ] :: XXXXXXXXXX
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- s [double ,out] :: Entropy [J/mol-K]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TRNPRPdll
(T, D, z, eta, tcx, ierr, herr, herr_length)¶ Compute the transport properties thermal conductivity and viscosity as functions of temperature, density, and composition.
Warning
Do NOT call this routine for two-phase states, otherwise it will return a metastable state if near the phase boundary or complete nonsense at other conditions. The value of q that is returned from the flash routines will indicate a two phase state by returning a value between 0 and 1. In such a situation, the transport properties can only be calculated for the saturated liquid and vapor states. For example, when calling PHFLSH:
call PHFLSH (P,h,z,T,D,Dl,Dv,x,y,q,e,s,Cv,Cp,w,ierr,herr)
If q>0 and q<1, then values of the liquid compositions will be returned in the x and y arrays, and the transport properties of the liquid and vapor states can be calculated as follows:
call TRNPRP (T,Dl,x,etaliq,tcxliq,ierr,herr) call TRNPRP (T,Dv,y,etavap,tcxvap,ierr,herr)
Parameters: - T [double ,in] :: Temperature [K]
- D [double ,in] :: Molar density [mol/L]
- z (20) [double ,in] :: Composition array (array of mole fractions)
- eta [double ,out] :: Viscosity [uPa-s]
- tcx [double ,out] :: Thermal conductivity [W/m-K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 502: Unknown viscosity or thermal conductivity model specified 73: One or more inputs are out of bounds for the ECS model 74: Inputs to the vis. and th. cond. correlations are out 2of range 540: Transport equations are not available for one or more of the fluids 541: Transport equations are not available for mixtures with water at molar concentrations greater than 5% 542: Transport equations are not available for mixtures with alcohols 543: Transport equations are not available for the ammonia/water mixture -508: Invalid region for viscosity of reference fluid 1 -558: 2-D Newton-Raphson method for conformal temperature and density did not converge -560: Pure fluid is exactly at the critical point; thermal conductivity is infinite 561: Pure fluid correlation produced an erroneous value for either viscosity or thermal conductivity 5##: Pure fluid correlation out of range; attempted to use ECS method
-
subroutine
TSATDdll
(D, z, T, ierr, herr, herr_length)¶ Compute the saturated temperature as a function of saturated density and composition.
Parameters: - D [double ,in] :: Saturated density [mol/L]
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 2: Density greater than triple point density 501: No equation available
-
subroutine
TSATPdll
(P, z, T, ierr, herr, herr_length)¶ Compute the vapor temperature as a function of pressure and composition.
If the input pressure is negative, compute the liquid temperature as a function of liquid pressure and composition (used only for pseudo-pure fluids).
Parameters: - P [double ,in] :: Vapor pressure [kPa] If negative, liquid pressure [kPa] (the negative sign is only used as a flag).
- z (20) [double ,in] :: Composition (array of mole fractions)
- T [double ,out] :: Temperature [K] ierr, herr; See error codes in the ANCERR2 routine.
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TSFL1dll
(T, s, z, Dmin, Dmax, D, ierr, herr, herr_length)¶ Iterate for single-phase density as a function of temperature, entropy, and composition. (See subroutine ABFL1 for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- Dmin [double ,in] :: Lower bound on density [mol/L]
- Dmax [double ,in] :: Upper bound on density [mol/L]
- D [double ,out] :: Density [mol/L]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
TSFLSHdll
(T, s, z, kr, P, D, Dl, Dv, x, y, q, e, h, Cv, Cp, w, ierr, herr, herr_length)¶ Flash calculation given temperature, bulk entropy, and bulk composition. (See subroutines ABFLSH or TBFLSH for the description of all variables.)
Parameters: - T [double ,in] :: Temperature [K]
- s [double ,in] :: Entropy [J/mol-K]
- z (20) [double ,in] :: Bulk Composition (array of mole fractions)
- kr [int ] :: XXXXXXXXXX
- P [double ,out] :: Pressure [kPa]
- D [double ,out] :: Density [mol/L]
- Dl [double ,out] :: Molar density of the liquid phase [mol/L]
- Dv [double ,out] :: Molar density of the vapor phase [mol/L]
- x (20) [double ,out] :: Composition of the liquid phase (array of mole fractions)
- y (20) [double ,out] :: Composition of the vapor phase (array of mole fractions)
- q [double ,out] :: Vapor quality [mol/mol]
- e [double ,out] :: Internal energy [J/mol]
- h [double ,out] :: Enthalpy [J/mol]
- Cv [double ,out] :: Isochoric heat capacity [J/mol-K]
- Cp [double ,out] :: Isobaric heat capacity [J/mol-K]
- w [double ,out] :: Speed of sound [m/s]
- ierr [int ,out] :: Error code (no error if ierr==0)
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
UNSETAGAdll
()¶ Load original values into arrays changed in the call to SETAGA. This routine resets the values back to those loaded when SETUP was called.
-
subroutine
VAPSPNDLdll
(T, z, D, ierr, herr, herr_length)¶ Find the vapor spinodal density for a given temperature. If no spinodal exists, return the point of zero curvature. This only happens with a few of the older equations, these being D5, methanol, and nitrogen.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- D [double ,out] :: Density at vapor spinodal [mol/L]
- ierr [int ,out] :: Error flag
- herr [char ,out] :: Error string (character*255)
- herr_length [int ] :: length of variable
herr
(default: 255)
Flags : ierr
flags0: Successful 121: T>Tc 633: Failed to converge -638: Spinodal not found, point of zero curvature returned
-
subroutine
VIRBAdll
(T, z, Ba)¶ Compute the second acoustic virial coefficient Ba (L/mol) as a function of temperature (K) and composition x (array of mole fractions). For further information, see Trusler and Zarari, J. Chem. Thermodyn., 28:329-335, 1996. Gillis and Moldover, Int. J. Theromphys., 17(6):1305-1324, 1996. This routine approximates Ba. For pure fluids, the routine VIRBCD is exact.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- Ba [double ,out] :: Second acoustic virial coefficient [L/mol]
-
subroutine
VIRBCD12dll
(T, z, iFlag, B, C, D, E)¶ Compute virial coefficients as a function of temperature and composition. The routine currently works only for pure fluids and for the Helmholtz equation. All values are computed exactly based on the terms in the EOS, not as was done in VIRB by calculating properties at a density of 1d-8.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- iFlag [int ,in] :: Flag to specify the outputs (or for use in future applications). 0 - Return virial coefficients. 1 - Return acoustic virial coefficients; see: Trusler and Zarari, J. Chem. Thermodyn., 28:329-335, 1996. Gillis and Moldover, Int. J. Theromphys., 17(6):1305-1324, 1996.
- B (6) [double ] :: XXXXXXXXXX
- C (6) [double ] :: XXXXXXXXXX
- D (6) [double ] :: XXXXXXXXXX
- E (6) [double ] :: XXXXXXXXXX
-
subroutine
VIRBCDdll
(T, z, B, C, D, E)¶ Compute virial coefficients as a function of temperature and composition. The routine currently works only for pure fluids and for the Helmholtz equation. All values are computed exactly based on the terms in the EOS, not as was done in VIRB by calculating properties at a density of 1d-8.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- B [double ,out] :: Second virial coefficient [L/mol] = a01
- C [double ,out] :: Third virial coefficient [(L/mol)^2] = a02
- D [double ,out] :: Fourth virial coefficient [(L/mol)^3] = a03/2d0
- E [double ,out] :: Fifth virial coefficient [(L/mol)^4] = a04/6d0 assume nomenclature of a02=[partial^2(alphar)/partial(del)^2] above
-
subroutine
VIRBdll
(T, z, B)¶ Compute the second virial coefficient B (L/mol) as a function of temperature T (K) and composition x (array of mole fractions). This routine approximates B. For pure fluids, the routine VIRBCD is exact.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- B [double ,out] :: Second virial coefficient [L/mol]
-
subroutine
VIRCAdll
(T, z, Ca)¶ Compute the third acoustic virial coefficient Ca (L/mol)^2 as a function of temperature (K) and composition x (array of mole fractions). For further information, see Estela-Uribe and Trusler, Int. J. Theromphys., 21(5):1033, 2000. Gillis and Moldover, Int. J. Theromphys., 17(6):1305-1324, 1996. This routine approximates Ca. For pure fluids, the routine VIRBCD is exact.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- Ca [double ,out] :: Third acoustic virial coefficient [(L/mol)^2]
-
subroutine
VIRCdll
(T, z, C)¶ Compute the third virial coefficient C (L/mol)^2 as a function of temperature T (K) and composition x (array of mole fractions). This routine approximates C. For pure fluids, the routine VIRBCD is exact.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- C [double ,out] :: Third virial coefficient [(L/mol)^2] = a02
-
subroutine
VIRTAUdll
(T, z, iFlag, BTau, CTau, DTau, ETau, ierr, herr, herr_length)¶ Compute virial coefficients as a function of tau and composition. The routine currently works only for pure fluids and for the Helmholtz equation. All values are computed exactly based on the terms in the EOS, not as was done in VIRB by calculating properties at a density of 1d-8.
Parameters: - T [double ,in] :: Temperature [K]
- z (20) [double ,in] :: Composition (array of mole fractions)
- iFlag [int ] :: XXXXXXXXXX
- BTau (6) [double ] :: XXXXXXXXXX
- CTau (6) [double ] :: XXXXXXXXXX
- DTau (6) [double ] :: XXXXXXXXXX
- ETau (6) [double ] :: XXXXXXXXXX
- ierr [int ] :: XXXXXXXXXX
- herr [char ] :: XXXXXXXXXX
- herr_length [int ] :: length of variable
herr
(default: 255)
-
subroutine
WMOLIdll
(icomp, wmm)¶ Return the molar mass (molecular weight) of a component in a mixture.
Parameters: - icomp [int ,in] :: Component number in the mixture
- wmm [double ] :: XXXXXXXXXX
-
subroutine
WMOLdll
(z, wmm)¶ Return the molar mass (molecular weight) for a mixture of a specified composition.
Parameters: - z (20) [double ,in] :: Composition array (array of mole fractions)
- wmm [double ] :: XXXXXXXXXX
-
subroutine
XMASSdll
(xmol, xkg, wmix)¶ Converts composition on a mole fraction basis to mass fractions.
Parameters: - xmol (20) [double ,in] :: Composition array (array of mole fractions)
- xkg (20) [double ,out] :: Composition array (array of mass fractions)
- wmix [double ,out] :: Molar mass of the mixture [g/mol], a.k.a. molecular weight
-
subroutine
XMOLEdll
(xkg, xmol, wmix)¶ Converts composition on a mass fraction basis to mole fraction.
Parameters: - xkg (20) [double ,in] :: Composition array (array of mass fractions)
- xmol (20) [double ,out] :: Composition array (array of mole fractions)
- wmix [double ,out] :: Molar mass of the mixture [g/mol], a.k.a. molecular weight