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