| Cantera 3.0.0

Loading...
Searching...
No Matches
IdealMolalSoln.cpp
Go to the documentation of this file.
1/**
2 * @file IdealMolalSoln.cpp
3 * ThermoPhase object for the ideal molal equation of
4 * state (see @ref thermoprops
5 * and class @link Cantera::IdealMolalSoln IdealMolalSoln@endlink).
6 *
7 * Definition file for a derived class of ThermoPhase that handles variable
8 * pressure standard state methods for calculating thermodynamic properties that
9 * are further based upon activities on the molality scale. The Ideal molal
10 * solution assumes that all molality-based activity coefficients are equal to
11 * one. This turns out, actually, to be highly nonlinear when the solvent
12 * densities get low.
13 */
14
15// This file is part of Cantera. See License.txt in the top-level directory or
16// at https://cantera.org/license.txt for license and copyright information.
17
18#include "cantera/thermo/IdealMolalSoln.h"
19#include "cantera/thermo/ThermoFactory.h"
20#include "cantera/thermo/PDSS.h"
21#include "cantera/base/stringUtils.h"
22
23#include <iostream>
24
25 namespace {
26 double X_o_cutoff_default = 0.20;
27 double gamma_o_min_default = 0.00001;
28 double gamma_k_min_default = 10.0;
29 double slopefCut_default = 0.6;
30 double slopegCut_default = 0.0;
31 double cCut_default = .05;
32}
33
34 namespace Cantera
35{
36
37 IdealMolalSoln::IdealMolalSoln(const string& inputFile, const string& id_) :
38 IMS_X_o_cutoff_(X_o_cutoff_default),
39 IMS_gamma_o_min_(gamma_o_min_default),
40 IMS_gamma_k_min_(gamma_k_min_default),
41 IMS_slopefCut_(slopefCut_default),
42 IMS_slopegCut_(slopegCut_default),
43 IMS_cCut_(cCut_default)
44{
45 initThermoFile(inputFile, id_);
46}
47
48 double IdealMolalSoln::enthalpy_mole() const
49{
50 getPartialMolarEnthalpies(m_tmpV.data());
51 return mean_X(m_tmpV);
52}
53
54 double IdealMolalSoln::intEnergy_mole() const
55{
56 getPartialMolarIntEnergies(m_tmpV.data());
57 return mean_X(m_tmpV);
58}
59
60 double IdealMolalSoln::entropy_mole() const
61{
62 getPartialMolarEntropies(m_tmpV.data());
63 return mean_X(m_tmpV);
64}
65
66 double IdealMolalSoln::gibbs_mole() const
67{
68 getChemPotentials(m_tmpV.data());
69 return mean_X(m_tmpV);
70}
71
72 double IdealMolalSoln::cp_mole() const
73{
74 getPartialMolarCp(m_tmpV.data());
75 return mean_X(m_tmpV);
76}
77
78// ------- Mechanical Equation of State Properties ------------------------
79
80 void IdealMolalSoln::calcDensity()
81{
82 getPartialMolarVolumes(m_tmpV.data());
83 double dd = meanMolecularWeight() / mean_X(m_tmpV);
84 Phase::assignDensity(dd);
85}
86
87 double IdealMolalSoln::isothermalCompressibility() const
88{
89 return 0.0;
90}
91
92 double IdealMolalSoln::thermalExpansionCoeff() const
93{
94 return 0.0;
95}
96
97// ------- Activities and Activity Concentrations
98
99 Units IdealMolalSoln::standardConcentrationUnits() const
100{
101 if (m_formGC == 0) {
102 return Units(1.0); // dimensionless
103 } else {
104 // kmol/m^3 for bulk phases
105 return Units(1.0, 0, -static_cast<double>(nDim()), 0, 0, 0, 1);
106 }
107}
108
109 void IdealMolalSoln::getActivityConcentrations(double* c) const
110{
111 if (m_formGC != 1) {
112 double c_solvent = standardConcentration();
113 getActivities(c);
114 for (size_t k = 0; k < m_kk; k++) {
115 c[k] *= c_solvent;
116 }
117 } else {
118 getActivities(c);
119 for (size_t k = 0; k < m_kk; k++) {
120 double c0 = standardConcentration(k);
121 c[k] *= c0;
122 }
123 }
124}
125
126 double IdealMolalSoln::standardConcentration(size_t k) const
127{
128 switch (m_formGC) {
129 case 0:
130 return 1.0;
131 case 1:
132 return 1.0 / m_speciesMolarVolume[k];
133 case 2:
134 return 1.0 / m_speciesMolarVolume[0];
135 default:
136 throw CanteraError("IdealMolalSoln::standardConcentration",
137 "m_formGC is set to an incorrect value. \
138 Allowed values are 0, 1, and 2");
139 }
140}
141
142 void IdealMolalSoln::getActivities(double* ac) const
143{
144 _updateStandardStateThermo();
145
146 // Update the molality array, m_molalities(). This requires an update due to
147 // mole fractions
148 if (IMS_typeCutoff_ == 0) {
149 calcMolalities();
150 for (size_t k = 0; k < m_kk; k++) {
151 ac[k] = m_molalities[k];
152 }
153 double xmolSolvent = moleFraction(0);
154 // Limit the activity coefficient to be finite as the solvent mole
155 // fraction goes to zero.
156 xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
157 ac[0] = exp((xmolSolvent - 1.0)/xmolSolvent);
158 } else {
159
160 s_updateIMS_lnMolalityActCoeff();
161
162 // Now calculate the array of activities.
163 for (size_t k = 1; k < m_kk; k++) {
164 ac[k] = m_molalities[k] * exp(IMS_lnActCoeffMolal_[k]);
165 }
166 double xmolSolvent = moleFraction(0);
167 ac[0] = exp(IMS_lnActCoeffMolal_[0]) * xmolSolvent;
168 }
169}
170
171 void IdealMolalSoln::getMolalityActivityCoefficients(double* acMolality) const
172{
173 if (IMS_typeCutoff_ == 0) {
174 for (size_t k = 0; k < m_kk; k++) {
175 acMolality[k] = 1.0;
176 }
177 double xmolSolvent = moleFraction(0);
178 // Limit the activity coefficient to be finite as the solvent mole
179 // fraction goes to zero.
180 xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
181 acMolality[0] = exp((xmolSolvent - 1.0)/xmolSolvent) / xmolSolvent;
182 } else {
183 s_updateIMS_lnMolalityActCoeff();
184 std::copy(IMS_lnActCoeffMolal_.begin(), IMS_lnActCoeffMolal_.end(), acMolality);
185 for (size_t k = 0; k < m_kk; k++) {
186 acMolality[k] = exp(acMolality[k]);
187 }
188 }
189}
190
191// ------ Partial Molar Properties of the Solution -----------------
192
193 void IdealMolalSoln::getChemPotentials(double* mu) const
194{
195 // First get the standard chemical potentials. This requires updates of
196 // standard state as a function of T and P These are defined at unit
197 // molality.
198 getStandardChemPotentials(mu);
199
200 // Update the molality array, m_molalities(). This requires an update due to
201 // mole fractions
202 calcMolalities();
203
204 // get the solvent mole fraction
205 double xmolSolvent = moleFraction(0);
206
207 if (IMS_typeCutoff_ == 0 || xmolSolvent > 3.* IMS_X_o_cutoff_/2.0) {
208 for (size_t k = 1; k < m_kk; k++) {
209 double xx = std::max(m_molalities[k], SmallNumber);
210 mu[k] += RT() * log(xx);
211 }
212
213 // Do the solvent
214 // -> see my notes
215 double xx = std::max(xmolSolvent, SmallNumber);
216 mu[0] += (RT() * (xmolSolvent - 1.0) / xx);
217 } else {
218 // Update the activity coefficients. This also updates the internal
219 // molality array.
220 s_updateIMS_lnMolalityActCoeff();
221
222 for (size_t k = 1; k < m_kk; k++) {
223 double xx = std::max(m_molalities[k], SmallNumber);
224 mu[k] += RT() * (log(xx) + IMS_lnActCoeffMolal_[k]);
225 }
226 double xx = std::max(xmolSolvent, SmallNumber);
227 mu[0] += RT() * (log(xx) + IMS_lnActCoeffMolal_[0]);
228 }
229}
230
231 void IdealMolalSoln::getPartialMolarEnthalpies(double* hbar) const
232{
233 getEnthalpy_RT(hbar);
234 for (size_t k = 0; k < m_kk; k++) {
235 hbar[k] *= RT();
236 }
237}
238
239 void IdealMolalSoln::getPartialMolarIntEnergies(double* ubar) const
240{
241 getIntEnergy_RT(ubar);
242 for (size_t k = 0; k < m_kk; k++) {
243 ubar[k] *= RT();
244 }
245}
246
247 void IdealMolalSoln::getPartialMolarEntropies(double* sbar) const
248{
249 getEntropy_R(sbar);
250 calcMolalities();
251 if (IMS_typeCutoff_ == 0) {
252 for (size_t k = 1; k < m_kk; k++) {
253 double mm = std::max(SmallNumber, m_molalities[k]);
254 sbar[k] -= GasConstant * log(mm);
255 }
256 double xmolSolvent = moleFraction(0);
257 sbar[0] -= (GasConstant * (xmolSolvent - 1.0) / xmolSolvent);
258 } else {
259 // Update the activity coefficients, This also update the internally
260 // stored molalities.
261 s_updateIMS_lnMolalityActCoeff();
262
263 // First we will add in the obvious dependence on the T term out front
264 // of the log activity term
265 double mm;
266 for (size_t k = 1; k < m_kk; k++) {
267 mm = std::max(SmallNumber, m_molalities[k]);
268 sbar[k] -= GasConstant * (log(mm) + IMS_lnActCoeffMolal_[k]);
269 }
270 double xmolSolvent = moleFraction(0);
271 mm = std::max(SmallNumber, xmolSolvent);
272 sbar[0] -= GasConstant *(log(mm) + IMS_lnActCoeffMolal_[0]);
273 }
274}
275
276 void IdealMolalSoln::getPartialMolarVolumes(double* vbar) const
277{
278 getStandardVolumes(vbar);
279}
280
281 void IdealMolalSoln::getPartialMolarCp(double* cpbar) const
282{
283 // Get the nondimensional Gibbs standard state of the species at the T and P
284 // of the solution.
285 getCp_R(cpbar);
286 for (size_t k = 0; k < m_kk; k++) {
287 cpbar[k] *= GasConstant;
288 }
289}
290
291// -------------- Utilities -------------------------------
292
293 bool IdealMolalSoln::addSpecies(shared_ptr<Species> spec)
294{
295 bool added = MolalityVPSSTP::addSpecies(spec);
296 if (added) {
297 m_speciesMolarVolume.push_back(0.0);
298 m_tmpV.push_back(0.0);
299 IMS_lnActCoeffMolal_.push_back(0.0);
300 }
301 return added;
302}
303
304 void IdealMolalSoln::initThermo()
305{
306 MolalityVPSSTP::initThermo();
307
308 if (m_input.hasKey("standard-concentration-basis")) {
309 setStandardConcentrationModel(m_input["standard-concentration-basis"].asString());
310 }
311 if (m_input.hasKey("cutoff")) {
312 auto& cutoff = m_input["cutoff"].as<AnyMap>();
313 setCutoffModel(cutoff.getString("model", "none"));
314 IMS_gamma_o_min_ = cutoff.getDouble("gamma_o", gamma_o_min_default);
315 IMS_gamma_k_min_ = cutoff.getDouble("gamma_k", gamma_k_min_default);
316 IMS_X_o_cutoff_ = cutoff.getDouble("X_o", X_o_cutoff_default);
317 IMS_cCut_ = cutoff.getDouble("c_0", cCut_default);
318 IMS_slopefCut_ = cutoff.getDouble("slope_f", slopefCut_default);
319 IMS_slopegCut_ = cutoff.getDouble("slope_g", slopegCut_default);
320 }
321
322 for (size_t k = 0; k < nSpecies(); k++) {
323 m_speciesMolarVolume[k] = providePDSS(k)->molarVolume();
324 }
325 if (IMS_typeCutoff_ == 2) {
326 calcIMSCutoffParams_();
327 }
328 setMoleFSolventMin(1.0E-5);
329}
330
331 void IdealMolalSoln::getParameters(AnyMap& phaseNode) const
332{
333 MolalityVPSSTP::getParameters(phaseNode);
334
335 // "solvent-molar-volume" (m_formGC == 2) is the default, and can be omitted
336 if (m_formGC == 0) {
337 phaseNode["standard-concentration-basis"] = "unity";
338 } else if (m_formGC == 1) {
339 phaseNode["standard-concentration-basis"] = "species-molar-volume";
340 }
341
342 AnyMap cutoff;
343 if (IMS_typeCutoff_ == 1) {
344 cutoff["model"] = "poly";
345 } else if (IMS_typeCutoff_ == 2) {
346 cutoff["model"] = "polyexp";
347 }
348
349 if (IMS_gamma_o_min_ != gamma_o_min_default) {
350 cutoff["gamma_o"] = IMS_gamma_o_min_;
351 }
352 if (IMS_gamma_k_min_ != gamma_k_min_default) {
353 cutoff["gamma_k"] = IMS_gamma_k_min_;
354 }
355 if (IMS_X_o_cutoff_ != X_o_cutoff_default) {
356 cutoff["X_o"] = IMS_X_o_cutoff_;
357 }
358 if (IMS_cCut_ != cCut_default) {
359 cutoff["c_0"] = IMS_cCut_;
360 }
361 if (IMS_slopefCut_ != slopefCut_default) {
362 cutoff["slope_f"] = IMS_slopefCut_;
363 }
364 if (IMS_slopegCut_ != slopegCut_default) {
365 cutoff["slope_g"] = IMS_slopegCut_;
366 }
367
368 if (cutoff.size()) {
369 phaseNode["cutoff"] = std::move(cutoff);
370 }
371}
372
373 void IdealMolalSoln::setStandardConcentrationModel(const string& model)
374{
375 if (caseInsensitiveEquals(model, "unity")) {
376 m_formGC = 0;
377 } else if (caseInsensitiveEquals(model, "species-molar-volume")
378 || caseInsensitiveEquals(model, "molar_volume")) {
379 m_formGC = 1;
380 } else if (caseInsensitiveEquals(model, "solvent-molar-volume")
381 || caseInsensitiveEquals(model, "solvent_volume")) {
382 m_formGC = 2;
383 } else {
384 throw CanteraError("IdealMolalSoln::setStandardConcentrationModel",
385 "Unknown standard concentration model '{}'", model);
386 }
387}
388
389 void IdealMolalSoln::setCutoffModel(const string& model)
390{
391 if (caseInsensitiveEquals(model, "none")) {
392 IMS_typeCutoff_ = 0;
393 } else if (caseInsensitiveEquals(model, "poly")) {
394 IMS_typeCutoff_ = 1;
395 } else if (caseInsensitiveEquals(model, "polyexp")) {
396 IMS_typeCutoff_ = 2;
397 } else {
398 throw CanteraError("IdealMolalSoln::setCutoffModel",
399 "Unknown cutoff model '{}'", model);
400 }
401}
402
403// ------------ Private and Restricted Functions ------------------
404
405 void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const
406{
407 // Calculate the molalities. Currently, the molalities may not be current
408 // with respect to the contents of the State objects' data.
409 calcMolalities();
410
411 double xmolSolvent = moleFraction(0);
412 double xx = std::max(m_xmolSolventMIN, xmolSolvent);
413
414 if (IMS_typeCutoff_ == 0) {
415 for (size_t k = 1; k < m_kk; k++) {
416 IMS_lnActCoeffMolal_[k]= 0.0;
417 }
418 IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
419 return;
420 } else if (IMS_typeCutoff_ == 1) {
421 if (xmolSolvent > 3.0 * IMS_X_o_cutoff_/2.0) {
422 for (size_t k = 1; k < m_kk; k++) {
423 IMS_lnActCoeffMolal_[k]= 0.0;
424 }
425 IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
426 return;
427 } else if (xmolSolvent < IMS_X_o_cutoff_/2.0) {
428 double tmp = log(xx * IMS_gamma_k_min_);
429 for (size_t k = 1; k < m_kk; k++) {
430 IMS_lnActCoeffMolal_[k]= tmp;
431 }
432 IMS_lnActCoeffMolal_[0] = log(IMS_gamma_o_min_);
433 return;
434 } else {
435 // If we are in the middle region, calculate the connecting polynomials
436 double xminus = xmolSolvent - IMS_X_o_cutoff_/2.0;
437 double xminus2 = xminus * xminus;
438 double xminus3 = xminus2 * xminus;
439 double x_o_cut2 = IMS_X_o_cutoff_ * IMS_X_o_cutoff_;
440 double x_o_cut3 = x_o_cut2 * IMS_X_o_cutoff_;
441
442 double h2 = 3.5 * xminus2 / IMS_X_o_cutoff_ - 2.0 * xminus3 / x_o_cut2;
443 double h2_prime = 7.0 * xminus / IMS_X_o_cutoff_ - 6.0 * xminus2 / x_o_cut2;
444
445 double h1 = (1.0 - 3.0 * xminus2 / x_o_cut2 + 2.0 * xminus3/ x_o_cut3);
446 double h1_prime = (- 6.0 * xminus / x_o_cut2 + 6.0 * xminus2/ x_o_cut3);
447
448 double h1_g = h1 / IMS_gamma_o_min_;
449 double h1_g_prime = h1_prime / IMS_gamma_o_min_;
450
451 double alpha = 1.0 / (exp(1.0) * IMS_gamma_k_min_);
452 double h1_f = h1 * alpha;
453 double h1_f_prime = h1_prime * alpha;
454
455 double f = h2 + h1_f;
456 double f_prime = h2_prime + h1_f_prime;
457
458 double g = h2 + h1_g;
459 double g_prime = h2_prime + h1_g_prime;
460
461 double tmp = (xmolSolvent/ g * g_prime + (1.0-xmolSolvent) / f * f_prime);
462 double lngammak = -1.0 - log(f) + tmp * xmolSolvent;
463 double lngammao =-log(g) - tmp * (1.0-xmolSolvent);
464
465 tmp = log(xmolSolvent) + lngammak;
466 for (size_t k = 1; k < m_kk; k++) {
467 IMS_lnActCoeffMolal_[k]= tmp;
468 }
469 IMS_lnActCoeffMolal_[0] = lngammao;
470 }
471 } else if (IMS_typeCutoff_ == 2) {
472 // Exponentials - trial 2
473 if (xmolSolvent > IMS_X_o_cutoff_) {
474 for (size_t k = 1; k < m_kk; k++) {
475 IMS_lnActCoeffMolal_[k]= 0.0;
476 }
477 IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
478 return;
479 } else {
480 double xoverc = xmolSolvent/IMS_cCut_;
481 double eterm = std::exp(-xoverc);
482
483 double fptmp = IMS_bfCut_ - IMS_afCut_ / IMS_cCut_ - IMS_bfCut_*xoverc
484 + 2.0*IMS_dfCut_*xmolSolvent - IMS_dfCut_*xmolSolvent*xoverc;
485 double f_prime = 1.0 + eterm*fptmp;
486 double f = xmolSolvent + IMS_efCut_ + eterm * (IMS_afCut_ + xmolSolvent * (IMS_bfCut_ + IMS_dfCut_*xmolSolvent));
487
488 double gptmp = IMS_bgCut_ - IMS_agCut_ / IMS_cCut_ - IMS_bgCut_*xoverc
489 + 2.0*IMS_dgCut_*xmolSolvent - IMS_dgCut_*xmolSolvent*xoverc;
490 double g_prime = 1.0 + eterm*gptmp;
491 double g = xmolSolvent + IMS_egCut_ + eterm * (IMS_agCut_ + xmolSolvent * (IMS_bgCut_ + IMS_dgCut_*xmolSolvent));
492
493 double tmp = (xmolSolvent / g * g_prime + (1.0 - xmolSolvent) / f * f_prime);
494 double lngammak = -1.0 - log(f) + tmp * xmolSolvent;
495 double lngammao =-log(g) - tmp * (1.0-xmolSolvent);
496
497 tmp = log(xx) + lngammak;
498 for (size_t k = 1; k < m_kk; k++) {
499 IMS_lnActCoeffMolal_[k]= tmp;
500 }
501 IMS_lnActCoeffMolal_[0] = lngammao;
502 }
503 }
504}
505
506 void IdealMolalSoln::calcIMSCutoffParams_()
507{
508 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
509 IMS_efCut_ = 0.0;
510 bool converged = false;
511 for (int its = 0; its < 100 && !converged; its++) {
512 double oldV = IMS_efCut_;
513 IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_) - IMS_efCut_;
514 IMS_bfCut_ = IMS_afCut_ / IMS_cCut_ + IMS_slopefCut_ - 1.0;
515 IMS_dfCut_ = ((- IMS_afCut_/IMS_cCut_ + IMS_bfCut_ - IMS_bfCut_*IMS_X_o_cutoff_/IMS_cCut_)
516 /
517 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
518 double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ * IMS_X_o_cutoff_);
519 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
520 IMS_efCut_ = - eterm * (tmp);
521 if (fabs(IMS_efCut_ - oldV) < 1.0E-14) {
522 converged = true;
523 }
524 }
525 if (!converged) {
526 throw CanteraError("IdealMolalSoln::calcCutoffParams_",
527 "failed to converge on the f polynomial");
528 }
529 converged = false;
530 double f_0 = IMS_afCut_ + IMS_efCut_;
531 double f_prime_0 = 1.0 - IMS_afCut_ / IMS_cCut_ + IMS_bfCut_;
532 IMS_egCut_ = 0.0;
533 for (int its = 0; its < 100 && !converged; its++) {
534 double oldV = IMS_egCut_;
535 double lng_0 = -log(IMS_gamma_o_min_) - f_prime_0 / f_0;
536 IMS_agCut_ = exp(lng_0) - IMS_egCut_;
537 IMS_bgCut_ = IMS_agCut_ / IMS_cCut_ + IMS_slopegCut_ - 1.0;
538 IMS_dgCut_ = ((- IMS_agCut_/IMS_cCut_ + IMS_bgCut_ - IMS_bgCut_*IMS_X_o_cutoff_/IMS_cCut_)
539 /
540 (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
541 double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_);
542 double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
543 IMS_egCut_ = - eterm * (tmp);
544 if (fabs(IMS_egCut_ - oldV) < 1.0E-14) {
545 converged = true;
546 }
547 }
548 if (!converged) {
549 throw CanteraError("IdealMolalSoln::calcCutoffParams_",
550 "failed to converge on the g polynomial");
551 }
552}
553
554}
IdealMolalSoln.h
ThermoPhase object for the ideal molal equation of state (see Thermodynamic Properties and class Idea...
PDSS.h
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
ThermoFactory.h
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::AnyMap::size
size_t size() const
Returns the number of elements in this map.
Definition AnyMap.h:622
Cantera::AnyMap::hasKey
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1423
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
Cantera::IdealMolalSoln::calcIMSCutoffParams_
void calcIMSCutoffParams_()
Calculate parameters for cutoff treatments of activity coefficients.
Definition IdealMolalSoln.cpp:506
Cantera::IdealMolalSoln::enthalpy_mole
double enthalpy_mole() const override
Molar enthalpy of the solution. Units: J/kmol.
Definition IdealMolalSoln.cpp:48
Cantera::IdealMolalSoln::thermalExpansionCoeff
double thermalExpansionCoeff() const override
The thermal expansion coefficient. Units: 1/K.
Definition IdealMolalSoln.cpp:92
Cantera::IdealMolalSoln::getPartialMolarEnthalpies
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
Definition IdealMolalSoln.cpp:231
Cantera::IdealMolalSoln::getChemPotentials
void getChemPotentials(double *mu) const override
Get the species chemical potentials: Units: J/kmol.
Definition IdealMolalSoln.cpp:193
Cantera::IdealMolalSoln::IMS_slopegCut_
double IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
Definition IdealMolalSoln.h:432
Cantera::IdealMolalSoln::IMS_gamma_o_min_
double IMS_gamma_o_min_
gamma_o value for the cutoff process at the zero solvent point
Definition IdealMolalSoln.h:421
Cantera::IdealMolalSoln::IMS_typeCutoff_
int IMS_typeCutoff_
Cutoff type.
Definition IdealMolalSoln.h:404
Cantera::IdealMolalSoln::IdealMolalSoln
IdealMolalSoln(const string &inputFile="", const string &id="")
Constructor for phase initialization.
Definition IdealMolalSoln.cpp:37
Cantera::IdealMolalSoln::getParameters
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition IdealMolalSoln.cpp:331
Cantera::IdealMolalSoln::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition IdealMolalSoln.cpp:304
Cantera::IdealMolalSoln::m_tmpV
vector< double > m_tmpV
vector of size m_kk, used as a temporary holding area.
Definition IdealMolalSoln.h:408
Cantera::IdealMolalSoln::getActivityConcentrations
void getActivityConcentrations(double *c) const override
This method returns an array of generalized concentrations.
Definition IdealMolalSoln.cpp:109
Cantera::IdealMolalSoln::getPartialMolarVolumes
void getPartialMolarVolumes(double *vbar) const override
Definition IdealMolalSoln.cpp:276
Cantera::IdealMolalSoln::IMS_lnActCoeffMolal_
vector< double > IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.
Definition IdealMolalSoln.h:414
Cantera::IdealMolalSoln::setStandardConcentrationModel
void setStandardConcentrationModel(const string &model)
Set the standard concentration model.
Definition IdealMolalSoln.cpp:373
Cantera::IdealMolalSoln::IMS_slopefCut_
double IMS_slopefCut_
Parameter in the polyExp cutoff treatment.
Definition IdealMolalSoln.h:428
Cantera::IdealMolalSoln::isothermalCompressibility
double isothermalCompressibility() const override
The isothermal compressibility. Units: 1/Pa.
Definition IdealMolalSoln.cpp:87
Cantera::IdealMolalSoln::intEnergy_mole
double intEnergy_mole() const override
Molar internal energy of the solution: Units: J/kmol.
Definition IdealMolalSoln.cpp:54
Cantera::IdealMolalSoln::entropy_mole
double entropy_mole() const override
Molar entropy of the solution. Units: J/kmol/K.
Definition IdealMolalSoln.cpp:60
Cantera::IdealMolalSoln::calcDensity
void calcDensity() override
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Definition IdealMolalSoln.cpp:80
Cantera::IdealMolalSoln::setCutoffModel
void setCutoffModel(const string &model)
Set cutoff model. Must be one of 'none', 'poly', or 'polyExp'.
Definition IdealMolalSoln.cpp:389
Cantera::IdealMolalSoln::IMS_gamma_k_min_
double IMS_gamma_k_min_
gamma_k minimum for the cutoff process at the zero solvent point
Definition IdealMolalSoln.h:424
Cantera::IdealMolalSoln::m_formGC
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'species-molar-vo...
Definition IdealMolalSoln.h:401
Cantera::IdealMolalSoln::m_speciesMolarVolume
vector< double > m_speciesMolarVolume
Species molar volume .
Definition IdealMolalSoln.h:394
Cantera::IdealMolalSoln::cp_mole
double cp_mole() const override
Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
Definition IdealMolalSoln.cpp:72
Cantera::IdealMolalSoln::getActivities
void getActivities(double *ac) const override
Get the array of non-dimensional activities at the current solution temperature, pressure,...
Definition IdealMolalSoln.cpp:142
Cantera::IdealMolalSoln::IMS_X_o_cutoff_
double IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process;
Definition IdealMolalSoln.h:418
Cantera::IdealMolalSoln::standardConcentrationUnits
Units standardConcentrationUnits() const override
Returns the units of the "standard concentration" for this phase.
Definition IdealMolalSoln.cpp:99
Cantera::IdealMolalSoln::getPartialMolarCp
void getPartialMolarCp(double *cpbar) const override
Partial molar heat capacity of the solution:. UnitsL J/kmol/K.
Definition IdealMolalSoln.cpp:281
Cantera::IdealMolalSoln::gibbs_mole
double gibbs_mole() const override
Molar Gibbs function for the solution: Units J/kmol.
Definition IdealMolalSoln.cpp:66
Cantera::IdealMolalSoln::standardConcentration
double standardConcentration(size_t k=0) const override
Return the standard concentration for the kth species.
Definition IdealMolalSoln.cpp:126
Cantera::IdealMolalSoln::addSpecies
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition IdealMolalSoln.cpp:293
Cantera::IdealMolalSoln::getPartialMolarIntEnergies
void getPartialMolarIntEnergies(double *hbar) const override
Returns an array of partial molar internal energies for the species in the mixture.
Definition IdealMolalSoln.cpp:239
Cantera::IdealMolalSoln::s_updateIMS_lnMolalityActCoeff
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
Definition IdealMolalSoln.cpp:405
Cantera::IdealMolalSoln::getMolalityActivityCoefficients
void getMolalityActivityCoefficients(double *acMolality) const override
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
Definition IdealMolalSoln.cpp:171
Cantera::IdealMolalSoln::getPartialMolarEntropies
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
Definition IdealMolalSoln.cpp:247
Cantera::MolalityVPSSTP::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition MolalityVPSSTP.cpp:269
Cantera::MolalityVPSSTP::m_xmolSolventMIN
double m_xmolSolventMIN
In any molality implementation, it makes sense to have a minimum solvent mole fraction requirement,...
Definition MolalityVPSSTP.h:610
Cantera::MolalityVPSSTP::m_molalities
vector< double > m_molalities
Current value of the molalities of the species in the phase.
Definition MolalityVPSSTP.h:619
Cantera::MolalityVPSSTP::setMoleFSolventMin
void setMoleFSolventMin(double xmolSolventMIN)
Sets the minimum mole fraction in the molality formulation.
Definition MolalityVPSSTP.cpp:45
Cantera::MolalityVPSSTP::calcMolalities
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
Definition MolalityVPSSTP.cpp:60
Cantera::MolalityVPSSTP::addSpecies
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition MolalityVPSSTP.cpp:343
Cantera::PDSS::molarVolume
virtual double molarVolume() const
Return the molar volume at standard state.
Definition PDSS.cpp:63
Cantera::Phase::assignDensity
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition Phase.cpp:718
Cantera::Phase::nSpecies
size_t nSpecies() const
Returns the number of species in the phase.
Definition Phase.h:245
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition Phase.h:947
Cantera::Phase::nDim
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition Phase.h:646
Cantera::Phase::meanMolecularWeight
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition Phase.h:760
Cantera::Phase::moleFraction
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:545
Cantera::Phase::mean_X
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:737
Cantera::ThermoPhase::getParameters
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition ThermoPhase.cpp:1176
Cantera::ThermoPhase::RT
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1077
Cantera::ThermoPhase::initThermoFile
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
Definition ThermoPhase.cpp:1072
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition ThermoPhase.h:2130
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
Cantera::VPStandardStateTP::getEntropy_R
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition VPStandardStateTP.cpp:62
Cantera::VPStandardStateTP::_updateStandardStateThermo
virtual void _updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
Definition VPStandardStateTP.cpp:269
Cantera::VPStandardStateTP::getStandardChemPotentials
void getStandardChemPotentials(double *mu) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition VPStandardStateTP.cpp:48
Cantera::VPStandardStateTP::getCp_R
void getCp_R(double *cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition VPStandardStateTP.cpp:90
Cantera::VPStandardStateTP::getEnthalpy_RT
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition VPStandardStateTP.cpp:56
Cantera::VPStandardStateTP::getStandardVolumes
void getStandardVolumes(double *vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
Definition VPStandardStateTP.cpp:96
Cantera::VPStandardStateTP::getIntEnergy_RT
void getIntEnergy_RT(double *urt) const override
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition VPStandardStateTP.cpp:81
Cantera::caseInsensitiveEquals
bool caseInsensitiveEquals(const string &input, const string &test)
Case insensitive equality predicate.
Definition stringUtils.cpp:223
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::SmallNumber
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:158
stringUtils.h
Contains declarations for string manipulation functions within Cantera.