Cantera  2.1.2
WaterPropsIAPWS.cpp
Go to the documentation of this file.
1 /**
2  * @file WaterPropsIAPWS.cpp
3  * Definitions for a class for calculating the equation of state of water
4  * from the IAPWS 1995 Formulation based on the steam tables thermodynamic
5  * basis (See class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink).
6  */
7 /*
8  * Copyright (2006) Sandia Corporation. Under the terms of
9  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
10  * U.S. Government retains certain rights in this software.
11  */
15 
16 namespace Cantera
17 {
18 /*
19  * Critical Point values of water in mks units
20  */
21 //! Critical Temperature value (kelvin)
22 const doublereal T_c = 647.096;
23 //! Critical Pressure (Pascals)
24 static const doublereal P_c = 22.064E6;
25 //! Value of the Density at the critical point (kg m-3)
26 const doublereal Rho_c = 322.;
27 //! Molecular Weight of water that is consistent with the paper (kg kmol-1)
28 static const doublereal M_water = 18.015268;
29 
30 //! Gas constant that is quoted in the paper
31 /*
32  * Note, this is the Rgas value quoted in the paper. For consistency
33  * we have to use that value and not the updated value
34  *
35  * The Ratio of R/M = 0.46151805 kJ kg-1 K-1 , which is Eqn. (6.3) in the paper.
36  */
37 static const doublereal Rgas = 8.314371E3; // Joules kmol-1 K-1
38 
39 // Base constructor
41  m_phi(0),
42  tau(-1.0),
43  delta(-1.0),
44  iState(-30000)
45 {
46  m_phi = new WaterPropsIAPWSphi();
47 }
48 
50  m_phi(0),
51  tau(b.tau),
52  delta(b.delta),
53  iState(b.iState)
54 {
55  m_phi = new WaterPropsIAPWSphi();
57 }
58 
60 {
61  if (this == &b) {
62  return *this;
63  }
64  tau = b.tau;
65  delta = b.delta;
66  iState = b.iState;
68  return *this;
69 }
70 
72 {
73  delete m_phi;
74  m_phi = 0;
75 }
76 
77 void WaterPropsIAPWS::calcDim(doublereal temperature, doublereal rho)
78 {
79  tau = T_c / temperature;
80  delta = rho / Rho_c;
81  /*
82  * Determine the internal state
83  */
84  if (temperature > T_c) {
85  iState = WATER_SUPERCRIT;
86  } else {
87  if (delta < 1.0) {
88  iState = WATER_GAS;
89  } else {
90  iState = WATER_LIQUID;
91  }
92  }
93 }
94 
95 doublereal WaterPropsIAPWS::helmholtzFE() const
96 {
97  doublereal retn = m_phi->phi(tau, delta);
98  doublereal temperature = T_c/tau;
99  doublereal RT = Rgas * temperature;
100  return retn * RT;
101 }
102 
103 doublereal WaterPropsIAPWS::pressure() const
104 {
105  doublereal retn = m_phi->pressureM_rhoRT(tau, delta);
106  doublereal rho = delta * Rho_c;
107  doublereal temperature = T_c / tau;
108  return retn * rho * Rgas * temperature/M_water;
109 }
110 
111 doublereal WaterPropsIAPWS::density(doublereal temperature, doublereal pressure,
112  int phase, doublereal rhoguess)
113 {
114  doublereal deltaGuess = 0.0;
115  if (rhoguess == -1.0) {
116  if (phase != -1) {
117  if (temperature > T_c) {
118  rhoguess = pressure * M_water / (Rgas * temperature);
119  } else {
120  if (phase == WATER_GAS || phase == WATER_SUPERCRIT) {
121  rhoguess = pressure * M_water / (Rgas * temperature);
122  } else if (phase == WATER_LIQUID) {
123  /*
124  * Provide a guess about the liquid density that is
125  * relatively high -> convergence from above seems robust.
126  */
127  rhoguess = 1000.;
128  } else if (phase == WATER_UNSTABLELIQUID || phase == WATER_UNSTABLEGAS) {
129  throw Cantera::CanteraError("WaterPropsIAPWS::density",
130  "Unstable Branch finder is untested");
131  } else {
132  throw Cantera::CanteraError("WaterPropsIAPWS::density",
133  "unknown state: " + Cantera::int2str(phase));
134  }
135  }
136  } else {
137  /*
138  * Assume the Gas phase initial guess, if nothing is
139  * specified to the routine
140  */
141  rhoguess = pressure * M_water / (Rgas * temperature);
142  }
143 
144  }
145  doublereal p_red = pressure * M_water / (Rgas * temperature * Rho_c);
146  deltaGuess = rhoguess / Rho_c;
147  setState_TR(temperature, rhoguess);
148  doublereal delta_retn = m_phi->dfind(p_red, tau, deltaGuess);
149  doublereal density_retn;
150  if (delta_retn >0.0) {
151  delta = delta_retn;
152 
153  /*
154  * Dimensionalize the density before returning
155  */
156  density_retn = delta_retn * Rho_c;
157  /*
158  * Set the internal state -> this may be
159  * a duplication. However, let's just be sure.
160  */
161  setState_TR(temperature, density_retn);
162 
163 
164  } else {
165  density_retn = -1.0;
166  }
167  return density_retn;
168 }
169 
170 doublereal WaterPropsIAPWS::density_const(doublereal pressure,
171  int phase, doublereal rhoguess) const
172 {
173  doublereal temperature = T_c / tau;
174  doublereal deltaGuess = 0.0;
175  doublereal deltaSave = delta;
176  if (rhoguess == -1.0) {
177  if (phase != -1) {
178  if (temperature > T_c) {
179  rhoguess = pressure * M_water / (Rgas * temperature);
180  } else {
181  if (phase == WATER_GAS || phase == WATER_SUPERCRIT) {
182  rhoguess = pressure * M_water / (Rgas * temperature);
183  } else if (phase == WATER_LIQUID) {
184  /*
185  * Provide a guess about the liquid density that is
186  * relatively high -> convergence from above seems robust.
187  */
188  rhoguess = 1000.;
189  } else if (phase == WATER_UNSTABLELIQUID || phase == WATER_UNSTABLEGAS) {
190  throw Cantera::CanteraError("WaterPropsIAPWS::density",
191  "Unstable Branch finder is untested");
192  } else {
193  throw Cantera::CanteraError("WaterPropsIAPWS::density",
194  "unknown state: " + Cantera::int2str(phase));
195  }
196  }
197  } else {
198  /*
199  * Assume the Gas phase initial guess, if nothing is
200  * specified to the routine
201  */
202  rhoguess = pressure * M_water / (Rgas * temperature);
203  }
204 
205  }
206  doublereal p_red = pressure * M_water / (Rgas * temperature * Rho_c);
207  deltaGuess = rhoguess / Rho_c;
208 
209  delta = deltaGuess;
211  // setState_TR(temperature, rhoguess);
212 
213  doublereal delta_retn = m_phi->dfind(p_red, tau, deltaGuess);
214  doublereal density_retn;
215  if (delta_retn > 0.0) {
216  delta = delta_retn;
217 
218  /*
219  * Dimensionalize the density before returning
220  */
221  density_retn = delta_retn * Rho_c;
222 
223  } else {
224  density_retn = -1.0;
225  }
226 
227  delta = deltaSave;
229  return density_retn;
230 }
231 
232 doublereal WaterPropsIAPWS::density() const
233 {
234  return delta * Rho_c;
235 }
236 
238 {
239  return T_c / tau;
240 }
241 
242 doublereal WaterPropsIAPWS::psat_est(doublereal temperature) const
243 {
244  static const doublereal A[8] = {
245  -7.8889166E0,
246  2.5514255E0,
247  -6.716169E0,
248  33.2239495E0,
249  -105.38479E0,
250  174.35319E0,
251  -148.39348E0,
252  48.631602E0
253  };
254  doublereal ps;
255  if (temperature < 314.) {
256  doublereal pl = 6.3573118E0 - 8858.843E0 / temperature
257  + 607.56335E0 * pow(temperature, -0.6);
258  ps = 0.1 * exp(pl);
259  } else {
260  doublereal v = temperature / 647.25;
261  doublereal w = fabs(1.0-v);
262  doublereal b = 0.0;
263  for (int i = 0; i < 8; i++) {
264  doublereal z = i + 1;
265  b += A[i] * pow(w, ((z+1.0)/2.0));
266  }
267  doublereal q = b / v;
268  ps = 22.093*exp(q);
269  }
270  /*
271  * Original correlation was in cgs. Convert to mks
272  */
273  ps *= 1.0E6;
274  return ps;
275 }
276 
278 {
279  doublereal dpdrho_val = dpdrho();
280  doublereal dens = delta * Rho_c;
281  return 1.0 / (dens * dpdrho_val);
282 }
283 
284 doublereal WaterPropsIAPWS::dpdrho() const
285 {
286  doublereal retn = m_phi->dimdpdrho(tau, delta);
287  doublereal temperature = T_c/tau;
288  return retn * Rgas * temperature / M_water;
289 }
290 
292 {
293  return m_phi->dimdpdT(tau, delta);
294 }
295 
297 {
298  doublereal kappa = isothermalCompressibility();
299  doublereal beta = coeffPresExp();
300  doublereal dens = delta * Rho_c;
301  return kappa * dens * Rgas * beta / M_water;
302 }
303 
304 doublereal WaterPropsIAPWS::Gibbs() const
305 {
306  doublereal gRT = m_phi->gibbs_RT();
307  doublereal temperature = T_c/tau;
308  return gRT * Rgas * temperature;
309 }
310 
312 corr(doublereal temperature, doublereal pressure, doublereal& densLiq,
313  doublereal& densGas, doublereal& delGRT)
314 {
315 
316  densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
317  if (densLiq <= 0.0) {
318  throw Cantera::CanteraError("WaterPropsIAPWS::corr",
319  "Error occurred trying to find liquid density at (T,P) = "
320  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
321  }
322  setState_TR(temperature, densLiq);
323  doublereal gibbsLiqRT = m_phi->gibbs_RT();
324 
325  densGas = density(temperature, pressure, WATER_GAS, densGas);
326  if (densGas <= 0.0) {
327  throw Cantera::CanteraError("WaterPropsIAPWS::corr",
328  "Error occurred trying to find gas density at (T,P) = "
329  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
330  }
331  setState_TR(temperature, densGas);
332  doublereal gibbsGasRT = m_phi->gibbs_RT();
333 
334  delGRT = gibbsLiqRT - gibbsGasRT;
335 }
336 
338 corr1(doublereal temperature, doublereal pressure, doublereal& densLiq,
339  doublereal& densGas, doublereal& pcorr)
340 {
341 
342  densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
343  if (densLiq <= 0.0) {
344  throw Cantera::CanteraError("WaterPropsIAPWS::corr1",
345  "Error occurred trying to find liquid density at (T,P) = "
346  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
347  }
348  setState_TR(temperature, densLiq);
349  doublereal prL = m_phi->phiR();
350 
351  densGas = density(temperature, pressure, WATER_GAS, densGas);
352  if (densGas <= 0.0) {
353  throw Cantera::CanteraError("WaterPropsIAPWS::corr1",
354  "Error occurred trying to find gas density at (T,P) = "
355  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
356  }
357  setState_TR(temperature, densGas);
358  doublereal prG = m_phi->phiR();
359 
360  doublereal rhs = (prL - prG) + log(densLiq/densGas);
361  rhs /= (1.0/densGas - 1.0/densLiq);
362 
363  pcorr = rhs * Rgas * temperature / M_water;
364 }
365 
366 doublereal WaterPropsIAPWS::psat(doublereal temperature, int waterState)
367 {
368  static int method = 1;
369  doublereal densLiq = -1.0, densGas = -1.0, delGRT = 0.0;
370  doublereal dp, pcorr;
371  if (temperature >= T_c) {
372  densGas = density(temperature, P_c, WATER_SUPERCRIT);
373  setState_TR(temperature, densGas);
374  return P_c;
375  }
376  doublereal p = psat_est(temperature);
377  for (int i = 0; i < 30; i++) {
378  if (method == 1) {
379  corr(temperature, p, densLiq, densGas, delGRT);
380  doublereal delV = M_water * (1.0/densLiq - 1.0/densGas);
381  dp = - delGRT * Rgas * temperature / delV;
382  } else {
383  corr1(temperature, p, densLiq, densGas, pcorr);
384  dp = pcorr - p;
385  }
386  p += dp;
387 
388  if ((method == 1) && delGRT < 1.0E-8) {
389  break;
390  } else {
391  if (fabs(dp/p) < 1.0E-9) {
392  break;
393  }
394  }
395  }
396  // Put the fluid in the desired end condition
397  if (waterState == WATER_LIQUID) {
398  setState_TR(temperature, densLiq);
399  } else if (waterState == WATER_GAS) {
400  setState_TR(temperature, densGas);
401  } else {
402  throw Cantera::CanteraError("WaterPropsIAPWS::psat",
403  "unknown water state input: " + Cantera::int2str(waterState));
404  }
405  return p;
406 }
407 
408 int WaterPropsIAPWS::phaseState(bool checkState) const
409 {
410  if (checkState) {
411  if (tau <= 1.0) {
412  iState = WATER_SUPERCRIT;
413  } else {
414  doublereal T = T_c / tau;
415  doublereal rho = delta * Rho_c;
416  //doublereal psatTable = psat_est(T);
417  doublereal rhoMidAtm = 0.5 * (OneAtm * M_water / (Rgas * 373.15) + 1.0E3);
418  doublereal rhoMid = Rho_c + (T - T_c) * (Rho_c - rhoMidAtm) / (T_c - 373.15);
419  int iStateGuess = WATER_LIQUID;
420  if (rho < rhoMid) {
421  iStateGuess = WATER_GAS;
422  }
423  doublereal kappa = isothermalCompressibility();
424  if (kappa >= 0.0) {
425  iState = iStateGuess;
426  } else {
427  // When we are here we are between the spinodal curves
428  doublereal rhoDel = rho * 1.000001;
429 
430  //setState_TR(T, rhoDel);
431  doublereal deltaSave = delta;
432  doublereal deltaDel = rhoDel / Rho_c;
433  delta = deltaDel;
434  m_phi->tdpolycalc(tau, deltaDel);
435 
436  doublereal kappaDel = isothermalCompressibility();
437  doublereal d2rhodp2 = (rhoDel * kappaDel - rho * kappa) / (rhoDel - rho);
438  if (d2rhodp2 > 0.0) {
439  iState = WATER_UNSTABLELIQUID;
440  } else {
441  iState = WATER_UNSTABLEGAS;
442  }
443  //setState_TR(T, rho);
444  delta = deltaSave;
445 
447  }
448  }
449  }
450  return iState;
451 }
452 
454 {
455  doublereal temperature = T_c/tau;
456  doublereal delta_save = delta;
457  // return the critical density if we are above or even just a little below
458  // the critical temperature. We just don't want to worry about the critical
459  // point at this juncture.
460  if (temperature >= T_c - 0.001) {
461  return Rho_c;
462  }
463  doublereal p = psat_est(temperature);
464  doublereal rho_low = 0.0;
465  doublereal rho_high = 1000;
466 
467  doublereal densSatLiq = density_const(p, WATER_LIQUID);
468  doublereal dens_old = densSatLiq;
469  delta = dens_old / Rho_c;
471  doublereal dpdrho_old = dpdrho();
472  if (dpdrho_old > 0.0) {
473  rho_high = std::min(dens_old, rho_high);
474  } else {
475  rho_low = std::max(rho_low, dens_old);
476  }
477  doublereal dens_new = densSatLiq* (1.0001);
478  delta = dens_new / Rho_c;
480  doublereal dpdrho_new = dpdrho();
481  if (dpdrho_new > 0.0) {
482  rho_high = std::min(dens_new, rho_high);
483  } else {
484  rho_low = std::max(rho_low, dens_new);
485  }
486  bool conv = false;
487 
488  for (int it = 0; it < 50; it++) {
489  doublereal slope = (dpdrho_new - dpdrho_old)/(dens_new - dens_old);
490  if (slope >= 0.0) {
491  slope = std::max(slope, dpdrho_new *5.0/ dens_new);
492  } else {
493  slope = -dpdrho_new;
494  //slope = MIN(slope, dpdrho_new *5.0 / dens_new);
495  // shouldn't be here for liquid spinodal
496  }
497  doublereal delta_rho = - dpdrho_new / slope;
498  if (delta_rho > 0.0) {
499  delta_rho = std::min(delta_rho, dens_new * 0.1);
500  } else {
501  delta_rho = std::max(delta_rho, - dens_new * 0.1);
502  }
503  doublereal dens_est = dens_new + delta_rho;
504  if (dens_est < rho_low) {
505  dens_est = 0.5 * (rho_low + dens_new);
506  }
507  if (dens_est > rho_high) {
508  dens_est = 0.5 * (rho_high + dens_new);
509  }
510 
511 
512  dens_old = dens_new;
513  dpdrho_old = dpdrho_new;
514  dens_new = dens_est;
515 
516  delta = dens_new / Rho_c;
518  dpdrho_new = dpdrho();
519  if (dpdrho_new > 0.0) {
520  rho_high = std::min(dens_new, rho_high);
521  } else if (dpdrho_new < 0.0) {
522  rho_low = std::max(rho_low, dens_new);
523  } else {
524  conv = true;
525  break;
526  }
527 
528  if (fabs(dpdrho_new) < 1.0E-5) {
529  conv = true;
530  break;
531  }
532  }
533 
534  if (!conv) {
535  throw Cantera::CanteraError(" WaterPropsIAPWS::densSpinodalWater()",
536  " convergence failure");
537  }
538  // Restore the original delta
539  delta = delta_save;
541 
542  return dens_new;
543 }
544 
546 {
547  doublereal temperature = T_c/tau;
548  doublereal delta_save = delta;
549  // return the critical density if we are above or even just a little below
550  // the critical temperature. We just don't want to worry about the critical
551  // point at this juncture.
552  if (temperature >= T_c - 0.001) {
553  return Rho_c;
554  }
555  doublereal p = psat_est(temperature);
556  doublereal rho_low = 0.0;
557  doublereal rho_high = 1000;
558 
559  doublereal densSatGas = density_const(p, WATER_GAS);
560  doublereal dens_old = densSatGas;
561  delta = dens_old / Rho_c;
563  doublereal dpdrho_old = dpdrho();
564  if (dpdrho_old < 0.0) {
565  rho_high = std::min(dens_old, rho_high);
566  } else {
567  rho_low = std::max(rho_low, dens_old);
568  }
569  doublereal dens_new = densSatGas * (0.99);
570  delta = dens_new / Rho_c;
572  doublereal dpdrho_new = dpdrho();
573  if (dpdrho_new < 0.0) {
574  rho_high = std::min(dens_new, rho_high);
575  } else {
576  rho_low = std::max(rho_low, dens_new);
577  }
578  bool conv = false;
579 
580  for (int it = 0; it < 50; it++) {
581  doublereal slope = (dpdrho_new - dpdrho_old)/(dens_new - dens_old);
582  if (slope >= 0.0) {
583  slope = dpdrho_new;
584  //slope = MAX(slope, dpdrho_new *5.0/ dens_new);
585  // shouldn't be here for gas spinodal
586  } else {
587  //slope = -dpdrho_new;
588  slope = std::min(slope, dpdrho_new *5.0 / dens_new);
589 
590  }
591  doublereal delta_rho = - dpdrho_new / slope;
592  if (delta_rho > 0.0) {
593  delta_rho = std::min(delta_rho, dens_new * 0.1);
594  } else {
595  delta_rho = std::max(delta_rho, - dens_new * 0.1);
596  }
597  doublereal dens_est = dens_new + delta_rho;
598  if (dens_est < rho_low) {
599  dens_est = 0.5 * (rho_low + dens_new);
600  }
601  if (dens_est > rho_high) {
602  dens_est = 0.5 * (rho_high + dens_new);
603  }
604 
605 
606  dens_old = dens_new;
607  dpdrho_old = dpdrho_new;
608  dens_new = dens_est;
609 
610  delta = dens_new / Rho_c;
612  dpdrho_new = dpdrho();
613  if (dpdrho_new < 0.0) {
614  rho_high = std::min(dens_new, rho_high);
615  } else if (dpdrho_new > 0.0) {
616  rho_low = std::max(rho_low, dens_new);
617  } else {
618  conv = true;
619  break;
620  }
621 
622  if (fabs(dpdrho_new) < 1.0E-5) {
623  conv = true;
624  break;
625  }
626  }
627 
628  if (!conv) {
629  throw Cantera::CanteraError(" WaterPropsIAPWS::densSpinodalSteam()",
630  " convergence failure");
631  }
632  // Restore the original delta
633  delta = delta_save;
635 
636  return dens_new;
637 }
638 
639 void WaterPropsIAPWS::setState_TR(doublereal temperature, doublereal rho)
640 {
641  calcDim(temperature, rho);
643 }
644 
645 doublereal WaterPropsIAPWS::enthalpy() const
646 {
647  doublereal temperature = T_c/tau;
648  doublereal hRT = m_phi->enthalpy_RT();
649  return hRT * Rgas * temperature;
650 }
651 
652 doublereal WaterPropsIAPWS::intEnergy() const
653 {
654  doublereal temperature = T_c / tau;
655  doublereal uRT = m_phi->intEnergy_RT();
656  return uRT * Rgas * temperature;
657 }
658 
659 doublereal WaterPropsIAPWS::entropy() const
660 {
661  doublereal sR = m_phi->entropy_R();
662  return sR * Rgas;
663 }
664 
665 doublereal WaterPropsIAPWS::cv() const
666 {
667  doublereal cvR = m_phi->cv_R();
668  return cvR * Rgas;
669 }
670 
671 doublereal WaterPropsIAPWS::cp() const
672 {
673  doublereal cpR = m_phi->cp_R();
674  return cpR * Rgas;
675 }
676 
678 {
679  doublereal rho = delta * Rho_c;
680  return M_water / rho;
681 }
682 
683 }
doublereal densSpinodalSteam() const
Return the value of the density at the water spinodal point (on the gas side) for the current tempera...
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
Definition: stringUtils.cpp:40
doublereal isothermalCompressibility() const
Returns the coefficient of isothermal compressibility for the state of the object.
doublereal psat_est(doublereal temperature) const
This function returns an estimated value for the saturation pressure.
doublereal delta
Dimensionless density.
const doublereal OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:71
void setState_TR(doublereal temperature, doublereal rho)
Set the internal state of the object wrt temperature and density.
doublereal cv() const
Calculate the constant volume heat capacity in mks units of J kmol-1 K-1 at the last temperature and ...
doublereal gibbs_RT() const
Calculate the dimensionless gibbs free energy.
int phaseState(bool checkState=false) const
Returns the Phase State flag for the current state of the object.
Class for calculating the equation of state of water.
doublereal density_const(doublereal pressure, int phase=-1, doublereal rhoguess=-1.0) const
Calculates the density given the temperature and the pressure, and a guess at the density...
doublereal entropy_R() const
Calculate the dimensionless entropy, s/R.
WaterPropsIAPWS()
Base constructor.
const doublereal Rho_c
Value of the Density at the critical point (kg m-3)
doublereal Gibbs() const
Calculate the Gibbs free energy in mks units of J kmol-1 K-1.
doublereal density() const
Returns the density (kg m-3)
void corr(doublereal temperature, doublereal pressure, doublereal &densLiq, doublereal &densGas, doublereal &delGRT)
Utility routine in the calculation of the saturation pressure.
doublereal coeffThermExp() const
Returns the coefficient of thermal expansion.
doublereal densSpinodalWater() const
Return the value of the density at the water spinodal point (on the liquid side) for the current temp...
static const doublereal P_c
Critical Pressure (Pascals)
WaterPropsIAPWS & operator=(const WaterPropsIAPWS &right)
assignment constructor
doublereal dfind(doublereal p_red, doublereal tau, doublereal deltaGuess)
This function computes the reduced density, given the reduced pressure and the reduced temperature...
void calcDim(doublereal temperature, doublereal rho)
Calculate the dimensionless temp and rho and store internally.
doublereal entropy() const
Calculate the entropy in mks units of J kmol-1 K-1.
doublereal pressureM_rhoRT(doublereal tau, doublereal delta)
Calculate the dimensionless pressure at tau and delta;.
int iState
Current state of the system.
doublereal dpdrho() const
Returns the value of dp / drho at constant T for the state of the object.
doublereal molarVolume() const
Calculate the molar volume (kmol m-3) at the last temperature and density.
const doublereal T_c
Critical Temperature value (kelvin)
doublereal dimdpdrho(doublereal tau, doublereal delta)
Dimensionless derivative of p wrt rho at constant T.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Definition: stringUtils.cpp:29
doublereal enthalpy() const
Calculate the enthalpy in mks units of J kmol-1 using the last temperature and density.
doublereal dimdpdT(doublereal tau, doublereal delta)
Dimensionless derivative of p wrt T at constant rho.
static const doublereal Rgas
Gas constant that is quoted in the paper.
void tdpolycalc(doublereal tau, doublereal delta)
Calculates internal polynomials in tau and delta.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:68
doublereal intEnergy() const
Calculate the internal energy in mks units of J kmol-1.
doublereal tau
Dimensionless temperature.
doublereal pressure() const
Calculates the pressure (Pascals), given the current value of the temperature and density...
doublereal enthalpy_RT() const
Calculate the dimensionless enthalpy, h/RT.
Low level class for the real description of water.
void corr1(doublereal temperature, doublereal pressure, doublereal &densLiq, doublereal &densGas, doublereal &pcorr)
Utility routine in the calculation of the saturation pressure.
doublereal cp_R() const
Calculate the dimensionless constant pressure heat capacity, Cv/R.
doublereal cv_R() const
Calculate the dimensionless constant volume heat capacity, Cv/R.
static const doublereal M_water
Molecular Weight of water that is consistent with the paper (kg kmol-1)
Contains declarations for string manipulation functions within Cantera.
doublereal cp() const
Calculate the constant pressure heat capacity in mks units of J kmol-1 K-1 at the last temperature an...
doublereal intEnergy_RT() const
Calculate the dimensionless internal energy, u/RT.
doublereal helmholtzFE() const
Calculate the Helmholtz free energy in mks units of J kmol-1 K-1, using the last temperature and dens...
doublereal phi(doublereal tau, doublereal delta)
Calculate the Phi function, which is the base function.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
doublereal temperature() const
Returns the temperature (Kelvin)
WaterPropsIAPWSphi * m_phi
pointer to the underlying object that does the calculations.
doublereal psat(doublereal temperature, int waterState=WATER_LIQUID)
This function returns the saturation pressure given the temperature as an input parameter, and sets the internal state to the saturated conditions.
doublereal coeffPresExp() const
Returns the isochoric pressure derivative wrt temperature.
Headers for a class for calculating the equation of state of water from the IAPWS 1995 Formulation ba...