Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
311 void WaterPropsIAPWS::corr(doublereal temperature, doublereal pressure,
312  doublereal& densLiq, doublereal& densGas, doublereal& delGRT)
313 {
314 
315  densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
316  if (densLiq <= 0.0) {
317  throw Cantera::CanteraError("WaterPropsIAPWS::corr",
318  "Error occurred trying to find liquid density at (T,P) = "
319  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
320  }
321  setState_TR(temperature, densLiq);
322  doublereal gibbsLiqRT = m_phi->gibbs_RT();
323 
324  densGas = density(temperature, pressure, WATER_GAS, densGas);
325  if (densGas <= 0.0) {
326  throw Cantera::CanteraError("WaterPropsIAPWS::corr",
327  "Error occurred trying to find gas density at (T,P) = "
328  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
329  }
330  setState_TR(temperature, densGas);
331  doublereal gibbsGasRT = m_phi->gibbs_RT();
332 
333  delGRT = gibbsLiqRT - gibbsGasRT;
334 }
335 
336 void WaterPropsIAPWS::corr1(doublereal temperature, doublereal pressure,
337  doublereal& densLiq, doublereal& densGas, doublereal& pcorr)
338 {
339 
340  densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
341  if (densLiq <= 0.0) {
342  throw Cantera::CanteraError("WaterPropsIAPWS::corr1",
343  "Error occurred trying to find liquid density at (T,P) = "
344  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
345  }
346  setState_TR(temperature, densLiq);
347  doublereal prL = m_phi->phiR();
348 
349  densGas = density(temperature, pressure, WATER_GAS, densGas);
350  if (densGas <= 0.0) {
351  throw Cantera::CanteraError("WaterPropsIAPWS::corr1",
352  "Error occurred trying to find gas density at (T,P) = "
353  + Cantera::fp2str(temperature) + " " + Cantera::fp2str(pressure));
354  }
355  setState_TR(temperature, densGas);
356  doublereal prG = m_phi->phiR();
357 
358  doublereal rhs = (prL - prG) + log(densLiq/densGas);
359  rhs /= (1.0/densGas - 1.0/densLiq);
360 
361  pcorr = rhs * Rgas * temperature / M_water;
362 }
363 
364 doublereal WaterPropsIAPWS::psat(doublereal temperature, int waterState)
365 {
366  static int method = 1;
367  doublereal densLiq = -1.0, densGas = -1.0, delGRT = 0.0;
368  doublereal dp, pcorr;
369  if (temperature >= T_c) {
370  densGas = density(temperature, P_c, WATER_SUPERCRIT);
371  setState_TR(temperature, densGas);
372  return P_c;
373  }
374  doublereal p = psat_est(temperature);
375  for (int i = 0; i < 30; i++) {
376  if (method == 1) {
377  corr(temperature, p, densLiq, densGas, delGRT);
378  doublereal delV = M_water * (1.0/densLiq - 1.0/densGas);
379  dp = - delGRT * Rgas * temperature / delV;
380  } else {
381  corr1(temperature, p, densLiq, densGas, pcorr);
382  dp = pcorr - p;
383  }
384  p += dp;
385 
386  if ((method == 1) && delGRT < 1.0E-8) {
387  break;
388  } else {
389  if (fabs(dp/p) < 1.0E-9) {
390  break;
391  }
392  }
393  }
394  // Put the fluid in the desired end condition
395  if (waterState == WATER_LIQUID) {
396  setState_TR(temperature, densLiq);
397  } else if (waterState == WATER_GAS) {
398  setState_TR(temperature, densGas);
399  } else {
400  throw Cantera::CanteraError("WaterPropsIAPWS::psat",
401  "unknown water state input: " + Cantera::int2str(waterState));
402  }
403  return p;
404 }
405 
406 int WaterPropsIAPWS::phaseState(bool checkState) const
407 {
408  if (checkState) {
409  if (tau <= 1.0) {
410  iState = WATER_SUPERCRIT;
411  } else {
412  doublereal T = T_c / tau;
413  doublereal rho = delta * Rho_c;
414  doublereal rhoMidAtm = 0.5 * (OneAtm * M_water / (Rgas * 373.15) + 1.0E3);
415  doublereal rhoMid = Rho_c + (T - T_c) * (Rho_c - rhoMidAtm) / (T_c - 373.15);
416  int iStateGuess = WATER_LIQUID;
417  if (rho < rhoMid) {
418  iStateGuess = WATER_GAS;
419  }
420  doublereal kappa = isothermalCompressibility();
421  if (kappa >= 0.0) {
422  iState = iStateGuess;
423  } else {
424  // When we are here we are between the spinodal curves
425  doublereal rhoDel = rho * 1.000001;
426  doublereal deltaSave = delta;
427  doublereal deltaDel = rhoDel / Rho_c;
428  delta = deltaDel;
429  m_phi->tdpolycalc(tau, deltaDel);
430 
431  doublereal kappaDel = isothermalCompressibility();
432  doublereal d2rhodp2 = (rhoDel * kappaDel - rho * kappa) / (rhoDel - rho);
433  if (d2rhodp2 > 0.0) {
434  iState = WATER_UNSTABLELIQUID;
435  } else {
436  iState = WATER_UNSTABLEGAS;
437  }
438  delta = deltaSave;
439 
441  }
442  }
443  }
444  return iState;
445 }
446 
448 {
449  doublereal temperature = T_c/tau;
450  doublereal delta_save = delta;
451  // return the critical density if we are above or even just a little below
452  // the critical temperature. We just don't want to worry about the critical
453  // point at this juncture.
454  if (temperature >= T_c - 0.001) {
455  return Rho_c;
456  }
457  doublereal p = psat_est(temperature);
458  doublereal rho_low = 0.0;
459  doublereal rho_high = 1000;
460 
461  doublereal densSatLiq = density_const(p, WATER_LIQUID);
462  doublereal dens_old = densSatLiq;
463  delta = dens_old / Rho_c;
465  doublereal dpdrho_old = dpdrho();
466  if (dpdrho_old > 0.0) {
467  rho_high = std::min(dens_old, rho_high);
468  } else {
469  rho_low = std::max(rho_low, dens_old);
470  }
471  doublereal dens_new = densSatLiq* (1.0001);
472  delta = dens_new / Rho_c;
474  doublereal dpdrho_new = dpdrho();
475  if (dpdrho_new > 0.0) {
476  rho_high = std::min(dens_new, rho_high);
477  } else {
478  rho_low = std::max(rho_low, dens_new);
479  }
480  bool conv = false;
481 
482  for (int it = 0; it < 50; it++) {
483  doublereal slope = (dpdrho_new - dpdrho_old)/(dens_new - dens_old);
484  if (slope >= 0.0) {
485  slope = std::max(slope, dpdrho_new *5.0/ dens_new);
486  } else {
487  slope = -dpdrho_new;
488  // shouldn't be here for liquid spinodal
489  }
490  doublereal delta_rho = - dpdrho_new / slope;
491  if (delta_rho > 0.0) {
492  delta_rho = std::min(delta_rho, dens_new * 0.1);
493  } else {
494  delta_rho = std::max(delta_rho, - dens_new * 0.1);
495  }
496  doublereal dens_est = dens_new + delta_rho;
497  if (dens_est < rho_low) {
498  dens_est = 0.5 * (rho_low + dens_new);
499  }
500  if (dens_est > rho_high) {
501  dens_est = 0.5 * (rho_high + dens_new);
502  }
503 
504 
505  dens_old = dens_new;
506  dpdrho_old = dpdrho_new;
507  dens_new = dens_est;
508 
509  delta = dens_new / Rho_c;
511  dpdrho_new = dpdrho();
512  if (dpdrho_new > 0.0) {
513  rho_high = std::min(dens_new, rho_high);
514  } else if (dpdrho_new < 0.0) {
515  rho_low = std::max(rho_low, dens_new);
516  } else {
517  conv = true;
518  break;
519  }
520 
521  if (fabs(dpdrho_new) < 1.0E-5) {
522  conv = true;
523  break;
524  }
525  }
526 
527  if (!conv) {
528  throw Cantera::CanteraError(" WaterPropsIAPWS::densSpinodalWater()",
529  " convergence failure");
530  }
531  // Restore the original delta
532  delta = delta_save;
534 
535  return dens_new;
536 }
537 
539 {
540  doublereal temperature = T_c/tau;
541  doublereal delta_save = delta;
542  // return the critical density if we are above or even just a little below
543  // the critical temperature. We just don't want to worry about the critical
544  // point at this juncture.
545  if (temperature >= T_c - 0.001) {
546  return Rho_c;
547  }
548  doublereal p = psat_est(temperature);
549  doublereal rho_low = 0.0;
550  doublereal rho_high = 1000;
551 
552  doublereal densSatGas = density_const(p, WATER_GAS);
553  doublereal dens_old = densSatGas;
554  delta = dens_old / Rho_c;
556  doublereal dpdrho_old = dpdrho();
557  if (dpdrho_old < 0.0) {
558  rho_high = std::min(dens_old, rho_high);
559  } else {
560  rho_low = std::max(rho_low, dens_old);
561  }
562  doublereal dens_new = densSatGas * (0.99);
563  delta = dens_new / Rho_c;
565  doublereal dpdrho_new = dpdrho();
566  if (dpdrho_new < 0.0) {
567  rho_high = std::min(dens_new, rho_high);
568  } else {
569  rho_low = std::max(rho_low, dens_new);
570  }
571  bool conv = false;
572 
573  for (int it = 0; it < 50; it++) {
574  doublereal slope = (dpdrho_new - dpdrho_old)/(dens_new - dens_old);
575  if (slope >= 0.0) {
576  slope = dpdrho_new;
577  // shouldn't be here for gas spinodal
578  } else {
579  slope = std::min(slope, dpdrho_new *5.0 / dens_new);
580 
581  }
582  doublereal delta_rho = - dpdrho_new / slope;
583  if (delta_rho > 0.0) {
584  delta_rho = std::min(delta_rho, dens_new * 0.1);
585  } else {
586  delta_rho = std::max(delta_rho, - dens_new * 0.1);
587  }
588  doublereal dens_est = dens_new + delta_rho;
589  if (dens_est < rho_low) {
590  dens_est = 0.5 * (rho_low + dens_new);
591  }
592  if (dens_est > rho_high) {
593  dens_est = 0.5 * (rho_high + dens_new);
594  }
595 
596 
597  dens_old = dens_new;
598  dpdrho_old = dpdrho_new;
599  dens_new = dens_est;
600 
601  delta = dens_new / Rho_c;
603  dpdrho_new = dpdrho();
604  if (dpdrho_new < 0.0) {
605  rho_high = std::min(dens_new, rho_high);
606  } else if (dpdrho_new > 0.0) {
607  rho_low = std::max(rho_low, dens_new);
608  } else {
609  conv = true;
610  break;
611  }
612 
613  if (fabs(dpdrho_new) < 1.0E-5) {
614  conv = true;
615  break;
616  }
617  }
618 
619  if (!conv) {
620  throw Cantera::CanteraError(" WaterPropsIAPWS::densSpinodalSteam()",
621  " convergence failure");
622  }
623  // Restore the original delta
624  delta = delta_save;
626 
627  return dens_new;
628 }
629 
630 void WaterPropsIAPWS::setState_TR(doublereal temperature, doublereal rho)
631 {
632  calcDim(temperature, rho);
634 }
635 
636 doublereal WaterPropsIAPWS::enthalpy() const
637 {
638  doublereal temperature = T_c/tau;
639  doublereal hRT = m_phi->enthalpy_RT();
640  return hRT * Rgas * temperature;
641 }
642 
643 doublereal WaterPropsIAPWS::intEnergy() const
644 {
645  doublereal temperature = T_c / tau;
646  doublereal uRT = m_phi->intEnergy_RT();
647  return uRT * Rgas * temperature;
648 }
649 
650 doublereal WaterPropsIAPWS::entropy() const
651 {
652  doublereal sR = m_phi->entropy_R();
653  return sR * Rgas;
654 }
655 
656 doublereal WaterPropsIAPWS::cv() const
657 {
658  doublereal cvR = m_phi->cv_R();
659  return cvR * Rgas;
660 }
661 
662 doublereal WaterPropsIAPWS::cp() const
663 {
664  doublereal cpR = m_phi->cp_R();
665  return cpR * Rgas;
666 }
667 
669 {
670  doublereal rho = delta * Rho_c;
671  return M_water / rho;
672 }
673 
674 }
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:39
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:69
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:28
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:99
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...