21const double T_c = 647.096;
23static const double P_c = 22.064E6;
27static const double R_water = 461.51805;
55 int phase,
double rhoguess)
63 double deltaGuess = 0.0;
64 if (rhoguess == -1.0) {
69 if (phase == WATER_GAS || phase == WATER_SUPERCRIT) {
71 }
else if (phase == WATER_LIQUID) {
75 }
else if (phase == WATER_UNSTABLELIQUID || phase == WATER_UNSTABLEGAS) {
77 "Unstable Branch finder is untested");
80 "unknown state: {}", phase);
90 deltaGuess = rhoguess /
Rho_c;
93 if (delta_retn <= 0) {
99 if (delta_retn > 0.0) {
103 density_retn = delta_retn *
Rho_c;
130 static const double A[8] = {
147 double w = fabs(1.0-v);
149 for (
int i = 0; i < 8; i++) {
151 b += A[i] * pow(w, ((z+1.0)/2.0));
164 double dpdrho_val =
dpdrho();
166 return 1.0 / (dens * dpdrho_val);
186 return kappa * dens * R_water * beta;
190 double& densLiq,
double& densGas,
double& delGRT)
193 if (densLiq <= 0.0) {
195 "Error occurred trying to find liquid density at (T,P) = {} {}",
202 if (densGas <= 0.0) {
204 "Error occurred trying to find gas density at (T,P) = {} {}",
210 delGRT = gibbsLiqRT - gibbsGasRT;
215 double densLiq = -1.0, densGas = -1.0, delGRT = 0.0;
222 for (
int i = 0; i < 30; i++) {
224 double delV = 1.0/densLiq - 1.0/densGas;
226 if (delGRT < 1.0E-8) {
231 if (waterState == WATER_LIQUID) {
233 }
else if (waterState == WATER_GAS) {
237 "unknown water state input: {}", waterState);
250 double rhoMidAtm = 0.5 * (
OneAtm / (R_water * 373.15) + 1.0E3);
252 int iStateGuess = WATER_LIQUID;
254 iStateGuess = WATER_GAS;
261 double rhoDel = rho * 1.000001;
262 double deltaSave =
delta;
263 double deltaDel = rhoDel /
Rho_c;
268 double d2rhodp2 = (rhoDel * kappaDel - rho * kappa) / (rhoDel - rho);
269 if (d2rhodp2 > 0.0) {
270 iState = WATER_UNSTABLELIQUID;
272 iState = WATER_UNSTABLEGAS;
Headers for a class for calculating the equation of state of water from the IAPWS 1995 Formulation ba...
Base class for exceptions thrown by Cantera classes.
double coeffThermExp() const
Returns the coefficient of thermal expansion.
double density() const
Returns the density (kg m-3)
void corr(double temperature, double pressure, double &densLiq, double &densGas, double &delGRT)
Utility routine in the calculation of the saturation pressure.
double pressure() const
Calculates the pressure (Pascals), given the current value of the temperature and density.
double gibbs_mass() const
Get the Gibbs free energy (J/kg) at the current temperature and density.
double isothermalCompressibility() const
Returns the coefficient of isothermal compressibility for the state of the object.
double psat(double temperature, int waterState=WATER_LIQUID)
This function returns the saturation pressure given the temperature as an input parameter,...
double temperature() const
Returns the temperature (Kelvin)
double cv_mass() const
Get the constant volume heat capacity (J/kg/K) at the current temperature and density.
double entropy_mass() const
Get the entropy (J/kg/K) at the current temperature and density.
double delta
Dimensionless density, delta = rho / rho_c.
double cp_mass() const
Get the constant pressure heat capacity (J/kg/K) at the current temperature and density.
double intEnergy_mass() const
Get the internal energy (J/kg) at the current temperature and density.
double coeffPresExp() const
Returns the isochoric pressure derivative wrt temperature.
int iState
Current state of the system.
void setState_TD(double temperature, double rho)
Set the internal state of the object wrt temperature and density.
double tau
Dimensionless temperature, tau = T_C / T.
WaterPropsIAPWSphi m_phi
pointer to the underlying object that does the calculations.
void calcDim(double temperature, double rho)
Calculate the dimensionless temp and rho and store internally.
int phaseState(bool checkState=false) const
Returns the Phase State flag for the current state of the object.
double dpdrho() const
Returns the value of dp / drho at constant T for the state of the object.
double psat_est(double temperature) const
This function returns an estimated value for the saturation pressure.
double enthalpy_mass() const
Get the enthalpy (J/kg) at the current temperature and density.
double gibbs_RT() const
Calculate the dimensionless Gibbs free energy.
double cv_R() const
Calculate the dimensionless constant volume heat capacity, Cv/R.
double intEnergy_RT() const
Calculate the dimensionless internal energy, u/RT.
double enthalpy_RT() const
Calculate the dimensionless enthalpy, h/RT.
double entropy_R() const
Calculate the dimensionless entropy, s/R.
double pressureM_rhoRT(double tau, double delta)
Calculate the dimensionless pressure at tau and delta;.
double dimdpdrho(double tau, double delta)
Dimensionless derivative of p wrt rho at constant T.
double dfind(double p_red, double tau, double deltaGuess)
This function computes the reduced density, given the reduced pressure and the reduced temperature,...
double dimdpdT(double tau, double delta)
Dimensionless derivative of p wrt T at constant rho.
double cp_R() const
Calculate the dimensionless constant pressure heat capacity, Cv/R.
void tdpolycalc(double tau, double delta)
Calculates internal polynomials in tau and delta.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
const double OneAtm
One atmosphere [Pa].
Namespace for the Cantera kernel.
const double Rho_c
Value of the Density at the critical point (kg m-3)
const double T_c
Critical Temperature value (kelvin)
static const double P_c
Critical Pressure (Pascals)
Contains declarations for string manipulation functions within Cantera.