CoolProp 8.0.0
An open-source fluid property and humid air property database
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AbstractCubic Class Referenceabstract

Detailed Description

Definition at line 108 of file GeneralizedCubic.h.

#include <GeneralizedCubic.h>

Inheritance diagram for AbstractCubic:
PengRobinson SRK VTPRCubic

Public Member Functions

 AbstractCubic (const std::vector< double > &Tc, std::vector< double > pc, std::vector< double > acentric, double R_u, double Delta_1, double Delta_2, const std::vector< double > &C1=std::vector< double >(), const std::vector< double > &C2=std::vector< double >(), const std::vector< double > &C3=std::vector< double >())
 The abstract base clase for the concrete implementations of the cubic equations of state. More...
 
virtual ~AbstractCubic ()=default
 
void set_alpha (const std::vector< double > &C1, const std::vector< double > &C2, const std::vector< double > &C3)
 Set the constants for the Mathias-Copeman alpha function, or if C1,C2,C3 are all empty, set the default alpha model. More...
 
void set_alpha_function (std::size_t i, shared_ptr< AbstractCubicAlphaFunction > &acaf)
 Set the alpha function for the i-th component. More...
 
shared_ptr< AbstractCubicAlphaFunctionget_alpha_function (std::size_t i)
 Get the alpha function for the i-th component. More...
 
const std::vector< shared_ptr< AbstractCubicAlphaFunction > > & get_all_alpha_functions ()
 Get all the alpha functions. More...
 
void set_all_alpha_functions (const std::vector< shared_ptr< AbstractCubicAlphaFunction > > &alpha)
 Set all the alpha functions. More...
 
const std::vector< std::vector< double > > & get_kmat ()
 Get the entire kij matrix in one shot. More...
 
void set_kmat (const std::vector< std::vector< double > > &k)
 Set the entire kij matrix in one shot. More...
 
void set_kij (std::size_t i, std::size_t j, double val)
 Set the kij factor for the ij pair. More...
 
double get_kij (std::size_t i, std::size_t j)
 Get the kij factor for the ij pair. More...
 
std::vector< double > & get_Tc ()
 Get the vector of critical temperatures (in K) More...
 
std::vector< double > & get_pc ()
 Get the vector of critical pressures (in Pa) More...
 
std::vector< double > & get_acentric ()
 Get the vector of acentric factors. More...
 
double get_Delta_1 ()
 Read-only accessor for value of Delta_1. More...
 
double get_Delta_2 ()
 Read-only accessor for value of Delta_2. More...
 
double get_R_u ()
 Read-only accessor for value of R_u (universal gas constant) More...
 
void set_Tr (double Tr)
 Set the reducing temperature to be used. More...
 
void set_rhor (double rhor)
 Set the reducing density to be used. More...
 
double get_Tr ()
 Get the reducing temperature to be used. More...
 
double get_rhor ()
 Get the reducing density to be used. More...
 
void set_C_MC (std::size_t i, double c1, double c2, double c3)
 Set the three Mathias-Copeman constants in one shot for the component i of a mixture. More...
 
void set_C_Twu (std::size_t i, double L, double M, double N)
 Set the three Twu constants in one shot for the component i of a mixture. More...
 
virtual double a0_ii (std::size_t i)=0
 
virtual double b0_ii (std::size_t i)=0
 
virtual double m_ii (std::size_t i)=0
 Get the m_ii variable in the alpha term inculuded in the attractive part. More...
 
virtual double alphar (double tau, double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta)
 The residual non-dimensionalized Helmholtz energy \(\alpha^r\). More...
 
virtual double d_alphar_dxi (double tau, double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, bool xN_independent)
 The first composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\). More...
 
virtual double d2_alphar_dxidxj (double tau, double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\). More...
 
virtual double d3_alphar_dxidxjdxk (double tau, double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\). More...
 
virtual double am_term (double tau, const std::vector< double > &x, std::size_t itau)
 The n-th derivative of \(a_m\) with respect to \(\tau\). More...
 
virtual double d_am_term_dxi (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, bool xN_independent)
 The first composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\). More...
 
virtual double d2_am_term_dxidxj (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\). More...
 
virtual double d3_am_term_dxidxjdxk (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\). More...
 
virtual double bm_term (const std::vector< double > &x)
 The term \(b_{\rm m}\) (mixture co-volume) More...
 
virtual double d_bm_term_dxi (const std::vector< double > &x, std::size_t i, bool xN_independent)
 The first composition derivative of \(b_m\). More...
 
virtual double d2_bm_term_dxidxj (const std::vector< double > &x, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \(b_m\). More...
 
virtual double d3_bm_term_dxidxjdxk (const std::vector< double > &x, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \(b_m\). More...
 
virtual double cm_term ()
 The term \(c_{\rm m}\) (volume translation) More...
 
void set_cm (double val)
 Set the volume translation parameter. More...
 
double get_cm ()
 Get the volume translation parameter. More...
 
virtual void set_Q_k (const size_t sgi, const double value)
 Modify the surface parameter Q_k of the sub group sgi. More...
 
virtual double get_Q_k (const size_t sgi) const
 Retrieve the surface parameter Q_k of the sub group sgi. More...
 
double aij_term (double tau, std::size_t i, std::size_t j, std::size_t itau)
 The n-th \(\tau\) derivative of \(a_{ij}(\tau)\). More...
 
double u_term (double tau, std::size_t i, std::size_t j, std::size_t itau)
 
double aii_term (double tau, std::size_t i, std::size_t itau)
 
double psi_minus (double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta)
 The term \( \psi^{(-)}\) and its \(\tau\) and \( \delta \) derivatives. More...
 
double d_psi_minus_dxi (double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, bool xN_independent)
 The third composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives. More...
 
double d2_psi_minus_dxidxj (double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives. More...
 
double d3_psi_minus_dxidxjdxk (double delta, const std::vector< double > &x, std::size_t itau, std::size_t idelta, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives. More...
 
double PI_12 (double delta, const std::vector< double > &x, std::size_t idelta)
 The term \( \Pi_{12}\) and its \( \delta \) derivatives. More...
 
double d_PI_12_dxi (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, bool xN_independent)
 The first composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives. More...
 
double d2_PI_12_dxidxj (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives. More...
 
double d3_PI_12_dxidxjdxk (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives. More...
 
double tau_times_a (double tau, const std::vector< double > &x, std::size_t itau)
 The term \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives. More...
 
double d_tau_times_a_dxi (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, bool xN_independent)
 The first composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives. More...
 
double d2_tau_times_a_dxidxj (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives. More...
 
double d3_tau_times_a_dxidxjdxk (double tau, const std::vector< double > &x, std::size_t itau, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives. More...
 
double psi_plus (double delta, const std::vector< double > &x, std::size_t idelta)
 The term \( \psi^{(+)}\) and its \( \delta \) derivatives. More...
 
double d_psi_plus_dxi (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, bool xN_independent)
 The first composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives. More...
 
double d2_psi_plus_dxidxj (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives. More...
 
double d3_psi_plus_dxidxjdxk (double delta, const std::vector< double > &x, std::size_t idelta, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives. More...
 
double c_term (const std::vector< double > &x)
 The term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d_c_term_dxi (const std::vector< double > &x, std::size_t i, bool xN_independent)
 The first composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d2_c_term_dxidxj (const std::vector< double > &x, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d3_c_term_dxidxjdxk (const std::vector< double > &x, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double A_term (double delta, const std::vector< double > &x)
 The term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d_A_term_dxi (double delta, const std::vector< double > &x, std::size_t i, bool xN_independent)
 The first composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d2_A_term_dxidxj (double delta, const std::vector< double > &x, std::size_t i, std::size_t j, bool xN_independent)
 The second composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
double d3_A_term_dxidxjdxk (double delta, const std::vector< double > &x, std::size_t i, std::size_t j, std::size_t k, bool xN_independent)
 The third composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\). More...
 
virtual void set_interaction_parameter (const std::size_t mgi1, const std::size_t mgi2, const std::string &parameter, const double value)
 
virtual double get_interaction_parameter (const std::size_t mgi1, const std::size_t mgi2, const std::string &parameter)
 

Protected Member Functions

void _ensure_aii_cache (double tau) const
 

Protected Attributes

double rho_r
 The reducing density to be used [mol/m3]. More...
 
double T_r
 The reducing temperature to be used [K]. More...
 
std::vector< double > Tc
 Vector of critical temperatures (in K) More...
 
std::vector< double > pc
 Vector of critical pressures (in Pa) More...
 
std::vector< double > acentric
 Vector of acentric factors (unitless) More...
 
double R_u
 The universal gas constant in J/(mol*K) More...
 
double Delta_1
 The first cubic constant. More...
 
double Delta_2
 The second cubic constant. More...
 
int N
 Number of components in the mixture. More...
 
std::vector< std::vector< double > > k
 The interaction parameters (k_ii = 0) More...
 
double cm
 The volume translation parameter. More...
 
std::vector< shared_ptr< AbstractCubicAlphaFunction > > alpha
 
double m_tau_cache
 Cache: aii_term values for the most recent tau. Populated lazily by _ensure_aii_cache(). More...
 
std::vector< std::array< double, 5 > > m_aii_cache
 
std::vector< unsigned long > m_alpha_versions_cache
 
std::vector< double > m_b0_ii_cache
 

Constructor & Destructor Documentation

◆ AbstractCubic()

AbstractCubic::AbstractCubic ( const std::vector< double > &  Tc,
std::vector< double >  pc,
std::vector< double >  acentric,
double  R_u,
double  Delta_1,
double  Delta_2,
const std::vector< double > &  C1 = std::vector<double>(),
const std::vector< double > &  C2 = std::vector<double>(),
const std::vector< double > &  C3 = std::vector<double>() 
)

The abstract base clase for the concrete implementations of the cubic equations of state.

This abstract base class describes the structure that must be implemented by concrete implementations of the cubic equations of state (SRK, PR, etc.). The virtual functions must be implemented by the derived classes, the remaining functions are generic and are not dependent on the equation of state, so long as it has the formulation given in this work.

Definition at line 196 of file GeneralizedCubic.cpp.

◆ ~AbstractCubic()

virtual AbstractCubic::~AbstractCubic ( )
virtualdefault

Member Function Documentation

◆ _ensure_aii_cache()

void AbstractCubic::_ensure_aii_cache ( double  tau) const
inlineprotected

Definition at line 135 of file GeneralizedCubic.h.

◆ a0_ii()

virtual double AbstractCubic::a0_ii ( std::size_t  i)
pure virtual

Get the leading constant in the expression for the pure fluid attractive energy term (must be implemented by derived classes)

Implemented in PengRobinson, and SRK.

◆ A_term()

double AbstractCubic::A_term ( double  delta,
const std::vector< double > &  x 
)
inline

The term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

\[ A = \log\left(\frac{\Delta_1\delta\rho_r b_m+1}{\Delta_2\delta\rho_r b+1}\right) \]

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions

Definition at line 619 of file GeneralizedCubic.h.

◆ aii_term()

double AbstractCubic::aii_term ( double  tau,
std::size_t  i,
std::size_t  itau 
)

Take the n-th tau derivative of the \(a_{ii}(\tau)\) pure fluid contribution

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
iThe index of the component
itauThe number of derivatives of \(u\) to take with respect to \(\tau\) (itau=0 is just a_{ij}, itau=1 is d(a_ij)/d(tau), etc.)

Definition at line 311 of file GeneralizedCubic.cpp.

◆ aij_term()

double AbstractCubic::aij_term ( double  tau,
std::size_t  i,
std::size_t  j,
std::size_t  itau 
)

The n-th \(\tau\) derivative of \(a_{ij}(\tau)\).

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
iThe first index
jThe second index
itauThe number of derivatives of \(a_{ij}\) to take with respect to \(\tau\) (itau=0 is just a_{ij}, itau=1 is d(a_ij)/d(tau), etc.)

Definition at line 344 of file GeneralizedCubic.cpp.

◆ alphar()

double AbstractCubic::alphar ( double  tau,
double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta 
)
virtual

The residual non-dimensionalized Helmholtz energy \(\alpha^r\).

Definition at line 733 of file GeneralizedCubic.cpp.

◆ am_term()

double AbstractCubic::am_term ( double  tau,
const std::vector< double > &  x,
std::size_t  itau 
)
virtual

The n-th derivative of \(a_m\) with respect to \(\tau\).

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
xThe vector of mole fractions
itauThe number of derivatives of \(a_m\) to take with respect to \(\tau\) (itau=0 is just a_m, itau=1 is d(a_m)/d(tau), etc.)

Reimplemented in VTPRCubic.

Definition at line 232 of file GeneralizedCubic.cpp.

◆ b0_ii()

virtual double AbstractCubic::b0_ii ( std::size_t  i)
pure virtual

Get the leading constant in the expression for the pure fluid covolume term (must be implemented by derived classes)

Implemented in PengRobinson, and SRK.

◆ bm_term()

double AbstractCubic::bm_term ( const std::vector< double > &  x)
virtual

The term \(b_{\rm m}\) (mixture co-volume)

Parameters
xThe vector of mole fractions

Reimplemented in VTPRCubic.

Definition at line 277 of file GeneralizedCubic.cpp.

◆ c_term()

double AbstractCubic::c_term ( const std::vector< double > &  x)
inline

The term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

\(c\) is given by

\[ c = \frac{1}{b_m} \]

Parameters
xThe vector of mole fractions

Definition at line 566 of file GeneralizedCubic.h.

◆ cm_term()

double AbstractCubic::cm_term ( )
virtual

The term \(c_{\rm m}\) (volume translation)

Definition at line 307 of file GeneralizedCubic.cpp.

◆ d2_A_term_dxidxj()

double AbstractCubic::d2_A_term_dxidxj ( double  delta,
const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)
inline

The second composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 643 of file GeneralizedCubic.h.

◆ d2_alphar_dxidxj()

double AbstractCubic::d2_alphar_dxidxj ( double  tau,
double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)
virtual

The second composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\).

Definition at line 743 of file GeneralizedCubic.cpp.

◆ d2_am_term_dxidxj()

double AbstractCubic::d2_am_term_dxidxj ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)
virtual

The second composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\).

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
xThe vector of mole fractions
itauThe number of derivatives of \(a_m\) to take with respect to \(\tau\) (itau=0 is just a_m, itau=1 is d(a_m)/d(tau), etc.)
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 262 of file GeneralizedCubic.cpp.

◆ d2_bm_term_dxidxj()

double AbstractCubic::d2_bm_term_dxidxj ( const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)
virtual

The second composition derivative of \(b_m\).

Parameters
xThe vector of mole fractions
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 300 of file GeneralizedCubic.cpp.

◆ d2_c_term_dxidxj()

double AbstractCubic::d2_c_term_dxidxj ( const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)
inline

The second composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
xThe vector of mole fractions
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 585 of file GeneralizedCubic.h.

◆ d2_PI_12_dxidxj()

double AbstractCubic::d2_PI_12_dxidxj ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)

The second composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 507 of file GeneralizedCubic.cpp.

◆ d2_psi_minus_dxidxj()

double AbstractCubic::d2_psi_minus_dxidxj ( double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)

The second composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 424 of file GeneralizedCubic.cpp.

◆ d2_psi_plus_dxidxj()

double AbstractCubic::d2_psi_plus_dxidxj ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)

The second composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 610 of file GeneralizedCubic.cpp.

◆ d2_tau_times_a_dxidxj()

double AbstractCubic::d2_tau_times_a_dxidxj ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
std::size_t  j,
bool  xN_independent 
)

The second composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives.

Parameters
tauThe reciprocal reduced temperature \(\tau = \frac{T_c}{T}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
iThe first index
jThe second index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 716 of file GeneralizedCubic.cpp.

◆ d3_A_term_dxidxjdxk()

double AbstractCubic::d3_A_term_dxidxjdxk ( double  delta,
const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)
inline

The third composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 659 of file GeneralizedCubic.h.

◆ d3_alphar_dxidxjdxk()

double AbstractCubic::d3_alphar_dxidxjdxk ( double  tau,
double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)
virtual

The third composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\).

Definition at line 752 of file GeneralizedCubic.cpp.

◆ d3_am_term_dxidxjdxk()

double AbstractCubic::d3_am_term_dxidxjdxk ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)
virtual

The third composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\).

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
xThe vector of mole fractions
itauThe number of derivatives of \(a_m\) to take with respect to \(\tau\) (itau=0 is just a_m, itau=1 is d(a_m)/d(tau), etc.)
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 272 of file GeneralizedCubic.cpp.

◆ d3_bm_term_dxidxjdxk()

double AbstractCubic::d3_bm_term_dxidxjdxk ( const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)
virtual

The third composition derivative of \(b_m\).

Parameters
xThe vector of mole fractions
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 303 of file GeneralizedCubic.cpp.

◆ d3_c_term_dxidxjdxk()

double AbstractCubic::d3_c_term_dxidxjdxk ( const std::vector< double > &  x,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)
inline

The third composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
xThe vector of mole fractions
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 598 of file GeneralizedCubic.h.

◆ d3_PI_12_dxidxjdxk()

double AbstractCubic::d3_PI_12_dxidxjdxk ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)

The third composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 533 of file GeneralizedCubic.cpp.

◆ d3_psi_minus_dxidxjdxk()

double AbstractCubic::d3_psi_minus_dxidxjdxk ( double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)

The third composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 450 of file GeneralizedCubic.cpp.

◆ d3_psi_plus_dxidxjdxk()

double AbstractCubic::d3_psi_plus_dxidxjdxk ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)

The third composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 674 of file GeneralizedCubic.cpp.

◆ d3_tau_times_a_dxidxjdxk()

double AbstractCubic::d3_tau_times_a_dxidxjdxk ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
std::size_t  j,
std::size_t  k,
bool  xN_independent 
)

The third composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives.

Parameters
tauThe reciprocal reduced temperature \(\tau = \frac{T_c}{T}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
iThe first index
jThe second index
kThe third index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 724 of file GeneralizedCubic.cpp.

◆ d_A_term_dxi()

double AbstractCubic::d_A_term_dxi ( double  delta,
const std::vector< double > &  x,
std::size_t  i,
bool  xN_independent 
)
inline

The first composition derivative of the term \(A\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 631 of file GeneralizedCubic.h.

◆ d_alphar_dxi()

double AbstractCubic::d_alphar_dxi ( double  tau,
double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
bool  xN_independent 
)
virtual

The first composition derivative of \(\alpha^r\) as well as derivatives with respect to \(\tau\) and \(\delta\).

Definition at line 736 of file GeneralizedCubic.cpp.

◆ d_am_term_dxi()

double AbstractCubic::d_am_term_dxi ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
bool  xN_independent 
)
virtual

The first composition derivative of \(a_m\) as well as derivatives with respect to \(\tau\).

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
xThe vector of mole fractions
itauThe number of derivatives of \(a_m\) to take with respect to \(\tau\) (itau=0 is just a_m, itau=1 is d(a_m)/d(tau), etc.)
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 246 of file GeneralizedCubic.cpp.

◆ d_bm_term_dxi()

double AbstractCubic::d_bm_term_dxi ( const std::vector< double > &  x,
std::size_t  i,
bool  xN_independent 
)
virtual

The first composition derivative of \(b_m\).

Parameters
xThe vector of mole fractions
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Reimplemented in VTPRCubic.

Definition at line 293 of file GeneralizedCubic.cpp.

◆ d_c_term_dxi()

double AbstractCubic::d_c_term_dxi ( const std::vector< double > &  x,
std::size_t  i,
bool  xN_independent 
)
inline

The first composition derivative of the term \(c\) used in the pure composition partial derivatives of \(\psi^{(+)}\).

Parameters
xThe vector of mole fractions
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 575 of file GeneralizedCubic.h.

◆ d_PI_12_dxi()

double AbstractCubic::d_PI_12_dxi ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
bool  xN_independent 
)

The first composition derivative of \( \Pi_{12}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 488 of file GeneralizedCubic.cpp.

◆ d_psi_minus_dxi()

double AbstractCubic::d_psi_minus_dxi ( double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta,
std::size_t  i,
bool  xN_independent 
)

The third composition derivative of \( \psi^{(-)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 402 of file GeneralizedCubic.cpp.

◆ d_psi_plus_dxi()

double AbstractCubic::d_psi_plus_dxi ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta,
std::size_t  i,
bool  xN_independent 
)

The first composition derivative of \( \psi^{(+)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 576 of file GeneralizedCubic.cpp.

◆ d_tau_times_a_dxi()

double AbstractCubic::d_tau_times_a_dxi ( double  tau,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  i,
bool  xN_independent 
)

The first composition derivative of \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives.

Parameters
tauThe reciprocal reduced temperature \(\tau = \frac{T_c}{T}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
iThe first index
xN_independentTrue if \(x_N\) is an independent variable, false otherwise (dependent on other \(N-1\) mole fractions)

Definition at line 709 of file GeneralizedCubic.cpp.

◆ get_acentric()

std::vector< double > & AbstractCubic::get_acentric ( )
inline

Get the vector of acentric factors.

Definition at line 217 of file GeneralizedCubic.h.

◆ get_all_alpha_functions()

const std::vector< shared_ptr< AbstractCubicAlphaFunction > > & AbstractCubic::get_all_alpha_functions ( )
inline

Get all the alpha functions.

Definition at line 182 of file GeneralizedCubic.h.

◆ get_alpha_function()

shared_ptr< AbstractCubicAlphaFunction > AbstractCubic::get_alpha_function ( std::size_t  i)
inline

Get the alpha function for the i-th component.

Definition at line 178 of file GeneralizedCubic.h.

◆ get_cm()

double AbstractCubic::get_cm ( )
inline

Get the volume translation parameter.

Definition at line 358 of file GeneralizedCubic.h.

◆ get_Delta_1()

double AbstractCubic::get_Delta_1 ( )
inline

Read-only accessor for value of Delta_1.

Definition at line 221 of file GeneralizedCubic.h.

◆ get_Delta_2()

double AbstractCubic::get_Delta_2 ( )
inline

Read-only accessor for value of Delta_2.

Definition at line 225 of file GeneralizedCubic.h.

◆ get_interaction_parameter()

virtual double AbstractCubic::get_interaction_parameter ( const std::size_t  mgi1,
const std::size_t  mgi2,
const std::string &  parameter 
)
inlinevirtual

Reimplemented in VTPRCubic.

Definition at line 678 of file GeneralizedCubic.h.

◆ get_kij()

double AbstractCubic::get_kij ( std::size_t  i,
std::size_t  j 
)
inline

Get the kij factor for the ij pair.

Definition at line 205 of file GeneralizedCubic.h.

◆ get_kmat()

const std::vector< std::vector< double > > & AbstractCubic::get_kmat ( )
inline

Get the entire kij matrix in one shot.

Definition at line 192 of file GeneralizedCubic.h.

◆ get_pc()

std::vector< double > & AbstractCubic::get_pc ( )
inline

Get the vector of critical pressures (in Pa)

Definition at line 213 of file GeneralizedCubic.h.

◆ get_Q_k()

virtual double AbstractCubic::get_Q_k ( const size_t  sgi) const
inlinevirtual

Retrieve the surface parameter Q_k of the sub group sgi.

Reimplemented in VTPRCubic.

Definition at line 367 of file GeneralizedCubic.h.

◆ get_R_u()

double AbstractCubic::get_R_u ( )
inline

Read-only accessor for value of R_u (universal gas constant)

Definition at line 229 of file GeneralizedCubic.h.

◆ get_rhor()

double AbstractCubic::get_rhor ( )
inline

Get the reducing density to be used.

Definition at line 249 of file GeneralizedCubic.h.

◆ get_Tc()

std::vector< double > & AbstractCubic::get_Tc ( )
inline

Get the vector of critical temperatures (in K)

Definition at line 209 of file GeneralizedCubic.h.

◆ get_Tr()

double AbstractCubic::get_Tr ( )
inline

Get the reducing temperature to be used.

Definition at line 245 of file GeneralizedCubic.h.

◆ m_ii()

virtual double AbstractCubic::m_ii ( std::size_t  i)
pure virtual

Get the m_ii variable in the alpha term inculuded in the attractive part.

Implemented in PengRobinson, and SRK.

◆ PI_12()

double AbstractCubic::PI_12 ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta 
)

The term \( \Pi_{12}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)

\[ \Pi_{12} = (1+\Delta_1\bm\rhor \delta)(1+\Delta_2\bm\rhor \delta) \]

Definition at line 470 of file GeneralizedCubic.cpp.

◆ psi_minus()

double AbstractCubic::psi_minus ( double  delta,
const std::vector< double > &  x,
std::size_t  itau,
std::size_t  idelta 
)

The term \( \psi^{(-)}\) and its \(\tau\) and \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)
ideltaHow many derivatives to take with respect to \(\delta\)

Definition at line 376 of file GeneralizedCubic.cpp.

◆ psi_plus()

double AbstractCubic::psi_plus ( double  delta,
const std::vector< double > &  x,
std::size_t  idelta 
)

The term \( \psi^{(+)}\) and its \( \delta \) derivatives.

Parameters
deltaThe reduced density \(\delta = \frac{\rho}{\rho_c}\)
xThe vector of mole fractions
ideltaHow many derivatives to take with respect to \(\delta\)

\[ \psi^{(+)} = \dfrac{\ln\left(\dfrac{\Delta_1\bm\rhor \delta+1}{\Delta_2\bm\rhor \delta+1}\right)}{\bm(\Delta_1-\Delta_2)} \]

Definition at line 553 of file GeneralizedCubic.cpp.

◆ set_all_alpha_functions()

void AbstractCubic::set_all_alpha_functions ( const std::vector< shared_ptr< AbstractCubicAlphaFunction > > &  alpha)
inline

Set all the alpha functions.

Definition at line 186 of file GeneralizedCubic.h.

◆ set_alpha()

void AbstractCubic::set_alpha ( const std::vector< double > &  C1,
const std::vector< double > &  C2,
const std::vector< double > &  C3 
)

Set the constants for the Mathias-Copeman alpha function, or if C1,C2,C3 are all empty, set the default alpha model.

Resize the vector of alpha functions

If no Mathias-Copeman coefficients are passed in (all empty vectors), use the predictive scheme for m_ii

Use the Mathias-Copeman constants passed in to initialize Mathias-Copeman alpha functions

Definition at line 215 of file GeneralizedCubic.cpp.

◆ set_alpha_function()

void AbstractCubic::set_alpha_function ( std::size_t  i,
shared_ptr< AbstractCubicAlphaFunction > &  acaf 
)
inline

Set the alpha function for the i-th component.

Definition at line 173 of file GeneralizedCubic.h.

◆ set_C_MC()

void AbstractCubic::set_C_MC ( std::size_t  i,
double  c1,
double  c2,
double  c3 
)
inline

Set the three Mathias-Copeman constants in one shot for the component i of a mixture.

Definition at line 254 of file GeneralizedCubic.h.

◆ set_C_Twu()

void AbstractCubic::set_C_Twu ( std::size_t  i,
double  L,
double  M,
double  N 
)
inline

Set the three Twu constants in one shot for the component i of a mixture.

Definition at line 259 of file GeneralizedCubic.h.

◆ set_cm()

void AbstractCubic::set_cm ( double  val)
inline

Set the volume translation parameter.

Definition at line 354 of file GeneralizedCubic.h.

◆ set_interaction_parameter()

virtual void AbstractCubic::set_interaction_parameter ( const std::size_t  mgi1,
const std::size_t  mgi2,
const std::string &  parameter,
const double  value 
)
inlinevirtual

Reimplemented in VTPRCubic.

Definition at line 674 of file GeneralizedCubic.h.

◆ set_kij()

void AbstractCubic::set_kij ( std::size_t  i,
std::size_t  j,
double  val 
)
inline

Set the kij factor for the ij pair.

Definition at line 200 of file GeneralizedCubic.h.

◆ set_kmat()

void AbstractCubic::set_kmat ( const std::vector< std::vector< double > > &  k)
inline

Set the entire kij matrix in one shot.

Definition at line 196 of file GeneralizedCubic.h.

◆ set_Q_k()

virtual void AbstractCubic::set_Q_k ( const size_t  sgi,
const double  value 
)
inlinevirtual

Modify the surface parameter Q_k of the sub group sgi.

Reimplemented in VTPRCubic.

Definition at line 363 of file GeneralizedCubic.h.

◆ set_rhor()

void AbstractCubic::set_rhor ( double  rhor)
inline

Set the reducing density to be used.

Definition at line 241 of file GeneralizedCubic.h.

◆ set_Tr()

void AbstractCubic::set_Tr ( double  Tr)
inline

Set the reducing temperature to be used.

Definition at line 233 of file GeneralizedCubic.h.

◆ tau_times_a()

double AbstractCubic::tau_times_a ( double  tau,
const std::vector< double > &  x,
std::size_t  itau 
)

The term \( \tau\cdot a_m(\tau)\) and its \( \tau \) derivatives.

Parameters
tauThe reciprocal reduced temperature \(\tau = \frac{T_c}{T}\)
xThe vector of mole fractions
itauHow many derivatives to take with respect to \(\tau\)

Definition at line 702 of file GeneralizedCubic.cpp.

◆ u_term()

double AbstractCubic::u_term ( double  tau,
std::size_t  i,
std::size_t  j,
std::size_t  itau 
)

The n-th tau derivative of \(u(\tau)\), the argument of sqrt in the cross aij term

Parameters
tauThe reciprocal reduced temperature \(\tau=T_r/T\)
iThe first index
jThe first index
itauThe number of derivatives of \(a_{ij}\) to take with respect to \(\tau\) (itau=0 is just a_{ij}, itau=1 is d(a_ij)/d(tau), etc.)

Definition at line 320 of file GeneralizedCubic.cpp.

Member Data Documentation

◆ acentric

std::vector<double> AbstractCubic::acentric
protected

Vector of acentric factors (unitless)

Definition at line 116 of file GeneralizedCubic.h.

◆ alpha

std::vector<shared_ptr<AbstractCubicAlphaFunction> > AbstractCubic::alpha
protected

The vector of alpha functions for the pure components

Definition at line 123 of file GeneralizedCubic.h.

◆ cm

double AbstractCubic::cm
protected

The volume translation parameter.

Definition at line 122 of file GeneralizedCubic.h.

◆ Delta_1

double AbstractCubic::Delta_1
protected

The first cubic constant.

Definition at line 118 of file GeneralizedCubic.h.

◆ Delta_2

double AbstractCubic::Delta_2
protected

The second cubic constant.

Definition at line 119 of file GeneralizedCubic.h.

◆ k

std::vector<std::vector<double> > AbstractCubic::k
protected

The interaction parameters (k_ii = 0)

Definition at line 121 of file GeneralizedCubic.h.

◆ m_aii_cache

std::vector<std::array<double, 5> > AbstractCubic::m_aii_cache
mutableprotected

Definition at line 126 of file GeneralizedCubic.h.

◆ m_alpha_versions_cache

std::vector<unsigned long> AbstractCubic::m_alpha_versions_cache
mutableprotected

alpha[i]->version() values recorded when m_aii_cache was last populated; used together with m_tau_cache to detect when an alpha function was mutated (e.g., via set_Tr_over_Tci()) without going through one of AbstractCubic's own cache-invalidating setters.

Definition at line 130 of file GeneralizedCubic.h.

◆ m_b0_ii_cache

std::vector<double> AbstractCubic::m_b0_ii_cache
mutableprotected

Cache: per-component covolumes b0_ii(i). These depend only on Tc, pc and R_u (fixed at construction), so they are computed once on first use; bm_term() reads them instead of re-evaluating the R_u*Tc/pc division on every call.

Definition at line 134 of file GeneralizedCubic.h.

◆ m_tau_cache

double AbstractCubic::m_tau_cache
mutableprotected

Cache: aii_term values for the most recent tau. Populated lazily by _ensure_aii_cache().

Definition at line 125 of file GeneralizedCubic.h.

◆ N

int AbstractCubic::N
protected

Number of components in the mixture.

Definition at line 120 of file GeneralizedCubic.h.

◆ pc

std::vector<double> AbstractCubic::pc
protected

Vector of critical pressures (in Pa)

Definition at line 115 of file GeneralizedCubic.h.

◆ R_u

double AbstractCubic::R_u
protected

The universal gas constant in J/(mol*K)

Definition at line 117 of file GeneralizedCubic.h.

◆ rho_r

double AbstractCubic::rho_r
protected

The reducing density to be used [mol/m3].

Definition at line 112 of file GeneralizedCubic.h.

◆ T_r

double AbstractCubic::T_r
protected

The reducing temperature to be used [K].

Definition at line 113 of file GeneralizedCubic.h.

◆ Tc

std::vector<double> AbstractCubic::Tc
protected

Vector of critical temperatures (in K)

Definition at line 114 of file GeneralizedCubic.h.


The documentation for this class was generated from the following files: