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);
104 throw CanteraError(
"waterSSTP::getGibbs_RT",
"Phase not ready");
110 checkArraySize(
"WaterSSTP::getStandardChemPotentials", gss.size(), 1);
113 throw CanteraError(
"waterSSTP::getStandardChemPotentials",
135 int waterState = WATER_GAS;
136 double rc =
m_sub.Rhocrit();
138 waterState = WATER_LIQUID;
140 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
142 throw CanteraError(
"WaterSSTP::getEnthalpy_RT_ref",
"error");
146 dd =
m_sub.density(T, p, waterState, dens);
155 int waterState = WATER_GAS;
156 double rc =
m_sub.Rhocrit();
158 waterState = WATER_LIQUID;
160 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
162 throw CanteraError(
"WaterSSTP::getGibbs_RT_ref",
"error");
164 m_sub.setState_TD(T, dd);
167 dd =
m_sub.density(T, p, waterState, dens);
173 for (
size_t k = 0; k <
m_kk; k++) {
184 int waterState = WATER_GAS;
185 double rc =
m_sub.Rhocrit();
187 waterState = WATER_LIQUID;
189 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
192 throw CanteraError(
"WaterSSTP::getEntropy_R_ref",
"error");
194 m_sub.setState_TD(T, dd);
198 dd =
m_sub.density(T, p, waterState, dens);
207 int waterState = WATER_GAS;
208 double rc =
m_sub.Rhocrit();
210 waterState = WATER_LIQUID;
212 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
213 m_sub.setState_TD(T, dd);
219 dd =
m_sub.density(T, p, waterState, dens);
224 checkArraySize(
"WaterSSTP::getStandardVolumes_ref", vol.size(), 1);
228 int waterState = WATER_GAS;
229 double rc =
m_sub.Rhocrit();
231 waterState = WATER_LIQUID;
233 double dd =
m_sub.density(T,
OneAtm, waterState, dens);
235 throw CanteraError(
"WaterSSTP::getStandardVolumes_ref",
"error");
238 dd =
m_sub.density(T, p, waterState, dens);
243 return m_sub.pressure();
250 double pp =
m_sub.psat(T);
251 int waterState = WATER_SUPERCRIT;
252 if (T <
m_sub.Tcrit()) {
254 waterState = WATER_LIQUID;
258 "Model assumes liquid phase; pressure p = {} lies below\n"
259 "the saturation pressure (P_sat = {}).", p, pp);
263 double dd =
m_sub.density(T, p, waterState, dens);
272 return m_sub.isothermalCompressibility();
277 return m_sub.coeffThermExp();
285 double tt = T - 0.04;
286 double dd =
m_sub.density(tt, pres, WATER_LIQUID, dens_save);
288 throw CanteraError(
"WaterSSTP::dthermalExpansionCoeffdT",
289 "Unable to solve for the density at T = {}, P = {}", tt, pres);
291 double vald =
m_sub.coeffThermExp();
292 m_sub.setState_TD(T, dens_save);
293 double val2 =
m_sub.coeffThermExp();
294 return (val2 - vald) / 0.04;
299 return m_sub.Tcrit();
304 return m_sub.Pcrit();
309 return m_sub.Rhocrit();
316 "Model assumes liquid phase; temperature T = {} lies below\n"
317 "the triple point temperature (T_triple = 273.16).", temp);
332 double pp =
m_sub.psat(t);
333 m_sub.setState_TD(tsave, dsave);
341 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).
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.
size_t elementIndex(const string &name, bool raise=true) const
Return the index of element named 'name'.
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.
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
Contains declarations for string manipulation functions within Cantera.