Cantera  2.4.0
MolalityVPSSTP.cpp
Go to the documentation of this file.
1 /**
2  * @file MolalityVPSSTP.cpp
3  * Definitions for intermediate ThermoPhase object for phases which
4  * employ molality based activity coefficient formulations
5  * (see \ref thermoprops
6  * and class \link Cantera::MolalityVPSSTP MolalityVPSSTP\endlink).
7  */
8 
9 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
14 #include "cantera/base/ctml.h"
15 #include "cantera/base/utilities.h"
16 
17 #include <fstream>
18 
19 using namespace std;
20 
21 namespace Cantera
22 {
23 
24 MolalityVPSSTP::MolalityVPSSTP() :
25  m_pHScalingType(PHSCALE_PITZER),
26  m_indexCLM(npos),
27  m_weightSolvent(18.01528),
28  m_xmolSolventMIN(0.01),
29  m_Mnaught(18.01528E-3)
30 {
31  // Change the default to be that charge neutrality in the phase is necessary
32  // condition for the proper specification of thermodynamic functions within
33  // the phase
35 }
36 
37 // -------------- Utilities -------------------------------
38 
39 void MolalityVPSSTP::setpHScale(const int pHscaleType)
40 {
41  m_pHScalingType = pHscaleType;
42  if (pHscaleType != PHSCALE_PITZER && pHscaleType != PHSCALE_NBS) {
43  throw CanteraError("MolalityVPSSTP::setpHScale",
44  "Unknown scale type: {}", pHscaleType);
45  }
46 }
47 
49 {
50  return m_pHScalingType;
51 }
52 
54 {
55  warn_deprecated("MolalityVPSSTP::setSolvent", "Solvent is always the first"
56  " species. To be removed after Cantera 2.4.");
57 }
58 
60 {
61  warn_deprecated("MolalityVPSSTP::solventIndex", "Solvent is always the"
62  " first species. To be removed after Cantera 2.4.");
63  return 0;
64 }
65 
66 void MolalityVPSSTP::setMoleFSolventMin(doublereal xmolSolventMIN)
67 {
68  if (xmolSolventMIN <= 0.0) {
69  throw CanteraError("MolalityVPSSTP::setSolute ", "trouble");
70  } else if (xmolSolventMIN > 0.9) {
71  throw CanteraError("MolalityVPSSTP::setSolute ", "trouble");
72  }
73  m_xmolSolventMIN = xmolSolventMIN;
74 }
75 
77 {
78  return m_xmolSolventMIN;
79 }
80 
82 {
84  double xmolSolvent = std::max(m_molalities[0], m_xmolSolventMIN);
85  double denomInv = 1.0/ (m_Mnaught * xmolSolvent);
86  for (size_t k = 0; k < m_kk; k++) {
87  m_molalities[k] *= denomInv;
88  }
89 }
90 
91 void MolalityVPSSTP::getMolalities(doublereal* const molal) const
92 {
94  for (size_t k = 0; k < m_kk; k++) {
95  molal[k] = m_molalities[k];
96  }
97 }
98 
99 void MolalityVPSSTP::setMolalities(const doublereal* const molal)
100 {
101  double Lsum = 1.0 / m_Mnaught;
102  for (size_t k = 1; k < m_kk; k++) {
103  m_molalities[k] = molal[k];
104  Lsum += molal[k];
105  }
106  double tmp = 1.0 / Lsum;
107  m_molalities[0] = tmp / m_Mnaught;
108  double sum = m_molalities[0];
109  for (size_t k = 1; k < m_kk; k++) {
110  m_molalities[k] = tmp * molal[k];
111  sum += m_molalities[k];
112  }
113  if (sum != 1.0) {
114  tmp = 1.0 / sum;
115  for (size_t k = 0; k < m_kk; k++) {
116  m_molalities[k] *= tmp;
117  }
118  }
120 
121  // Essentially we don't trust the input: We calculate the molalities from
122  // the mole fractions that we just obtained.
123  calcMolalities();
124 }
125 
127 {
128  // HKM -> Might need to be more complicated here, setting neutrals so that
129  // the existing mole fractions are preserved.
130 
131  // Get a vector of mole fractions
132  vector_fp mf(m_kk, 0.0);
133  getMoleFractions(mf.data());
134  double xmolSmin = std::max(mf[0], m_xmolSolventMIN);
135  for (size_t k = 0; k < m_kk; k++) {
136  double mol_k = getValue(mMap, speciesName(k), 0.0);
137  if (mol_k > 0) {
138  mf[k] = mol_k * m_Mnaught * xmolSmin;
139  }
140  }
141 
142  // check charge neutrality
143  size_t largePos = npos;
144  double cPos = 0.0;
145  size_t largeNeg = npos;
146  double cNeg = 0.0;
147  double sum = 0.0;
148  for (size_t k = 0; k < m_kk; k++) {
149  double ch = charge(k);
150  if (mf[k] > 0.0) {
151  if (ch > 0.0 && ch * mf[k] > cPos) {
152  largePos = k;
153  cPos = ch * mf[k];
154  }
155  if (ch < 0.0 && fabs(ch) * mf[k] > cNeg) {
156  largeNeg = k;
157  cNeg = fabs(ch) * mf[k];
158  }
159  }
160  sum += mf[k] * ch;
161  }
162  if (sum != 0.0) {
163  if (sum > 0.0) {
164  if (cPos > sum) {
165  mf[largePos] -= sum / charge(largePos);
166  } else {
167  throw CanteraError("MolalityVPSSTP:setMolalitiesbyName",
168  "unbalanced charges");
169  }
170  } else {
171  if (cNeg > (-sum)) {
172  mf[largeNeg] -= (-sum) / fabs(charge(largeNeg));
173  } else {
174  throw CanteraError("MolalityVPSSTP:setMolalitiesbyName",
175  "unbalanced charges");
176  }
177  }
178  }
179  sum = 0.0;
180  for (size_t k = 0; k < m_kk; k++) {
181  sum += mf[k];
182  }
183  sum = 1.0/sum;
184  for (size_t k = 0; k < m_kk; k++) {
185  mf[k] *= sum;
186  }
187  setMoleFractions(mf.data());
188 
189  // After we formally set the mole fractions, we calculate the molalities
190  // again and store it in this object.
191  calcMolalities();
192 }
193 
194 void MolalityVPSSTP::setMolalitiesByName(const std::string& x)
195 {
198 }
199 
200 // - Activities, Standard States, Activity Concentrations -----------
201 
203 {
205 }
206 
208 {
209  throw NotImplementedError("MolalityVPSSTP::getActivityConcentrations");
210 }
211 
212 doublereal MolalityVPSSTP::standardConcentration(size_t k) const
213 {
214  throw NotImplementedError("MolalityVPSSTP::standardConcentration");
215 }
216 
217 void MolalityVPSSTP::getActivities(doublereal* ac) const
218 {
219  throw NotImplementedError("MolalityVPSSTP::getActivities");
220 }
221 
222 void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const
223 {
225  double xmolSolvent = std::max(moleFraction(0), m_xmolSolventMIN);
226  for (size_t k = 1; k < m_kk; k++) {
227  ac[k] /= xmolSolvent;
228  }
229 }
230 
231 void MolalityVPSSTP::getMolalityActivityCoefficients(doublereal* acMolality) const
232 {
234  applyphScale(acMolality);
235 }
236 
238 {
239  // First, we calculate the activities all over again
240  vector_fp act(m_kk);
241  getActivities(act.data());
242 
243  // Then, we calculate the sum of the solvent molalities
244  double sum = 0;
245  for (size_t k = 1; k < m_kk; k++) {
246  sum += std::max(m_molalities[k], 0.0);
247  }
248  double oc = 1.0;
249  if (sum > 1.0E-200) {
250  oc = - log(act[0]) / (m_Mnaught * sum);
251  }
252  return oc;
253 }
254 
256 {
258  string comp = getChildValue(state,"soluteMolalities");
259  if (comp != "") {
260  setMolalitiesByName(comp);
261  }
262  if (state.hasChild("pressure")) {
263  double p = getFloat(state, "pressure", "pressure");
264  setPressure(p);
265  }
266 }
267 
268 void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p,
269  const doublereal* const molalities)
270 {
271  setMolalities(molalities);
272  setState_TP(t, p);
273 }
274 
275 void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const compositionMap& m)
276 {
278  setState_TP(t, p);
279 }
280 
281 void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& m)
282 {
284  setState_TP(t, p);
285 }
286 
288 {
290 
291  // Find the Cl- species
293 }
294 
296 {
297  throw NotImplementedError("MolalityVPSSTP::getUnscaledMolalityActivityCoefficients");
298 }
299 
300 void MolalityVPSSTP::applyphScale(doublereal* acMolality) const
301 {
302  throw NotImplementedError("MolalityVPSSTP::applyphScale");
303 }
304 
306 {
307  size_t indexCLM = npos;
308  size_t eCl = npos;
309  size_t eE = npos;
310  size_t ne = nElements();
311  for (size_t e = 0; e < ne; e++) {
312  string sn = elementName(e);
313  if (sn == "Cl" || sn == "CL") {
314  eCl = e;
315  break;
316  }
317  }
318  // We have failed if we can't find the Cl element index
319  if (eCl == npos) {
320  return npos;
321  }
322  for (size_t e = 0; e < ne; e++) {
323  string sn = elementName(e);
324  if (sn == "E" || sn == "e") {
325  eE = e;
326  break;
327  }
328  }
329  // We have failed if we can't find the E element index
330  if (eE == npos) {
331  return npos;
332  }
333  for (size_t k = 1; k < m_kk; k++) {
334  doublereal nCl = nAtoms(k, eCl);
335  if (nCl != 1.0) {
336  continue;
337  }
338  doublereal nE = nAtoms(k, eE);
339  if (nE != 1.0) {
340  continue;
341  }
342  for (size_t e = 0; e < ne; e++) {
343  if (e != eE && e != eCl) {
344  doublereal nA = nAtoms(k, e);
345  if (nA != 0.0) {
346  continue;
347  }
348  }
349  }
350  string sn = speciesName(k);
351  if (sn != "Cl-" && sn != "CL-") {
352  continue;
353  }
354 
355  indexCLM = k;
356  break;
357  }
358  return indexCLM;
359 }
360 
361 bool MolalityVPSSTP::addSpecies(shared_ptr<Species> spec)
362 {
363  bool added = VPStandardStateTP::addSpecies(spec);
364  if (added) {
365  if (m_kk == 1) {
366  // The solvent defaults to species 0
368  m_Mnaught = m_weightSolvent / 1000.;
369  }
370  m_molalities.push_back(0.0);
371  }
372  return added;
373 }
374 
375 std::string MolalityVPSSTP::report(bool show_thermo, doublereal threshold) const
376 {
377  fmt::memory_buffer b;
378  try {
379  if (name() != "") {
380  format_to(b, "\n {}:\n", name());
381  }
382  format_to(b, "\n");
383  format_to(b, " temperature {:12.6g} K\n", temperature());
384  format_to(b, " pressure {:12.6g} Pa\n", pressure());
385  format_to(b, " density {:12.6g} kg/m^3\n", density());
386  format_to(b, " mean mol. weight {:12.6g} amu\n", meanMolecularWeight());
387 
388  doublereal phi = electricPotential();
389  format_to(b, " potential {:12.6g} V\n", phi);
390 
391  vector_fp x(m_kk);
392  vector_fp molal(m_kk);
393  vector_fp mu(m_kk);
394  vector_fp muss(m_kk);
395  vector_fp acMolal(m_kk);
396  vector_fp actMolal(m_kk);
397  getMoleFractions(&x[0]);
398  getMolalities(&molal[0]);
399  getChemPotentials(&mu[0]);
400  getStandardChemPotentials(&muss[0]);
401  getMolalityActivityCoefficients(&acMolal[0]);
402  getActivities(&actMolal[0]);
403 
404  size_t iHp = speciesIndex("H+");
405  if (iHp != npos) {
406  double pH = -log(actMolal[iHp]) / log(10.0);
407  format_to(b, " pH {:12.4g}\n", pH);
408  }
409 
410  if (show_thermo) {
411  format_to(b, "\n");
412  format_to(b, " 1 kg 1 kmol\n");
413  format_to(b, " ----------- ------------\n");
414  format_to(b, " enthalpy {:12.6g} {:12.4g} J\n",
416  format_to(b, " internal energy {:12.6g} {:12.4g} J\n",
418  format_to(b, " entropy {:12.6g} {:12.4g} J/K\n",
420  format_to(b, " Gibbs function {:12.6g} {:12.4g} J\n",
421  gibbs_mass(), gibbs_mole());
422  format_to(b, " heat capacity c_p {:12.6g} {:12.4g} J/K\n",
423  cp_mass(), cp_mole());
424  try {
425  format_to(b, " heat capacity c_v {:12.6g} {:12.4g} J/K\n",
426  cv_mass(), cv_mole());
427  } catch (NotImplementedError&) {
428  format_to(b, " heat capacity c_v <not implemented>\n");
429  }
430  }
431 
432  format_to(b, "\n");
433  int nMinor = 0;
434  doublereal xMinor = 0.0;
435  if (show_thermo) {
436  format_to(b, " X "
437  " Molalities Chem.Pot. ChemPotSS ActCoeffMolal\n");
438  format_to(b, " "
439  " (J/kmol) (J/kmol)\n");
440  format_to(b, " ------------- "
441  " ------------ ------------ ------------ ------------\n");
442  for (size_t k = 0; k < m_kk; k++) {
443  if (x[k] > threshold) {
444  if (x[k] > SmallNumber) {
445  format_to(b, "{:>18s} {:12.6g} {:12.6g} {:12.6g} {:12.6g} {:12.6g}\n",
446  speciesName(k), x[k], molal[k], mu[k], muss[k], acMolal[k]);
447  } else {
448  format_to(b, "{:>18s} {:12.6g} {:12.6g} N/A {:12.6g} {:12.6g}\n",
449  speciesName(k), x[k], molal[k], muss[k], acMolal[k]);
450  }
451  } else {
452  nMinor++;
453  xMinor += x[k];
454  }
455  }
456  } else {
457  format_to(b, " X"
458  "Molalities\n");
459  format_to(b, " -------------"
460  " ------------\n");
461  for (size_t k = 0; k < m_kk; k++) {
462  if (x[k] > threshold) {
463  format_to(b, "{:>18s} {:12.6g} {:12.6g}\n",
464  speciesName(k), x[k], molal[k]);
465  } else {
466  nMinor++;
467  xMinor += x[k];
468  }
469  }
470  }
471  if (nMinor) {
472  format_to(b, " [{:+5d} minor] {:12.6g}\n", nMinor, xMinor);
473  }
474  } catch (CanteraError& err) {
475  return to_string(b) + err.what();
476  }
477  return to_string(b);
478 }
479 
480 void MolalityVPSSTP::getCsvReportData(std::vector<std::string>& names,
481  std::vector<vector_fp>& data) const
482 {
483  names.clear();
484  data.assign(10, vector_fp(nSpecies()));
485 
486  names.push_back("X");
487  getMoleFractions(&data[0][0]);
488 
489  names.push_back("Molal");
490  getMolalities(&data[1][0]);
491 
492  names.push_back("Chem. Pot. (J/kmol)");
493  getChemPotentials(&data[2][0]);
494 
495  names.push_back("Chem. Pot. SS (J/kmol)");
496  getStandardChemPotentials(&data[3][0]);
497 
498  names.push_back("Molal Act. Coeff.");
499  getMolalityActivityCoefficients(&data[4][0]);
500 
501  names.push_back("Molal Activity");
502  getActivities(&data[5][0]);
503 
504  names.push_back("Part. Mol Enthalpy (J/kmol)");
505  getPartialMolarEnthalpies(&data[5][0]);
506 
507  names.push_back("Part. Mol. Entropy (J/K/kmol)");
508  getPartialMolarEntropies(&data[6][0]);
509 
510  names.push_back("Part. Mol. Energy (J/kmol)");
511  getPartialMolarIntEnergies(&data[7][0]);
512 
513  names.push_back("Part. Mol. Cp (J/K/kmol");
514  getPartialMolarCp(&data[8][0]);
515 
516  names.push_back("Part. Mol. Cv (J/K/kmol)");
517  getPartialMolarVolumes(&data[9][0]);
518 }
519 
520 }
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:149
size_t nElements() const
Number of elements.
Definition: Phase.cpp:88
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
std::string getChildValue(const XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its XML value as the return s...
Definition: ctml.cpp:131
void setSolvent(size_t k)
This routine sets the index number of the solvent for the phase.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
int activityConvention() const
We set the convention to molality here.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: ThermoPhase.h:230
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
size_t speciesIndex(const std::string &name) const
Returns the index of a species named &#39;name&#39; within the Phase object.
Definition: Phase.cpp:175
virtual size_t findCLMIndex() const
Returns the index of the Cl- species.
doublereal m_Mnaught
This is the multiplication factor that goes inside log expressions involving the molalities of specie...
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: ThermoPhase.h:497
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
Definition: ThermoPhase.h:734
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:471
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: ThermoPhase.h:461
void setpHScale(const int pHscaleType)
Set the pH scale, which determines the scale for single-ion activity coefficients.
size_t m_indexCLM
Index of the phScale species.
const char * what() const
Get a description of the error.
virtual void applyphScale(doublereal *acMolality) const
Apply the current phScale to a set of activity Coefficients or activities.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:266
STL namespace.
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
Definition: ThermoPhase.h:714
virtual bool addSpecies(shared_ptr< Species > spec)
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: ThermoPhase.h:205
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: ThermoPhase.h:528
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
doublereal moleFSolventMin() const
Returns the minimum mole fraction in the molality formulation.
virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const
returns a summary of the state of the phase as a string
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality based activity coefficients at the current solution tempera...
size_t solventIndex() const
Returns the solvent index.
virtual double osmoticCoefficient() const
Calculate the osmotic coefficient.
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
Definition: Phase.cpp:197
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature, pressure, and solution concentration.
virtual bool addSpecies(shared_ptr< Species > spec)
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
Definition: ThermoPhase.h:1637
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the phase to the conditions specified in the state XML element.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: ThermoPhase.h:210
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: ThermoPhase.h:220
void setMolalitiesByName(const compositionMap &xMap)
Set the molalities of a phase.
void getMolalities(doublereal *const molal) const
This function will return the molalities of the species.
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:191
int pHScale() const
Reports the pH scale, which determines the scale for single-ion activity coefficients.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities (molality based for this class and classes that derive fr...
doublereal electricPotential() const
Returns the electric potential of this phase (V).
Definition: ThermoPhase.h:302
const int PHSCALE_NBS
Scale to be used for evaluation of single-ion activity coefficients is that used by the NBS standard ...
doublereal entropy_mass() const
Specific entropy. Units: J/kg/K.
Definition: ThermoPhase.h:724
const U & getValue(const std::map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a std::map.
Definition: utilities.h:504
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: ThermoPhase.h:487
const int PHSCALE_PITZER
Scale to be used for the output of single-ion activity coefficients is that used by Pitzer...
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.
Definition: ThermoPhase.h:28
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
Definition: ThermoPhase.h:507
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: ThermoPhase.h:225
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values.
Definition: Phase.cpp:251
virtual void getUnscaledMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of unscaled non-dimensional molality based activity coefficients at the current solutio...
int m_pHScalingType
Scaling to be used for output of single-ion species activity coefficients.
virtual void setStateFromXML(const XML_Node &state)
Set equation of state parameter values from XML entries.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
Definition: Phase.cpp:466
virtual doublereal pressure() const
Returns the current pressure of the phase.
void setMolalities(const doublereal *const molal)
Set the molalities of the solutes in a phase.
virtual void getCsvReportData(std::vector< std::string > &names, std::vector< vector_fp > &data) const
Fills names and data with the column names and species thermo properties to be included in the output...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
void setState_TPM(doublereal t, doublereal p, const doublereal *const molalities)
Set the temperature (K), pressure (Pa), and molalities (gmol kg-1) of the solutes.
compositionMap parseCompString(const std::string &ss, const std::vector< std::string > &names)
Parse a composition string into a map consisting of individual key:composition pairs.
Definition: stringUtils.cpp:60
doublereal cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
Definition: ThermoPhase.h:739
vector_fp m_molalities
Current value of the molalities of the species in the phase.
const doublereal SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:126
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:661
doublereal gibbs_mass() const
Specific Gibbs function. Units: J/kg.
Definition: ThermoPhase.h:729
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:78
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
doublereal m_weightSolvent
Molecular weight of the Solvent.
size_t m_kk
Number of species in the phase.
Definition: Phase.h:788
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:420
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: ThermoPhase.h:518
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
doublereal intEnergy_mass() const
Specific internal energy. Units: J/kg.
Definition: ThermoPhase.h:719
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
Definition: Phase.cpp:161
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: ThermoPhase.h:215
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:577
std::string elementName(size_t m) const
Name of the element with index m.
Definition: Phase.cpp:107
virtual void setState_TP(doublereal T, doublereal pres)
Set the temperature and pressure at the same time.
void setMoleFSolventMin(doublereal xmolSolventMIN)
Sets the minimum mole fraction in the molality formulation.