mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Implemented ideal curves at C++ level; see #654
This commit is contained in:
@@ -19,12 +19,12 @@ namespace CoolProp {
|
||||
|
||||
class GuessesStructure{
|
||||
public:
|
||||
CoolPropDbl T, p, rhomolar, hmolar, smolar;
|
||||
CoolPropDbl rhomolar_liq, rhomolar_vap;
|
||||
std::vector<CoolPropDbl> x,
|
||||
y;
|
||||
GuessesStructure() : T(_HUGE), p(_HUGE), rhomolar(_HUGE), hmolar(_HUGE), smolar(_HUGE),
|
||||
rhomolar_liq(_HUGE), rhomolar_vap(_HUGE), x(), y(){};
|
||||
CoolPropDbl T, p, rhomolar, hmolar, smolar;
|
||||
CoolPropDbl rhomolar_liq, rhomolar_vap;
|
||||
std::vector<CoolPropDbl> x,
|
||||
y;
|
||||
GuessesStructure() : T(_HUGE), p(_HUGE), rhomolar(_HUGE), hmolar(_HUGE), smolar(_HUGE),
|
||||
rhomolar_liq(_HUGE), rhomolar_vap(_HUGE), x(), y(){};
|
||||
};
|
||||
|
||||
//! The mother of all state classes
|
||||
@@ -55,13 +55,13 @@ protected:
|
||||
bool isSupercriticalPhase(void){
|
||||
return (this->_phase == iphase_supercritical || this->_phase == iphase_supercritical_liquid || this->_phase == iphase_supercritical_gas);
|
||||
}
|
||||
|
||||
|
||||
bool isHomogeneousPhase(void){
|
||||
return (this->_phase==iphase_liquid || this->_phase==iphase_gas || isSupercriticalPhase() || this->_phase == iphase_critical_point);
|
||||
return (this->_phase == iphase_liquid || this->_phase == iphase_gas || isSupercriticalPhase() || this->_phase == iphase_critical_point);
|
||||
}
|
||||
|
||||
bool isTwoPhase(void){
|
||||
return (this->_phase==iphase_twophase);
|
||||
return (this->_phase == iphase_twophase);
|
||||
}
|
||||
|
||||
/// Two important points
|
||||
@@ -93,14 +93,14 @@ protected:
|
||||
|
||||
/// Cached low-level elements for in-place calculation of other properties
|
||||
CachedElement _alpha0, _dalpha0_dTau, _dalpha0_dDelta, _d2alpha0_dTau2, _d2alpha0_dDelta_dTau,
|
||||
_d2alpha0_dDelta2, _d3alpha0_dTau3, _d3alpha0_dDelta_dTau2, _d3alpha0_dDelta2_dTau,
|
||||
_d3alpha0_dDelta3, _alphar, _dalphar_dTau, _dalphar_dDelta, _d2alphar_dTau2, _d2alphar_dDelta_dTau,
|
||||
_d2alphar_dDelta2, _d3alphar_dTau3, _d3alphar_dDelta_dTau2, _d3alphar_dDelta2_dTau,
|
||||
_d3alphar_dDelta3, _d4alphar_dTau4, _d4alphar_dDelta_dTau3, _d4alphar_dDelta2_dTau2,
|
||||
_d4alphar_dDelta3_dTau, _d4alphar_dDelta4;
|
||||
_d2alpha0_dDelta2, _d3alpha0_dTau3, _d3alpha0_dDelta_dTau2, _d3alpha0_dDelta2_dTau,
|
||||
_d3alpha0_dDelta3, _alphar, _dalphar_dTau, _dalphar_dDelta, _d2alphar_dTau2, _d2alphar_dDelta_dTau,
|
||||
_d2alphar_dDelta2, _d3alphar_dTau3, _d3alphar_dDelta_dTau2, _d3alphar_dDelta2_dTau,
|
||||
_d3alphar_dDelta3, _d4alphar_dTau4, _d4alphar_dDelta_dTau3, _d4alphar_dDelta2_dTau2,
|
||||
_d4alphar_dDelta3_dTau, _d4alphar_dDelta4;
|
||||
|
||||
CachedElement _dalphar_dDelta_lim, _d2alphar_dDelta2_lim,
|
||||
_d2alphar_dDelta_dTau_lim, _d3alphar_dDelta2_dTau_lim;
|
||||
_d2alphar_dDelta_dTau_lim, _d3alphar_dDelta2_dTau_lim;
|
||||
|
||||
/// Two-Phase variables
|
||||
CachedElement _rhoLmolar, _rhoVmolar;
|
||||
@@ -110,122 +110,122 @@ protected:
|
||||
// for properties that are not always calculated
|
||||
// ----------------------------------------
|
||||
/// Using this backend, calculate the molar enthalpy in J/mol
|
||||
virtual CoolPropDbl calc_hmolar(void){throw NotImplementedError("calc_hmolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_hmolar(void){ throw NotImplementedError("calc_hmolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar entropy in J/mol/K
|
||||
virtual CoolPropDbl calc_smolar(void){throw NotImplementedError("calc_smolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_smolar(void){ throw NotImplementedError("calc_smolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar internal energy in J/mol
|
||||
virtual CoolPropDbl calc_umolar(void){throw NotImplementedError("calc_umolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_umolar(void){ throw NotImplementedError("calc_umolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar constant-pressure specific heat in J/mol/K
|
||||
virtual CoolPropDbl calc_cpmolar(void){throw NotImplementedError("calc_cpmolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_cpmolar(void){ throw NotImplementedError("calc_cpmolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal gas molar constant-pressure specific heat in J/mol/K
|
||||
virtual CoolPropDbl calc_cpmolar_idealgas(void){throw NotImplementedError("calc_cpmolar_idealgas is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_cpmolar_idealgas(void){ throw NotImplementedError("calc_cpmolar_idealgas is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar constant-volume specific heat in J/mol/K
|
||||
virtual CoolPropDbl calc_cvmolar(void){throw NotImplementedError("calc_cvmolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_cvmolar(void){ throw NotImplementedError("calc_cvmolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar Gibbs function in J/mol
|
||||
virtual CoolPropDbl calc_gibbsmolar(void){throw NotImplementedError("calc_gibbsmolar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_gibbsmolar(void){ throw NotImplementedError("calc_gibbsmolar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the speed of sound in m/s
|
||||
virtual CoolPropDbl calc_speed_sound(void){throw NotImplementedError("calc_speed_sound is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_speed_sound(void){ throw NotImplementedError("calc_speed_sound is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the isothermal compressibility \f$ \kappa = -\frac{1}{v}\left.\frac{\partial v}{\partial p}\right|_T=\frac{1}{\rho}\left.\frac{\partial \rho}{\partial p}\right|_T\f$ in 1/Pa
|
||||
virtual CoolPropDbl calc_isothermal_compressibility(void){throw NotImplementedError("calc_isothermal_compressibility is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_isothermal_compressibility(void){ throw NotImplementedError("calc_isothermal_compressibility is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the isobaric expansion coefficient \f$ \beta = \frac{1}{v}\left.\frac{\partial v}{\partial T}\right|_p = -\frac{1}{\rho}\left.\frac{\partial \rho}{\partial T}\right|_p\f$ in 1/K
|
||||
virtual CoolPropDbl calc_isobaric_expansion_coefficient(void){throw NotImplementedError("calc_isobaric_expansion_coefficient is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_isobaric_expansion_coefficient(void){ throw NotImplementedError("calc_isobaric_expansion_coefficient is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the viscosity in Pa-s
|
||||
virtual CoolPropDbl calc_viscosity(void){throw NotImplementedError("calc_viscosity is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_viscosity(void){ throw NotImplementedError("calc_viscosity is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the thermal conductivity in W/m/K
|
||||
virtual CoolPropDbl calc_conductivity(void){throw NotImplementedError("calc_conductivity is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_conductivity(void){ throw NotImplementedError("calc_conductivity is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the surface tension in N/m
|
||||
virtual CoolPropDbl calc_surface_tension(void){throw NotImplementedError("calc_surface_tension is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_surface_tension(void){ throw NotImplementedError("calc_surface_tension is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the molar mass in kg/mol
|
||||
virtual CoolPropDbl calc_molar_mass(void){throw NotImplementedError("calc_molar_mass is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_molar_mass(void){ throw NotImplementedError("calc_molar_mass is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the acentric factor
|
||||
virtual CoolPropDbl calc_acentric_factor(void){throw NotImplementedError("calc_acentric_factor is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_acentric_factor(void){ throw NotImplementedError("calc_acentric_factor is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the pressure in Pa
|
||||
virtual CoolPropDbl calc_pressure(void){throw NotImplementedError("calc_pressure is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_pressure(void){ throw NotImplementedError("calc_pressure is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the universal gas constant \f$R_u\f$ in J/mol/K
|
||||
virtual CoolPropDbl calc_gas_constant(void){throw NotImplementedError("calc_gas_constant is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_gas_constant(void){ throw NotImplementedError("calc_gas_constant is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the fugacity coefficient (dimensionless)
|
||||
virtual CoolPropDbl calc_fugacity_coefficient(int i){throw NotImplementedError("calc_fugacity_coefficient is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_fugacity_coefficient(int i){ throw NotImplementedError("calc_fugacity_coefficient is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the phase identification parameter (PIP)
|
||||
virtual CoolPropDbl calc_PIP(void){throw NotImplementedError("calc_PIP is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_PIP(void){ throw NotImplementedError("calc_PIP is not implemented for this backend"); };
|
||||
|
||||
// Derivatives of residual helmholtz energy
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_alphar(void){throw NotImplementedError("calc_alphar is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_alphar(void){ throw NotImplementedError("calc_alphar is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_dalphar_dDelta(void){throw NotImplementedError("calc_dalphar_dDelta is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dalphar_dDelta(void){ throw NotImplementedError("calc_dalphar_dDelta is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_dalphar_dTau(void){throw NotImplementedError("calc_dalphar_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dalphar_dTau(void){ throw NotImplementedError("calc_dalphar_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alphar_dDelta2(void){throw NotImplementedError("calc_d2alphar_dDelta2 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alphar_dDelta2(void){ throw NotImplementedError("calc_d2alphar_dDelta2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alphar_dDelta_dTau(void){throw NotImplementedError("calc_d2alphar_dDelta_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alphar_dDelta_dTau(void){ throw NotImplementedError("calc_d2alphar_dDelta_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alphar_dTau2(void){throw NotImplementedError("calc_d2alphar_dTau2 is not implemented for this backend");};
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta3(void){throw NotImplementedError("calc_d3alphar_dDelta3 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alphar_dTau2(void){ throw NotImplementedError("calc_d2alphar_dTau2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta3(void){ throw NotImplementedError("calc_d3alphar_dDelta3 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta2_dTau(void){throw NotImplementedError("calc_d3alphar_dDelta2_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta2_dTau(void){ throw NotImplementedError("calc_d3alphar_dDelta2_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta_dTau2(void){throw NotImplementedError("calc_d3alphar_dDelta_dTau2 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alphar_dDelta_dTau2(void){ throw NotImplementedError("calc_d3alphar_dDelta_dTau2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\tau\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alphar_dTau3(void){throw NotImplementedError("calc_d3alphar_dTau3 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alphar_dTau3(void){ throw NotImplementedError("calc_d3alphar_dTau3 is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta4(void){throw NotImplementedError("calc_d4alphar_dDelta4 is not implemented for this backend");};
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta4(void){ throw NotImplementedError("calc_d4alphar_dDelta4 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\delta\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta3_dTau(void){throw NotImplementedError("calc_d4alphar_dDelta3_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta3_dTau(void){ throw NotImplementedError("calc_d4alphar_dDelta3_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\delta\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta2_dTau2(void){throw NotImplementedError("calc_d4alphar_dDelta2_dTau2 is not implemented for this backend");};
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\tau\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta_dTau3(void){throw NotImplementedError("calc_d4alphar_dDelta_dTau3 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta2_dTau2(void){ throw NotImplementedError("calc_d4alphar_dDelta2_dTau2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\delta\tau\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dDelta_dTau3(void){ throw NotImplementedError("calc_d4alphar_dDelta_dTau3 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the residual Helmholtz energy term \f$\alpha^r_{\tau\tau\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d4alphar_dTau4(void){throw NotImplementedError("calc_d4alphar_dTau4 is not implemented for this backend");};
|
||||
|
||||
virtual CoolPropDbl calc_d4alphar_dTau4(void){ throw NotImplementedError("calc_d4alphar_dTau4 is not implemented for this backend"); };
|
||||
|
||||
// Derivatives of ideal-gas helmholtz energy
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_alpha0(void){throw NotImplementedError("calc_alpha0 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_alpha0(void){ throw NotImplementedError("calc_alpha0 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_dalpha0_dDelta(void){throw NotImplementedError("calc_dalpha0_dDelta is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dalpha0_dDelta(void){ throw NotImplementedError("calc_dalpha0_dDelta is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_dalpha0_dTau(void){throw NotImplementedError("calc_dalpha0_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dalpha0_dTau(void){ throw NotImplementedError("calc_dalpha0_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alpha0_dDelta_dTau(void){throw NotImplementedError("calc_d2alpha0_dDelta_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alpha0_dDelta_dTau(void){ throw NotImplementedError("calc_d2alpha0_dDelta_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alpha0_dDelta2(void){throw NotImplementedError("calc_d2alpha0_dDelta2 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alpha0_dDelta2(void){ throw NotImplementedError("calc_d2alpha0_dDelta2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d2alpha0_dTau2(void){throw NotImplementedError("calc_d2alpha0_dTau2 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d2alpha0_dTau2(void){ throw NotImplementedError("calc_d2alpha0_dTau2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta\delta\delta}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta3(void){throw NotImplementedError("calc_d3alpha0_dDelta3 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta3(void){ throw NotImplementedError("calc_d3alpha0_dDelta3 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta\delta\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta2_dTau(void){throw NotImplementedError("calc_d3alpha0_dDelta2_dTau is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta2_dTau(void){ throw NotImplementedError("calc_d3alpha0_dDelta2_dTau is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\delta\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta_dTau2(void){throw NotImplementedError("calc_d3alpha0_dDelta_dTau2 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alpha0_dDelta_dTau2(void){ throw NotImplementedError("calc_d3alpha0_dDelta_dTau2 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ideal-gas Helmholtz energy term \f$\alpha^0_{\tau\tau\tau}\f$ (dimensionless)
|
||||
virtual CoolPropDbl calc_d3alpha0_dTau3(void){throw NotImplementedError("calc_d3alpha0_dTau3 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_d3alpha0_dTau3(void){ throw NotImplementedError("calc_d3alpha0_dTau3 is not implemented for this backend"); };
|
||||
|
||||
virtual void calc_reducing_state(void){throw NotImplementedError("calc_reducing_state is not implemented for this backend");};
|
||||
virtual void calc_reducing_state(void){ throw NotImplementedError("calc_reducing_state is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, calculate the maximum temperature in K
|
||||
virtual CoolPropDbl calc_Tmax(void){throw NotImplementedError("calc_Tmax is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_Tmax(void){ throw NotImplementedError("calc_Tmax is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the minimum temperature in K
|
||||
virtual CoolPropDbl calc_Tmin(void){throw NotImplementedError("calc_Tmin is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_Tmin(void){ throw NotImplementedError("calc_Tmin is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the maximum pressure in Pa
|
||||
virtual CoolPropDbl calc_pmax(void){throw NotImplementedError("calc_pmax is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_pmax(void){ throw NotImplementedError("calc_pmax is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, calculate the 20-year global warming potential (GWP)
|
||||
virtual CoolPropDbl calc_GWP20(void){throw NotImplementedError("calc_GWP20 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_GWP20(void){ throw NotImplementedError("calc_GWP20 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the 100-year global warming potential (GWP)
|
||||
virtual CoolPropDbl calc_GWP100(void){throw NotImplementedError("calc_GWP100 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_GWP100(void){ throw NotImplementedError("calc_GWP100 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the 500-year global warming potential (GWP)
|
||||
virtual CoolPropDbl calc_GWP500(void){throw NotImplementedError("calc_GWP500 is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_GWP500(void){ throw NotImplementedError("calc_GWP500 is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the ozone depletion potential (ODP)
|
||||
virtual CoolPropDbl calc_ODP(void){throw NotImplementedError("calc_ODP is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_ODP(void){ throw NotImplementedError("calc_ODP is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the flame hazard
|
||||
virtual CoolPropDbl calc_flame_hazard(void){throw NotImplementedError("calc_flame_hazard is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_flame_hazard(void){ throw NotImplementedError("calc_flame_hazard is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the health hazard
|
||||
virtual CoolPropDbl calc_health_hazard(void){throw NotImplementedError("calc_health_hazard is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_health_hazard(void){ throw NotImplementedError("calc_health_hazard is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the physical hazard
|
||||
virtual CoolPropDbl calc_physical_hazard(void){throw NotImplementedError("calc_physical_hazard is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_physical_hazard(void){ throw NotImplementedError("calc_physical_hazard is not implemented for this backend"); };
|
||||
|
||||
/// Calculate the first partial derivative for the desired derivative
|
||||
virtual CoolPropDbl calc_first_partial_deriv(parameters Of, parameters Wrt, parameters Constant);
|
||||
@@ -233,142 +233,141 @@ protected:
|
||||
virtual CoolPropDbl calc_second_partial_deriv(parameters Of1, parameters Wrt1, parameters Constant1, parameters Of2, parameters Constant2);
|
||||
|
||||
/// Using this backend, calculate the reduced density (rho/rhoc)
|
||||
virtual CoolPropDbl calc_reduced_density(void){throw NotImplementedError("calc_reduced_density is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_reduced_density(void){ throw NotImplementedError("calc_reduced_density is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the reciprocal reduced temperature (Tc/T)
|
||||
virtual CoolPropDbl calc_reciprocal_reduced_temperature(void){throw NotImplementedError("calc_reciprocal_reduced_temperature is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_reciprocal_reduced_temperature(void){ throw NotImplementedError("calc_reciprocal_reduced_temperature is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, calculate the second virial coefficient
|
||||
virtual CoolPropDbl calc_Bvirial(void){throw NotImplementedError("calc_Bvirial is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_Bvirial(void){ throw NotImplementedError("calc_Bvirial is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the third virial coefficient
|
||||
virtual CoolPropDbl calc_Cvirial(void){throw NotImplementedError("calc_Cvirial is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_Cvirial(void){ throw NotImplementedError("calc_Cvirial is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the derivative dB/dT
|
||||
virtual CoolPropDbl calc_dBvirial_dT(void){throw NotImplementedError("calc_dBvirial_dT is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dBvirial_dT(void){ throw NotImplementedError("calc_dBvirial_dT is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the derivative dC/dT
|
||||
virtual CoolPropDbl calc_dCvirial_dT(void){throw NotImplementedError("calc_dCvirial_dT is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_dCvirial_dT(void){ throw NotImplementedError("calc_dCvirial_dT is not implemented for this backend"); };
|
||||
/// Using this backend, calculate the compressibility factor Z \f$ Z = p/(\rho R T) \f$
|
||||
virtual CoolPropDbl calc_compressibility_factor(void){throw NotImplementedError("calc_compressibility_factor is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_compressibility_factor(void){ throw NotImplementedError("calc_compressibility_factor is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, get the name of the fluid
|
||||
virtual std::string calc_name(void){throw NotImplementedError("calc_name is not implemented for this backend");};
|
||||
virtual std::string calc_name(void){ throw NotImplementedError("calc_name is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, get the triple point temperature in K
|
||||
virtual CoolPropDbl calc_Ttriple(void){throw NotImplementedError("calc_Ttriple is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_Ttriple(void){ throw NotImplementedError("calc_Ttriple is not implemented for this backend"); };
|
||||
/// Using this backend, get the triple point pressure in Pa
|
||||
virtual CoolPropDbl calc_p_triple(void){throw NotImplementedError("calc_p_triple is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_p_triple(void){ throw NotImplementedError("calc_p_triple is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, get the critical point temperature in K
|
||||
virtual CoolPropDbl calc_T_critical(void){throw NotImplementedError("calc_T_critical is not implemented for this backend");};
|
||||
/// Using this backend, get the reducing point temperature in K
|
||||
virtual CoolPropDbl calc_T_reducing(void){throw NotImplementedError("calc_T_reducing is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_T_critical(void){ throw NotImplementedError("calc_T_critical is not implemented for this backend"); };
|
||||
/// Using this backend, get the reducing point temperature in K
|
||||
virtual CoolPropDbl calc_T_reducing(void){ throw NotImplementedError("calc_T_reducing is not implemented for this backend"); };
|
||||
/// Using this backend, get the critical point pressure in Pa
|
||||
virtual CoolPropDbl calc_p_critical(void){throw NotImplementedError("calc_p_critical is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_p_critical(void){ throw NotImplementedError("calc_p_critical is not implemented for this backend"); };
|
||||
/// Using this backend, get the reducing point pressure in Pa
|
||||
virtual CoolPropDbl calc_p_reducing(void){throw NotImplementedError("calc_p_reducing is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_p_reducing(void){ throw NotImplementedError("calc_p_reducing is not implemented for this backend"); };
|
||||
/// Using this backend, get the critical point molar density in mol/m^3
|
||||
virtual CoolPropDbl calc_rhomolar_critical(void){throw NotImplementedError("calc_rhomolar_critical is not implemented for this backend");};
|
||||
/// Using this backend, get the reducing point molar density in mol/m^3
|
||||
virtual CoolPropDbl calc_rhomolar_reducing(void){throw NotImplementedError("calc_rhomolar_reducing is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_rhomolar_critical(void){ throw NotImplementedError("calc_rhomolar_critical is not implemented for this backend"); };
|
||||
/// Using this backend, get the reducing point molar density in mol/m^3
|
||||
virtual CoolPropDbl calc_rhomolar_reducing(void){ throw NotImplementedError("calc_rhomolar_reducing is not implemented for this backend"); };
|
||||
/// Using this backend, construct the phase envelope, the variable type describes the type of phase envelope to be built.
|
||||
virtual void calc_phase_envelope(const std::string &type){throw NotImplementedError("calc_phase_envelope is not implemented for this backend");};
|
||||
virtual void calc_phase_envelope(const std::string &type){ throw NotImplementedError("calc_phase_envelope is not implemented for this backend"); };
|
||||
///
|
||||
virtual CoolPropDbl calc_rhomass(void){return rhomolar()*molar_mass();}
|
||||
virtual CoolPropDbl calc_hmass(void){return hmolar()/molar_mass();}
|
||||
virtual CoolPropDbl calc_smass(void){return smolar()/molar_mass();}
|
||||
virtual CoolPropDbl calc_cpmass(void){return cpmolar()/molar_mass();}
|
||||
virtual CoolPropDbl calc_cp0mass(void){return cp0molar()/molar_mass();}
|
||||
virtual CoolPropDbl calc_cvmass(void){return cvmolar()/molar_mass();}
|
||||
virtual CoolPropDbl calc_umass(void){return umolar()/molar_mass();}
|
||||
|
||||
virtual CoolPropDbl calc_rhomass(void){ return rhomolar()*molar_mass(); }
|
||||
virtual CoolPropDbl calc_hmass(void){ return hmolar() / molar_mass(); }
|
||||
virtual CoolPropDbl calc_smass(void){ return smolar() / molar_mass(); }
|
||||
virtual CoolPropDbl calc_cpmass(void){ return cpmolar() / molar_mass(); }
|
||||
virtual CoolPropDbl calc_cp0mass(void){ return cp0molar() / molar_mass(); }
|
||||
virtual CoolPropDbl calc_cvmass(void){ return cvmolar() / molar_mass(); }
|
||||
virtual CoolPropDbl calc_umass(void){ return umolar() / molar_mass(); }
|
||||
|
||||
/// Update the states after having changed the reference state for enthalpy and entropy
|
||||
virtual void update_states(void){throw NotImplementedError("This backend does not implement update_states function");};
|
||||
|
||||
virtual CoolPropDbl calc_melting_line(int param, int given, CoolPropDbl value){throw NotImplementedError("This backend does not implement calc_melting_line function");};
|
||||
|
||||
virtual void update_states(void){ throw NotImplementedError("This backend does not implement update_states function"); };
|
||||
|
||||
virtual CoolPropDbl calc_melting_line(int param, int given, CoolPropDbl value){ throw NotImplementedError("This backend does not implement calc_melting_line function"); };
|
||||
|
||||
/// @param param The key for the parameter to be returned
|
||||
/// @param Q The quality for the parameter that is given (0 = saturated liquid, 1 = saturated vapor)
|
||||
/// @param given The key for the parameter that is given
|
||||
/// @param value The value for the parameter that is given
|
||||
virtual CoolPropDbl calc_saturation_ancillary(parameters param, int Q, parameters given, double value){throw NotImplementedError("This backend does not implement calc_saturation_ancillary");};
|
||||
|
||||
virtual CoolPropDbl calc_saturation_ancillary(parameters param, int Q, parameters given, double value){ throw NotImplementedError("This backend does not implement calc_saturation_ancillary"); };
|
||||
|
||||
/// Using this backend, calculate the phase
|
||||
virtual phases calc_phase(void){throw NotImplementedError("This backend does not implement calc_phase function");};
|
||||
virtual phases calc_phase(void){ throw NotImplementedError("This backend does not implement calc_phase function"); };
|
||||
/// Using this backend, specify the phase to be used for all further calculations
|
||||
virtual void calc_specify_phase(phases phase){throw NotImplementedError("This backend does not implement calc_specify_phase function");};
|
||||
virtual void calc_specify_phase(phases phase){ throw NotImplementedError("This backend does not implement calc_specify_phase function"); };
|
||||
/// Using this backend, unspecify the phase
|
||||
virtual void calc_unspecify_phase(void){throw NotImplementedError("This backend does not implement calc_unspecify_phase function");};
|
||||
virtual void calc_unspecify_phase(void){ throw NotImplementedError("This backend does not implement calc_unspecify_phase function"); };
|
||||
/// Using this backend, get a vector of fluid names
|
||||
virtual std::vector<std::string> calc_fluid_names(void){throw NotImplementedError("This backend does not implement calc_fluid_names function");};
|
||||
virtual std::vector<std::string> calc_fluid_names(void){ throw NotImplementedError("This backend does not implement calc_fluid_names function"); };
|
||||
/// Using this backend, calculate a phase given by the state string
|
||||
/// @param state A string that describes the state desired, one of "hs_anchor", "critical"/"crit", "reducing"
|
||||
virtual const CoolProp::SimpleState & calc_state(const std::string &state){throw NotImplementedError("calc_state is not implemented for this backend");};
|
||||
|
||||
virtual const CoolProp::PhaseEnvelopeData & calc_phase_envelope_data(void){throw NotImplementedError("calc_phase_envelope_data is not implemented for this backend");};
|
||||
|
||||
virtual std::vector<CoolPropDbl> calc_mole_fractions_liquid(void){throw NotImplementedError("calc_mole_fractions_liquid is not implemented for this backend");};
|
||||
virtual std::vector<CoolPropDbl> calc_mole_fractions_vapor(void){throw NotImplementedError("calc_mole_fractions_vapor is not implemented for this backend");};
|
||||
virtual const CoolProp::SimpleState & calc_state(const std::string &state){ throw NotImplementedError("calc_state is not implemented for this backend"); };
|
||||
|
||||
virtual const CoolProp::PhaseEnvelopeData & calc_phase_envelope_data(void){ throw NotImplementedError("calc_phase_envelope_data is not implemented for this backend"); };
|
||||
|
||||
virtual std::vector<CoolPropDbl> calc_mole_fractions_liquid(void){ throw NotImplementedError("calc_mole_fractions_liquid is not implemented for this backend"); };
|
||||
virtual std::vector<CoolPropDbl> calc_mole_fractions_vapor(void){ throw NotImplementedError("calc_mole_fractions_vapor is not implemented for this backend"); };
|
||||
|
||||
/// Get the minimum fraction (mole, mass, volume) for incompressible fluid
|
||||
virtual CoolPropDbl calc_fraction_min(void){throw NotImplementedError("calc_fraction_min is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_fraction_min(void){ throw NotImplementedError("calc_fraction_min is not implemented for this backend"); };
|
||||
/// Get the maximum fraction (mole, mass, volume) for incompressible fluid
|
||||
virtual CoolPropDbl calc_fraction_max(void){throw NotImplementedError("calc_fraction_max is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_T_freeze(void){throw NotImplementedError("calc_T_freeze is not implemented for this backend");};
|
||||
|
||||
virtual CoolPropDbl calc_first_saturation_deriv(parameters Of1, parameters Wrt1){throw NotImplementedError("calc_first_saturation_deriv is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_second_saturation_deriv(parameters Of1, parameters Wrt1, parameters Of2, parameters Wrt2){throw NotImplementedError("calc_second_saturation_deriv is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_first_two_phase_deriv(parameters Of, parameters Wrt, parameters Constant){throw NotImplementedError("calc_first_two_phase_deriv is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_second_two_phase_deriv(parameters Of, parameters Wrt, parameters Constant, parameters Wrt2, parameters Constant2){throw NotImplementedError("calc_second_two_phase_deriv is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_first_two_phase_deriv_splined(parameters Of, parameters Wrt, parameters Constant, CoolPropDbl x_end){throw NotImplementedError("calc_first_two_phase_deriv_splined is not implemented for this backend");};
|
||||
|
||||
virtual CoolPropDbl calc_saturated_liquid_keyed_output(parameters key){throw NotImplementedError("calc_saturated_liquid_keyed_output is not implemented for this backend");};
|
||||
virtual CoolPropDbl calc_saturated_vapor_keyed_output(parameters key){throw NotImplementedError("calc_saturated_vapor_keyed_output is not implemented for this backend");};
|
||||
|
||||
virtual CoolPropDbl calc_fraction_max(void){ throw NotImplementedError("calc_fraction_max is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_T_freeze(void){ throw NotImplementedError("calc_T_freeze is not implemented for this backend"); };
|
||||
|
||||
virtual CoolPropDbl calc_first_saturation_deriv(parameters Of1, parameters Wrt1){ throw NotImplementedError("calc_first_saturation_deriv is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_second_saturation_deriv(parameters Of1, parameters Wrt1, parameters Of2, parameters Wrt2){ throw NotImplementedError("calc_second_saturation_deriv is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_first_two_phase_deriv(parameters Of, parameters Wrt, parameters Constant){ throw NotImplementedError("calc_first_two_phase_deriv is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_second_two_phase_deriv(parameters Of, parameters Wrt, parameters Constant, parameters Wrt2, parameters Constant2){ throw NotImplementedError("calc_second_two_phase_deriv is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_first_two_phase_deriv_splined(parameters Of, parameters Wrt, parameters Constant, CoolPropDbl x_end){ throw NotImplementedError("calc_first_two_phase_deriv_splined is not implemented for this backend"); };
|
||||
|
||||
virtual CoolPropDbl calc_saturated_liquid_keyed_output(parameters key){ throw NotImplementedError("calc_saturated_liquid_keyed_output is not implemented for this backend"); };
|
||||
virtual CoolPropDbl calc_saturated_vapor_keyed_output(parameters key){ throw NotImplementedError("calc_saturated_vapor_keyed_output is not implemented for this backend"); };
|
||||
virtual void calc_ideal_curve(const std::string &type, std::vector<double> &T, std::vector<double> &p){ throw NotImplementedError("calc_ideal_curve is not implemented for this backend"); };
|
||||
|
||||
/// Using this backend, get the temperature
|
||||
virtual long double calc_T(void){return _T;}
|
||||
virtual long double calc_T(void){ return _T; }
|
||||
/// Using this backend, get the molar density in mol/m^3
|
||||
virtual long double calc_rhomolar(void){return _rhomolar;}
|
||||
virtual long double calc_rhomolar(void){ return _rhomolar; }
|
||||
|
||||
/// Using this backend, return true critical point where dp/drho|T = 0 and d2p/drho^2|T = 0
|
||||
virtual void calc_true_critical_point(double &T, double &rho){throw NotImplementedError("calc_true_critical_point is not implemented for this backend");};
|
||||
|
||||
|
||||
virtual void calc_true_critical_point(double &T, double &rho){ throw NotImplementedError("calc_true_critical_point is not implemented for this backend"); };
|
||||
public:
|
||||
|
||||
AbstractState():_fluid_type(FLUID_TYPE_UNDEFINED),_phase(iphase_unknown),_rhospline(-_HUGE),_dsplinedp(-_HUGE),_dsplinedh(-_HUGE){clear();}
|
||||
AbstractState() :_fluid_type(FLUID_TYPE_UNDEFINED), _phase(iphase_unknown), _rhospline(-_HUGE), _dsplinedp(-_HUGE), _dsplinedh(-_HUGE){ clear(); }
|
||||
virtual ~AbstractState(){};
|
||||
|
||||
/// A factory function to return a pointer to a new-allocated instance of one of the backends.
|
||||
/**
|
||||
* @brief This is a convenience function to allow for the use of '&' delimited fluid names. Slightly less computationally efficient than the
|
||||
* @brief This is a convenience function to allow for the use of '&' delimited fluid names. Slightly less computationally efficient than the
|
||||
* @param backend The backend in use, one of "HEOS", "REFPROP", etc.
|
||||
* @param fluid_names Fluid names as a '&' delimited string
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
static AbstractState * factory(const std::string &backend, const std::string &fluid_names)
|
||||
{
|
||||
return factory(backend, strsplit(fluid_names, '&'));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief A factory function to return a pointer to a new-allocated instance of one of the backends.
|
||||
* @param backend The backend in use, "HEOS", "REFPROP", etc.
|
||||
* @param fluid_names A vector of strings of the fluid names
|
||||
* @return A pointer to the instance generated
|
||||
*
|
||||
*
|
||||
* Several backends are possible:
|
||||
*
|
||||
*
|
||||
* 1. "?" : The backend is unknown, we will parse the fluid string to determine the backend to be used. Probably will use HEOS backend (see below)
|
||||
* 2. "HEOS" : The Helmholtz Equation of State backend for use with pure and pseudo-pure fluids, and mixtures, all of which are based on multi-parameter Helmholtz Energy equations of state. The fluid part of the string should then either be
|
||||
* 1. A pure or pseudo-pure fluid name (eg. "PROPANE" or "R410A"), yielding a HelmholtzEOSBackend instance.
|
||||
* 2. A string that encodes the components of the mixture with a "&" between them (e.g. "R32&R125"), yielding a HelmholtzEOSMixtureBackend instance.
|
||||
*
|
||||
*
|
||||
* 3. "REFPROP" : The REFPROP backend will be used. The fluid part of the string should then either be
|
||||
* 1. A pure or pseudo-pure fluid name (eg. "PROPANE" or "R410A"), yielding a REFPROPBackend instance.
|
||||
* 2. A string that encodes the components of the mixture with a "&" between them (e.g. "R32&R125"), yielding a REFPROPMixtureBackend instance.
|
||||
*
|
||||
*
|
||||
* 4. "INCOMP": The incompressible backend will be used
|
||||
* 5. "TTSE&XXXX": The TTSE backend will be used, and the tables will be generated using the XXXX backend where XXXX is one of the base backends("HEOS", "REFPROP", etc. )
|
||||
* 6. "BICUBIC&XXXX": The Bicubic backend will be used, and the tables will be generated using the XXXX backend where XXXX is one of the base backends("HEOS", "REFPROP", etc. )
|
||||
*
|
||||
*
|
||||
* Very Important!! : Use a smart pointer to manage the pointer returned. In older versions of C++, you can use std::tr1::smart_ptr. In C++2011 you can use std::shared_ptr
|
||||
*/
|
||||
static AbstractState * factory(const std::string &backend, const std::vector<std::string> &fluid_names);
|
||||
@@ -380,48 +379,48 @@ public:
|
||||
virtual bool using_mass_fractions(void) = 0;
|
||||
virtual bool using_volu_fractions(void) = 0;
|
||||
|
||||
/// Update the state using two state variables
|
||||
/// Update the state using two state variables
|
||||
virtual void update(CoolProp::input_pairs input_pair, double Value1, double Value2) = 0;
|
||||
|
||||
/// Update the state using two state variables and providing guess values
|
||||
/// Some or all of the guesses will be used
|
||||
virtual void update_with_guesses(CoolProp::input_pairs input_pair, double Value1, double Value2, const GuessesStructure &guesses){throw NotImplementedError("update_with_guesses is not implemented for this backend");};
|
||||
/// Update the state using two state variables and providing guess values
|
||||
/// Some or all of the guesses will be used
|
||||
virtual void update_with_guesses(CoolProp::input_pairs input_pair, double Value1, double Value2, const GuessesStructure &guesses){ throw NotImplementedError("update_with_guesses is not implemented for this backend"); };
|
||||
|
||||
virtual void set_mole_fractions(const std::vector<CoolPropDbl> &mole_fractions) = 0;
|
||||
virtual void set_mass_fractions(const std::vector<CoolPropDbl> &mass_fractions) = 0;
|
||||
virtual void set_volu_fractions(const std::vector<CoolPropDbl> &mass_fractions){throw NotImplementedError("Volume composition has not been implemented.");}
|
||||
virtual void set_volu_fractions(const std::vector<CoolPropDbl> &mass_fractions){ throw NotImplementedError("Volume composition has not been implemented."); }
|
||||
/// Get the mole fractions of the components
|
||||
virtual const std::vector<CoolPropDbl> & get_mole_fractions(void) = 0;
|
||||
|
||||
/// A function that says whether the backend instance can be instantiated in the high-level interface
|
||||
/// In general this should be true, except for some other backends (especially the tabular backend)
|
||||
/// Should be overloaded in derived classes to make this not possible by returning false
|
||||
virtual bool available_in_high_level(void){return true;}
|
||||
|
||||
std::vector<std::string> fluid_names(void);
|
||||
|
||||
virtual bool available_in_high_level(void){ return true; }
|
||||
|
||||
std::vector<std::string> fluid_names(void);
|
||||
|
||||
/// Clear all the cached values
|
||||
bool clear();
|
||||
|
||||
void set_mole_fractions(const std::vector<double> &mole_fractions){set_mole_fractions(std::vector<CoolPropDbl>(mole_fractions.begin(), mole_fractions.end()));};
|
||||
void set_mass_fractions(const std::vector<double> &mass_fractions){set_mass_fractions(std::vector<CoolPropDbl>(mass_fractions.begin(), mass_fractions.end()));};
|
||||
void set_volu_fractions(const std::vector<double> &volu_fractions){set_volu_fractions(std::vector<CoolPropDbl>(volu_fractions.begin(), volu_fractions.end()));};
|
||||
void set_mole_fractions(const std::vector<double> &mole_fractions){ set_mole_fractions(std::vector<CoolPropDbl>(mole_fractions.begin(), mole_fractions.end())); };
|
||||
void set_mass_fractions(const std::vector<double> &mass_fractions){ set_mass_fractions(std::vector<CoolPropDbl>(mass_fractions.begin(), mass_fractions.end())); };
|
||||
void set_volu_fractions(const std::vector<double> &volu_fractions){ set_volu_fractions(std::vector<CoolPropDbl>(volu_fractions.begin(), volu_fractions.end())); };
|
||||
|
||||
virtual const CoolProp::SimpleState & get_reducing_state(){return _reducing;};
|
||||
const CoolProp::SimpleState & get_state(const std::string &state){return calc_state(state);};
|
||||
virtual const CoolProp::SimpleState & get_reducing_state(){ return _reducing; };
|
||||
const CoolProp::SimpleState & get_state(const std::string &state){ return calc_state(state); };
|
||||
|
||||
// Limits
|
||||
double Tmin(void);
|
||||
double Tmax(void);
|
||||
double pmax(void);
|
||||
double Ttriple(void);
|
||||
|
||||
|
||||
/// Get the phase of the state
|
||||
phases phase(void){return calc_phase();};
|
||||
phases phase(void){ return calc_phase(); };
|
||||
/// Specify the phase for all further calculations with this state class
|
||||
void specify_phase(phases phase){calc_specify_phase(phase);};
|
||||
void specify_phase(phases phase){ calc_specify_phase(phase); };
|
||||
/// Unspecify the phase and go back to calculating it based on the inputs
|
||||
void unspecify_phase(void){calc_unspecify_phase();};
|
||||
void unspecify_phase(void){ calc_unspecify_phase(); };
|
||||
|
||||
/// Return the critical temperature in K
|
||||
/**
|
||||
@@ -429,7 +428,7 @@ public:
|
||||
For mixtures, it is the exact critical point temperature calculated by the methods of Michelsen( \todo fill in reference)
|
||||
*/
|
||||
double T_critical(void);
|
||||
/// Return the reducing point temperature in K
|
||||
/// Return the reducing point temperature in K
|
||||
double T_reducing(void);
|
||||
/// Return the critical pressure in Pa
|
||||
/**
|
||||
@@ -439,34 +438,34 @@ public:
|
||||
double p_critical(void);
|
||||
///
|
||||
/** \brief Return the critical molar density in mol/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
* For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference)
|
||||
*/
|
||||
double rhomolar_critical(void);
|
||||
/** \brief Return the critical molar density in kg/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
/** \brief Return the critical molar density in kg/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
* For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference)
|
||||
*/
|
||||
double rhomass_critical(void);
|
||||
/** \brief Return the molar density at the reducing point in mol/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
/** \brief Return the molar density at the reducing point in mol/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
* For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference)
|
||||
*/
|
||||
double rhomolar_reducing(void);
|
||||
/** \brief Return the mass density at the reducing point in kg/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
/** \brief Return the mass density at the reducing point in kg/m^3
|
||||
*
|
||||
* For pure fluids, this is the critical point molar density
|
||||
* For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference)
|
||||
*/
|
||||
double rhomass_reducing(void);
|
||||
|
||||
|
||||
/// Return the triple point pressure
|
||||
double p_triple(void);
|
||||
|
||||
std::string name(){return calc_name();};
|
||||
std::string name(){ return calc_name(); };
|
||||
|
||||
// ----------------------------------------
|
||||
// Bulk properties - temperature and density are directly calculated every time
|
||||
@@ -477,20 +476,20 @@ public:
|
||||
/// A trivial keyed output like molar mass that does not depend on the state
|
||||
double trivial_keyed_output(parameters key);
|
||||
/// Get an output from the saturated liquid state by key
|
||||
double saturated_liquid_keyed_output(parameters key){return calc_saturated_liquid_keyed_output(key);};
|
||||
double saturated_liquid_keyed_output(parameters key){ return calc_saturated_liquid_keyed_output(key); };
|
||||
/// Get an output from the saturated vapor state by key
|
||||
double saturated_vapor_keyed_output(parameters key){return calc_saturated_vapor_keyed_output(key);};
|
||||
|
||||
double saturated_vapor_keyed_output(parameters key){ return calc_saturated_vapor_keyed_output(key); };
|
||||
|
||||
/// Return the temperature in K
|
||||
double T(void) {return calc_T();};
|
||||
double T(void) { return calc_T(); };
|
||||
/// Return the molar density in mol/m^3
|
||||
double rhomolar(void){return calc_rhomolar();};
|
||||
double rhomolar(void){ return calc_rhomolar(); };
|
||||
/// Return the mass density in kg/m^3
|
||||
double rhomass(void){return calc_rhomass();};
|
||||
double rhomass(void){ return calc_rhomass(); };
|
||||
/// Return the pressure in Pa
|
||||
double p(void) {return _p;};
|
||||
double p(void) { return _p; };
|
||||
/// Return the vapor quality (mol/mol); Q = 0 for saturated liquid
|
||||
double Q(void) {return _Q;};
|
||||
double Q(void) { return _Q; };
|
||||
/// Return the reciprocal of the reduced temperature (\f$\tau = T_c/T\f$)
|
||||
double tau(void);
|
||||
/// Return the reduced density (\f$\delta = \rho/\rho_c\f$)
|
||||
@@ -514,29 +513,29 @@ public:
|
||||
/// Return the molar enthalpy in J/mol
|
||||
double hmolar(void);
|
||||
/// Return the mass enthalpy in J/kg
|
||||
double hmass(void){return calc_hmass();};
|
||||
double hmass(void){ return calc_hmass(); };
|
||||
/// Return the molar entropy in J/mol/K
|
||||
double smolar(void);
|
||||
/// Return the molar entropy in J/kg/K
|
||||
double smass(void){return calc_smass();};
|
||||
double smass(void){ return calc_smass(); };
|
||||
/// Return the molar internal energy in J/mol
|
||||
double umolar(void);
|
||||
/// Return the mass internal energy in J/kg
|
||||
double umass(void){return calc_umass();};
|
||||
double umass(void){ return calc_umass(); };
|
||||
/// Return the molar constant pressure specific heat in J/mol/K
|
||||
double cpmolar(void);
|
||||
/// Return the mass constant pressure specific heat in J/kg/K
|
||||
double cpmass(void){return calc_cpmass();};
|
||||
double cpmass(void){ return calc_cpmass(); };
|
||||
/// Return the molar constant pressure specific heat for ideal gas part only in J/mol/K
|
||||
double cp0molar(void);
|
||||
/// Return the mass constant pressure specific heat for ideal gas part only in J/kg/K
|
||||
double cp0mass(void){return calc_cp0mass();};
|
||||
double cp0mass(void){ return calc_cp0mass(); };
|
||||
/// Return the molar constant volume specific heat in J/mol/K
|
||||
double cvmolar(void);
|
||||
/// Return the mass constant volume specific heat in J/kg/K
|
||||
double cvmass(void){return calc_cvmass();};
|
||||
double cvmass(void){ return calc_cvmass(); };
|
||||
/// Return the Gibbs function in J/mol
|
||||
double gibbsmolar(void){return calc_gibbsmolar();};
|
||||
double gibbsmolar(void){ return calc_gibbsmolar(); };
|
||||
/// Return the speed of sound in m/s
|
||||
double speed_sound(void);
|
||||
/// Return the isothermal compressibility \f$ \kappa = -\frac{1}{v}\left.\frac{\partial v}{\partial p}\right|_T=\frac{1}{\rho}\left.\frac{\partial \rho}{\partial p}\right|_T\f$ in 1/Pa
|
||||
@@ -547,13 +546,15 @@ public:
|
||||
/// Return the fundamental derivative of gas dynamics
|
||||
//double fundamental_derivative_of_gas_dynamics(void){return this->second_partial_deriv(iP, iDmolar, iSmolar, iDmolar, iSmolar)/pow(speed_sound(), 2)/2/pow(this->rhomolar(),3);};
|
||||
/// Return the phase identification parameter (PIP) of G. Venkatarathnam and L.R. Oellrich, "Identification of the phase of a fluid using partial derivatives of pressure, volume, and temperature without reference to saturation properties: Applications in phase equilibria calculations"
|
||||
double PIP(){return calc_PIP();};
|
||||
double PIP(){ return calc_PIP(); };
|
||||
|
||||
/// Find the "true" critical point where dpdrho|T and d2p/drho2|T are equal to zero
|
||||
void true_critical_point(double &T, double &rho){ calc_true_critical_point(T, rho); }
|
||||
|
||||
std::vector<CoolPropDbl> mole_fractions_liquid(void){return calc_mole_fractions_liquid();};
|
||||
std::vector<CoolPropDbl> mole_fractions_vapor(void){return calc_mole_fractions_vapor();};
|
||||
|
||||
std::vector<CoolPropDbl> mole_fractions_liquid(void){ return calc_mole_fractions_liquid(); };
|
||||
std::vector<CoolPropDbl> mole_fractions_vapor(void){ return calc_mole_fractions_vapor(); };
|
||||
|
||||
void ideal_curve(const std::string &type, std::vector<double> &T, std::vector<double> &p){ calc_ideal_curve(type, T, p); };
|
||||
|
||||
// ----------------------------------------
|
||||
// Partial derivatives
|
||||
@@ -590,55 +591,55 @@ public:
|
||||
*/
|
||||
CoolPropDbl second_partial_deriv(parameters Of1, parameters Wrt1, parameters Constant1, parameters Of2, parameters Constant2){return calc_second_partial_deriv(Of1,Wrt1,Constant1,Of2,Constant2);};
|
||||
|
||||
/** \brief The first partial derivative along the saturation curve
|
||||
*
|
||||
* Implementing the algorithms and ideas of:
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
*
|
||||
* Basically the idea is that the p-T derivative is given by Clapeyron relations:
|
||||
*
|
||||
* \f[ \left(\frac{\partial T}{\partial p}\right)_{\sigma} = T\left(\frac{v'' - v'}{h'' - h'}\right)_{\sigma} \f]
|
||||
*
|
||||
* and then other derivatives can be obtained along the saturation curve from
|
||||
*
|
||||
* \f[ \left(\frac{\partial y}{\partial p}\right)_{\sigma} = \left(\frac{\partial y}{\partial p}\right)+\left(\frac{\partial y}{\partial T}\right)\left(\frac{\partial T}{\partial p}\right)_{\sigma} \f]
|
||||
*
|
||||
* \f[ \left(\frac{\partial y}{\partial T}\right)_{\sigma} = \left(\frac{\partial y}{\partial T}\right)+\left(\frac{\partial y}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* where derivatives without the \f$ \sigma \f$ are homogeneous (conventional) derivatives.
|
||||
*
|
||||
* @param Of1 The parameter that the derivative is taken of
|
||||
* @param Wrt1 The parameter that the derivative is taken with respect to
|
||||
*/
|
||||
CoolPropDbl first_saturation_deriv(parameters Of1, parameters Wrt1){return calc_first_saturation_deriv(Of1,Wrt1);};
|
||||
|
||||
/** \brief The second partial derivative along the saturation curve
|
||||
*
|
||||
* Implementing the algorithms and ideas of:
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
*
|
||||
* Like with \ref first_saturation_deriv, we can express the derivative as
|
||||
* \f[ \left(\frac{\partial y}{\partial T}\right)_{\sigma} = \left(\frac{\partial y}{\partial T}\right)+\left(\frac{\partial y}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* where \f$ y \f$ is already a saturation derivative. So you might end up with something like
|
||||
*
|
||||
* \f[ \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)_{\sigma} = \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)+\left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* @param Of1 The parameter that the first derivative is taken of
|
||||
* @param Wrt1 The parameter that the first derivative is taken with respect to
|
||||
* @param Of2 The parameter that the second derivative is taken of
|
||||
* @param Wrt2 The parameter that the second derivative is taken with respect to
|
||||
* */
|
||||
CoolPropDbl second_saturation_deriv(parameters Of1, parameters Wrt1, parameters Of2, parameters Wrt2){return calc_second_saturation_deriv(Of1,Wrt1,Of2,Wrt2);};
|
||||
/** \brief The first partial derivative along the saturation curve
|
||||
*
|
||||
* Implementing the algorithms and ideas of:
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
*
|
||||
* Basically the idea is that the p-T derivative is given by Clapeyron relations:
|
||||
*
|
||||
* \f[ \left(\frac{\partial T}{\partial p}\right)_{\sigma} = T\left(\frac{v'' - v'}{h'' - h'}\right)_{\sigma} \f]
|
||||
*
|
||||
* and then other derivatives can be obtained along the saturation curve from
|
||||
*
|
||||
* \f[ \left(\frac{\partial y}{\partial p}\right)_{\sigma} = \left(\frac{\partial y}{\partial p}\right)+\left(\frac{\partial y}{\partial T}\right)\left(\frac{\partial T}{\partial p}\right)_{\sigma} \f]
|
||||
*
|
||||
* \f[ \left(\frac{\partial y}{\partial T}\right)_{\sigma} = \left(\frac{\partial y}{\partial T}\right)+\left(\frac{\partial y}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* where derivatives without the \f$ \sigma \f$ are homogeneous (conventional) derivatives.
|
||||
*
|
||||
* @param Of1 The parameter that the derivative is taken of
|
||||
* @param Wrt1 The parameter that the derivative is taken with respect to
|
||||
*/
|
||||
CoolPropDbl first_saturation_deriv(parameters Of1, parameters Wrt1){return calc_first_saturation_deriv(Of1,Wrt1);};
|
||||
|
||||
/** \brief The second partial derivative along the saturation curve
|
||||
*
|
||||
* Implementing the algorithms and ideas of:
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
*
|
||||
* Like with \ref first_saturation_deriv, we can express the derivative as
|
||||
* \f[ \left(\frac{\partial y}{\partial T}\right)_{\sigma} = \left(\frac{\partial y}{\partial T}\right)+\left(\frac{\partial y}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* where \f$ y \f$ is already a saturation derivative. So you might end up with something like
|
||||
*
|
||||
* \f[ \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)_{\sigma} = \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)+\left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f]
|
||||
*
|
||||
* @param Of1 The parameter that the first derivative is taken of
|
||||
* @param Wrt1 The parameter that the first derivative is taken with respect to
|
||||
* @param Of2 The parameter that the second derivative is taken of
|
||||
* @param Wrt2 The parameter that the second derivative is taken with respect to
|
||||
* */
|
||||
CoolPropDbl second_saturation_deriv(parameters Of1, parameters Wrt1, parameters Of2, parameters Wrt2){return calc_second_saturation_deriv(Of1,Wrt1,Of2,Wrt2);};
|
||||
|
||||
/**
|
||||
* @brief Calculate the first "two-phase" derivative as described by Thorade and Sadaat, EAS, 2013
|
||||
*
|
||||
* Implementing the algorithms and ideas of:
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
* Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation",
|
||||
* Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503
|
||||
*
|
||||
* Spline evaluation is as described in:
|
||||
* S Quoilin, I Bell, A Desideri, P Dewallef, V Lemort,
|
||||
@@ -771,43 +772,43 @@ public:
|
||||
if (!_d2alphar_dTau2) _d2alphar_dTau2 = calc_d2alphar_dTau2();
|
||||
return _d2alphar_dTau2;
|
||||
};
|
||||
CoolPropDbl d3alphar_dDelta3(void){
|
||||
CoolPropDbl d3alphar_dDelta3(void){
|
||||
if (!_d3alphar_dDelta3) _d3alphar_dDelta3 = calc_d3alphar_dDelta3();
|
||||
return _d3alphar_dDelta3;
|
||||
};
|
||||
CoolPropDbl d3alphar_dDelta2_dTau(void){
|
||||
CoolPropDbl d3alphar_dDelta2_dTau(void){
|
||||
if (!_d3alphar_dDelta2_dTau) _d3alphar_dDelta2_dTau = calc_d3alphar_dDelta2_dTau();
|
||||
return _d3alphar_dDelta2_dTau;
|
||||
};
|
||||
CoolPropDbl d3alphar_dDelta_dTau2(void){
|
||||
CoolPropDbl d3alphar_dDelta_dTau2(void){
|
||||
if (!_d3alphar_dDelta_dTau2) _d3alphar_dDelta_dTau2 = calc_d3alphar_dDelta_dTau2();
|
||||
return _d3alphar_dDelta_dTau2;
|
||||
};
|
||||
CoolPropDbl d3alphar_dTau3(void){
|
||||
CoolPropDbl d3alphar_dTau3(void){
|
||||
if (!_d3alphar_dTau3) _d3alphar_dTau3 = calc_d3alphar_dTau3();
|
||||
return _d3alphar_dTau3;
|
||||
};
|
||||
CoolPropDbl d4alphar_dDelta4(void){
|
||||
CoolPropDbl d4alphar_dDelta4(void){
|
||||
if (!_d4alphar_dDelta4) _d4alphar_dDelta4 = calc_d4alphar_dDelta4();
|
||||
return _d4alphar_dDelta4;
|
||||
};
|
||||
CoolPropDbl d4alphar_dDelta3_dTau(void){
|
||||
CoolPropDbl d4alphar_dDelta3_dTau(void){
|
||||
if (!_d4alphar_dDelta3_dTau) _d4alphar_dDelta3_dTau = calc_d4alphar_dDelta3_dTau();
|
||||
return _d4alphar_dDelta3_dTau;
|
||||
};
|
||||
CoolPropDbl d4alphar_dDelta2_dTau2(void){
|
||||
CoolPropDbl d4alphar_dDelta2_dTau2(void){
|
||||
if (!_d4alphar_dDelta2_dTau2) _d4alphar_dDelta2_dTau2 = calc_d4alphar_dDelta2_dTau2();
|
||||
return _d4alphar_dDelta2_dTau2;
|
||||
};
|
||||
CoolPropDbl d4alphar_dDelta_dTau3(void){
|
||||
CoolPropDbl d4alphar_dDelta_dTau3(void){
|
||||
if (!_d4alphar_dDelta_dTau3) _d4alphar_dDelta_dTau3 = calc_d4alphar_dDelta_dTau3();
|
||||
return _d4alphar_dDelta_dTau3;
|
||||
};
|
||||
CoolPropDbl d4alphar_dTau4(void){
|
||||
CoolPropDbl d4alphar_dTau4(void){
|
||||
if (!_d4alphar_dTau4) _d4alphar_dTau4 = calc_d4alphar_dTau4();
|
||||
return _d4alphar_dTau4;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
virtual double dalphar_dDelta_lim(void) = 0;
|
||||
virtual double d2alphar_dDelta2_lim(void) = 0;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "PhaseEnvelopeRoutines.h"
|
||||
#include "ReducingFunctions.h"
|
||||
#include "MixtureParameters.h"
|
||||
#include "IdealCurves.h"
|
||||
|
||||
static int deriv_counter = 0;
|
||||
|
||||
@@ -600,9 +601,16 @@ std::string HelmholtzEOSMixtureBackend::calc_name(void)
|
||||
throw ValueError(format("calc_name is only valid for pure and pseudo-pure fluids, %d components", components.size()));
|
||||
}
|
||||
else{
|
||||
return components[0].name;
|
||||
return components[0].name;
|
||||
}
|
||||
}
|
||||
void HelmholtzEOSMixtureBackend::calc_ideal_curve(const std::string &type, std::vector<double> &T, std::vector<double> &p){
|
||||
shared_ptr<AbstractState> AS(this);
|
||||
if (type == "Joule-Thomson"){
|
||||
JouleThomsonCurveTracer JTCT(AS, 1e5, 800);
|
||||
JTCT.trace(T, p);
|
||||
}
|
||||
};
|
||||
std::vector<std::string> HelmholtzEOSMixtureBackend::calc_fluid_names(void)
|
||||
{
|
||||
std::vector<std::string> out;
|
||||
|
||||
@@ -160,6 +160,8 @@ public:
|
||||
*/
|
||||
void set_mass_fractions(const std::vector<CoolPropDbl> &mass_fractions){throw std::exception();};
|
||||
|
||||
void calc_ideal_curve(const std::string &type, std::vector<double> &T, std::vector<double> &p);
|
||||
|
||||
CoolPropDbl calc_molar_mass(void);
|
||||
CoolPropDbl calc_gas_constant(void);
|
||||
CoolPropDbl calc_acentric_factor(void);
|
||||
|
||||
123
src/Backends/Helmholtz/IdealCurves.h
Normal file
123
src/Backends/Helmholtz/IdealCurves.h
Normal file
@@ -0,0 +1,123 @@
|
||||
#include "AbstractState.h"
|
||||
#include "crossplatform_shared_ptr.h"
|
||||
#include "Solvers.h"
|
||||
#include "CoolPropTools.h"
|
||||
#include <string>
|
||||
|
||||
namespace CoolProp{
|
||||
|
||||
class CurveTracer : public FuncWrapper1D
|
||||
{
|
||||
public:
|
||||
double p0, T0, lnT, lnp, rho_guess;
|
||||
shared_ptr<AbstractState> &AS;
|
||||
std::vector<double> T, p;
|
||||
enum OBJECTIVE_TYPE { OBJECTIVE_CIRCLE, OBJECTIVE_T };
|
||||
OBJECTIVE_TYPE obj;
|
||||
CurveTracer(shared_ptr<AbstractState> &AS, double p0, double T0) : AS(AS), p0(p0), T0(T0)
|
||||
{
|
||||
this->p.push_back(p0);
|
||||
};
|
||||
void init(){
|
||||
// Solve for Temperature for first point
|
||||
this->obj = OBJECTIVE_T;
|
||||
this->rho_guess = -1;
|
||||
static std::string errstr;
|
||||
this->T.push_back(Secant(this, T0, 0.001*T0, 1e-10, 100, errstr));
|
||||
}
|
||||
|
||||
virtual double objective(void) = 0;
|
||||
|
||||
virtual double starting_direction(){
|
||||
return M_PI / 2.0;
|
||||
}
|
||||
|
||||
double call(double t){
|
||||
if (this->obj == OBJECTIVE_CIRCLE){
|
||||
double T2, P2;
|
||||
this->TPcoords(t, lnT, lnp, T2, P2);
|
||||
this->AS->update(PT_INPUTS, P2, T2);
|
||||
}
|
||||
else{
|
||||
if (this->rho_guess < 0)
|
||||
this->AS->update(PT_INPUTS, this->p[this->p.size()-1], t);
|
||||
else{
|
||||
GuessesStructure guesses;
|
||||
guesses.rhomolar = this->rho_guess;
|
||||
this->AS->update_with_guesses(PT_INPUTS, this->p[this->p.size() - 1], t, guesses);
|
||||
}
|
||||
}
|
||||
double r = this->objective();
|
||||
return r;
|
||||
}
|
||||
|
||||
void TPcoords(double t, double lnT, double lnp, double &T, double &p){
|
||||
double rlnT = 0.1, rlnp = 0.1;
|
||||
T = exp(lnT + rlnT*cos(t));
|
||||
p = exp(lnp + rlnp*sin(t));
|
||||
}
|
||||
|
||||
void trace(std::vector<double> &T, std::vector<double> &p)
|
||||
{
|
||||
double t = this->starting_direction();
|
||||
for (int i = 0; i < 1000; ++i){
|
||||
try{
|
||||
this->lnT = log(this->T[this->T.size() - 1]);
|
||||
this->lnp = log(this->p[this->p.size() - 1]);
|
||||
static std::string errstr;
|
||||
this->obj = OBJECTIVE_CIRCLE;
|
||||
t = Brent(this, t - M_PI / 2.0, t + M_PI / 2.0, DBL_EPSILON, 1e-10, 100, errstr);
|
||||
double T2, P2;
|
||||
this->TPcoords(t, this->lnT, this->lnp, T2, P2);
|
||||
this->T.push_back(T2);
|
||||
this->p.push_back(P2);
|
||||
if (this->T[this->T.size() - 1] < this->AS->keyed_output(iT_triple) || this->p[this->p.size() - 1] > 1000 * this->AS->keyed_output(iP_critical)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (std::exception &e){
|
||||
break;
|
||||
}
|
||||
}
|
||||
T = this->T;
|
||||
p = this->p;
|
||||
}
|
||||
};
|
||||
|
||||
class IdealCurveTracer : public CurveTracer{
|
||||
public:
|
||||
IdealCurveTracer(shared_ptr<AbstractState> &AS, double p0, double T0) : CurveTracer(AS, p0, T0) { init(); };
|
||||
/// Z = 1
|
||||
double objective(void){ return this->AS->keyed_output(iZ) - 1; };
|
||||
};
|
||||
|
||||
class BoyleCurveTracer : public CurveTracer{
|
||||
public:
|
||||
BoyleCurveTracer(shared_ptr<AbstractState> &AS, double p0, double T0) : CurveTracer(AS, p0, T0) { init(); };
|
||||
/// dZ/dv|T = 0
|
||||
double objective(void){
|
||||
double r = (this->AS->p() - this->AS->rhomolar()*this->AS->first_partial_deriv(iP, iDmolar, iT)) / (this->AS->gas_constant()*this->AS->T());
|
||||
return r;
|
||||
};
|
||||
};
|
||||
class JouleInversionCurveTracer : public CurveTracer{
|
||||
public:
|
||||
JouleInversionCurveTracer(shared_ptr<AbstractState> &AS, double p0, double T0) : CurveTracer(AS, p0, T0) { init(); };
|
||||
/// dZ/dT|v = 0
|
||||
double objective(void){
|
||||
double r = (this->AS->gas_constant()*this->AS->T() * 1 / this->AS->rhomolar()*this->AS->first_partial_deriv(iP, iT, iDmolar) - this->AS->p()*this->AS->gas_constant() / this->AS->rhomolar()) / POW2(this->AS->gas_constant()*this->AS->T());
|
||||
return r;
|
||||
};
|
||||
};
|
||||
class JouleThomsonCurveTracer : public CurveTracer{
|
||||
public:
|
||||
JouleThomsonCurveTracer(shared_ptr<AbstractState> &AS, double p0, double T0) : CurveTracer(AS, p0, T0) { init(); };
|
||||
/// dZ/dT|p = 0
|
||||
double objective(void){
|
||||
double dvdT__constp = -this->AS->first_partial_deriv(iDmolar, iT, iP) / POW2(this->AS->rhomolar());
|
||||
double r = this->AS->p() / (this->AS->gas_constant()*POW2(this->AS->T()))*(this->AS->T()*dvdT__constp - 1 / this->AS->rhomolar());
|
||||
return r;
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace CoolProp */
|
||||
Reference in New Issue
Block a user