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