5 using namespace Cantera;
9 static const double Tmn=273.16;
10 static const double Tmx=1600.0;
11 static const double M=18.016;
12 static const double Tc=647.286;
13 static const double Pc=22.089e6;
14 static const double Roc=317.0;
15 static const double To=273.16;
16 static const double R=461.51;
17 static const double E=4.8E-3;
18 static const double Ta=1000.0;
19 static const double tauc=1.544912;
20 static const double Tp=338.15;
21 static const double aww=0.01;
22 static const double Roa1=634.0;
23 static const double Roaj=1000.0;
24 static const double u0=2375470.875;
25 static const double s0=6697.356635;
27 static const double A[10][7]= {{
28 2.9492937E-2,-5.1985860E-3,
29 6.8335354E-3,-1.5641040E-4,
30 -6.3972405E-3, -3.9661401E-3, -6.9048554E-4
33 -1.3213917E-4,7.7779182E-6, -2.6149751E-5,-7.2546108E-7,
34 2.6409282E-5, 1.5453061E-5,2.7407416E-6
37 2.7464632E-7,-3.3301902E-8,6.5326396E-8,-9.2734289E-9,
38 -4.7740374E-8,-2.9142470E-8,-5.1028070E-9
41 -3.6093828E-10, -1.6254622E-11, -2.6181978E-11, 4.3125840E-12,
42 5.6323130E-11, 2.9568796E-11,3.9636085E-12
44 {3.4218431E-13, -1.7731074E-13,0,0,0,0,0},
45 {-2.4450042E-16, 1.2748742E-16,0,0,0,0,0},
46 {1.5518535E-19, 1.3746153E-19,0,0,0,0,0},
47 {5.9728487E-24,1.5597836E-22, 0,0,0,0,0},
49 -4.1030848E-1, 3.3731180E-1, -1.3746678E-1, 6.7874983E-3,
50 1.3687317E-1, 7.984797E-2, 1.3041253E-2
53 -4.1605860E-4, -2.0988866E-4,-7.3396848E-4,1.0401717E-5,
54 6.4581880E-4, 3.9917570E-4, 7.1531353E-5
58 static const double F[]= {-7.4192420, 2.9721E-1,-1.155286E-1,8.685635E-3,
59 1.0940980E-3, -4.39993E-3, 2.5206580E-3, -5.2186840E-4
62 static const double D[]= {3.6711257,-2.8512396E1,2.2265240E2,-8.8243852E2,
63 2.0002765E3,-2.6122557E3,1.8297674E3,-5.3350520E2
66 static const double G[]= {4.6E4,1.011249E3,8.3893E-1,-2.19989E-4,2.466619E-7,
70 static const double taua[] = {1.544912, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5};
72 inline double water::C(
int i)
75 return (i == 0 ? R*T : R*T*(tau - tauc)*pow(tau - taua[i],i-1));
78 inline double water::Cprime(
int i)
81 return (i == 0 ? R : (i == 1 ? -R*tauc :
82 -R*pow(tau - taua[i],i-2)*(tauc*(tau - taua[i])
83 + (i-1)*tau*(tau - tauc))));
86 inline double water::I(
int j)
88 double factor, sum, rho_aj;
89 rho_aj = (j == 0 ? Roa1 : Roaj);
91 factor = Rho - rho_aj;
92 for (
int i=7; i>0; i--) {
97 sum += (exp(-E*Rho)*(A[8][j] + A[9][j]*Rho));
101 inline double water::H(
int j)
103 double factor, sum, rho_aj;
104 rho_aj = (j == 0 ? Roa1 : Roaj);
106 factor = Rho - rho_aj;
107 for (
int i=6; i>0; i--) {
108 sum += (A[i][j] + Rho*(i+1)*A[i+1][j]);
111 sum += (A[0][j] + Rho*A[1][j]);
112 sum += (exp(-E*Rho)*((1.0 - Rho*E)*A[8][j]
113 + Rho*(2.0 - Rho*E)*A[9][j]));
114 sum += A[7][j]*pow(factor,7);
122 for (i=0; i<7; i++) {
123 sum += (C(i) - T*Cprime(i))*I(i);
125 for (i=1; i<6; i++) {
126 sum += G[i]*(pow(T,i) - pow(To,i))/
double(i);
128 sum += G[0]*log(T/To) + u0;
129 return sum + m_energy_offset;
136 for (i=2; i<6; i++) {
137 sum += G[i]*(pow(T,i-1) - pow(To,i-1))/
double(i-1);
139 sum += G[1]*log(T/To);
140 sum -= G[0]*(1.0/T - 1.0/To);
141 sum += s0 - R*log(Rho);
142 for (i=0; i<7; i++) {
143 sum -= Cprime(i)*I(i);
145 return sum + m_entropy_offset;
151 for (
int i=0; i<7; i++) {
160 if ((T < Tmn) || (T > Tc)) {
161 throw TPX_Error(
"water::Psat",
162 "Temperature out of range. T = " +
fp2str(T));
164 for (
int i=1; i<=8; i++) {
165 sum += F[i-1]*pow(aww*(T-Tp),
double(i-1));
171 double water::ldens()
175 if ((T < Tmn) || (T >= Tc)) {
176 throw TPX_Error(
"water::ldens",
177 "Temperature out of range. T = " +
fp2str(T));
179 for (i=0; i<8; i++) {
180 sum+=D[i]*pow(1.0 - T/Tc,
double(i+1)/3.0);
185 double water::Tcrit()
189 double water::Pcrit()
193 double water::Vcrit()
205 double water::MolWt()
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Contains declarations for string manipulation functions within Cantera.