51 WaterProps::~WaterProps()
60 static const doublereal Tc = T - 273.15;
61 static const doublereal U1 = 288.9414;
62 static const doublereal U2 = 508929.2;
63 static const doublereal U3 = 68.12963;
64 static const doublereal U4 = -3.9863;
66 doublereal tmp1 = Tc + U1;
67 doublereal tmp4 = Tc + U4;
68 doublereal t4t4 = tmp4 * tmp4;
69 doublereal tmp3 = Tc + U3;
70 doublereal rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3));
79 }
else if (ifunc == 3) {
81 }
else if (ifunc == 2) {
82 return 2.0 * rhomin / (T * T);
87 doublereal drhodT = 1000./U2 * (
88 - tmp4 * tmp4 / (tmp3)
89 - tmp1 * 2 * tmp4 / (tmp3)
90 + tmp1 * t4t4 / (tmp3*tmp3)
93 }
else if (ifunc == 3) {
95 }
else if (ifunc == 2) {
96 doublereal t3t3 = tmp3 * tmp3;
97 doublereal d2rhodT2 = 1000./U2 *
98 ((-4.0*tmp4-2.0*tmp1)/tmp3 +
99 (2.0*t4t4 + 4.0*tmp1*tmp4)/t3t3
100 - 2.0*tmp1 * t4t4/(t3t3*tmp3));
109 static const doublereal U1 = 3.4279E2;
110 static const doublereal U2 = -5.0866E-3;
111 static const doublereal U3 = 9.4690E-7;
112 static const doublereal U4 = -2.0525;
113 static const doublereal U5 = 3.1159E3;
114 static const doublereal U6 = -1.8289E2;
115 static const doublereal U7 = -8.0325E3;
116 static const doublereal U8 = 4.2142E6;
117 static const doublereal U9 = 2.1417;
118 doublereal T2 = T * T;
120 doublereal eps1000 = U1 * exp(U2 * T + U3 * T2);
121 doublereal C = U4 + U5/(U6 + T);
122 doublereal B = U7 + U8/T + U9 * T;
123 doublereal Pbar = P_pascal * 1.0E-5;
124 doublereal tmpBpar = B + Pbar;
125 doublereal tmpB1000 = B + 1000.0;
126 doublereal ltmp = log(tmpBpar/tmpB1000);
127 doublereal epsRel = eps1000 + C * ltmp;
129 if (ifunc == 1 || ifunc == 2) {
130 doublereal tmpC = U6 + T;
131 doublereal dCdT = - U5/(tmpC * tmpC);
132 doublereal dBdT = - U8/(T * T) + U9;
133 doublereal deps1000dT = eps1000 * (U2 + 2.0 * U3 * T);
134 doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
136 return deps1000dT + dCdT * ltmp + C * dltmpdT;
138 doublereal T3 = T2 * T;
139 doublereal d2CdT2 = - 2.0 * dCdT / tmpC;
140 doublereal d2BdT2 = 2.0 * U8 / (T3);
141 doublereal d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) +
142 dBdT*dBdT*(1.0/(tmpB1000*tmpB1000) - 1.0/(tmpBpar*tmpBpar)));
143 doublereal d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3));
146 doublereal d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT
152 doublereal dltmpdP = 1.0E-5 / tmpBpar;
162 if (psat > P_input) {
168 doublereal epsilon =
epsilon_0 * epsRelWater;
170 doublereal tmp = sqrt(2.0 *
Avogadro * dw / 1000.);
173 doublereal tmp3 = tmp2 * sqrt(tmp2);
174 doublereal A_Debye = tmp * tmp3 / (8.0 *
Pi);
178 if (ifunc == 1 || ifunc == 2) {
179 doublereal dAdT = - 1.5 * A_Debye / T;
181 doublereal depsRelWaterdT =
relEpsilon(T, P, 1);
182 dAdT -= A_Debye * (1.5 * depsRelWaterdT / epsRelWater);
186 doublereal contrib2 = - A_Debye * (0.5 * cte);
197 doublereal d2AdT2 = 1.5 / T * (A_Debye/T - dAdT);
198 doublereal d2epsRelWaterdT2 =
relEpsilon(T, P, 2);
199 d2AdT2 += 1.5 * (- dAdT * depsRelWaterdT / epsRelWater
200 - A_Debye / epsRelWater *
201 (d2epsRelWaterdT2 - depsRelWaterdT * depsRelWaterdT / epsRelWater));
202 doublereal deltaT = -0.1;
203 doublereal Tdel = T + deltaT;
205 doublereal dctedT = (cte_del - cte) / Tdel;
206 doublereal contrib3 = 0.5 * (-(dAdT * cte) -(A_Debye * dctedT));
221 doublereal dAdP = 0.0;
222 doublereal depsRelWaterdP =
relEpsilon(T, P, 3);
223 dAdP -= A_Debye * (1.5 * depsRelWaterdP / epsRelWater);
225 dAdP += A_Debye * (0.5 * kappa);
251 "Unable to solve for density at T = {} and P = {}", temp, press);
260 throw CanteraError(
"WaterProps::isothermalCompressibility_IAPWS",
261 "Unable to solve for density at T = {} and P = {}", temp, press);
Implementation of a pressure dependent standard state virtual function for a Pure Water Phase (see Sp...
Header for a class used to house several approximation routines for properties of water.
Base class for exceptions thrown by Cantera classes.
Class for the liquid water pressure dependent standard state.
WaterPropsIAPWS * getWater()
Get a pointer to a changeable WaterPropsIAPWS object.
Class for calculating the equation of state of water.
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 psat(doublereal temperature, int waterState=WATER_LIQUID)
This function returns the saturation pressure given the temperature as an input parameter,...
doublereal isothermalCompressibility() const
Returns the coefficient of isothermal compressibility for the state of the object.
doublereal ADebye(doublereal T, doublereal P, int ifunc)
ADebye calculates the value of A_Debye as a function of temperature and pressure according to relatio...
WaterPropsIAPWS * m_waterIAPWS
Pointer to the WaterPropsIAPWS object.
doublereal coeffThermalExp_IAPWS(doublereal T, doublereal P)
returns the coefficient of thermal expansion
doublereal density_IAPWS() const
Returns the density of water.
doublereal relEpsilon(doublereal T, doublereal P_pascal, int ifunc=0)
Bradley-Pitzer equation for the dielectric constant of water as a function of temperature and pressur...
doublereal isothermalCompressibility_IAPWS(doublereal T, doublereal P)
Returns the isothermal compressibility of water.
WaterProps()
Default constructor.
static doublereal density_T(doublereal T, doublereal P, int ifunc)
Simple calculation of water density at atmospheric pressure.
bool m_own_sub
true if we own the WaterPropsIAPWS object
doublereal satPressure(doublereal T)
Returns the saturation pressure given the temperature.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
const double Avogadro
Avogadro's Number [number/kmol].
const double epsilon_0
Permittivity of free space [F/m].
const double GasConstant
Universal Gas Constant [J/kmol/K].
const double ElectronCharge
Elementary charge [C].
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.