22 const vector<string> phases = {
23 "gas",
"liquid",
"supercritical",
"unstable-liquid",
"unstable-gas"
25 return phases[
m_sub.phaseState()];
41 m_mw = 2.0 * mw_H + mw_O;
49 double presLow = 1.0E-2;
50 double oneBar = 1.0E5;
51 double dd =
m_sub.density(T, presLow, WATER_GAS, 7.0E-8);
64 if (h != -241.826E6) {
71 double rho0 =
m_sub.density(298.15,
OneAtm, WATER_LIQUID);
100 throw CanteraError(
"waterSSTP::getGibbs_RT",
"Phase not ready");
108 throw CanteraError(
"waterSSTP::getStandardChemPotentials",
128 int waterState = WATER_GAS;
129 double rc =
m_sub.Rhocrit();
131 waterState = WATER_LIQUID;
133 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
135 throw CanteraError(
"WaterSSTP::getEnthalpy_RT_ref",
"error");
139 dd =
m_sub.density(T, p, waterState, dens);
147 int waterState = WATER_GAS;
148 double rc =
m_sub.Rhocrit();
150 waterState = WATER_LIQUID;
152 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
154 throw CanteraError(
"WaterSSTP::getGibbs_RT_ref",
"error");
156 m_sub.setState_TD(T, dd);
159 dd =
m_sub.density(T, p, waterState, dens);
165 for (
size_t k = 0; k <
m_kk; k++) {
175 int waterState = WATER_GAS;
176 double rc =
m_sub.Rhocrit();
178 waterState = WATER_LIQUID;
180 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
183 throw CanteraError(
"WaterSSTP::getEntropy_R_ref",
"error");
185 m_sub.setState_TD(T, dd);
189 dd =
m_sub.density(T, p, waterState, dens);
197 int waterState = WATER_GAS;
198 double rc =
m_sub.Rhocrit();
200 waterState = WATER_LIQUID;
202 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
203 m_sub.setState_TD(T, dd);
209 dd =
m_sub.density(T, p, waterState, dens);
217 int waterState = WATER_GAS;
218 double rc =
m_sub.Rhocrit();
220 waterState = WATER_LIQUID;
222 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
224 throw CanteraError(
"WaterSSTP::getStandardVolumes_ref",
"error");
227 dd =
m_sub.density(T, p, waterState, dens);
232 return m_sub.pressure();
239 double pp =
m_sub.psat(T);
240 int waterState = WATER_SUPERCRIT;
241 if (T <
m_sub.Tcrit()) {
243 waterState = WATER_LIQUID;
247 "Model assumes liquid phase; pressure p = {} lies below\n"
248 "the saturation pressure (P_sat = {}).", p, pp);
252 double dd =
m_sub.density(T, p, waterState, dens);
261 return m_sub.isothermalCompressibility();
266 return m_sub.coeffThermExp();
274 double tt = T - 0.04;
275 double dd =
m_sub.density(tt, pres, WATER_LIQUID, dens_save);
277 throw CanteraError(
"WaterSSTP::dthermalExpansionCoeffdT",
278 "Unable to solve for the density at T = {}, P = {}", tt, pres);
280 double vald =
m_sub.coeffThermExp();
281 m_sub.setState_TD(T, dens_save);
282 double val2 =
m_sub.coeffThermExp();
283 return (val2 - vald) / 0.04;
288 return m_sub.Tcrit();
293 return m_sub.Pcrit();
298 return m_sub.Rhocrit();
305 "Model assumes liquid phase; temperature T = {} lies below\n"
306 "the triple point temperature (T_triple = 273.16).", temp);
321 double pp =
m_sub.psat(t);
322 m_sub.setState_TD(tsave, dsave);
330 if (dens >=
m_sub.Rhocrit()) {
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.
double temperature() const
Temperature (K).
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
size_t elementIndex(const string &name) const
Return the index of element named 'name'.
double atomicWeight(size_t m) const
Atomic weight of element m.
virtual void setDensity(const double density_)
Set the internally stored density (kg/m^3) of the phase.
virtual double density() const
Density (kg/m^3).
virtual void setTemperature(double temp)
Set the internally stored temperature of the phase (K).
void setMolecularWeight(const int k, const double mw)
Set the molecular weight of a single species to a given value.
double enthalpy_mole() const override
Molar enthalpy. Units: J/kmol.
double entropy_mole() const override
Molar entropy. Units: J/kmol/K.
double RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
const double OneAtm
One atmosphere [Pa].
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.