Cantera  2.4.0
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 http://www.cantera.org/license.txt for license and copyright information.
17 
20 #include "cantera/base/ctml.h"
22 
23 #include <iostream>
24 
25 namespace Cantera
26 {
27 
29  m_formGC(2),
30  IMS_typeCutoff_(0),
31  IMS_X_o_cutoff_(0.20),
32  IMS_gamma_o_min_(0.00001),
33  IMS_gamma_k_min_(10.0),
34  IMS_slopefCut_(0.6),
35  IMS_slopegCut_(0.0),
36  IMS_cCut_(.05),
37  IMS_dfCut_(0.0),
38  IMS_efCut_(0.0),
39  IMS_afCut_(0.0),
40  IMS_bfCut_(0.0),
41  IMS_dgCut_(0.0),
42  IMS_egCut_(0.0),
43  IMS_agCut_(0.0),
44  IMS_bgCut_(0.0)
45 {
46 }
47 
48 IdealMolalSoln::IdealMolalSoln(const std::string& inputFile,
49  const std::string& id_) :
51  m_formGC(2),
52  IMS_typeCutoff_(0),
53  IMS_X_o_cutoff_(0.2),
54  IMS_gamma_o_min_(0.00001),
55  IMS_gamma_k_min_(10.0),
56  IMS_slopefCut_(0.6),
57  IMS_slopegCut_(0.0),
58  IMS_cCut_(.05),
59  IMS_dfCut_(0.0),
60  IMS_efCut_(0.0),
61  IMS_afCut_(0.0),
62  IMS_bfCut_(0.0),
63  IMS_dgCut_(0.0),
64  IMS_egCut_(0.0),
65  IMS_agCut_(0.0),
66  IMS_bgCut_(0.0)
67 {
68  initThermoFile(inputFile, id_);
69 }
70 
71 IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id_) :
73  m_formGC(2),
74  IMS_typeCutoff_(0),
75  IMS_X_o_cutoff_(0.2),
76  IMS_gamma_o_min_(0.00001),
77  IMS_gamma_k_min_(10.0),
78  IMS_slopefCut_(0.6),
79  IMS_slopegCut_(0.0),
80  IMS_cCut_(.05),
81  IMS_dfCut_(0.0),
82  IMS_efCut_(0.0),
83  IMS_afCut_(0.0),
84  IMS_bfCut_(0.0),
85  IMS_dgCut_(0.0),
86  IMS_egCut_(0.0),
87  IMS_agCut_(0.0),
88  IMS_bgCut_(0.0)
89 {
90  importPhase(root, this);
91 }
92 
94 {
96  return mean_X(m_tmpV);
97 }
98 
100 {
102  return mean_X(m_tmpV);
103 }
104 
106 {
108  return mean_X(m_tmpV);
109 }
110 
111 doublereal IdealMolalSoln::gibbs_mole() const
112 {
113  getChemPotentials(m_tmpV.data());
114  return mean_X(m_tmpV);
115 }
116 
117 doublereal IdealMolalSoln::cp_mole() const
118 {
119  getPartialMolarCp(m_tmpV.data());
120  return mean_X(m_tmpV);
121 }
122 
123 // ------- Mechanical Equation of State Properties ------------------------
124 
126 {
128  doublereal dd = meanMolecularWeight() / mean_X(m_tmpV);
129  Phase::setDensity(dd);
130 }
131 
133 {
134  return 0.0;
135 }
136 
138 {
139  return 0.0;
140 }
141 
142 void IdealMolalSoln::setDensity(const doublereal rho)
143 {
144  if (rho != density()) {
145  throw CanteraError("Idea;MolalSoln::setDensity",
146  "Density is not an independent variable");
147  }
148 }
149 
150 void IdealMolalSoln::setMolarDensity(const doublereal conc)
151 {
152  if (conc != Phase::molarDensity()) {
153  throw CanteraError("IdealMolalSoln::setMolarDensity",
154  "molarDensity/denisty is not an independent variable");
155  }
156 }
157 
158 // ------- Activities and Activity Concentrations
159 
161 {
162  if (m_formGC != 1) {
163  double c_solvent = standardConcentration();
164  getActivities(c);
165  for (size_t k = 0; k < m_kk; k++) {
166  c[k] *= c_solvent;
167  }
168  } else {
169  getActivities(c);
170  for (size_t k = 0; k < m_kk; k++) {
171  double c0 = standardConcentration(k);
172  c[k] *= c0;
173  }
174  }
175 }
176 
177 doublereal IdealMolalSoln::standardConcentration(size_t k) const
178 {
179  double c0 = 1.0;
180  switch (m_formGC) {
181  case 0:
182  break;
183  case 1:
184  return c0 = 1.0 /m_speciesMolarVolume[0];
185  break;
186  case 2:
187  c0 = 1.0 / m_speciesMolarVolume[0];
188  break;
189  }
190  return c0;
191 }
192 
193 void IdealMolalSoln::getActivities(doublereal* ac) const
194 {
196 
197  // Update the molality array, m_molalities(). This requires an update due to
198  // mole fractions
199  if (IMS_typeCutoff_ == 0) {
200  calcMolalities();
201  for (size_t k = 0; k < m_kk; k++) {
202  ac[k] = m_molalities[k];
203  }
204  double xmolSolvent = moleFraction(0);
205  // Limit the activity coefficient to be finite as the solvent mole
206  // fraction goes to zero.
207  xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
208  ac[0] = exp((xmolSolvent - 1.0)/xmolSolvent);
209  } else {
210 
212 
213  // Now calculate the array of activities.
214  for (size_t k = 1; k < m_kk; k++) {
215  ac[k] = m_molalities[k] * exp(IMS_lnActCoeffMolal_[k]);
216  }
217  double xmolSolvent = moleFraction(0);
218  ac[0] = exp(IMS_lnActCoeffMolal_[0]) * xmolSolvent;
219  }
220 }
221 
222 void IdealMolalSoln::getMolalityActivityCoefficients(doublereal* acMolality) const
223 {
224  if (IMS_typeCutoff_ == 0) {
225  for (size_t k = 0; k < m_kk; k++) {
226  acMolality[k] = 1.0;
227  }
228  double xmolSolvent = moleFraction(0);
229  // Limit the activity coefficient to be finite as the solvent mole
230  // fraction goes to zero.
231  xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
232  acMolality[0] = exp((xmolSolvent - 1.0)/xmolSolvent) / xmolSolvent;
233  } else {
235  std::copy(IMS_lnActCoeffMolal_.begin(), IMS_lnActCoeffMolal_.end(), acMolality);
236  for (size_t k = 0; k < m_kk; k++) {
237  acMolality[k] = exp(acMolality[k]);
238  }
239  }
240 }
241 
242 // ------ Partial Molar Properties of the Solution -----------------
243 
244 void IdealMolalSoln::getChemPotentials(doublereal* mu) const
245 {
246  // First get the standard chemical potentials. This requires updates of
247  // standard state as a function of T and P These are defined at unit
248  // molality.
250 
251  // Update the molality array, m_molalities(). This requires an update due to
252  // mole fractions
253  calcMolalities();
254 
255  // get the solvent mole fraction
256  double xmolSolvent = moleFraction(0);
257 
258  if (IMS_typeCutoff_ == 0 || xmolSolvent > 3.* IMS_X_o_cutoff_/2.0) {
259  for (size_t k = 1; k < m_kk; k++) {
260  double xx = std::max(m_molalities[k], SmallNumber);
261  mu[k] += RT() * log(xx);
262  }
263 
264  // Do the solvent
265  // -> see my notes
266  double xx = std::max(xmolSolvent, SmallNumber);
267  mu[0] += (RT() * (xmolSolvent - 1.0) / xx);
268  } else {
269  // Update the activity coefficients. This also updates the internal
270  // molality array.
272 
273  for (size_t k = 1; k < m_kk; k++) {
274  double xx = std::max(m_molalities[k], SmallNumber);
275  mu[k] += RT() * (log(xx) + IMS_lnActCoeffMolal_[k]);
276  }
277  double xx = std::max(xmolSolvent, SmallNumber);
278  mu[0] += RT() * (log(xx) + IMS_lnActCoeffMolal_[0]);
279  }
280 }
281 
282 void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const
283 {
284  getEnthalpy_RT(hbar);
285  for (size_t k = 0; k < m_kk; k++) {
286  hbar[k] *= RT();
287  }
288 }
289 
290 void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const
291 {
292  getEntropy_R(sbar);
293  calcMolalities();
294  if (IMS_typeCutoff_ == 0) {
295  for (size_t k = 1; k < m_kk; k++) {
296  doublereal mm = std::max(SmallNumber, m_molalities[k]);
297  sbar[k] -= GasConstant * log(mm);
298  }
299  double xmolSolvent = moleFraction(0);
300  sbar[0] -= (GasConstant * (xmolSolvent - 1.0) / xmolSolvent);
301  } else {
302  // Update the activity coefficients, This also update the internally
303  // stored molalities.
305 
306  // First we will add in the obvious dependence on the T term out front
307  // of the log activity term
308  doublereal mm;
309  for (size_t k = 1; k < m_kk; k++) {
310  mm = std::max(SmallNumber, m_molalities[k]);
311  sbar[k] -= GasConstant * (log(mm) + IMS_lnActCoeffMolal_[k]);
312  }
313  double xmolSolvent = moleFraction(0);
314  mm = std::max(SmallNumber, xmolSolvent);
315  sbar[0] -= GasConstant *(log(mm) + IMS_lnActCoeffMolal_[0]);
316  }
317 }
318 
319 void IdealMolalSoln::getPartialMolarVolumes(doublereal* vbar) const
320 {
321  getStandardVolumes(vbar);
322 }
323 
324 void IdealMolalSoln::getPartialMolarCp(doublereal* cpbar) const
325 {
326  // Get the nondimensional Gibbs standard state of the species at the T and P
327  // of the solution.
328  getCp_R(cpbar);
329  for (size_t k = 0; k < m_kk; k++) {
330  cpbar[k] *= GasConstant;
331  }
332 }
333 
334 // -------------- Utilities -------------------------------
335 
336 bool IdealMolalSoln::addSpecies(shared_ptr<Species> spec)
337 {
338  bool added = MolalityVPSSTP::addSpecies(spec);
339  if (added) {
340  m_speciesMolarVolume.push_back(0.0);
341  m_tmpV.push_back(0.0);
342  IMS_lnActCoeffMolal_.push_back(0.0);
343  }
344  return added;
345 }
346 
347 void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id_)
348 {
349  MolalityVPSSTP::initThermoXML(phaseNode, id_);
350 
351  if (id_.size() > 0 && phaseNode.id() != id_) {
352  throw CanteraError("IdealMolalSoln::initThermo",
353  "phasenode and Id are incompatible");
354  }
355 
356  // Find the Thermo XML node
357  if (!phaseNode.hasChild("thermo")) {
358  throw CanteraError("IdealMolalSoln::initThermo",
359  "no thermo XML node");
360  }
361  XML_Node& thermoNode = phaseNode.child("thermo");
362 
363  // Possible change the form of the standard concentrations
364  if (thermoNode.hasChild("standardConc")) {
365  XML_Node& scNode = thermoNode.child("standardConc");
366  setStandardConcentrationModel(scNode["model"]);
367  }
368 
369  if (thermoNode.hasChild("activityCoefficients")) {
370  XML_Node& acNode = thermoNode.child("activityCoefficients");
371  std::string modelString = acNode.attrib("model");
372  if (modelString != "IdealMolalSoln") {
373  throw CanteraError("IdealMolalSoln::initThermoXML",
374  "unknown ActivityCoefficient model: " + modelString);
375  }
376  if (acNode.hasChild("idealMolalSolnCutoff")) {
377  XML_Node& ccNode = acNode.child("idealMolalSolnCutoff");
378  modelString = ccNode.attrib("model");
379  if (modelString != "") {
380  setCutoffModel(modelString);
381  if (ccNode.hasChild("gamma_o_limit")) {
382  IMS_gamma_o_min_ = getFloat(ccNode, "gamma_o_limit");
383  }
384  if (ccNode.hasChild("gamma_k_limit")) {
385  IMS_gamma_k_min_ = getFloat(ccNode, "gamma_k_limit");
386  }
387  if (ccNode.hasChild("X_o_cutoff")) {
388  IMS_X_o_cutoff_ = getFloat(ccNode, "X_o_cutoff");
389  }
390  if (ccNode.hasChild("c_0_param")) {
391  IMS_cCut_ = getFloat(ccNode, "c_0_param");
392  }
393  if (ccNode.hasChild("slope_f_limit")) {
394  IMS_slopefCut_ = getFloat(ccNode, "slope_f_limit");
395  }
396  if (ccNode.hasChild("slope_g_limit")) {
397  IMS_slopegCut_ = getFloat(ccNode, "slope_g_limit");
398  }
399  }
400  } else {
401  setCutoffModel("none");
402  }
403  }
404 }
405 
407 {
409  for (size_t k = 0; k < nSpecies(); k++) {
410  m_speciesMolarVolume[k] = providePDSS(k)->molarVolume();
411  }
412  if (IMS_typeCutoff_ == 2) {
414  }
415  setMoleFSolventMin(1.0E-5);
416 }
417 
418 void IdealMolalSoln::setStandardConcentrationModel(const std::string& model)
419 {
420  if (caseInsensitiveEquals(model, "unity")) {
421  m_formGC = 0;
422  } else if (caseInsensitiveEquals(model, "molar_volume")) {
423  m_formGC = 1;
424  } else if (caseInsensitiveEquals(model, "solvent_volume")) {
425  m_formGC = 2;
426  } else {
427  throw CanteraError("IdealSolnGasVPSS::setStandardConcentrationModel",
428  "Unknown standard concentration model '{}'", model);
429  }
430 }
431 
432 void IdealMolalSoln::setCutoffModel(const std::string& model)
433 {
434  if (caseInsensitiveEquals(model, "none")) {
435  IMS_typeCutoff_ = 0;
436  } else if (caseInsensitiveEquals(model, "poly")) {
437  IMS_typeCutoff_ = 1;
438  } else if (caseInsensitiveEquals(model, "polyexp")) {
439  IMS_typeCutoff_ = 2;
440  } else {
441  throw CanteraError("IdealMolalSoln::setCutoffModel",
442  "Unknown cutoff model '{}'", model);
443  }
444 }
445 
446 // ------------ Private and Restricted Functions ------------------
447 
449 {
450  // Calculate the molalities. Currently, the molalities may not be current
451  // with respect to the contents of the State objects' data.
452  calcMolalities();
453 
454  double xmolSolvent = moleFraction(0);
455  double xx = std::max(m_xmolSolventMIN, xmolSolvent);
456 
457  if (IMS_typeCutoff_ == 0) {
458  for (size_t k = 1; k < m_kk; k++) {
459  IMS_lnActCoeffMolal_[k]= 0.0;
460  }
461  IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
462  return;
463  } else if (IMS_typeCutoff_ == 1) {
464  if (xmolSolvent > 3.0 * IMS_X_o_cutoff_/2.0) {
465  for (size_t k = 1; k < m_kk; k++) {
466  IMS_lnActCoeffMolal_[k]= 0.0;
467  }
468  IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
469  return;
470  } else if (xmolSolvent < IMS_X_o_cutoff_/2.0) {
471  double tmp = log(xx * IMS_gamma_k_min_);
472  for (size_t k = 1; k < m_kk; k++) {
473  IMS_lnActCoeffMolal_[k]= tmp;
474  }
476  return;
477  } else {
478  // If we are in the middle region, calculate the connecting polynomials
479  double xminus = xmolSolvent - IMS_X_o_cutoff_/2.0;
480  double xminus2 = xminus * xminus;
481  double xminus3 = xminus2 * xminus;
482  double x_o_cut2 = IMS_X_o_cutoff_ * IMS_X_o_cutoff_;
483  double x_o_cut3 = x_o_cut2 * IMS_X_o_cutoff_;
484 
485  double h2 = 3.5 * xminus2 / IMS_X_o_cutoff_ - 2.0 * xminus3 / x_o_cut2;
486  double h2_prime = 7.0 * xminus / IMS_X_o_cutoff_ - 6.0 * xminus2 / x_o_cut2;
487 
488  double h1 = (1.0 - 3.0 * xminus2 / x_o_cut2 + 2.0 * xminus3/ x_o_cut3);
489  double h1_prime = (- 6.0 * xminus / x_o_cut2 + 6.0 * xminus2/ x_o_cut3);
490 
491  double h1_g = h1 / IMS_gamma_o_min_;
492  double h1_g_prime = h1_prime / IMS_gamma_o_min_;
493 
494  double alpha = 1.0 / (exp(1.0) * IMS_gamma_k_min_);
495  double h1_f = h1 * alpha;
496  double h1_f_prime = h1_prime * alpha;
497 
498  double f = h2 + h1_f;
499  double f_prime = h2_prime + h1_f_prime;
500 
501  double g = h2 + h1_g;
502  double g_prime = h2_prime + h1_g_prime;
503 
504  double tmp = (xmolSolvent/ g * g_prime + (1.0-xmolSolvent) / f * f_prime);
505  double lngammak = -1.0 - log(f) + tmp * xmolSolvent;
506  double lngammao =-log(g) - tmp * (1.0-xmolSolvent);
507 
508  tmp = log(xmolSolvent) + lngammak;
509  for (size_t k = 1; k < m_kk; k++) {
510  IMS_lnActCoeffMolal_[k]= tmp;
511  }
512  IMS_lnActCoeffMolal_[0] = lngammao;
513  }
514  } else if (IMS_typeCutoff_ == 2) {
515  // Exponentials - trial 2
516  if (xmolSolvent > IMS_X_o_cutoff_) {
517  for (size_t k = 1; k < m_kk; k++) {
518  IMS_lnActCoeffMolal_[k]= 0.0;
519  }
520  IMS_lnActCoeffMolal_[0] = - log(xx) + (xx - 1.0)/xx;
521  return;
522  } else {
523  double xoverc = xmolSolvent/IMS_cCut_;
524  double eterm = std::exp(-xoverc);
525 
526  double fptmp = IMS_bfCut_ - IMS_afCut_ / IMS_cCut_ - IMS_bfCut_*xoverc
527  + 2.0*IMS_dfCut_*xmolSolvent - IMS_dfCut_*xmolSolvent*xoverc;
528  double f_prime = 1.0 + eterm*fptmp;
529  double f = xmolSolvent + IMS_efCut_ + eterm * (IMS_afCut_ + xmolSolvent * (IMS_bfCut_ + IMS_dfCut_*xmolSolvent));
530 
531  double gptmp = IMS_bgCut_ - IMS_agCut_ / IMS_cCut_ - IMS_bgCut_*xoverc
532  + 2.0*IMS_dgCut_*xmolSolvent - IMS_dgCut_*xmolSolvent*xoverc;
533  double g_prime = 1.0 + eterm*gptmp;
534  double g = xmolSolvent + IMS_egCut_ + eterm * (IMS_agCut_ + xmolSolvent * (IMS_bgCut_ + IMS_dgCut_*xmolSolvent));
535 
536  double tmp = (xmolSolvent / g * g_prime + (1.0 - xmolSolvent) / f * f_prime);
537  double lngammak = -1.0 - log(f) + tmp * xmolSolvent;
538  double lngammao =-log(g) - tmp * (1.0-xmolSolvent);
539 
540  tmp = log(xx) + lngammak;
541  for (size_t k = 1; k < m_kk; k++) {
542  IMS_lnActCoeffMolal_[k]= tmp;
543  }
544  IMS_lnActCoeffMolal_[0] = lngammao;
545  }
546  }
547 }
548 
550 {
551  IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
552  IMS_efCut_ = 0.0;
553  bool converged = false;
554  for (int its = 0; its < 100 && !converged; its++) {
555  double oldV = IMS_efCut_;
556  IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_) - IMS_efCut_;
557  IMS_bfCut_ = IMS_afCut_ / IMS_cCut_ + IMS_slopefCut_ - 1.0;
558  IMS_dfCut_ = ((- IMS_afCut_/IMS_cCut_ + IMS_bfCut_ - IMS_bfCut_*IMS_X_o_cutoff_/IMS_cCut_)
559  /
560  (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
561  double tmp = IMS_afCut_ + IMS_X_o_cutoff_*(IMS_bfCut_ + IMS_dfCut_ * IMS_X_o_cutoff_);
562  double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
563  IMS_efCut_ = - eterm * (tmp);
564  if (fabs(IMS_efCut_ - oldV) < 1.0E-14) {
565  converged = true;
566  }
567  }
568  if (!converged) {
569  throw CanteraError(" IdealMolalSoln::calcCutoffParams_()",
570  " failed to converge on the f polynomial");
571  }
572  converged = false;
573  double f_0 = IMS_afCut_ + IMS_efCut_;
574  double f_prime_0 = 1.0 - IMS_afCut_ / IMS_cCut_ + IMS_bfCut_;
575  IMS_egCut_ = 0.0;
576  for (int its = 0; its < 100 && !converged; its++) {
577  double oldV = IMS_egCut_;
578  double lng_0 = -log(IMS_gamma_o_min_) - f_prime_0 / f_0;
579  IMS_agCut_ = exp(lng_0) - IMS_egCut_;
580  IMS_bgCut_ = IMS_agCut_ / IMS_cCut_ + IMS_slopegCut_ - 1.0;
581  IMS_dgCut_ = ((- IMS_agCut_/IMS_cCut_ + IMS_bgCut_ - IMS_bgCut_*IMS_X_o_cutoff_/IMS_cCut_)
582  /
583  (IMS_X_o_cutoff_*IMS_X_o_cutoff_/IMS_cCut_ - 2.0 * IMS_X_o_cutoff_));
584  double tmp = IMS_agCut_ + IMS_X_o_cutoff_*(IMS_bgCut_ + IMS_dgCut_ *IMS_X_o_cutoff_);
585  double eterm = std::exp(-IMS_X_o_cutoff_/IMS_cCut_);
586  IMS_egCut_ = - eterm * (tmp);
587  if (fabs(IMS_egCut_ - oldV) < 1.0E-14) {
588  converged = true;
589  }
590  }
591  if (!converged) {
592  throw CanteraError(" IdealMolalSoln::calcCutoffParams_()",
593  " failed to converge on the g polynomial");
594  }
595 }
596 
597 }
ThermoPhase object for the ideal molal equation of state (see Thermodynamic Properties and class Idea...
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution: Units: J/kmol.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getPartialMolarVolumes(doublereal *vbar) const
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
doublereal IMS_slopefCut_
Parameter in the polyExp cutoff treatment.
doublereal IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:471
IdealMolalSoln()
Constructor.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual void getActivities(doublereal *ac) const
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:266
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
virtual void getPartialMolarCp(doublereal *cpbar) const
Partial molar heat capacity of the solution:. UnitsL J/kmol/K.
doublereal IMS_gamma_k_min_
gamma_k minimum for the cutoff process at the zero solvent point
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable...
virtual bool addSpecies(shared_ptr< Species > spec)
void setStandardConcentrationModel(const std::string &model)
Set the standard concentration model.
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
virtual doublereal cp_mole() const
Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
doublereal IMS_gamma_o_min_
gamma_o value for the cutoff process at the zero solvent point
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:614
vector_fp m_speciesMolarVolume
Species molar volume .
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:748
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS.cpp:72
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:590
virtual doublereal entropy_mole() const
Molar entropy of the solution. Units: J/kmol/K.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id="")
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal thermalExpansionCoeff() const
The thermal expansion coefficient. Units: 1/K.
virtual void _updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution. Units: J/kmol.
virtual bool addSpecies(shared_ptr< Species > spec)
int IMS_typeCutoff_
Cutoff type.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
XML_Node & child(const size_t n) const
Return a changeable reference to the n&#39;th child of the current node.
Definition: xml.cpp:546
void setCutoffModel(const std::string &model)
Set cutoff model. Must be one of &#39;none&#39;, &#39;poly&#39;, or &#39;polyExp&#39;.
vector_fp m_molalities
Current value of the molalities of the species in the phase.
int m_formGC
The standard concentrations can have one of three different forms: 0 = &#39;unity&#39;, 1 = &#39;molar_volume&#39;...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
const doublereal SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:126
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:500
virtual doublereal isothermalCompressibility() const
The isothermal compressibility. Units: 1/Pa.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:661
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials: Units: J/kmol.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:428
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
Contains declarations for string manipulation functions within Cantera.
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:164
size_t m_kk
Number of species in the phase.
Definition: Phase.h:788
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
virtual doublereal gibbs_mole() const
Molar Gibbs function for the solution: Units J/kmol.
void calcIMSCutoffParams_()
Calculate parameters for cutoff treatments of activity coefficients.
doublereal IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process; ...
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
Definition: Phase.h:622
void setMoleFSolventMin(doublereal xmolSolventMIN)
Sets the minimum mole fraction in the molality formulation.
vector_fp IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.