CoolProp 8.0.0
An open-source fluid property and humid air property database
Classes | Enumerations | Functions
CoolProp::SaturationSolvers Namespace Reference

Classes

struct  mixture_VLE_IO
 
class  newton_raphson_saturation
 A class to do newton raphson solver for mixture bubble point and dew point calculations. More...
 
struct  newton_raphson_saturation_options
 
class  newton_raphson_twophase
 A class to do newton raphson solver for mixture VLE for p,Q or T,Q. More...
 
struct  newton_raphson_twophase_options
 
class  PTflash_twophase
 Isothermal-Isobaric (PT) two-phase flash solver. More...
 
struct  PTflash_twophase_options
 Options and results for the PT flash two-phase solver. More...
 
struct  saturation_D_pure_options
 
struct  saturation_PHSU_pure_options
 
struct  saturation_T_pure_Akasaka_options
 
struct  saturation_T_pure_options
 
struct  SuccessiveSubstitutionStep
 
class  WilsonK_resid
 

Enumerations

enum  sstype_enum { imposed_T , imposed_p }
 

Functions

void saturation_D_pure (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl rhomolar, saturation_D_pure_options &options)
 
void saturation_T_pure (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl T, saturation_T_pure_options &options)
 
void saturation_T_pure_Akasaka (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl T, saturation_T_pure_Akasaka_options &options)
 
void saturation_T_pure_Maxwell (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl T, saturation_T_pure_Akasaka_options &options)
 
void saturation_PHSU_pure (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl specified_value, saturation_PHSU_pure_options &options)
 
void saturation_P_pure_1D_T (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl p, saturation_PHSU_pure_options &options)
 
void saturation_T_pure_1D_P (HelmholtzEOSMixtureBackend &HEOS, CoolPropDbl T, saturation_T_pure_options &options)
 
void saturation_critical (HelmholtzEOSMixtureBackend &HEOS, CoolProp::parameters ykey, CoolPropDbl y)
 
void successive_substitution (HelmholtzEOSMixtureBackend &HEOS, const CoolPropDbl beta, CoolPropDbl T, CoolPropDbl p, const std::vector< CoolPropDbl > &z, std::vector< CoolPropDbl > &K, mixture_VLE_IO &options)
 
void x_and_y_from_K (CoolPropDbl beta, const std::vector< CoolPropDbl > &K, const std::vector< CoolPropDbl > &z, std::vector< CoolPropDbl > &x, std::vector< CoolPropDbl > &y)
 Extract the mole fractions of liquid (x) and vapor (y) given the bulk composition (z), vapor mole fraction and K-factors. More...
 
void successive_substitution_guessrho (HelmholtzEOSMixtureBackend &HEOS, std::vector< CoolPropDbl > &x, std::vector< CoolPropDbl > &y, CoolPropDbl &rhomolar_liq, CoolPropDbl &rhomolar_vap, const std::vector< CoolPropDbl > &z, int num_steps, double tol=1e-6)
 Refine a two-phase guess (x, y, rhomolar_liq, rhomolar_vap) in place by successive substitution at fixed (T, p): re-solve each phase density near its current guess, recompute the K-factors from the fugacity-coefficient ratio, and re-split via Rachford-Rice. Stops early when max |Δln K| across components falls below tol. Used to seed the second-order (Michelsen) PT phase-split solver from a cheap estimate. (Adapted from jakobreichert's PR #2720.) More...
 
bool guess_split_from_wilson (HelmholtzEOSMixtureBackend &HEOS, std::vector< CoolPropDbl > &x, std::vector< CoolPropDbl > &y, CoolPropDbl &rhomolar_liq, CoolPropDbl &rhomolar_vap, const std::vector< CoolPropDbl > &z, CoolPropDbl T, CoolPropDbl p, int num_steps, bool require_bracket=true)
 Seed a two-phase guess (x, y, rhomolar_liq, rhomolar_vap) from the ideal (Wilson) K-factor estimate at fixed (T, p) and refine it by successive substitution. The liquid phase is seeded at the incipient (heavy-rich) composition rather than the feed, so the split does not collapse to the trivial solution near the dew point. Returns false when the Wilson estimate places the feed outside its bubble/dew points (no two-phase Rachford-Rice root) or a phase density cannot be obtained. Used to recover a two-phase state that the TPD stability test reported as single-phase (CoolProp-zgpy). More...
 
double saturation_preconditioner (HelmholtzEOSMixtureBackend &HEOS, double input_value, sstype_enum input_type, const std::vector< CoolPropDbl > &z)
 
double saturation_Wilson (HelmholtzEOSMixtureBackend &HEOS, double beta, double input_value, sstype_enum input_type, const std::vector< CoolPropDbl > &z, double guess)
 

Enumeration Type Documentation

◆ sstype_enum

Enumerator
imposed_T 
imposed_p 

Definition at line 46 of file VLERoutines.h.

Function Documentation

◆ guess_split_from_wilson()

bool CoolProp::SaturationSolvers::guess_split_from_wilson ( HelmholtzEOSMixtureBackend HEOS,
std::vector< CoolPropDbl > &  x,
std::vector< CoolPropDbl > &  y,
CoolPropDbl rhomolar_liq,
CoolPropDbl rhomolar_vap,
const std::vector< CoolPropDbl > &  z,
CoolPropDbl  T,
CoolPropDbl  p,
int  num_steps,
bool  require_bracket = true 
)

Seed a two-phase guess (x, y, rhomolar_liq, rhomolar_vap) from the ideal (Wilson) K-factor estimate at fixed (T, p) and refine it by successive substitution. The liquid phase is seeded at the incipient (heavy-rich) composition rather than the feed, so the split does not collapse to the trivial solution near the dew point. Returns false when the Wilson estimate places the feed outside its bubble/dew points (no two-phase Rachford-Rice root) or a phase density cannot be obtained. Used to recover a two-phase state that the TPD stability test reported as single-phase (CoolProp-zgpy).

Definition at line 1893 of file VLERoutines.cpp.

◆ saturation_critical()

void CoolProp::SaturationSolvers::saturation_critical ( HelmholtzEOSMixtureBackend HEOS,
CoolProp::parameters  ykey,
CoolPropDbl  y 
)

Definition at line 15 of file VLERoutines.cpp.

◆ saturation_D_pure()

void CoolProp::SaturationSolvers::saturation_D_pure ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  rhomolar,
saturation_D_pure_options options 
)

Definition at line 603 of file VLERoutines.cpp.

◆ saturation_P_pure_1D_T()

void CoolProp::SaturationSolvers::saturation_P_pure_1D_T ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  p,
saturation_PHSU_pure_options options 
)

Definition at line 125 of file VLERoutines.cpp.

◆ saturation_PHSU_pure()

void CoolProp::SaturationSolvers::saturation_PHSU_pure ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  specified_value,
saturation_PHSU_pure_options options 
)

Definition at line 166 of file VLERoutines.cpp.

◆ saturation_preconditioner()

double CoolProp::SaturationSolvers::saturation_preconditioner ( HelmholtzEOSMixtureBackend HEOS,
double  input_value,
sstype_enum  input_type,
const std::vector< CoolPropDbl > &  z 
)
inline

Definition at line 229 of file VLERoutines.h.

◆ saturation_T_pure()

void CoolProp::SaturationSolvers::saturation_T_pure ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  T,
saturation_T_pure_options options 
)

Definition at line 756 of file VLERoutines.cpp.

◆ saturation_T_pure_1D_P()

void CoolProp::SaturationSolvers::saturation_T_pure_1D_P ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  T,
saturation_T_pure_options options 
)

Definition at line 80 of file VLERoutines.cpp.

◆ saturation_T_pure_Akasaka()

void CoolProp::SaturationSolvers::saturation_T_pure_Akasaka ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  T,
saturation_T_pure_Akasaka_options options 
)

Definition at line 778 of file VLERoutines.cpp.

◆ saturation_T_pure_Maxwell()

void CoolProp::SaturationSolvers::saturation_T_pure_Maxwell ( HelmholtzEOSMixtureBackend HEOS,
CoolPropDbl  T,
saturation_T_pure_Akasaka_options options 
)

Definition at line 933 of file VLERoutines.cpp.

◆ saturation_Wilson()

double CoolProp::SaturationSolvers::saturation_Wilson ( HelmholtzEOSMixtureBackend HEOS,
double  beta,
double  input_value,
sstype_enum  input_type,
const std::vector< CoolPropDbl > &  z,
double  guess 
)
inline

Wilson gives the K-factor as

\[ \ln K_i = \ln\left(\frac{p_{c,i}}{p}\right)+5.373(1+\omega_i)\left(1-\frac{T_{c,i}}{T}\right) \]

From Rachford-Rice:

\[ \sum_i \frac{x_i(K_i-1)}{1 - \beta + \beta K_i} = 0 \]

When \(T\) is known for \(\beta=0\), \(p\) can be obtained from

\[ -1+\sum_i K_ix_i=0, \]

or

\[ p = \sum_i x_ip_{c,i}\exp(5.373(1+\omega_i)(1-T_{c,i}/T). \]

Or when \(T\) is known for \(\beta=1\), \(p\)can be obtained from

\[ -1+\sum_ix_i=0, \]

or

\[ p = \left[ \sum_i \frac{y_i}{p_{c,i}\exp(5.373(1+\omega_i)(1-T_{c,i}/T)} \right]^{-1} \]

Definition at line 283 of file VLERoutines.h.

◆ successive_substitution()

void CoolProp::SaturationSolvers::successive_substitution ( HelmholtzEOSMixtureBackend HEOS,
const CoolPropDbl  beta,
CoolPropDbl  T,
CoolPropDbl  p,
const std::vector< CoolPropDbl > &  z,
std::vector< CoolPropDbl > &  K,
mixture_VLE_IO options 
)

Definition at line 1138 of file VLERoutines.cpp.

◆ successive_substitution_guessrho()

void CoolProp::SaturationSolvers::successive_substitution_guessrho ( HelmholtzEOSMixtureBackend HEOS,
std::vector< CoolPropDbl > &  x,
std::vector< CoolPropDbl > &  y,
CoolPropDbl rhomolar_liq,
CoolPropDbl rhomolar_vap,
const std::vector< CoolPropDbl > &  z,
int  num_steps,
double  tol = 1e-6 
)

Refine a two-phase guess (x, y, rhomolar_liq, rhomolar_vap) in place by successive substitution at fixed (T, p): re-solve each phase density near its current guess, recompute the K-factors from the fugacity-coefficient ratio, and re-split via Rachford-Rice. Stops early when max |Δln K| across components falls below tol. Used to seed the second-order (Michelsen) PT phase-split solver from a cheap estimate. (Adapted from jakobreichert's PR #2720.)

Parameters
num_stepsMaximum number of successive-substitution steps
tolEarly-exit tolerance on max |Δln K|

Definition at line 1830 of file VLERoutines.cpp.

◆ x_and_y_from_K()

void CoolProp::SaturationSolvers::x_and_y_from_K ( CoolPropDbl  beta,
const std::vector< CoolPropDbl > &  K,
const std::vector< CoolPropDbl > &  z,
std::vector< CoolPropDbl > &  x,
std::vector< CoolPropDbl > &  y 
)

Extract the mole fractions of liquid (x) and vapor (y) given the bulk composition (z), vapor mole fraction and K-factors.

Parameters
betaVapor molar fraction [-]
KK-factors for the components [-]
zBulk molar composition [-]
xLiquid molar composition [-]
yVapor molar composition [-]

Definition at line 1129 of file VLERoutines.cpp.