Cantera 2.6.0

MolalityVPSSTP.h
Go to the documentation of this file.
1/**
2 * @file MolalityVPSSTP.h
3 * Header 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 * Header file for a derived class of ThermoPhase that handles
9 * variable pressure standard state methods for calculating
10 * thermodynamic properties that are further based upon activities
11 * based on the molality scale. These include most of the methods for
12 * calculating liquid electrolyte thermodynamics.
13 */
14
15// This file is part of Cantera. See License.txt in the top-level directory or
16// at https://cantera.org/license.txt for license and copyright information.
17
18#ifndef CT_MOLALITYVPSSTP_H
19#define CT_MOLALITYVPSSTP_H
20
21#include "VPStandardStateTP.h"
22
23 namespace Cantera
24{
25
26/*!
27 * MolalityVPSSTP is a derived class of ThermoPhase that handles variable
28 * pressure standard state methods for calculating thermodynamic properties that
29 * are further based on molality-scaled activities. This category incorporates
30 * most of the methods for calculating liquid electrolyte thermodynamics that
31 * have been developed since the 1970's.
32 *
33 * This class adds additional functions onto the ThermoPhase interface that
34 * handle molality based standard states. The ThermoPhase class includes a
35 * member function, ThermoPhase::activityConvention() that indicates which
36 * convention the activities are based on. The default is to assume activities
37 * are based on the molar convention. However, classes which derive from the
38 * MolalityVPSSTP class return `cAC_CONVENTION_MOLALITY` from this member
39 * function.
40 *
41 * The molality of a solute, \f$ m_i \f$, is defined as
42 *
43 * \f[
44 * m_i = \frac{n_i}{\tilde{M}_o n_o}
45 * \f]
46 * where
47 * \f[
48 * \tilde{M}_o = \frac{M_o}{1000}
49 * \f]
50 *
51 * where \f$ M_o \f$ is the molecular weight of the solvent. The molality has
52 * units of gmol/kg. For the solute, the molality may be considered
53 * as the amount of gmol's of solute per kg of solvent, a natural experimental
54 * quantity.
55 *
56 * The formulas for calculating mole fractions if given the molalities of the
57 * solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate
58 * quantity.
59 *
60 * \f[
61 * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
62 * \f]
63 * Then,
64 * \f[
65 * X_o = \frac{1}{\tilde{M}_o L^{sum}}
66 * \f]
67 * \f[
68 * X_i = \frac{m_i}{L^{sum}}
69 * \f]
70 * where \f$ X_o \f$ is the mole fraction of solvent, and \f$ X_o \f$ is the
71 * mole fraction of solute *i*. Thus, the molality scale and the mole fraction
72 * scale offer a one-to-one mapping between each other, except in the limit of a
73 * zero solvent mole fraction.
74 *
75 * The standard states for thermodynamic objects that derive from MolalityVPSSTP
76 * are on the unit molality basis. Chemical potentials of the solutes, \f$ \mu_k
77 * \f$, and the solvent, \f$ \mu_o \f$, which are based on the molality form,
78 * have the following general format:
79 *
80 * \f[
81 * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle})
82 * \f]
83 * \f[
84 * \mu_o = \mu^o_o(T,P) + RT ln(a_o)
85 * \f]
86 *
87 * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient
88 * for species \f$k\f$.
89 *
90 * The chemical potential of the solvent is thus expressed in a different format
91 * than the chemical potential of the solutes. Additionally, the activity of the
92 * solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic
93 * coefficient, \f$ \phi \f$.
94 * \f[
95 * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
96 * \f]
97 *
98 * MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$. Note
99 * there are a few of definitions of the osmotic coefficient floating around. We
100 * use the one defined in (Activity Coefficients in Electrolyte Solutions, K. S.
101 * Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most
102 * clearly related to theoretical calculation.
103 *
104 * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from
105 * the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$ by the
106 * following formula.
107 * \f[
108 * \gamma_k = \frac{\gamma_k^\triangle}{X_o}
109 * \f]
110 * For purposes of establishing a convention, the molar activity coefficient of
111 * the solvent is set equal to the molality-based activity coefficient of the
112 * solvent:
113 * \f[
114 * \gamma_o = \gamma_o^\triangle
115 * \f]
116 *
117 * The molality-based and molarity-based standard states may be related to one
118 * another by the following formula.
119 *
120 * \f[
121 * \mu_k^\triangle(T,P) = \mu_k^o(T,P) + R T \ln(\tilde{M}_o m^\triangle)
122 * \f]
123 *
124 * An important convention is followed in all routines that derive from
125 * MolalityVPSSTP. Standard state thermodynamic functions and reference state
126 * thermodynamic functions return the molality-based quantities. Also all
127 * functions which return activities return the molality-based activities. The
128 * reason for this convention has been discussed in supporting memos. However,
129 * it's important because the term in the equation above is non-trivial. For
130 * example it's equal to 2.38 kcal/gmol for water at 298 K.
131 *
132 * In order to prevent a singularity, this class includes the concept of a
133 * minimum value for the solvent mole fraction. All calculations involving the
134 * formulation of activity coefficients and other non-ideal solution behavior
135 * adhere to this concept of a minimal value for the solvent mole fraction. This
136 * makes sense because these solution behavior were all designed and measured
137 * far away from the zero solvent singularity condition and are not applicable
138 * in that limit.
139 *
140 * This objects add a layer that supports molality. It inherits from
141 * VPStandardStateTP.
142 *
143 * All objects that derive from this are assumed to have molality based standard
144 * states.
145 *
146 * Molality based activity coefficients are scaled according to the current pH
147 * scale. See the Eq3/6 manual for details.
148 *
149 * Activity coefficients for species k may be altered between scales s1 to s2
150 * using the following formula
151 *
152 * \f[
153 * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
154 * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
155 * \f]
156 *
157 * where j is any one species. For the NBS scale, j is equal to the Cl- species
158 * and
159 *
160 * \f[
161 * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
162 * \f]
163 *
164 * The Pitzer scale doesn't actually change anything. The pitzer scale is
165 * defined as the raw unscaled activity coefficients produced by the underlying
166 * objects.
167 *
168 * ### SetState Strategy
169 *
170 * The MolalityVPSSTP object does not have a setState strategy concerning the
171 * molalities. It does not keep track of whether the molalities have changed.
172 * It's strictly an interfacial layer that writes the current mole fractions to
173 * the State object. When molalities are needed it recalculates the molalities
174 * from the State object's mole fraction vector.
175 *
176 * @todo Make two solvent minimum fractions. One would be for calculation of the
177 * non-ideal factors. The other one would be for purposes of stoichiometry
178 * evaluation. the stoichiometry evaluation one would be a 1E-13 limit.
179 * Anything less would create problems with roundoff error.
180 */
181 class MolalityVPSSTP : public VPStandardStateTP
182{
183 public:
184 /// Default Constructor
185 /*!
186 * This doesn't do much more than initialize constants with default values
187 * for water at 25C. Water molecular weight comes from the default
188 * elements definitions. It actually differs slightly from the IAPWS95 value of
189 * 18.015268. However, density conservation and therefore element
190 * conservation is the more important principle to follow.
191 */
192 MolalityVPSSTP();
193
194 //! @name Utilities
195 //! @{
196
197 //! String indicating the mechanical phase of the matter in this Phase.
198 /*!
199 * All derived phases from `MolalityVPSSTP` always represent liquids.
200 */
201 virtual std::string phaseOfMatter() const {
202 return "liquid";
203 }
204
205 //! Set the pH scale, which determines the scale for single-ion activity
206 //! coefficients.
207 /*!
208 * Single ion activity coefficients are not unique in terms of the
209 * representing actual measurable quantities.
210 *
211 * @param pHscaleType Integer representing the pHscale
212 */
213 void setpHScale(const int pHscaleType);
214
215 //! Reports the pH scale, which determines the scale for single-ion activity
216 //! coefficients.
217 /*!
218 * Single ion activity coefficients are not unique in terms of the
219 * representing actual measurable quantities.
220 *
221 * @returns the pHscale type
222 */
223 int pHScale() const;
224
225 //! @}
226 //! @name Utilities for Solvent ID and Molality
227 //! @{
228
229 /**
230 * Sets the minimum mole fraction in the molality formulation. Note the
231 * molality formulation is singular in the limit that the solvent mole
232 * fraction goes to zero. Numerically, how this limit is treated and
233 * resolved is an ongoing issue within Cantera. The minimum mole fraction
234 * must be in the range 0 to 0.9.
235 *
236 * @param xmolSolventMIN Input double containing the minimum mole fraction
237 */
238 void setMoleFSolventMin(doublereal xmolSolventMIN);
239
240 //! Returns the minimum mole fraction in the molality formulation.
241 doublereal moleFSolventMin() const;
242
243 //! Calculates the molality of all species and stores the result internally.
244 /*!
245 * We calculate the vector of molalities of the species in the phase and
246 * store the result internally:
247 * \f[
248 * m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
249 * \f]
250 * where
251 * - \f$ M_o \f$ is the molecular weight of the solvent
252 * - \f$ X_o \f$ is the mole fraction of the solvent
253 * - \f$ X_i \f$ is the mole fraction of the solute.
254 * - \f$ X_{o,p} = \max (X_{o}^{min}, X_o) \f$
255 * - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed
256 * in the denominator.
257 */
258 void calcMolalities() const;
259
260 //! This function will return the molalities of the species.
261 /*!
262 * We calculate the vector of molalities of the species in the phase
263 * \f[
264 * m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
265 * \f]
266 * where
267 * - \f$ M_o \f$ is the molecular weight of the solvent
268 * - \f$ X_o \f$ is the mole fraction of the solvent
269 * - \f$ X_i \f$ is the mole fraction of the solute.
270 * - \f$ X_{o,p} = \max (X_{o}^{min}, X_o) \f$
271 * - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed
272 * in the denominator.
273 *
274 * @param molal Output vector of molalities. Length: m_kk.
275 */
276 void getMolalities(doublereal* const molal) const;
277
278 //! Set the molalities of the solutes in a phase
279 /*!
280 * Note, the entry for the solvent is not used. We are supplied with the
281 * molalities of all of the solute species. We then calculate the mole
282 * fractions of all species and update the ThermoPhase object.
283 * \f[
284 * m_i = \frac{X_i}{M_o/1000 * X_{o,p}}
285 * \f]
286 * where
287 * - \f$M_o\f$ is the molecular weight of the solvent
288 * - \f$X_o\f$ is the mole fraction of the solvent
289 * - \f$X_i\f$ is the mole fraction of the solute.
290 * - \f$X_{o,p} = \max(X_o^{min}, X_o)\f$
291 * - \f$X_o^{min}\f$ = minimum mole fraction of solvent allowed
292 * in the denominator.
293 *
294 * The formulas for calculating mole fractions are
295 * \f[
296 * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
297 * \f]
298 * Then,
299 * \f[
300 * X_o = \frac{1}{\tilde{M}_o L^{sum}}
301 * \f]
302 * \f[
303 * X_i = \frac{m_i}{L^{sum}}
304 * \f]
305 * It is currently an error if the solvent mole fraction is attempted to be
306 * set to a value lower than \f$ X_o^{min} \f$.
307 *
308 * @param molal Input vector of molalities. Length: m_kk.
309 */
310 void setMolalities(const doublereal* const molal);
311
312 //! Set the molalities of a phase
313 /*!
314 * Set the molalities of the solutes in a phase. Note, the entry for the
315 * solvent is not used.
316 *
317 * @param xMap Composition Map containing the molalities.
318 */
319 void setMolalitiesByName(const compositionMap& xMap);
320
321 //! Set the molalities of a phase
322 /*!
323 * Set the molalities of the solutes in a phase. Note, the entry for the
324 * solvent is not used.
325 *
326 * @param name String containing the information for a composition map.
327 */
328 void setMolalitiesByName(const std::string& name);
329
330 /**
331 * @}
332 * @name Activities, Standard States, and Activity Concentrations
333 *
334 * The activity \f$a_k\f$ of a species in solution is related to the
335 * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
336 * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
337 * which depends only on temperature and pressure.
338 * @{
339 */
340
341 /**
342 * We set the convention to molality here.
343 */
344 int activityConvention() const;
345
346 virtual void getActivityConcentrations(doublereal* c) const;
347 virtual doublereal standardConcentration(size_t k=0) const;
348
349 //! Get the array of non-dimensional activities (molality based for this
350 //! class and classes that derive from it) at the current solution
351 //! temperature, pressure, and solution concentration.
352 /*!
353 * All standard state properties for molality-based phases are evaluated
354 * consistent with the molality scale. Therefore, this function must return
355 * molality-based activities.
356 *
357 * \f[
358 * a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle}
359 * \f]
360 *
361 * This function must be implemented in derived classes.
362 *
363 * @param ac Output vector of molality-based activities. Length: m_kk.
364 */
365 virtual void getActivities(doublereal* ac) const;
366
367 //! Get the array of non-dimensional activity coefficients at
368 //! the current solution temperature, pressure, and solution concentration.
369 /*!
370 * These are mole-fraction based activity coefficients. In this
371 * object, their calculation is based on translating the values
372 * of the molality-based activity coefficients.
373 * See Denbigh p. 278 for a thorough discussion.
374 *
375 * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated
376 * from the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$
377 * by the following formula.
378 * \f[
379 * \gamma_k = \frac{\gamma_k^\triangle}{X_o}
380 * \f]
381 *
382 * For purposes of establishing a convention, the molar activity coefficient of the
383 * solvent is set equal to the molality-based activity coefficient of the
384 * solvent:
385 *
386 * \f[
387 * \gamma_o = \gamma_o^\triangle
388 * \f]
389 *
390 * Derived classes don't need to overload this function. This function is
391 * handled at this level.
392 *
393 * @param ac Output vector containing the mole-fraction based activity
394 * coefficients. length: m_kk.
395 */
396 virtual void getActivityCoefficients(doublereal* ac) const;
397
398 //! Get the array of non-dimensional molality based activity coefficients at
399 //! the current solution temperature, pressure, and solution concentration.
400 /*!
401 * See Denbigh p. 278 for a thorough discussion. This class must be
402 * overridden in classes which derive from MolalityVPSSTP. This function
403 * takes over from the molar-based activity coefficient calculation,
404 * getActivityCoefficients(), in derived classes.
405 *
406 * These molality based activity coefficients are scaled according to the
407 * current pH scale. See the Eq3/6 manual for details.
408 *
409 * Activity coefficients for species k may be altered between scales s1 to
410 * s2 using the following formula
411 *
412 * \f[
413 * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
414 * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
415 * \f]
416 *
417 * where j is any one species. For the NBS scale, j is equal to the Cl-
418 * species and
419 *
420 * \f[
421 * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
422 * \f]
423 *
424 * @param acMolality Output vector containing the molality based activity
425 * coefficients. length: m_kk.
426 */
427 virtual void getMolalityActivityCoefficients(doublereal* acMolality) const;
428
429 //! Calculate the osmotic coefficient
430 /*!
431 * \f[
432 * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
433 * \f]
434 *
435 * Note there are a few of definitions of the osmotic coefficient floating
436 * around. We use the one defined in (Activity Coefficients in Electrolyte
437 * Solutions, K. S. Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28).
438 * This definition is most clearly related to theoretical calculation.
439 *
440 * units = dimensionless
441 */
442 virtual double osmoticCoefficient() const;
443
444 //! @}
445
446 //! Set equation of state parameter values from XML entries.
447 /*!
448 * This method is called by function importPhase() when processing a phase
449 * definition in an input file. It should be overloaded in subclasses to set
450 * any parameters that are specific to that particular phase model.
451 *
452 * The MolalityVPSSTP object defines a new method for setting the
453 * concentrations of a phase. The new method is defined by a block called
454 * "soluteMolalities". If this block is found, the concentrations within
455 * that phase are set to the "name":"molalities pairs found within that XML
456 * block. The solvent concentration is then set to everything else.
457 *
458 * The function first calls the overloaded function,
459 * VPStandardStateTP::setStateFromXML(), to pick up the parent class
460 * behavior.
461 *
462 * usage: Overloaded functions should call this function before carrying out
463 * their own behavior.
464 *
465 * @param state An XML_Node object corresponding to the "state" entry for
466 * this phase in the input file.
467 *
468 * @deprecated The XML input format is deprecated and will be removed in
469 * Cantera 3.0.
470 */
471 virtual void setStateFromXML(const XML_Node& state);
472
473 //! @name Initialization
474 /// The following methods are used in the process of constructing the phase
475 /// and setting its parameters from a specification in an input file. They
476 /// are not normally used in application programs. To see how they are used,
477 /// see importPhase().
478 //! @{
479
480 virtual bool addSpecies(shared_ptr<Species> spec);
481 virtual void initThermo();
482
483 //! @}
484
485 //! Set the temperature (K), pressure (Pa), and molalities
486 //!(gmol kg-1) of the solutes
487 /*!
488 * @param t Temperature (K)
489 * @param p Pressure (Pa)
490 * @param molalities Input vector of molalities of the solutes.
491 * Length: m_kk.
492 */
493 void setState_TPM(doublereal t, doublereal p,
494 const doublereal* const molalities);
495
496 //! Set the temperature (K), pressure (Pa), and molalities.
497 /*!
498 * @param t Temperature (K)
499 * @param p Pressure (Pa)
500 * @param m compositionMap containing the molalities
501 */
502 void setState_TPM(doublereal t, doublereal p, const compositionMap& m);
503
504 //! Set the temperature (K), pressure (Pa), and molalities.
505 /*!
506 * @param t Temperature (K)
507 * @param p Pressure (Pa)
508 * @param m String which gets translated into a composition
509 * map for the molalities of the solutes.
510 */
511 void setState_TPM(doublereal t, doublereal p, const std::string& m);
512
513 //! @copydoc ThermoPhase::setState
514 /*!
515 * Additionally uses the keys `molalities` or `M` to set the molalities.
516 */
517 virtual void setState(const AnyMap& state);
518
519 virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) {
520 getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN);
521 }
522
523 virtual std::string report(bool show_thermo=true,
524 doublereal threshold=1e-14) const;
525
526 protected:
527 virtual void getCsvReportData(std::vector<std::string>& names,
528 std::vector<vector_fp>& data) const;
529
530 //! Get the array of unscaled non-dimensional molality based activity
531 //! coefficients at the current solution temperature, pressure, and solution
532 //! concentration.
533 /*!
534 * See Denbigh p. 278 for a thorough discussion. This class must be
535 * overridden in classes which derive from MolalityVPSSTP. This function
536 * takes over from the molar-based activity coefficient calculation,
537 * getActivityCoefficients(), in derived classes.
538 *
539 * @param acMolality Output vector containing the molality based activity
540 * coefficients. length: m_kk.
541 */
542 virtual void getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const;
543
544 //! Apply the current phScale to a set of activity Coefficients or
545 //! activities
546 /*!
547 * See the Eq3/6 Manual for a thorough discussion.
548 *
549 * @param acMolality input/Output vector containing the molality based
550 * activity coefficients. length: m_kk.
551 */
552 virtual void applyphScale(doublereal* acMolality) const;
553
554 private:
555 //! Returns the index of the Cl- species.
556 /*!
557 * The Cl- species is special in the sense that its single ion molality-
558 * based activity coefficient is used in the specification of the pH scale
559 * for single ions. Therefore, we need to know what species index is Cl-. If
560 * the species isn't in the species list then this routine returns -1, and
561 * we can't use the NBS pH scale.
562 *
563 * Right now we use a restrictive interpretation. The species must be named
564 * "Cl-". It must consist of exactly one Cl and one E atom.
565 */
566 virtual size_t findCLMIndex() const;
567
568 protected:
569 //! Scaling to be used for output of single-ion species activity
570 //! coefficients.
571 /*!
572 * Index of the species to be used in the single-ion scaling law. This is
573 * the identity of the Cl- species for the PHSCALE_NBS scaling. Either
574 * PHSCALE_PITZER or PHSCALE_NBS
575 */
576 int m_pHScalingType;
577
578 //! Index of the phScale species
579 /*!
580 * Index of the species to be used in the single-ion scaling law. This is
581 * the identity of the Cl- species for the PHSCALE_NBS scaling
582 */
583 size_t m_indexCLM;
584
585 //! Molecular weight of the Solvent
586 doublereal m_weightSolvent;
587
588 /*!
589 * In any molality implementation, it makes sense to have a minimum solvent
590 * mole fraction requirement, since the implementation becomes singular in
591 * the xmolSolvent=0 limit. The default is to set it to 0.01. We then modify
592 * the molality definition to ensure that molal_solvent = 0 when
593 * xmol_solvent = 0.
594 */
595 doublereal m_xmolSolventMIN;
596
597 //! This is the multiplication factor that goes inside log expressions
598 //! involving the molalities of species. It's equal to Wt_0 / 1000, where
599 //! Wt_0 = weight of solvent (kg/kmol)
600 doublereal m_Mnaught;
601
602 //! Current value of the molalities of the species in the phase. Note this
603 //! vector is a mutable quantity. units are (kg/kmol)
604 mutable vector_fp m_molalities;
605};
606
607
608//! Scale to be used for the output of single-ion activity coefficients is that
609//! used by Pitzer.
610/*!
611 * This is the internal scale used within the code. One property is that the
612 * activity coefficients for the cation and anion of a single salt will be
613 * equal. This scale is the one presumed by the formulation of the single-ion
614 * activity coefficients described in this report.
615 *
616 * Activity coefficients for species k may be altered between scales s1 to s2
617 * using the following formula
618 *
619 * \f[
620 * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
621 * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
622 * \f]
623 *
624 * where j is any one species.
625 */
626 const int PHSCALE_PITZER = 0;
627
628//! Scale to be used for evaluation of single-ion activity coefficients is that
629//! used by the NBS standard for evaluation of the pH variable.
630/*!
631 * This is not the internal scale used within the code.
632 *
633 * Activity coefficients for species k may be altered between scales s1 to s2
634 * using the following formula
635 *
636 * \f[
637 * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
638 * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
639 * \f]
640 *
641 * where j is any one species. For the NBS scale, j is equal to the Cl- species
642 * and
643 *
644 * \f[
645 * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
646 * \f]
647 *
648 * This is the NBS pH scale, which is used in all conventional pH measurements.
649 * and is based on the Bates-Guggenheim equations.
650 */
651 const int PHSCALE_NBS = 1;
652
653}
654
655#endif
VPStandardStateTP.h
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::MolalityVPSSTP
Definition: MolalityVPSSTP.h:182
Cantera::MolalityVPSSTP::setStateFromXML
virtual void setStateFromXML(const XML_Node &state)
Set equation of state parameter values from XML entries.
Definition: MolalityVPSSTP.cpp:242
Cantera::MolalityVPSSTP::applyphScale
virtual void applyphScale(doublereal *acMolality) const
Apply the current phScale to a set of activity Coefficients or activities.
Definition: MolalityVPSSTP.cpp:304
Cantera::MolalityVPSSTP::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: MolalityVPSSTP.cpp:365
Cantera::MolalityVPSSTP::setMolalitiesByName
void setMolalitiesByName(const compositionMap &xMap)
Set the molalities of a phase.
Definition: MolalityVPSSTP.cpp:113
Cantera::MolalityVPSSTP::getdlnActCoeffdlnN
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
Definition: MolalityVPSSTP.h:519
Cantera::MolalityVPSSTP::moleFSolventMin
doublereal moleFSolventMin() const
Returns the minimum mole fraction in the molality formulation.
Definition: MolalityVPSSTP.cpp:63
Cantera::MolalityVPSSTP::getActivityCoefficients
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature,...
Definition: MolalityVPSSTP.cpp:209
Cantera::MolalityVPSSTP::getMolalities
void getMolalities(doublereal *const molal) const
This function will return the molalities of the species.
Definition: MolalityVPSSTP.cpp:78
Cantera::MolalityVPSSTP::report
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
Definition: MolalityVPSSTP.cpp:379
Cantera::MolalityVPSSTP::setState
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
Definition: MolalityVPSSTP.cpp:274
Cantera::MolalityVPSSTP::getUnscaledMolalityActivityCoefficients
virtual void getUnscaledMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of unscaled non-dimensional molality based activity coefficients at the current solutio...
Definition: MolalityVPSSTP.cpp:299
Cantera::MolalityVPSSTP::getMolalityActivityCoefficients
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality based activity coefficients at the current solution tempera...
Definition: MolalityVPSSTP.cpp:218
Cantera::MolalityVPSSTP::m_indexCLM
size_t m_indexCLM
Index of the phScale species.
Definition: MolalityVPSSTP.h:583
Cantera::MolalityVPSSTP::findCLMIndex
virtual size_t findCLMIndex() const
Returns the index of the Cl- species.
Definition: MolalityVPSSTP.cpp:309
Cantera::MolalityVPSSTP::osmoticCoefficient
virtual double osmoticCoefficient() const
Calculate the osmotic coefficient.
Definition: MolalityVPSSTP.cpp:224
Cantera::MolalityVPSSTP::setMolalities
void setMolalities(const doublereal *const molal)
Set the molalities of the solutes in a phase.
Definition: MolalityVPSSTP.cpp:86
Cantera::MolalityVPSSTP::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MolalityVPSSTP.cpp:194
Cantera::MolalityVPSSTP::pHScale
int pHScale() const
Reports the pH scale, which determines the scale for single-ion activity coefficients.
Definition: MolalityVPSSTP.cpp:48
Cantera::MolalityVPSSTP::setpHScale
void setpHScale(const int pHscaleType)
Set the pH scale, which determines the scale for single-ion activity coefficients.
Definition: MolalityVPSSTP.cpp:39
Cantera::MolalityVPSSTP::getCsvReportData
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...
Definition: MolalityVPSSTP.cpp:487
Cantera::MolalityVPSSTP::setMoleFSolventMin
void setMoleFSolventMin(doublereal xmolSolventMIN)
Sets the minimum mole fraction in the molality formulation.
Definition: MolalityVPSSTP.cpp:53
Cantera::MolalityVPSSTP::phaseOfMatter
virtual std::string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
Definition: MolalityVPSSTP.h:201
Cantera::MolalityVPSSTP::activityConvention
int activityConvention() const
We set the convention to molality here.
Definition: MolalityVPSSTP.cpp:189
Cantera::MolalityVPSSTP::initThermo
virtual void initThermo()
Definition: MolalityVPSSTP.cpp:291
Cantera::MolalityVPSSTP::m_xmolSolventMIN
doublereal m_xmolSolventMIN
Definition: MolalityVPSSTP.h:595
Cantera::MolalityVPSSTP::m_pHScalingType
int m_pHScalingType
Scaling to be used for output of single-ion species activity coefficients.
Definition: MolalityVPSSTP.h:576
Cantera::MolalityVPSSTP::MolalityVPSSTP
MolalityVPSSTP()
Default Constructor.
Definition: MolalityVPSSTP.cpp:24
Cantera::MolalityVPSSTP::m_Mnaught
doublereal m_Mnaught
This is the multiplication factor that goes inside log expressions involving the molalities of specie...
Definition: MolalityVPSSTP.h:600
Cantera::MolalityVPSSTP::calcMolalities
void calcMolalities() const
Calculates the molality of all species and stores the result internally.
Definition: MolalityVPSSTP.cpp:68
Cantera::MolalityVPSSTP::m_molalities
vector_fp m_molalities
Current value of the molalities of the species in the phase.
Definition: MolalityVPSSTP.h:604
Cantera::MolalityVPSSTP::getActivities
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities (molality based for this class and classes that derive fr...
Definition: MolalityVPSSTP.cpp:204
Cantera::MolalityVPSSTP::setState_TPM
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.
Definition: MolalityVPSSTP.cpp:255
Cantera::MolalityVPSSTP::m_weightSolvent
doublereal m_weightSolvent
Molecular weight of the Solvent.
Definition: MolalityVPSSTP.h:586
Cantera::MolalityVPSSTP::standardConcentration
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MolalityVPSSTP.cpp:199
Cantera::Phase::name
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:70
Cantera::VPStandardStateTP
This is a filter class for ThermoPhase that implements some preparatory steps for efficiently handlin...
Definition: VPStandardStateTP.h:44
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::PHSCALE_PITZER
const int PHSCALE_PITZER
Scale to be used for the output of single-ion activity coefficients is that used by Pitzer.
Definition: MolalityVPSSTP.h:626
Cantera::vector_fp
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
Cantera::PHSCALE_NBS
const int PHSCALE_NBS
Scale to be used for evaluation of single-ion activity coefficients is that used by the NBS standard ...
Definition: MolalityVPSSTP.h:651
Cantera::compositionMap
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:176