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