Cantera 2.6.0

PDSS_HKFT.cpp
Go to the documentation of this file.
1/**
2 * @file PDSS_HKFT.cpp
3 * Definitions for the class PDSS_HKFT (pressure dependent standard state)
4 * which handles calculations for a single species in a phase using the
5 * HKFT standard state
6 * (see \ref pdssthermo and class \link Cantera::PDSS_HKFT PDSS_HKFT\endlink).
7 */
8
9// This file is part of Cantera. See License.txt in the top-level directory or
10// at https://cantera.org/license.txt for license and copyright information.
11
12#include "cantera/base/ctml.h"
13#include "cantera/thermo/PDSS_HKFT.h"
14#include "cantera/thermo/PDSS_Water.h"
15#include "cantera/thermo/VPStandardStateTP.h"
16#include "cantera/base/stringUtils.h"
17#include "cantera/base/global.h"
18
19 using namespace std;
20
21 namespace Cantera
22{
23// Set the default to error exit if there is an input file inconsistency
24 int PDSS_HKFT::s_InputInconsistencyErrorExit = 1;
25
26 PDSS_HKFT::PDSS_HKFT()
27 : m_waterSS(0)
28 , m_densWaterSS(-1.0)
29 , m_deltaG_formation_tr_pr(NAN)
30 , m_deltaH_formation_tr_pr(NAN)
31 , m_Mu0_tr_pr(0.0)
32 , m_Entrop_tr_pr(NAN)
33 , m_a1(0.0)
34 , m_a2(0.0)
35 , m_a3(0.0)
36 , m_a4(0.0)
37 , m_c1(0.0)
38 , m_c2(0.0)
39 , m_omega_pr_tr(0.0)
40 , m_Y_pr_tr(0.0)
41 , m_Z_pr_tr(0.0)
42 , m_presR_bar(0.0)
43 , m_domega_jdT_prtr(0.0)
44 , m_charge_j(0.0)
45{
46 m_pres = OneAtm;
47 m_presR_bar = OneAtm * 1.0E-5;
48 m_presR_bar = 1.0;
49}
50
51doublereal PDSS_HKFT::enthalpy_mole() const
52{
53 // Ok we may change this evaluation method in the future.
54 doublereal h = gibbs_mole() + m_temp * entropy_mole();
55 return h;
56}
57
58doublereal PDSS_HKFT::enthalpy_mole2() const
59{
60 double enthTRPR = m_Mu0_tr_pr + 298.15 * m_Entrop_tr_pr * toSI("cal/gmol");
61 return deltaH() + enthTRPR;
62}
63
64doublereal PDSS_HKFT::intEnergy_mole() const
65{
66 return enthalpy_RT() - molarVolume() * m_pres;
67}
68
69doublereal PDSS_HKFT::entropy_mole() const
70{
71 return m_Entrop_tr_pr * toSI("cal/gmol") + deltaS();
72}
73
74doublereal PDSS_HKFT::gibbs_mole() const
75{
76 return m_Mu0_tr_pr + deltaG();
77}
78
79doublereal PDSS_HKFT::cp_mole() const
80{
81 doublereal pbar = m_pres * 1.0E-5;
82 doublereal c1term = m_c1;
83 doublereal c2term = m_c2 / (m_temp - 228.) / (m_temp - 228.);
84 doublereal a3term = -m_a3 / (m_temp - 228.) / (m_temp - 228.) / (m_temp - 228.) * 2.0 * m_temp * (pbar - m_presR_bar);
85 doublereal a4term = -m_a4 / (m_temp - 228.) / (m_temp - 228.) / (m_temp - 228.) * 2.0 * m_temp
86 * log((2600. + pbar)/(2600. + m_presR_bar));
87
88 doublereal omega_j;
89 doublereal domega_jdT;
90 doublereal d2omega_jdT2;
91 if (m_charge_j == 0.0) {
92 omega_j = m_omega_pr_tr;
93 domega_jdT = 0.0;
94 d2omega_jdT2 = 0.0;
95 } else {
96 doublereal nu = 166027;
97 doublereal r_e_j_pr_tr = m_charge_j * m_charge_j / (m_omega_pr_tr/nu + m_charge_j/3.082);
98 doublereal gval = gstar(m_temp, m_pres, 0);
99 doublereal dgvaldT = gstar(m_temp, m_pres, 1);
100 doublereal d2gvaldT2 = gstar(m_temp, m_pres, 2);
101
102 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
103 doublereal dr_e_jdT = fabs(m_charge_j) * dgvaldT;
104 doublereal d2r_e_jdT2 = fabs(m_charge_j) * d2gvaldT2;
105 doublereal r_e_j2 = r_e_j * r_e_j;
106
107 doublereal charge2 = m_charge_j * m_charge_j;
108 doublereal r_e_H = 3.082 + gval;
109 doublereal r_e_H2 = r_e_H * r_e_H;
110 omega_j = nu * (charge2 / r_e_j - m_charge_j / r_e_H);
111 domega_jdT = nu * (-(charge2 / r_e_j2 * dr_e_jdT)
112 +(m_charge_j / r_e_H2 * dgvaldT));
113 d2omega_jdT2 = nu * (2.0*charge2*dr_e_jdT*dr_e_jdT/(r_e_j2*r_e_j) - charge2*d2r_e_jdT2/r_e_j2
114 -2.0*m_charge_j*dgvaldT*dgvaldT/(r_e_H2*r_e_H) + m_charge_j*d2gvaldT2 /r_e_H2);
115 }
116
117 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
118 doublereal drelepsilondT = m_waterProps->relEpsilon(m_temp, m_pres, 1);
119 doublereal Y = drelepsilondT / (relepsilon * relepsilon);
120 doublereal d2relepsilondT2 = m_waterProps->relEpsilon(m_temp, m_pres, 2);
121
122 doublereal X = d2relepsilondT2 / (relepsilon* relepsilon) - 2.0 * relepsilon * Y * Y;
123 doublereal Z = -1.0 / relepsilon;
124
125 doublereal yterm = 2.0 * m_temp * Y * domega_jdT;
126 doublereal xterm = omega_j * m_temp * X;
127 doublereal otterm = m_temp * d2omega_jdT2 * (Z + 1.0);
128 doublereal rterm = - m_domega_jdT_prtr * (m_Z_pr_tr + 1.0);
129
130 doublereal Cp_calgmol = c1term + c2term + a3term + a4term + yterm + xterm + otterm + rterm;
131
132 // Convert to Joules / kmol
133 doublereal Cp = Cp_calgmol * toSI("cal/gmol");
134
135 return Cp;
136}
137
138doublereal PDSS_HKFT::molarVolume() const
139{
140 // Initially do all calculations in (cal/gmol/Pa)
141
142 doublereal a1term = m_a1 * 1.0E-5;
143 doublereal a2term = m_a2 / (2600.E5 + m_pres);
144 doublereal a3term = m_a3 * 1.0E-5/ (m_temp - 228.);
145 doublereal a4term = m_a4 / (m_temp - 228.) / (2600.E5 + m_pres);
146
147 doublereal omega_j;
148 doublereal domega_jdP;
149 if (m_charge_j == 0.0) {
150 omega_j = m_omega_pr_tr;
151 domega_jdP = 0.0;
152 } else {
153 doublereal nu = 166027.;
154 doublereal charge2 = m_charge_j * m_charge_j;
155 doublereal r_e_j_pr_tr = charge2 / (m_omega_pr_tr/nu + m_charge_j/3.082);
156
157 doublereal gval = gstar(m_temp, m_pres, 0);
158 doublereal dgvaldP = gstar(m_temp, m_pres, 3);
159
160 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
161 doublereal r_e_H = 3.082 + gval;
162
163 omega_j = nu * (charge2 / r_e_j - m_charge_j / r_e_H);
164 doublereal dr_e_jdP = fabs(m_charge_j) * dgvaldP;
165 domega_jdP = - nu * (charge2 / (r_e_j * r_e_j) * dr_e_jdP)
166 + nu * m_charge_j / (r_e_H * r_e_H) * dgvaldP;
167 }
168
169 doublereal drelepsilondP = m_waterProps->relEpsilon(m_temp, m_pres, 3);
170 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
171 doublereal Q = drelepsilondP / (relepsilon * relepsilon);
172 doublereal Z = -1.0 / relepsilon;
173 doublereal wterm = - domega_jdP * (Z + 1.0);
174 doublereal qterm = - omega_j * Q;
175 doublereal molVol_calgmolPascal = a1term + a2term + a3term + a4term + wterm + qterm;
176
177 // Convert to m**3 / kmol from (cal/gmol/Pa)
178 return molVol_calgmolPascal * toSI("cal/gmol");
179}
180
181doublereal PDSS_HKFT::density() const
182{
183 return m_mw / molarVolume();
184}
185
186doublereal PDSS_HKFT::gibbs_RT_ref() const
187{
188 doublereal m_psave = m_pres;
189 m_pres = m_waterSS->pref_safe(m_temp);
190 doublereal ee = gibbs_RT();
191 m_pres = m_psave;
192 return ee;
193}
194
195doublereal PDSS_HKFT::enthalpy_RT_ref() const
196{
197 doublereal m_psave = m_pres;
198 m_pres = m_waterSS->pref_safe(m_temp);
199 doublereal hh = enthalpy_RT();
200 m_pres = m_psave;
201 return hh;
202}
203
204doublereal PDSS_HKFT::entropy_R_ref() const
205{
206 doublereal m_psave = m_pres;
207 m_pres = m_waterSS->pref_safe(m_temp);
208 doublereal ee = entropy_R();
209 m_pres = m_psave;
210 return ee;
211}
212
213doublereal PDSS_HKFT::cp_R_ref() const
214{
215 doublereal m_psave = m_pres;
216 m_pres = m_waterSS->pref_safe(m_temp);
217 doublereal ee = cp_R();
218 m_pres = m_psave;
219 return ee;
220}
221
222doublereal PDSS_HKFT::molarVolume_ref() const
223{
224 doublereal m_psave = m_pres;
225 m_pres = m_waterSS->pref_safe(m_temp);
226 doublereal ee = molarVolume();
227 m_pres = m_psave;
228 return ee;
229}
230
231 void PDSS_HKFT::setState_TP(doublereal temp, doublereal pres)
232{
233 setTemperature(temp);
234 setPressure(pres);
235}
236
237 void PDSS_HKFT::initThermo()
238{
239 PDSS::initThermo();
240 if (m_input.hasKey("h0")) {
241 m_deltaH_formation_tr_pr = m_input.convert("h0", "cal/gmol");
242 }
243 if (m_input.hasKey("g0")) {
244 m_deltaG_formation_tr_pr = m_input.convert("g0", "cal/gmol");
245 }
246 if (m_input.hasKey("s0")) {
247 m_Entrop_tr_pr = m_input.convert("s0", "cal/gmol/K");
248 }
249 auto& units = m_input.units();
250 if (m_input.hasKey("a")) {
251 auto& a = m_input["a"].asVector<AnyValue>(4);
252 m_a1 = units.convert(a[0], "cal/gmol/bar");
253 m_a2 = units.convert(a[1], "cal/gmol");
254 m_a3 = units.convert(a[2], "cal*K/gmol/bar");
255 m_a4 = units.convert(a[3], "cal*K/gmol");
256 }
257 if (m_input.hasKey("c")) {
258 auto& c = m_input["c"].asVector<AnyValue>(2);
259 m_c1 = units.convert(c[0], "cal/gmol/K");
260 m_c2 = units.convert(c[1], "cal*K/gmol");
261 }
262 if (m_input.hasKey("omega")) {
263 m_omega_pr_tr = m_input.convert("omega", "cal/gmol");
264 }
265
266 // Ok, if we are missing one, then we construct its value from the other two.
267 // This code has been internally verified.
268 m_charge_j = m_tp->charge(m_spindex);
269 if (std::isnan(m_deltaH_formation_tr_pr)) {
270 convertDGFormation();
271 doublereal Hcalc = m_Mu0_tr_pr + 298.15 * (m_Entrop_tr_pr * toSI("cal/gmol"));
272 m_deltaH_formation_tr_pr = Hcalc / toSI("cal/gmol");
273 } else if (std::isnan(m_deltaG_formation_tr_pr)) {
274 doublereal DHjmol = m_deltaH_formation_tr_pr * toSI("cal/gmol");
275 m_Mu0_tr_pr = DHjmol - 298.15 * (m_Entrop_tr_pr * toSI("cal/gmol"));
276 m_deltaG_formation_tr_pr = m_Mu0_tr_pr / toSI("cal/gmol");
277 double tmp = m_Mu0_tr_pr;
278 convertDGFormation();
279 double totalSum = m_Mu0_tr_pr - tmp;
280 m_Mu0_tr_pr = tmp;
281 m_deltaG_formation_tr_pr = (m_Mu0_tr_pr - totalSum)/ toSI("cal/gmol");
282 } else if (std::isnan(m_Entrop_tr_pr)) {
283 convertDGFormation();
284 doublereal DHjmol = m_deltaH_formation_tr_pr * toSI("cal/gmol");
285 m_Entrop_tr_pr = (DHjmol - m_Mu0_tr_pr) / (298.15 * toSI("cal/gmol"));
286 }
287
288 m_waterSS = &dynamic_cast<PDSS_Water&>(*m_tp->providePDSS(0));
289
290 // Section to initialize m_Z_pr_tr and m_Y_pr_tr
291 m_temp = 273.15 + 25.;
292 m_pres = OneAtm;
293 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
294 m_waterSS->setState_TP(m_temp, m_pres);
295 m_densWaterSS = m_waterSS->density();
296 m_Z_pr_tr = -1.0 / relepsilon;
297 doublereal drelepsilondT = m_waterProps->relEpsilon(m_temp, m_pres, 1);
298 m_Y_pr_tr = drelepsilondT / (relepsilon * relepsilon);
299 m_waterProps.reset(new WaterProps(m_waterSS));
300 m_presR_bar = OneAtm / 1.0E5;
301 m_presR_bar = 1.0;
302 convertDGFormation();
303
304 // Ok, we have mu. Let's check it against the input value
305 // of DH_F to see that we have some internal consistency
306 doublereal Hcalc = m_Mu0_tr_pr + 298.15 * (m_Entrop_tr_pr * toSI("cal/gmol"));
307 doublereal DHjmol = m_deltaH_formation_tr_pr * toSI("cal/gmol");
308
309 // If the discrepancy is greater than 100 cal gmol-1, print
310 // an error and exit.
311 if (fabs(Hcalc -DHjmol) > 100.* toSI("cal/gmol")) {
312 std::string sname = m_tp->speciesName(m_spindex);
313 if (s_InputInconsistencyErrorExit) {
314 throw CanteraError("PDSS_HKFT::initThermo", "For {}, DHjmol is"
315 " not consistent with G and S: {} vs {} cal gmol-1",
316 sname, Hcalc/toSI("cal/gmol"), m_deltaH_formation_tr_pr);
317 } else {
318 warn_user("PDSS_HKFT::initThermo",
319 "DHjmol for {} is not consistent with G and S: calculated {} "
320 "vs input {} cal gmol-1; continuing with consistent DHjmol = {}",
321 sname, Hcalc/toSI("cal/gmol"), m_deltaH_formation_tr_pr,
322 Hcalc/toSI("cal/gmol"));
323 m_deltaH_formation_tr_pr = Hcalc / toSI("cal/gmol");
324 }
325 }
326 doublereal nu = 166027;
327 doublereal r_e_j_pr_tr;
328 if (m_charge_j != 0.0) {
329 r_e_j_pr_tr = m_charge_j * m_charge_j / (m_omega_pr_tr/nu + m_charge_j/3.082);
330 } else {
331 r_e_j_pr_tr = 0.0;
332 }
333
334 if (m_charge_j == 0.0) {
335 m_domega_jdT_prtr = 0.0;
336 } else {
337 doublereal gval = gstar(m_temp, m_pres, 0);
338 doublereal dgvaldT = gstar(m_temp, m_pres, 1);
339 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
340 doublereal dr_e_jdT = fabs(m_charge_j) * dgvaldT;
341 m_domega_jdT_prtr = - nu * (m_charge_j * m_charge_j / (r_e_j * r_e_j) * dr_e_jdT)
342 + nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
343 }
344}
345
346 void PDSS_HKFT::setDeltaH0(double dh0) {
347 m_deltaH_formation_tr_pr = dh0 / toSI("cal/gmol");
348}
349
350 void PDSS_HKFT::setDeltaG0(double dg0) {
351 m_deltaG_formation_tr_pr = dg0 / toSI("cal/gmol");
352}
353
354 void PDSS_HKFT::setS0(double s0) {
355 m_Entrop_tr_pr = s0 / toSI("cal/gmol/K");
356}
357
358 void PDSS_HKFT::set_a(double* a) {
359 m_a1 = a[0] / toSI("cal/gmol/bar");
360 m_a2 = a[1] / toSI("cal/gmol");
361 m_a3 = a[2] / toSI("cal-K/gmol/bar");
362 m_a4 = a[3] / toSI("cal-K/gmol");
363}
364
365 void PDSS_HKFT::set_c(double* c) {
366 m_c1 = c[0] / toSI("cal/gmol/K");
367 m_c2 = c[1] / toSI("cal-K/gmol");
368}
369
370 void PDSS_HKFT::setOmega(double omega) {
371 m_omega_pr_tr = omega / toSI("cal/gmol");
372}
373
374 void PDSS_HKFT::setParametersFromXML(const XML_Node& speciesNode)
375{
376 PDSS::setParametersFromXML(speciesNode);
377 int hasDGO = 0;
378 int hasSO = 0;
379 int hasDHO = 0;
380
381 const XML_Node* tn = speciesNode.findByName("thermo");
382 if (!tn) {
383 throw CanteraError("PDSS_HKFT::setParametersFromXML",
384 "no thermo Node for species '{}'", speciesNode.name());
385 }
386 if (!caseInsensitiveEquals(tn->attrib("model"), "hkft")) {
387 throw CanteraError("PDSS_HKFT::setParametersFromXML",
388 "thermo model for species '{}' isn't 'hkft'",
389 speciesNode.name());
390 }
391 const XML_Node* hh = tn->findByName("HKFT");
392 if (!hh) {
393 throw CanteraError("PDSS_HKFT::setParametersFromXML",
394 "no Thermo::HKFT Node for species '{}'", speciesNode.name());
395 }
396
397 // go get the attributes
398 m_p0 = OneAtm;
399 std::string p0string = hh->attrib("Pref");
400 if (p0string != "") {
401 m_p0 = strSItoDbl(p0string);
402 }
403
404 std::string minTstring = hh->attrib("Tmin");
405 if (minTstring != "") {
406 m_minTemp = fpValueCheck(minTstring);
407 }
408
409 std::string maxTstring = hh->attrib("Tmax");
410 if (maxTstring != "") {
411 m_maxTemp = fpValueCheck(maxTstring);
412 }
413
414 if (hh->hasChild("DG0_f_Pr_Tr")) {
415 setDeltaG0(getFloat(*hh, "DG0_f_Pr_Tr", "toSI"));
416 hasDGO = 1;
417 }
418
419 if (hh->hasChild("DH0_f_Pr_Tr")) {
420 setDeltaH0(getFloat(*hh, "DH0_f_Pr_Tr", "toSI"));
421 hasDHO = 1;
422 }
423
424 if (hh->hasChild("S0_Pr_Tr")) {
425 setS0(getFloat(*hh, "S0_Pr_Tr", "toSI"));
426 hasSO = 1;
427 }
428
429 const XML_Node* ss = speciesNode.findByName("standardState");
430 if (!ss) {
431 throw CanteraError("PDSS_HKFT::setParametersFromXML",
432 "no 'standardState' Node for species '{}'",
433 speciesNode.name());
434 }
435 if (!caseInsensitiveEquals(ss->attrib("model"), "hkft")) {
436 throw CanteraError("PDSS_HKFT::setParametersFromXML",
437 "standardState model for species '{}' isn't 'hkft'",
438 speciesNode.name());
439 }
440 double a[4] = {getFloat(*ss, "a1", "toSI"), getFloat(*ss, "a2", "toSI"),
441 getFloat(*ss, "a3", "toSI"), getFloat(*ss, "a4", "toSI")};
442 set_a(a);
443
444 double c[2] = {getFloat(*ss, "c1", "toSI"), getFloat(*ss, "c2", "toSI")};
445 set_c(c);
446
447 setOmega(getFloat(*ss, "omega_Pr_Tr", "toSI"));
448
449 int isum = hasDGO + hasDHO + hasSO;
450 if (isum < 2) {
451 throw CanteraError("PDSS_HKFT::setParametersFromXML",
452 "Missing 2 or more of DG0_f_Pr_Tr, DH0_f_Pr_Tr, or S0_f_Pr_Tr fields. "
453 "Need to supply at least two of these fields");
454 }
455}
456
457 void PDSS_HKFT::getParameters(AnyMap& eosNode) const
458{
459 PDSS::getParameters(eosNode);
460 eosNode["model"] = "HKFT";
461 eosNode["h0"].setQuantity(m_deltaH_formation_tr_pr, "cal/gmol");
462 eosNode["g0"].setQuantity(m_deltaG_formation_tr_pr, "cal/gmol");
463 eosNode["s0"].setQuantity(m_Entrop_tr_pr, "cal/gmol/K");
464
465 std::vector<AnyValue> a(4), c(2);
466 a[0].setQuantity(m_a1, "cal/gmol/bar");
467 a[1].setQuantity(m_a2, "cal/gmol");
468 a[2].setQuantity(m_a3, "cal*K/gmol/bar");
469 a[3].setQuantity(m_a4, "cal*K/gmol");
470 eosNode["a"] = std::move(a);
471
472 c[0].setQuantity(m_c1, "cal/gmol/K");
473 c[1].setQuantity(m_c2, "cal*K/gmol");
474 eosNode["c"] = std::move(c);
475
476 eosNode["omega"].setQuantity(m_omega_pr_tr, "cal/gmol");
477}
478
479doublereal PDSS_HKFT::deltaH() const
480{
481 doublereal pbar = m_pres * 1.0E-5;
482 doublereal c1term = m_c1 * (m_temp - 298.15);
483 doublereal a1term = m_a1 * (pbar - m_presR_bar);
484 doublereal a2term = m_a2 * log((2600. + pbar)/(2600. + m_presR_bar));
485 doublereal c2term = -m_c2 * (1.0/(m_temp - 228.) - 1.0/(298.15 - 228.));
486 double a3tmp = (2.0 * m_temp - 228.)/ (m_temp - 228.) /(m_temp - 228.);
487 doublereal a3term = m_a3 * a3tmp * (pbar - m_presR_bar);
488 doublereal a4term = m_a4 * a3tmp * log((2600. + pbar)/(2600. + m_presR_bar));
489 doublereal omega_j;
490 doublereal domega_jdT;
491 if (m_charge_j == 0.0) {
492 omega_j = m_omega_pr_tr;
493 domega_jdT = 0.0;
494 } else {
495 doublereal nu = 166027;
496 doublereal r_e_j_pr_tr = m_charge_j * m_charge_j / (m_omega_pr_tr/nu + m_charge_j/3.082);
497 doublereal gval = gstar(m_temp, m_pres, 0);
498 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
499 doublereal dgvaldT = gstar(m_temp, m_pres, 1);
500 doublereal dr_e_jdT = fabs(m_charge_j) * dgvaldT;
501 omega_j = nu * (m_charge_j * m_charge_j / r_e_j - m_charge_j / (3.082 + gval));
502 domega_jdT = - nu * (m_charge_j * m_charge_j / (r_e_j * r_e_j) * dr_e_jdT)
503 + nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
504 }
505
506 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
507 doublereal drelepsilondT = m_waterProps->relEpsilon(m_temp, m_pres, 1);
508
509 doublereal Y = drelepsilondT / (relepsilon * relepsilon);
510 doublereal Z = -1.0 / relepsilon;
511
512 doublereal yterm = m_temp * omega_j * Y;
513 doublereal yrterm = - 298.15 * m_omega_pr_tr * m_Y_pr_tr;
514
515 doublereal wterm = - omega_j * (Z + 1.0);
516 doublereal wrterm = + m_omega_pr_tr * (m_Z_pr_tr + 1.0);
517
518 doublereal otterm = m_temp * domega_jdT * (Z + 1.0);
519 doublereal otrterm = - m_temp * m_domega_jdT_prtr * (m_Z_pr_tr + 1.0);
520
521 doublereal deltaH_calgmol = c1term + a1term + a2term + c2term + a3term + a4term
522 + yterm + yrterm + wterm + wrterm + otterm + otrterm;
523
524 // Convert to Joules / kmol
525 return deltaH_calgmol * toSI("cal/gmol");
526}
527
528doublereal PDSS_HKFT::deltaG() const
529{
530 doublereal pbar = m_pres * 1.0E-5;
531 doublereal sterm = - m_Entrop_tr_pr * (m_temp - 298.15);
532 doublereal c1term = -m_c1 * (m_temp * log(m_temp/298.15) - (m_temp - 298.15));
533 doublereal a1term = m_a1 * (pbar - m_presR_bar);
534 doublereal a2term = m_a2 * log((2600. + pbar)/(2600. + m_presR_bar));
535 doublereal c2term = -m_c2 * ((1.0/(m_temp - 228.) - 1.0/(298.15 - 228.)) * (228. - m_temp)/228.
536 - m_temp / (228.*228.) * log((298.15*(m_temp-228.)) / (m_temp*(298.15-228.))));
537 doublereal a3term = m_a3 / (m_temp - 228.) * (pbar - m_presR_bar);
538 doublereal a4term = m_a4 / (m_temp - 228.) * log((2600. + pbar)/(2600. + m_presR_bar));
539
540 doublereal omega_j;
541 if (m_charge_j == 0.0) {
542 omega_j = m_omega_pr_tr;
543 } else {
544 doublereal nu = 166027;
545 doublereal r_e_j_pr_tr = m_charge_j * m_charge_j / (m_omega_pr_tr/nu + m_charge_j/3.082);
546 doublereal gval = gstar(m_temp, m_pres, 0);
547 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
548 omega_j = nu * (m_charge_j * m_charge_j / r_e_j - m_charge_j / (3.082 + gval));
549 }
550
551 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
552 doublereal Z = -1.0 / relepsilon;
553 doublereal wterm = - omega_j * (Z + 1.0);
554 doublereal wrterm = m_omega_pr_tr * (m_Z_pr_tr + 1.0);
555 doublereal yterm = m_omega_pr_tr * m_Y_pr_tr * (m_temp - 298.15);
556 doublereal deltaG_calgmol = sterm + c1term + a1term + a2term + c2term + a3term + a4term + wterm + wrterm + yterm;
557
558 // Convert to Joules / kmol
559 return deltaG_calgmol * toSI("cal/gmol");
560}
561
562doublereal PDSS_HKFT::deltaS() const
563{
564 doublereal pbar = m_pres * 1.0E-5;
565
566 doublereal c1term = m_c1 * log(m_temp/298.15);
567 doublereal c2term = -m_c2 / 228. * ((1.0/(m_temp - 228.) - 1.0/(298.15 - 228.))
568 + 1.0 / 228. * log((298.15*(m_temp-228.)) / (m_temp*(298.15-228.))));
569 doublereal a3term = m_a3 / (m_temp - 228.) / (m_temp - 228.) * (pbar - m_presR_bar);
570 doublereal a4term = m_a4 / (m_temp - 228.) / (m_temp - 228.) * log((2600. + pbar)/(2600. + m_presR_bar));
571
572 doublereal omega_j;
573 doublereal domega_jdT;
574 if (m_charge_j == 0.0) {
575 omega_j = m_omega_pr_tr;
576 domega_jdT = 0.0;
577 } else {
578 doublereal nu = 166027;
579 doublereal r_e_j_pr_tr = m_charge_j * m_charge_j / (m_omega_pr_tr/nu + m_charge_j/3.082);
580 doublereal gval = gstar(m_temp, m_pres, 0);
581 doublereal dgvaldT = gstar(m_temp, m_pres, 1);
582 doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
583 doublereal dr_e_jdT = fabs(m_charge_j) * dgvaldT;
584 omega_j = nu * (m_charge_j * m_charge_j / r_e_j - m_charge_j / (3.082 + gval));
585 domega_jdT = - nu * (m_charge_j * m_charge_j / (r_e_j * r_e_j) * dr_e_jdT)
586 + nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
587 }
588
589 doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
590 doublereal drelepsilondT = m_waterProps->relEpsilon(m_temp, m_pres, 1);
591 doublereal Y = drelepsilondT / (relepsilon * relepsilon);
592 doublereal Z = -1.0 / relepsilon;
593 doublereal wterm = omega_j * Y;
594 doublereal wrterm = - m_omega_pr_tr * m_Y_pr_tr;
595 doublereal otterm = domega_jdT * (Z + 1.0);
596 doublereal otrterm = - m_domega_jdT_prtr * (m_Z_pr_tr + 1.0);
597 doublereal deltaS_calgmol = c1term + c2term + a3term + a4term + wterm + wrterm + otterm + otrterm;
598
599 // Convert to Joules / kmol
600 return deltaS_calgmol * toSI("cal/gmol");
601}
602
603doublereal PDSS_HKFT::ag(const doublereal temp, const int ifunc) const
604{
605 static doublereal ag_coeff[3] = { -2.037662, 5.747000E-3, -6.557892E-6};
606 if (ifunc == 0) {
607 return ag_coeff[0] + ag_coeff[1] * temp + ag_coeff[2] * temp * temp;
608 } else if (ifunc == 1) {
609 return ag_coeff[1] + ag_coeff[2] * 2.0 * temp;
610 }
611 if (ifunc != 2) {
612 return 0.0;
613 }
614 return ag_coeff[2] * 2.0;
615}
616
617doublereal PDSS_HKFT::bg(const doublereal temp, const int ifunc) const
618{
619 static doublereal bg_coeff[3] = { 6.107361, -1.074377E-2, 1.268348E-5};
620 if (ifunc == 0) {
621 return bg_coeff[0] + bg_coeff[1] * temp + bg_coeff[2] * temp * temp;
622 } else if (ifunc == 1) {
623 return bg_coeff[1] + bg_coeff[2] * 2.0 * temp;
624 }
625 if (ifunc != 2) {
626 return 0.0;
627 }
628 return bg_coeff[2] * 2.0;
629}
630
631doublereal PDSS_HKFT::f(const doublereal temp, const doublereal pres, const int ifunc) const
632{
633 static doublereal af_coeff[3] = { 3.666666E1, -0.1504956E-9, 0.5107997E-13};
634 doublereal TC = temp - 273.15;
635 doublereal presBar = pres / 1.0E5;
636
637 if (TC < 155.0) {
638 return 0.0;
639 }
640 TC = std::min(TC, 355.0);
641 if (presBar > 1000.) {
642 return 0.0;
643 }
644
645 doublereal T1 = (TC-155.0)/300.;
646 doublereal p2 = (1000. - presBar) * (1000. - presBar);
647 doublereal p3 = (1000. - presBar) * p2;
648 doublereal p4 = p2 * p2;
649 doublereal fac2 = af_coeff[1] * p3 + af_coeff[2] * p4;
650 if (ifunc == 0) {
651 return pow(T1,4.8) + af_coeff[0] * pow(T1, 16.0) * fac2;
652 } else if (ifunc == 1) {
653 return (4.8 * pow(T1,3.8) + 16.0 * af_coeff[0] * pow(T1, 15.0)) / 300. * fac2;
654 } else if (ifunc == 2) {
655 return (4.8 * 3.8 * pow(T1,2.8) + 16.0 * 15.0 * af_coeff[0] * pow(T1, 14.0)) / (300. * 300.) * fac2;
656 } else if (ifunc == 3) {
657 double fac1 = pow(T1,4.8) + af_coeff[0] * pow(T1, 16.0);
658 fac2 = - (3.0 * af_coeff[1] * p2 + 4.0 * af_coeff[2] * p3)/ 1.0E5;
659 return fac1 * fac2;
660 } else {
661 throw NotImplementedError("PDSS_HKFT::f");
662 }
663}
664
665doublereal PDSS_HKFT::g(const doublereal temp, const doublereal pres, const int ifunc) const
666{
667 doublereal afunc = ag(temp, 0);
668 doublereal bfunc = bg(temp, 0);
669 m_waterSS->setState_TP(temp, pres);
670 m_densWaterSS = m_waterSS->density();
671 // density in gm cm-3
672 doublereal dens = m_densWaterSS * 1.0E-3;
673 doublereal gval = afunc * pow((1.0-dens), bfunc);
674 if (dens >= 1.0) {
675 return 0.0;
676 }
677 if (ifunc == 0) {
678 return gval;
679 } else if (ifunc == 1 || ifunc == 2) {
680 doublereal afuncdT = ag(temp, 1);
681 doublereal bfuncdT = bg(temp, 1);
682 doublereal alpha = m_waterSS->thermalExpansionCoeff();
683
684 doublereal fac1 = afuncdT * gval / afunc;
685 doublereal fac2 = bfuncdT * gval * log(1.0 - dens);
686 doublereal fac3 = gval * alpha * bfunc * dens / (1.0 - dens);
687
688 doublereal dgdt = fac1 + fac2 + fac3;
689 if (ifunc == 1) {
690 return dgdt;
691 }
692
693 doublereal afuncdT2 = ag(temp, 2);
694 doublereal bfuncdT2 = bg(temp, 2);
695 doublereal dfac1dT = dgdt * afuncdT / afunc + afuncdT2 * gval / afunc
696 - afuncdT * afuncdT * gval / (afunc * afunc);
697 doublereal ddensdT = - alpha * dens;
698 doublereal dfac2dT = bfuncdT2 * gval * log(1.0 - dens)
699 + bfuncdT * dgdt * log(1.0 - dens)
700 - bfuncdT * gval /(1.0 - dens) * ddensdT;
701 doublereal dalphadT = m_waterSS->dthermalExpansionCoeffdT();
702 doublereal dfac3dT = dgdt * alpha * bfunc * dens / (1.0 - dens)
703 + gval * dalphadT * bfunc * dens / (1.0 - dens)
704 + gval * alpha * bfuncdT * dens / (1.0 - dens)
705 + gval * alpha * bfunc * ddensdT / (1.0 - dens)
706 + gval * alpha * bfunc * dens / ((1.0 - dens) * (1.0 - dens)) * ddensdT;
707
708 return dfac1dT + dfac2dT + dfac3dT;
709 } else if (ifunc == 3) {
710 doublereal beta = m_waterSS->isothermalCompressibility();
711 return - bfunc * gval * dens * beta / (1.0 - dens);
712 } else {
713 throw NotImplementedError("PDSS_HKFT::g");
714 }
715 return 0.0;
716}
717
718doublereal PDSS_HKFT::gstar(const doublereal temp, const doublereal pres, const int ifunc) const
719{
720 doublereal gval = g(temp, pres, ifunc);
721 doublereal fval = f(temp, pres, ifunc);
722 double res = gval - fval;
723 return res;
724}
725
726doublereal PDSS_HKFT::LookupGe(const std::string& elemName)
727{
728 size_t iE = m_tp->elementIndex(elemName);
729 if (iE == npos) {
730 throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
731 }
732 doublereal geValue = m_tp->entropyElement298(iE);
733 if (geValue == ENTROPY298_UNKNOWN) {
734 throw CanteraError("PDSS_HKFT::LookupGe",
735 "element " + elemName + " does not have a supplied entropy298");
736 }
737 return geValue * -298.15;
738}
739
740 void PDSS_HKFT::convertDGFormation()
741{
742 // Ok let's get the element compositions and conversion factors.
743 doublereal totalSum = 0.0;
744 for (size_t m = 0; m < m_tp->nElements(); m++) {
745 double na = m_tp->nAtoms(m_spindex, m);
746 if (na > 0.0) {
747 totalSum += na * LookupGe(m_tp->elementName(m));
748 }
749 }
750 // Add in the charge
751 if (m_charge_j != 0.0) {
752 totalSum -= m_charge_j * LookupGe("H");
753 }
754 // Ok, now do the calculation. Convert to joules kmol-1
755 doublereal dg = m_deltaG_formation_tr_pr * toSI("cal/gmol");
756 //! Store the result into an internal variable.
757 m_Mu0_tr_pr = dg + totalSum;
758}
759
760 void PDSS_HKFT::reportParams(size_t& kindex, int& type,
761 doublereal* const c,
762 doublereal& minTemp_,
763 doublereal& maxTemp_,
764 doublereal& refPressure_) const
765{
766 // Fill in the first part
767 PDSS::reportParams(kindex, type, c, minTemp_, maxTemp_,
768 refPressure_);
769
770 c[0] = m_deltaG_formation_tr_pr;
771 c[1] = m_deltaH_formation_tr_pr;
772 c[2] = m_Mu0_tr_pr;
773 c[3] = m_Entrop_tr_pr;
774 c[4] = m_a1;
775 c[5] = m_a2;
776 c[6] = m_a3;
777 c[7] = m_a4;
778 c[8] = m_c1;
779 c[9] = m_c2;
780 c[10] = m_omega_pr_tr;
781}
782
783}
ENTROPY298_UNKNOWN
#define ENTROPY298_UNKNOWN
Number indicating we don't know the entropy of the element in its most stable state at 298....
Definition: Elements.h:87
PDSS_HKFT.h
Declarations for the class PDSS_HKFT (pressure dependent standard state) which handles calculations f...
PDSS_Water.h
Implementation of a pressure dependent standard state virtual function for a Pure Water Phase (see Sp...
VPStandardStateTP.h
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::AnyMap::convert
double convert(const std::string &key, const std::string &units) const
Convert the item stored by the given key to the units specified in units.
Definition: AnyMap.cpp:1508
Cantera::AnyMap::units
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
Definition: AnyMap.h:598
Cantera::AnyMap::hasKey
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:1406
Cantera::AnyValue
A wrapper for a variable whose type is determined at runtime.
Definition: AnyMap.h:84
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Cantera::PDSS_HKFT::setOmega
void setOmega(double omega)
Set omega [J/kmol].
Definition: PDSS_HKFT.cpp:370
Cantera::PDSS_HKFT::s_InputInconsistencyErrorExit
static int s_InputInconsistencyErrorExit
Static variable determining error exiting.
Definition: PDSS_HKFT.h:344
Cantera::PDSS_HKFT::getParameters
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition: PDSS_HKFT.cpp:457
Cantera::PDSS_HKFT::cp_R_ref
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS_HKFT.cpp:213
Cantera::PDSS_HKFT::m_deltaG_formation_tr_pr
doublereal m_deltaG_formation_tr_pr
Input value of deltaG of Formation at Tr and Pr (cal gmol-1)
Definition: PDSS_HKFT.h:277
Cantera::PDSS_HKFT::m_spindex
size_t m_spindex
Index of this species within the parent phase.
Definition: PDSS_HKFT.h:143
Cantera::PDSS_HKFT::m_a3
doublereal m_a3
Input a3 coefficient (cal K gmol-1 bar-1)
Definition: PDSS_HKFT.h:310
Cantera::PDSS_HKFT::m_domega_jdT_prtr
doublereal m_domega_jdT_prtr
small value that is not quite zero
Definition: PDSS_HKFT.h:334
Cantera::PDSS_HKFT::m_a4
doublereal m_a4
Input a4 coefficient (cal K gmol-1)
Definition: PDSS_HKFT.h:313
Cantera::PDSS_HKFT::m_charge_j
doublereal m_charge_j
Charge of the ion.
Definition: PDSS_HKFT.h:337
Cantera::PDSS_HKFT::reportParams
virtual void reportParams(size_t &kindex, int &type, doublereal *const c, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
Definition: PDSS_HKFT.cpp:760
Cantera::PDSS_HKFT::m_c2
doublereal m_c2
Input c2 coefficient (cal K gmol-1)
Definition: PDSS_HKFT.h:319
Cantera::PDSS_HKFT::m_c1
doublereal m_c1
Input c1 coefficient (cal gmol-1 K-1)
Definition: PDSS_HKFT.h:316
Cantera::PDSS_HKFT::deltaH
doublereal deltaH() const
Routine that actually calculates the enthalpy difference between the reference state at Tr,...
Definition: PDSS_HKFT.cpp:479
Cantera::PDSS_HKFT::cp_mole
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS_HKFT.cpp:79
Cantera::PDSS_HKFT::m_tp
VPStandardStateTP * m_tp
Parent VPStandardStateTP (ThermoPhase) object.
Definition: PDSS_HKFT.h:142
Cantera::PDSS_HKFT::enthalpy_mole
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS_HKFT.cpp:51
Cantera::PDSS_HKFT::setDeltaG0
void setDeltaG0(double dg0)
Set Gibbs free energy of formation at Pr, Tr [J/kmol].
Definition: PDSS_HKFT.cpp:350
Cantera::PDSS_HKFT::setState_TP
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_HKFT.cpp:231
Cantera::PDSS_HKFT::m_omega_pr_tr
doublereal m_omega_pr_tr
Input omega_pr_tr coefficient(cal gmol-1)
Definition: PDSS_HKFT.h:322
Cantera::PDSS_HKFT::m_a2
doublereal m_a2
Input a2 coefficient (cal gmol-1)
Definition: PDSS_HKFT.h:307
Cantera::PDSS_HKFT::m_densWaterSS
doublereal m_densWaterSS
density of standard-state water. internal temporary variable
Definition: PDSS_HKFT.h:265
Cantera::PDSS_HKFT::m_Entrop_tr_pr
doublereal m_Entrop_tr_pr
Input value of S_j at Tr and Pr (cal gmol-1 K-1)
Definition: PDSS_HKFT.h:301
Cantera::PDSS_HKFT::PDSS_HKFT
PDSS_HKFT()
Default Constructor.
Definition: PDSS_HKFT.cpp:26
Cantera::PDSS_HKFT::bg
doublereal bg(const doublereal temp, const int ifunc=0) const
Internal formula for the calculation of b_g()
Definition: PDSS_HKFT.cpp:617
Cantera::PDSS_HKFT::g
doublereal g(const doublereal temp, const doublereal pres, const int ifunc=0) const
function g appearing in the formulation
Definition: PDSS_HKFT.cpp:665
Cantera::PDSS_HKFT::m_Y_pr_tr
doublereal m_Y_pr_tr
y = dZdT = 1/(esp*esp) desp/dT at 298.15 and 1 bar
Definition: PDSS_HKFT.h:325
Cantera::PDSS_HKFT::setS0
void setS0(double s0)
Set entropy of formation at Pr, Tr [J/kmol/K].
Definition: PDSS_HKFT.cpp:354
Cantera::PDSS_HKFT::ag
doublereal ag(const doublereal temp, const int ifunc=0) const
Internal formula for the calculation of a_g()
Definition: PDSS_HKFT.cpp:603
Cantera::PDSS_HKFT::f
doublereal f(const doublereal temp, const doublereal pres, const int ifunc=0) const
Difference function f appearing in the formulation.
Definition: PDSS_HKFT.cpp:631
Cantera::PDSS_HKFT::entropy_mole
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS_HKFT.cpp:69
Cantera::PDSS_HKFT::m_a1
doublereal m_a1
Input a1 coefficient (cal gmol-1 bar-1)
Definition: PDSS_HKFT.h:304
Cantera::PDSS_HKFT::enthalpy_mole2
doublereal enthalpy_mole2() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS_HKFT.cpp:58
Cantera::PDSS_HKFT::molarVolume_ref
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS_HKFT.cpp:222
Cantera::PDSS_HKFT::initThermo
virtual void initThermo()
Initialization routine.
Definition: PDSS_HKFT.cpp:237
Cantera::PDSS_HKFT::m_Z_pr_tr
doublereal m_Z_pr_tr
Z = -1 / relEpsilon at 298.15 and 1 bar.
Definition: PDSS_HKFT.h:328
Cantera::PDSS_HKFT::m_deltaH_formation_tr_pr
doublereal m_deltaH_formation_tr_pr
Input value of deltaH of Formation at Tr and Pr (cal gmol-1)
Definition: PDSS_HKFT.h:286
Cantera::PDSS_HKFT::set_a
void set_a(double *a)
Set "a" coefficients (array of 4 elements).
Definition: PDSS_HKFT.cpp:358
Cantera::PDSS_HKFT::LookupGe
doublereal LookupGe(const std::string &elemName)
Function to look up Element Free Energies.
Definition: PDSS_HKFT.cpp:726
Cantera::PDSS_HKFT::molarVolume
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS_HKFT.cpp:138
Cantera::PDSS_HKFT::setParametersFromXML
void setParametersFromXML(const XML_Node &speciesNode)
Initialization routine for the PDSS object based on the speciesNode.
Definition: PDSS_HKFT.cpp:374
Cantera::PDSS_HKFT::gibbs_mole
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS_HKFT.cpp:74
Cantera::PDSS_HKFT::enthalpy_RT_ref
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS_HKFT.cpp:195
Cantera::PDSS_HKFT::deltaS
doublereal deltaS() const
Main routine that actually calculates the entropy difference between the reference state at Tr,...
Definition: PDSS_HKFT.cpp:562
Cantera::PDSS_HKFT::convertDGFormation
void convertDGFormation()
Translate a Gibbs free energy of formation value to a NIST-based Chemical potential.
Definition: PDSS_HKFT.cpp:740
Cantera::PDSS_HKFT::m_Mu0_tr_pr
doublereal m_Mu0_tr_pr
Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r.
Definition: PDSS_HKFT.h:295
Cantera::PDSS_HKFT::density
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS_HKFT.cpp:181
Cantera::PDSS_HKFT::m_presR_bar
doublereal m_presR_bar
Reference pressure is 1 atm in units of bar= 1.0132.
Definition: PDSS_HKFT.h:331
Cantera::PDSS_HKFT::gstar
doublereal gstar(const doublereal temp, const doublereal pres, const int ifunc=0) const
Evaluate the Gstar value appearing in the HKFT formulation.
Definition: PDSS_HKFT.cpp:718
Cantera::PDSS_HKFT::entropy_R_ref
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS_HKFT.cpp:204
Cantera::PDSS_HKFT::gibbs_RT_ref
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS_HKFT.cpp:186
Cantera::PDSS_HKFT::m_waterSS
PDSS_Water * m_waterSS
Water standard state calculator.
Definition: PDSS_HKFT.h:262
Cantera::PDSS_HKFT::deltaG
doublereal deltaG() const
Main routine that actually calculates the Gibbs free energy difference between the reference state at...
Definition: PDSS_HKFT.cpp:528
Cantera::PDSS_HKFT::m_waterProps
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
Definition: PDSS_HKFT.h:268
Cantera::PDSS_HKFT::set_c
void set_c(double *c)
Set "c" coefficients (array of 2 elements).
Definition: PDSS_HKFT.cpp:365
Cantera::PDSS_HKFT::intEnergy_mole
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS_HKFT.cpp:64
Cantera::PDSS_HKFT::setDeltaH0
void setDeltaH0(double dh0)
Set enthalpy of formation at Pr, Tr [J/kmol].
Definition: PDSS_HKFT.cpp:346
Cantera::PDSS_Molar::entropy_R
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:216
Cantera::PDSS_Molar::enthalpy_RT
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:211
Cantera::PDSS_Molar::gibbs_RT
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:221
Cantera::PDSS_Molar::cp_R
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:226
Cantera::PDSS_Water
Class for the liquid water pressure dependent standard state.
Definition: PDSS_Water.h:50
Cantera::PDSS_Water::pref_safe
doublereal pref_safe(doublereal temp) const
Returns a reference pressure value that can be safely calculated by the underlying real equation of s...
Definition: PDSS_Water.cpp:241
Cantera::PDSS_Water::setState_TP
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_Water.cpp:228
Cantera::PDSS_Water::thermalExpansionCoeff
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: PDSS_Water.cpp:170
Cantera::PDSS_Water::dthermalExpansionCoeffdT
virtual doublereal dthermalExpansionCoeffdT() const
Return the derivative of the volumetric thermal expansion coefficient.
Definition: PDSS_Water.cpp:175
Cantera::PDSS_Water::density
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS_Water.cpp:217
Cantera::PDSS_Water::isothermalCompressibility
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: PDSS_Water.cpp:191
Cantera::PDSS::initThermo
virtual void initThermo()
Initialization routine.
Definition: PDSS.h:415
Cantera::PDSS::reportParams
virtual void reportParams(size_t &kindex, int &type, doublereal *const c, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
Definition: PDSS.cpp:196
Cantera::PDSS::setParametersFromXML
virtual void setParametersFromXML(const XML_Node &speciesNode)
Initialization routine for the PDSS object based on the speciesNode.
Definition: PDSS.h:434
Cantera::PDSS::m_pres
doublereal m_pres
State of the system - pressure.
Definition: PDSS.h:458
Cantera::PDSS::setPressure
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS.cpp:157
Cantera::PDSS::m_temp
doublereal m_temp
Current temperature used by the PDSS object.
Definition: PDSS.h:455
Cantera::PDSS::m_maxTemp
doublereal m_maxTemp
Maximum temperature.
Definition: PDSS.h:467
Cantera::PDSS::setTemperature
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS.cpp:167
Cantera::PDSS::m_p0
doublereal m_p0
Reference state pressure of the species.
Definition: PDSS.h:461
Cantera::PDSS::m_mw
doublereal m_mw
Molecular Weight of the species.
Definition: PDSS.h:470
Cantera::PDSS::m_input
AnyMap m_input
Input data supplied via setParameters.
Definition: PDSS.h:474
Cantera::PDSS::getParameters
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition: PDSS.h:424
Cantera::PDSS::m_minTemp
doublereal m_minTemp
Minimum temperature.
Definition: PDSS.h:464
Cantera::Phase::entropyElement298
doublereal entropyElement298(size_t m) const
Entropy of the element in its standard state at 298 K and 1 bar.
Definition: Phase.cpp:126
Cantera::Phase::charge
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:630
Cantera::Phase::elementIndex
size_t elementIndex(const std::string &name) const
Return the index of element named 'name'.
Definition: Phase.cpp:106
Cantera::Phase::speciesName
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:200
Cantera::Phase::nAtoms
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
Definition: Phase.cpp:154
Cantera::Phase::nElements
size_t nElements() const
Number of elements.
Definition: Phase.cpp:81
Cantera::Phase::elementName
std::string elementName(size_t m) const
Name of the element with index m.
Definition: Phase.cpp:100
Cantera::WaterProps
The WaterProps class is used to house several approximation routines for properties of water.
Definition: WaterProps.h:100
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::XML_Node::attrib
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:493
Cantera::XML_Node::name
std::string name() const
Returns the name of the XML node.
Definition: xml.h:371
Cantera::XML_Node::hasChild
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:529
Cantera::XML_Node::findByName
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node.
Definition: xml.cpp:680
ctml.h
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
global.h
This file contains definitions for utility functions and text for modules, inputfiles,...
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:192
Cantera::getFloat
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
Definition: ctml.cpp:166
Cantera::OneAtm
const double OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:81
Cantera::caseInsensitiveEquals
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
Definition: stringUtils.cpp:266
Cantera::warn_user
void warn_user(const std::string &method, const std::string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition: global.h:245
Cantera::toSI
doublereal toSI(const std::string &unit)
Return the conversion factor to convert unit std::string 'unit' to SI units.
Definition: global.cpp:170
Cantera::fpValueCheck
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.
Definition: stringUtils.cpp:137
Cantera::strSItoDbl
doublereal strSItoDbl(const std::string &strSI)
Interpret one or two token string as a single double.
Definition: stringUtils.cpp:218
stringUtils.h
Contains declarations for string manipulation functions within Cantera.