132 doublereal Tc = T - 273.15;
133 const doublereal U1 = 288.9414;
134 const doublereal U2 = 508929.2;
135 const doublereal U3 = 68.12963;
136 const doublereal U4 = -3.9863;
138 doublereal tmp1 = Tc + U1;
139 doublereal tmp4 = Tc + U4;
140 doublereal t4t4 = tmp4 * tmp4;
141 doublereal tmp3 = Tc + U3;
142 doublereal rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3));
153 doublereal drhodT = - rhomin / T;
155 }
else if (ifunc == 3) {
156 doublereal drhodP = rhomin / P;
158 }
else if (ifunc == 2) {
159 doublereal d2rhodT2 = 2.0 * rhomin / (T * T);
165 doublereal drhodT = 1000./U2 * (
166 - tmp4 * tmp4 / (tmp3)
167 - tmp1 * 2 * tmp4 / (tmp3)
168 + tmp1 * t4t4 / (tmp3*tmp3)
171 }
else if (ifunc == 3) {
173 }
else if (ifunc == 2) {
174 doublereal t3t3 = tmp3 * tmp3;
175 doublereal d2rhodT2 = 1000./U2 *
176 ((-4.0*tmp4-2.0*tmp1)/tmp3 +
177 (2.0*t4t4 + 4.0*tmp1*tmp4)/t3t3
178 - 2.0*tmp1 * t4t4/(t3t3*tmp3));
219 const doublereal U1 = 3.4279E2;
220 const doublereal U2 = -5.0866E-3;
221 const doublereal U3 = 9.4690E-7;
222 const doublereal U4 = -2.0525;
223 const doublereal U5 = 3.1159E3;
224 const doublereal U6 = -1.8289E2;
225 const doublereal U7 = -8.0325E3;
226 const doublereal U8 = 4.2142E6;
227 const doublereal U9 = 2.1417;
228 doublereal T2 = T * T;
230 doublereal eps1000 = U1 * exp(U2 * T + U3 * T2);
231 doublereal C = U4 + U5/(U6 + T);
232 doublereal B = U7 + U8/T + U9 * T;
234 doublereal Pbar = P_pascal * 1.0E-5;
235 doublereal tmpBpar = B + Pbar;
236 doublereal tmpB1000 = B + 1000.0;
237 doublereal ltmp = log(tmpBpar/tmpB1000);
238 doublereal epsRel = eps1000 + C * ltmp;
240 if (ifunc == 1 || ifunc == 2) {
241 doublereal tmpC = U6 + T;
242 doublereal dCdT = - U5/(tmpC * tmpC);
244 doublereal dBdT = - U8/(T * T) + U9;
246 doublereal deps1000dT = eps1000 * (U2 + 2.0 * U3 * T);
248 doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
250 doublereal depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT;
253 doublereal T3 = T2 * T;
254 doublereal d2CdT2 = - 2.0 * dCdT / tmpC;
255 doublereal d2BdT2 = 2.0 * U8 / (T3);
257 doublereal d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) +
258 dBdT*dBdT*(1.0/(tmpB1000*tmpB1000) - 1.0/(tmpBpar*tmpBpar)));
260 doublereal d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3));
263 doublereal d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT
269 doublereal dltmpdP = 1.0E-5 / tmpBpar;
270 doublereal depsReldP = C * dltmpdP;
282 if (psat > P_input) {
293 doublereal epsilon =
epsilon_0 * epsRelWater;
295 doublereal tmp = sqrt(2.0 *
Avogadro * dw / 1000.);
296 doublereal tmp2 = ElectronCharge * ElectronCharge *
Avogadro /
298 doublereal tmp3 = tmp2 * sqrt(tmp2);
299 doublereal A_Debye = tmp * tmp3 / (8.0 *
Pi);
307 if (ifunc == 1 || ifunc == 2) {
308 doublereal dAdT = - 1.5 * A_Debye / T;
310 doublereal depsRelWaterdT =
relEpsilon(T, P, 1);
311 dAdT -= A_Debye * (1.5 * depsRelWaterdT / epsRelWater);
321 doublereal contrib2 = - A_Debye * (0.5 * cte);
341 doublereal d2AdT2 = 1.5 / T * (A_Debye/T - dAdT);
343 doublereal d2epsRelWaterdT2 =
relEpsilon(T, P, 2);
352 d2AdT2 += 1.5 * (- dAdT * depsRelWaterdT / epsRelWater
353 - A_Debye / epsRelWater *
354 (d2epsRelWaterdT2 - depsRelWaterdT * depsRelWaterdT / epsRelWater));
356 doublereal deltaT = -0.1;
357 doublereal Tdel = T + deltaT;
359 doublereal dctedT = (cte_del - cte) / Tdel;
364 doublereal contrib3 = 0.5 * (-(dAdT * cte) -(A_Debye * dctedT));
384 doublereal dAdP = 0.0;
386 doublereal depsRelWaterdP =
relEpsilon(T, P, 3);
387 dAdP -= A_Debye * (1.5 * depsRelWaterdP / epsRelWater);
392 dAdP += A_Debye * (0.5 * kappa);
436 "Unable to solve for density at T = " +
fp2str(temp) +
" and P = " +
fp2str(press));
446 throw CanteraError(
"WaterProps::isothermalCompressibility_IAPWS",
447 "Unable to solve for density at T = " +
fp2str(temp) +
" and P = " +
fp2str(press));
460 const doublereal H[4] = {1.,
466 const doublereal Hij[6][7] = {
467 { 0.5132047, 0.2151778, -0.2818107, 0.1778064, -0.04176610, 0., 0.},
468 { 0.3205656, 0.7317883, -1.070786 , 0.4605040, 0., -0.01578386, 0.},
469 { 0., 1.241044 , -1.263184 , 0.2340379, 0., 0., 0.},
470 { 0., 1.476783 , 0., -0.4924179, 0.1600435, 0., -0.003629481},
471 {-0.7782567, 0.0 , 0., 0. , 0., 0., 0.},
472 { 0.1885447, 0.0 , 0., 0. , 0., 0., 0.},
474 const doublereal TStar = 647.27;
475 const doublereal rhoStar = 317.763;
476 const doublereal presStar = 22.115E6;
477 const doublereal muStar = 55.071E-6;
509 doublereal rhobar = dens/rhoStar;
510 doublereal tbar = temp / TStar;
513 doublereal tbar2 = tbar * tbar;
514 doublereal tbar3 = tbar2 * tbar;
516 doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
521 doublereal tfac1 = 1.0 / tbar - 1.0;
522 doublereal tfac2 = tfac1 * tfac1;
523 doublereal tfac3 = tfac2 * tfac1;
524 doublereal tfac4 = tfac3 * tfac1;
525 doublereal tfac5 = tfac4 * tfac1;
527 doublereal rfac1 = rhobar - 1.0;
528 doublereal rfac2 = rfac1 * rfac1;
529 doublereal rfac3 = rfac2 * rfac1;
530 doublereal rfac4 = rfac3 * rfac1;
531 doublereal rfac5 = rfac4 * rfac1;
532 doublereal rfac6 = rfac5 * rfac1;
534 doublereal sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
535 Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
536 Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 +
537 Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 +
538 Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
539 Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6
541 doublereal mu1bar = std::exp(rhobar * sum);
544 doublereal mu2bar = 1.0;
545 if ((tbar >= 0.9970) && tbar <= 1.0082) {
546 if ((rhobar >= 0.755) && (rhobar <= 1.290)) {
548 drhodp *= presStar / rhoStar;
549 doublereal xsi = rhobar * drhodp;
551 mu2bar = 0.922 * std::pow(xsi, 0.0263);
556 doublereal mubar = mu0bar * mu1bar * mu2bar;
558 return mubar * muStar;
578 static const doublereal Tstar = 647.27;
579 static const doublereal rhostar = 317.763;
580 static const doublereal lambdastar = 0.4945;
581 static const doublereal presstar = 22.115E6;
582 static const doublereal L[4] = {
588 static const doublereal Lji[6][5] = {
589 { 1.3293046, 1.7018363, 5.2246158, 8.7127675, -1.8525999},
590 {-0.40452437, -2.2156845, -10.124111, -9.5000611, 0.93404690},
591 { 0.24409490, 1.6511057, 4.9874687, 4.3786606, 0.0},
592 { 0.018660751, -0.76736002, -0.27297694, -0.91783782, 0.0},
593 {-0.12961068, 0.37283344, -0.43083393, 0.0, 0.0},
594 { 0.044809953, -0.11203160, 0.13333849, 0.0, 0.0},
600 doublereal rhobar = dens/rhostar;
601 doublereal tbar = temp / Tstar;
602 doublereal tbar2 = tbar * tbar;
603 doublereal tbar3 = tbar2 * tbar;
604 doublereal lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3);
608 doublereal tfac1 = 1.0 / tbar - 1.0;
609 doublereal tfac2 = tfac1 * tfac1;
610 doublereal tfac3 = tfac2 * tfac1;
611 doublereal tfac4 = tfac3 * tfac1;
613 doublereal rfac1 = rhobar - 1.0;
614 doublereal rfac2 = rfac1 * rfac1;
615 doublereal rfac3 = rfac2 * rfac1;
616 doublereal rfac4 = rfac3 * rfac1;
617 doublereal rfac5 = rfac4 * rfac1;
619 doublereal sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 +
620 Lji[1][0]*rfac1 + Lji[1][1]*tfac1*rfac1 + Lji[1][2]*tfac2*rfac1 + Lji[1][3]*tfac3*rfac1 + Lji[1][4]*tfac4*rfac1 +
621 Lji[2][0]*rfac2 + Lji[2][1]*tfac1*rfac2 + Lji[2][2]*tfac2*rfac2 + Lji[2][3]*tfac3*rfac2 +
622 Lji[3][0]*rfac3 + Lji[3][1]*tfac1*rfac3 + Lji[3][2]*tfac2*rfac3 + Lji[3][3]*tfac3*rfac3 +
623 Lji[4][0]*rfac4 + Lji[4][1]*tfac1*rfac4 + Lji[4][2]*tfac2*rfac4 +
624 Lji[5][0]*rfac5 + Lji[5][1]*tfac1*rfac5 + Lji[5][2]*tfac2*rfac5
626 doublereal lambda1bar = exp(rhobar * sum);
628 doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
630 doublereal tfac5 = tfac4 * tfac1;
631 doublereal rfac6 = rfac5 * rfac1;
633 sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
634 Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
635 Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 +
636 Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 +
637 Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
638 Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6
640 doublereal mu1bar = std::exp(rhobar * sum);
642 doublereal t2r2 = tbar * tbar / (rhobar * rhobar);
644 drhodp *= presStar / rhoStar;
645 doublereal xsi = rhobar * drhodp;
646 doublereal xsipow = std::pow(xsi, 0.4678);
647 doublereal rho1 = rhobar - 1.;
648 doublereal rho2 = rho1 * rho1;
649 doublereal rho4 = rho2 * rho2;
650 doublereal temp2 = (tbar - 1.0) * (tbar - 1.0);
662 doublereal dpdT_const_rho = beta *
GasConstant * dens / 18.015268;
663 dpdT_const_rho *= Tstar / presstar;
665 doublereal lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho *
666 xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rho4);
668 doublereal lambda = (lambda0bar * lambda1bar + lambda2bar) * lambdastar;