18 WaterSSTP::WaterSSTP() :
23 m_allowGasPhase(false)
32 m_allowGasPhase(false)
42 m_allowGasPhase(false)
48 const vector<std::string> phases = {
49 "gas",
"liquid",
"supercritical",
"unstable-liquid",
"unstable-gas"
75 m_mw = 2.0 * mw_H + mw_O;
79 doublereal T = 298.15;
83 doublereal presLow = 1.0E-2;
84 doublereal oneBar = 1.0E5;
85 doublereal dd =
m_sub.
density(T, presLow, WATER_GAS, 7.0E-8);
98 if (h != -241.826E6) {
116 eosdata.
_require(
"model",
"PureLiquidWater");
138 throw CanteraError(
"waterSSTP::getGibbs_RT",
"Phase not ready");
146 throw CanteraError(
"waterSSTP::getStandardChemPotentials",
166 int waterState = WATER_GAS;
169 waterState = WATER_LIQUID;
173 throw CanteraError(
"WaterSSTP::getEnthalpy_RT_ref",
"error");
185 int waterState = WATER_GAS;
188 waterState = WATER_LIQUID;
192 throw CanteraError(
"WaterSSTP::getGibbs_RT_ref",
"error");
203 for (
size_t k = 0; k <
m_kk; k++) {
213 int waterState = WATER_GAS;
216 waterState = WATER_LIQUID;
221 throw CanteraError(
"WaterSSTP::getEntropy_R_ref",
"error");
235 int waterState = WATER_GAS;
238 waterState = WATER_LIQUID;
255 int waterState = WATER_GAS;
258 waterState = WATER_LIQUID;
262 throw CanteraError(
"WaterSSTP::getStandardVolumes_ref",
"error");
278 int waterState = WATER_SUPERCRIT;
281 waterState = WATER_LIQUID;
285 "Model assumes liquid phase; pressure p = {} lies below\n"
286 "the saturation pressure (P_sat = {}).", p, pp);
310 doublereal dens_save =
density();
312 double tt = T - 0.04;
313 doublereal dd =
m_sub.
density(tt, pres, WATER_LIQUID, dens_save);
315 throw CanteraError(
"WaterSSTP::dthermalExpansionCoeffdT",
316 "Unable to solve for the density at T = {}, P = {}", tt, pres);
321 return (val2 - vald) / 0.04;
343 "Model assumes liquid phase; temperature T = {} lies below\n"
344 "the triple point temperature (T_triple = 273.16).", temp);
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Base class for exceptions thrown by Cantera classes.
size_t m_kk
Number of species in the phase.
doublereal atomicWeight(size_t m) const
Atomic weight of element m.
size_t elementIndex(const std::string &name) const
Return the index of element named 'name'.
virtual void setDensity(const double density_)
Set the internally stored density (kg/m^3) of the phase.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double density() const
Density (kg/m^3).
doublereal temperature() const
Temperature (K).
void setMolecularWeight(const int k, const double mw)
Set the molecular weight of a single species to a given value.
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
doublereal density(doublereal temperature, doublereal pressure, int phase=-1, doublereal rhoguess=-1.0)
Calculates the density given the temperature and the pressure, and a guess at the density.
doublereal coeffThermExp() const
Returns the coefficient of thermal expansion.
doublereal cp() const
Calculate the constant pressure heat capacity in mks units of J kmol-1 K-1 at the last temperature an...
doublereal pressure() const
Calculates the pressure (Pascals), given the current value of the temperature and density.
doublereal enthalpy() const
Calculate the enthalpy in mks units of J kmol-1 using the last temperature and density.
doublereal Tcrit() const
Returns the critical temperature of water (Kelvin)
doublereal cv() const
Calculate the constant volume heat capacity in mks units of J kmol-1 K-1 at the last temperature and ...
doublereal entropy() const
Calculate the entropy in mks units of J kmol-1 K-1.
doublereal intEnergy() const
Calculate the internal energy in mks units of J kmol-1.
doublereal Rhocrit() const
Return the critical density of water (kg m-3)
doublereal Gibbs() const
Calculate the Gibbs free energy in mks units of J kmol-1 K-1.
doublereal psat(doublereal temperature, int waterState=WATER_LIQUID)
This function returns the saturation pressure given the temperature as an input parameter,...
void setState_TR(doublereal temperature, doublereal rho)
Set the internal state of the object wrt temperature and density.
int phaseState(bool checkState=false) const
Returns the Phase State flag for the current state of the object.
doublereal isothermalCompressibility() const
Returns the coefficient of isothermal compressibility for the state of the object.
doublereal Pcrit() const
Returns the critical pressure of water (22.064E6 Pa)
The WaterProps class is used to house several approximation routines for properties of water.
Class XML_Node is a tree-based representation of the contents of an XML file.
void _require(const std::string &a, const std::string &v) const
Require that the current XML node has an attribute named by the first argument, a,...
const size_t npos
index returned by functions to indicate "no position"
const double OneAtm
One atmosphere [Pa].
const double GasConstant
Universal Gas Constant [J/kmol/K].
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.