41WaterProps::~WaterProps()
50 static const double Tc = T - 273.15;
51 static const double U1 = 288.9414;
52 static const double U2 = 508929.2;
53 static const double U3 = 68.12963;
54 static const double U4 = -3.9863;
56 double tmp1 = Tc + U1;
57 double tmp4 = Tc + U4;
58 double t4t4 = tmp4 * tmp4;
59 double tmp3 = Tc + U3;
60 double rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3));
69 }
else if (ifunc == 3) {
71 }
else if (ifunc == 2) {
72 return 2.0 * rhomin / (T * T);
77 double drhodT = 1000./U2 * (
78 - tmp4 * tmp4 / (tmp3)
79 - tmp1 * 2 * tmp4 / (tmp3)
80 + tmp1 * t4t4 / (tmp3*tmp3)
83 }
else if (ifunc == 3) {
85 }
else if (ifunc == 2) {
86 double t3t3 = tmp3 * tmp3;
87 double d2rhodT2 = 1000./U2 *
88 ((-4.0*tmp4-2.0*tmp1)/tmp3 +
89 (2.0*t4t4 + 4.0*tmp1*tmp4)/t3t3
90 - 2.0*tmp1 * t4t4/(t3t3*tmp3));
98 static const double U1 = 3.4279E2;
99 static const double U2 = -5.0866E-3;
100 static const double U3 = 9.4690E-7;
101 static const double U4 = -2.0525;
102 static const double U5 = 3.1159E3;
103 static const double U6 = -1.8289E2;
104 static const double U7 = -8.0325E3;
105 static const double U8 = 4.2142E6;
106 static const double U9 = 2.1417;
109 double eps1000 = U1 * exp(U2 * T + U3 * T2);
110 double C = U4 + U5/(U6 + T);
111 double B = U7 + U8/T + U9 * T;
112 double Pbar = P_pascal * 1.0E-5;
113 double tmpBpar = B + Pbar;
114 double tmpB1000 = B + 1000.0;
115 double ltmp = log(tmpBpar/tmpB1000);
116 double epsRel = eps1000 + C * ltmp;
118 if (ifunc == 1 || ifunc == 2) {
119 double tmpC = U6 + T;
120 double dCdT = - U5/(tmpC * tmpC);
121 double dBdT = - U8/(T * T) + U9;
122 double deps1000dT = eps1000 * (U2 + 2.0 * U3 * T);
123 double dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
125 return deps1000dT + dCdT * ltmp + C * dltmpdT;
128 double d2CdT2 = - 2.0 * dCdT / tmpC;
129 double d2BdT2 = 2.0 * U8 / (T3);
130 double d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) +
131 dBdT*dBdT*(1.0/(tmpB1000*tmpB1000) - 1.0/(tmpBpar*tmpBpar)));
132 double d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3));
135 double d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT
141 double dltmpdP = 1.0E-5 / tmpBpar;
151 if (psat > P_input) {
157 double epsilon =
epsilon_0 * epsRelWater;
159 double tmp = sqrt(2.0 *
Avogadro * dw / 1000.);
162 double tmp3 = tmp2 * sqrt(tmp2);
163 double A_Debye = tmp * tmp3 / (8.0 *
Pi);
167 if (ifunc == 1 || ifunc == 2) {
168 double dAdT = - 1.5 * A_Debye / T;
171 dAdT -= A_Debye * (1.5 * depsRelWaterdT / epsRelWater);
175 double contrib2 = - A_Debye * (0.5 * cte);
186 double d2AdT2 = 1.5 / T * (A_Debye/T - dAdT);
187 double d2epsRelWaterdT2 =
relEpsilon(T, P, 2);
188 d2AdT2 += 1.5 * (- dAdT * depsRelWaterdT / epsRelWater
189 - A_Debye / epsRelWater *
190 (d2epsRelWaterdT2 - depsRelWaterdT * depsRelWaterdT / epsRelWater));
191 double deltaT = -0.1;
192 double Tdel = T + deltaT;
194 double dctedT = (cte_del - cte) / Tdel;
195 double contrib3 = 0.5 * (-(dAdT * cte) -(A_Debye * dctedT));
212 dAdP -= A_Debye * (1.5 * depsRelWaterdP / epsRelWater);
214 dAdP += A_Debye * (0.5 * kappa);
240 "Unable to solve for density at T = {} and P = {}", temp, press);
249 throw CanteraError(
"WaterProps::isothermalCompressibility_IAPWS",
250 "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.
double coeffThermExp() const
Returns the coefficient of thermal expansion.
double density(double temperature, double pressure, int phase=-1, double rhoguess=-1.0)
Calculates the density given the temperature and the pressure, and a guess at the 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 satPressure(double T)
Returns the saturation pressure given the temperature.
double isothermalCompressibility_IAPWS(double T, double P)
Returns the isothermal compressibility of water.
WaterPropsIAPWS * m_waterIAPWS
Pointer to the WaterPropsIAPWS object.
double relEpsilon(double T, double P_pascal, int ifunc=0)
Bradley-Pitzer equation for the dielectric constant of water as a function of temperature and pressur...
double density_IAPWS() const
Returns the density of water.
static double density_T(double T, double P, int ifunc)
Simple calculation of water density at atmospheric pressure.
WaterProps()
Default constructor.
double coeffThermalExp_IAPWS(double T, double P)
returns the coefficient of thermal expansion
double ADebye(double T, double P, int ifunc)
ADebye calculates the value of A_Debye as a function of temperature and pressure according to relatio...
bool m_own_sub
true if we own the WaterPropsIAPWS object
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.