Cantera  2.3.0
DebyeHuckel.h
Go to the documentation of this file.
1 /**
2  * @file DebyeHuckel.h
3  * Headers for the DebyeHuckel ThermoPhase object, which models dilute
4  * electrolyte solutions
5  * (see \ref thermoprops and \link Cantera::DebyeHuckel DebyeHuckel \endlink) .
6  *
7  * Class DebyeHuckel represents a dilute liquid electrolyte phase which
8  * obeys the Debye Huckel formulation for nonideality.
9  */
10 
11 // This file is part of Cantera. See License.txt in the top-level directory or
12 // at http://www.cantera.org/license.txt for license and copyright information.
13 
14 #ifndef CT_DEBYEHUCKEL_H
15 #define CT_DEBYEHUCKEL_H
16 
17 #include "MolalityVPSSTP.h"
18 #include "cantera/base/Array.h"
19 
20 namespace Cantera
21 {
22 
23 /*!
24  * @name Formats for the Activity Coefficients
25  *
26  * These are possible formats for the molality-based activity coefficients.
27  */
28 //@{
29 #define DHFORM_DILUTE_LIMIT 0
30 #define DHFORM_BDOT_AK 1
31 #define DHFORM_BDOT_ACOMMON 2
32 #define DHFORM_BETAIJ 3
33 #define DHFORM_PITZER_BETAIJ 4
34 //@}
35 /*!
36  * @name Acceptable ways to calculate the value of A_Debye
37  */
38 //@{
39 #define A_DEBYE_CONST 0
40 #define A_DEBYE_WATER 1
41 //@}
42 
43 class WaterProps;
44 class PDSS_Water;
45 
46 /**
47  * @ingroup thermoprops
48  *
49  * Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys
50  * the Debye Huckel formulation for nonideality.
51  *
52  * The concentrations of the ionic species are assumed to obey the
53  * electroneutrality condition.
54  *
55  * ## Specification of Species Standard State Properties
56  *
57  * The standard states are on the unit molality basis. Therefore, in the
58  * documentation below, the normal \f$ o \f$ superscript is replaced with the
59  * \f$ \triangle \f$ symbol. The reference state symbol is now
60  * \f$ \triangle, ref \f$.
61  *
62  * It is assumed that the reference state thermodynamics may be obtained by a
63  * pointer to a populated species thermodynamic property manager class (see
64  * ThermoPhase::m_spthermo). How to relate pressure changes to the reference
65  * state thermodynamics is resolved at this level.
66  *
67  * For an incompressible, stoichiometric substance, the molar internal energy is
68  * independent of pressure. Since the thermodynamic properties are specified by
69  * giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted
70  * from the specified molar enthalpy to compute the molar internal energy. The
71  * entropy is assumed to be independent of the pressure.
72  *
73  * The enthalpy function is given by the following relation.
74  *
75  * \f[
76  * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T)
77  * + \tilde v \left( P - P_{ref} \right)
78  * \f]
79  *
80  * For an incompressible, stoichiometric substance, the molar internal energy is
81  * independent of pressure. Since the thermodynamic properties are specified by
82  * giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is
83  * subtracted from the specified reference molar enthalpy to compute the molar
84  * internal energy.
85  *
86  * \f[
87  * u^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - P_{ref} \tilde v
88  * \f]
89  *
90  * The standard state heat capacity and entropy are independent of pressure. The
91  * standard state Gibbs free energy is obtained from the enthalpy and entropy
92  * functions.
93  *
94  * The vector Phase::m_speciesSize[] is used to hold the base values of species
95  * sizes. These are defined as the molar volumes of species at infinite dilution
96  * at 300 K and 1 atm of water. m_speciesSize are calculated during the
97  * initialization of the DebyeHuckel object and are then not touched.
98  *
99  * The current model assumes that an incompressible molar volume for all
100  * solutes. The molar volume for the water solvent, however, is obtained from a
101  * pure water equation of state, waterSS. Therefore, the water standard state
102  * varies with both T and P. It is an error to request standard state water
103  * properties at a T and P where the water phase is not a stable phase, i.e.,
104  * beyond its spinodal curve.
105  *
106  * ## Specification of Solution Thermodynamic Properties
107  *
108  * Chemical potentials of the solutes, \f$ \mu_k \f$, and the solvent, \f$ \mu_o
109  * \f$, which are based on the molality form, have the following general format:
110  *
111  * \f[
112  * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle})
113  * \f]
114  * \f[
115  * \mu_o = \mu^o_o(T,P) + RT ln(a_o)
116  * \f]
117  *
118  * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient
119  * for species \f$k\f$.
120  *
121  * Individual activity coefficients of ions can not be independently measured.
122  * Instead, only binary pairs forming electroneutral solutions can be measured.
123  *
124  * ### Ionic Strength
125  *
126  * Most of the parameterizations within the model use the ionic strength as a
127  * key variable. The ionic strength, \f$ I\f$ is defined as follows
128  *
129  * \f[
130  * I = \frac{1}{2} \sum_k{m_k z_k^2}
131  * \f]
132  *
133  * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge of
134  * the kth species. Note, the ionic strength is a defined units quantity. The
135  * molality has defined units of gmol kg-1, and therefore the ionic strength has
136  * units of sqrt( gmol kg-1).
137  *
138  * In some instances, from some authors, a different formulation is used for the
139  * ionic strength in the equations below. The different formulation is due to
140  * the possibility of the existence of weak acids and how association wrt to the
141  * weak acid equilibrium relation affects the calculation of the activity
142  * coefficients via the assumed value of the ionic strength.
143  *
144  * If we are to assume that the association reaction doesn't have an effect on
145  * the ionic strength, then we will want to consider the associated weak acid as
146  * in effect being fully dissociated, when we calculate an effective value for
147  * the ionic strength. We will call this calculated value, the stoichiometric
148  * ionic strength, \f$ I_s \f$, putting a subscript s to denote it from the more
149  * straightforward calculation of \f$ I \f$.
150  *
151  * \f[
152  * I_s = \frac{1}{2} \sum_k{m_k^s z_k^2}
153  * \f]
154  *
155  * Here, \f$ m_k^s \f$ is the value of the molalities calculated assuming that
156  * all weak acid-base pairs are in their fully dissociated states. This
157  * calculation may be simplified by considering that the weakly associated acid
158  * may be made up of two charged species, k1 and k2, each with their own
159  * charges, obeying the following relationship:
160  *
161  * \f[
162  * z_k = z_{k1} + z_{k2}
163  * \f]
164  * Then, we may only need to specify one charge value, say, \f$ z_{k1}\f$, the
165  * cation charge number, in order to get both numbers, since we have already
166  * specified \f$ z_k \f$ in the definition of original species. Then, the
167  * stoichiometric ionic strength may be calculated via the following formula.
168  *
169  * \f[
170  * I_s = \frac{1}{2} \left(\sum_{k,ions}{m_k z_k^2}+
171  * \sum_{k,weak_assoc}(m_k z_{k1}^2 + m_k z_{k2}^2) \right)
172  * \f]
173  *
174  * The specification of which species are weakly associated acids is made in the
175  * input file via the `stoichIsMods` XML block, where the charge for k1 is also
176  * specified. An example is given below:
177  *
178  * @code
179  * <stoichIsMods>
180  * NaCl(aq):-1.0
181  * </stoichIsMods>
182  * @endcode
183  *
184  * Because we need the concept of a weakly associated acid in order to calculate
185  * \f$ I_s \f$ we need to catalog all species in the phase. This is done using
186  * the following categories:
187  *
188  * - `cEST_solvent` Solvent species (neutral)
189  * - `cEST_chargedSpecies` Charged species (charged)
190  * - `cEST_weakAcidAssociated` Species which can break apart into charged species.
191  * It may or may not be charged. These may or
192  * may not be be included in the
193  * species solution vector.
194  * - `cEST_strongAcidAssociated` Species which always breaks apart into charged species.
195  * It may or may not be charged. Normally, these aren't included
196  * in the speciation vector.
197  * - `cEST_polarNeutral` Polar neutral species
198  * - `cEST_nonpolarNeutral` Non polar neutral species
199  *
200  * Polar and non-polar neutral species are differentiated, because some
201  * additions to the activity coefficient expressions distinguish between these
202  * two types of solutes. This is the so-called salt-out effect.
203  *
204  * The type of species is specified in the `electrolyteSpeciesType` XML block.
205  * Note, this is not considered a part of the specification of the standard
206  * state for the species, at this time. Therefore, this information is put under
207  * the `activityCoefficient` XML block. An example is given below
208  *
209  * @code
210  * <electrolyteSpeciesType>
211  * H2L(L):solvent
212  * H+:chargedSpecies
213  * NaOH(aq):weakAcidAssociated
214  * NaCl(aq):strongAcidAssociated
215  * NH3(aq):polarNeutral
216  * O2(aq):nonpolarNeutral
217  * </electrolyteSpeciesType>
218  * @endcode
219  *
220  * Much of the species electrolyte type information is inferred from other
221  * information in the input file. For example, as species which is charged is
222  * given the "chargedSpecies" default category. A neutral solute species is put
223  * into the "nonpolarNeutral" category by default.
224  *
225  * The specification of solute activity coefficients depends on the model
226  * assumed for the Debye-Huckel term. The model is set by the internal parameter
227  * #m_formDH. We will now describe each category in its own section.
228  *
229  * ### Debye-Huckel Dilute Limit
230  *
231  * DHFORM_DILUTE_LIMIT = 0
232  *
233  * This form assumes a dilute limit to DH, and is mainly for informational purposes:
234  * \f[
235  * \ln(\gamma_k^\triangle) = - z_k^2 A_{Debye} \sqrt{I}
236  * \f]
237  * where \f$ I\f$ is the ionic strength
238  * \f[
239  * I = \frac{1}{2} \sum_k{m_k z_k^2}
240  * \f]
241  *
242  * The activity for the solvent water,\f$ a_o \f$, is not independent and must
243  * be determined from the Gibbs-Duhem relation.
244  *
245  * \f[
246  * \ln(a_o) = \frac{X_o - 1.0}{X_o} + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2}
247  * \f]
248  *
249  * ### Bdot Formulation
250  *
251  * DHFORM_BDOT_AK = 1
252  *
253  * This form assumes Bethke's format for the Debye Huckel activity coefficient:
254  *
255  * \f[
256  * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a_k \sqrt{I}}
257  * + \log(10) B^{dot}_k I
258  * \f]
259  *
260  * Note, this particular form where \f$ a_k \f$ can differ in multielectrolyte
261  * solutions has problems with respect to a Gibbs-Duhem analysis. However, we
262  * include it here because there is a lot of data fit to it.
263  *
264  * The activity for the solvent water,\f$ a_o \f$, is not independent and must
265  * be determined from the Gibbs-Duhem relation. Here, we use:
266  *
267  * \f[
268  * \ln(a_o) = \frac{X_o - 1.0}{X_o}
269  * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{1/2}
270  * \left[ \sum_k{\frac{1}{2} m_k z_k^2 \sigma( B_{Debye} a_k \sqrt{I} ) } \right]
271  * - \frac{\log(10)}{2} \tilde{M}_o I \sum_k{ B^{dot}_k m_k}
272  * \f]
273  * where
274  * \f[
275  * \sigma (y) = \frac{3}{y^3} \left[ (1+y) - 2 \ln(1 + y) - \frac{1}{1+y} \right]
276  * \f]
277  *
278  * Additionally, Helgeson's formulation for the water activity is offered as an
279  * alternative.
280  *
281  * ### Bdot Formulation with Uniform Size Parameter in the Denominator
282  *
283  * DHFORM_BDOT_AUNIFORM = 2
284  *
285  * This form assumes Bethke's format for the Debye-Huckel activity coefficient
286  *
287  * \f[
288  * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
289  * + \log(10) B^{dot}_k I
290  * \f]
291  *
292  * The value of a is determined at the beginning of the calculation, and not changed.
293  *
294  * \f[
295  * \ln(a_o) = \frac{X_o - 1.0}{X_o}
296  * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} \sigma( B_{Debye} a \sqrt{I} )
297  * - \frac{\log(10)}{2} \tilde{M}_o I \sum_k{ B^{dot}_k m_k}
298  * \f]
299  *
300  * ### Beta_IJ formulation
301  *
302  * DHFORM_BETAIJ = 3
303  *
304  * This form assumes a linear expansion in a virial coefficient form. It is used
305  * extensively in the book by Newmann, "Electrochemistry Systems", and is the
306  * beginning of more complex treatments for stronger electrolytes, fom Pitzer
307  * and from Harvey, Moller, and Weire.
308  *
309  * \f[
310  * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
311  * + 2 \sum_j \beta_{j,k} m_j
312  * \f]
313  *
314  * In the current treatment the binary interaction coefficients, \f$
315  * \beta_{j,k}\f$, are independent of temperature and pressure.
316  *
317  * \f[
318  * \ln(a_o) = \frac{X_o - 1.0}{X_o}
319  * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} \sigma( B_{Debye} a \sqrt{I} )
320  * - \tilde{M}_o \sum_j \sum_k \beta_{j,k} m_j m_k
321  * \f]
322  *
323  * In this formulation the ionic radius, \f$ a \f$, is a constant. This must be
324  * supplied to the model, in an <DFN> ionicRadius </DFN> XML block.
325  *
326  * The \f$ \beta_{j,k} \f$ parameters are binary interaction parameters. They
327  * are supplied to the object in an `DHBetaMatrix` XML block. There are in
328  * principle \f$ N (N-1) /2 \f$ different, symmetric interaction parameters,
329  * where \f$ N \f$ are the number of solute species in the mechanism. An example
330  * is given below.
331  *
332  * An example `activityCoefficients` XML block for this formulation is supplied
333  * below
334  *
335  * @code
336  * <activityCoefficients model="Beta_ij">
337  * <!-- A_Debye units = sqrt(kg/gmol) -->
338  * <A_Debye> 1.172576 </A_Debye>
339  * <!-- B_Debye units = sqrt(kg/gmol)/m -->
340  * <B_Debye> 3.28640E9 </B_Debye>
341  * <ionicRadius default="3.042843" units="Angstroms">
342  * </ionicRadius>
343  * <DHBetaMatrix>
344  * H+:Cl-:0.27
345  * Na+:Cl-:0.15
346  * Na+:OH-:0.06
347  * </DHBetaMatrix>
348  * <stoichIsMods>
349  * NaCl(aq):-1.0
350  * </stoichIsMods>
351  * <electrolyteSpeciesType>
352  * H+:chargedSpecies
353  * NaCl(aq):weakAcidAssociated
354  * </electrolyteSpeciesType>
355  * </activityCoefficients>
356  * @endcode
357  *
358  * ### Pitzer Beta_IJ formulation
359  *
360  * DHFORM_PITZER_BETAIJ = 4
361  *
362  * This form assumes an activity coefficient formulation consistent with a
363  * truncated form of Pitzer's formulation. Pitzer's formulation is equivalent to
364  * the formulations above in the dilute limit, where rigorous theory may be
365  * applied.
366  *
367  * \f[
368  * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye}}{3} \frac{\sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
369  * -2 z_k^2 \frac{A_{Debye}}{3} \frac{\ln(1 + B_{Debye} a \sqrt{I})}{ B_{Debye} a}
370  * + 2 \sum_j \beta_{j,k} m_j
371  * \f]
372  * \f[
373  * \ln(a_o) = \frac{X_o - 1.0}{X_o}
374  * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} \frac{(I)^{3/2} }{1 + B_{Debye} a \sqrt{I} }
375  * - \tilde{M}_o \sum_j \sum_k \beta_{j,k} m_j m_k
376  * \f]
377  *
378  * ### Specification of the Debye Huckel Constants
379  *
380  * In the equations above, the formulas for \f$ A_{Debye} \f$ and \f$
381  * B_{Debye} \f$ are needed. The DebyeHuckel object uses two methods for
382  * specifying these quantities. The default method is to assume that \f$
383  * A_{Debye} \f$ is a constant, given in the initialization process, and stored
384  * in the member double, m_A_Debye. Optionally, a full water treatment may be
385  * employed that makes \f$ A_{Debye} \f$ a full function of *T* and *P*.
386  *
387  * \f[
388  * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2}
389  * \f]
390  * where
391  * \f[
392  * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}}
393  * \f]
394  * Therefore:
395  * \f[
396  * A_{Debye} = \frac{1}{8 \pi}
397  * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2}
398  * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
399  * \f]
400  * where
401  * - \f$ N_a \f$ is Avogadro's number
402  * - \f$ \rho_w \f$ is the density of water
403  * - \f$ e \f$ is the electronic charge
404  * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
405  * - \f$ K \f$ is the dielectric constant of water
406  * - \f$ \epsilon_o \f$ is the permittivity of free space
407  * - \f$ \rho_o \f$ is the density of the solvent in its standard state.
408  *
409  * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)^(1/2) based on:
410  * - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
411  * - T = 298.15 K
412  * - B_Debye = 3.28640E9 (kg/gmol)^(1/2) / m
413  *
414  * An example of a fixed value implementation is given below.
415  * @code
416  * <activityCoefficients model="Beta_ij">
417  * <!-- A_Debye units = sqrt(kg/gmol) -->
418  * <A_Debye> 1.172576 </A_Debye>
419  * <!-- B_Debye units = sqrt(kg/gmol)/m -->
420  * <B_Debye> 3.28640E9 </B_Debye>
421  * </activityCoefficients>
422  * @endcode
423  *
424  * An example of a variable value implementation is given below.
425  * @code
426  * <activityCoefficients model="Beta_ij">
427  * <A_Debye model="water" />
428  * <!-- B_Debye units = sqrt(kg/gmol)/m -->
429  * <B_Debye> 3.28640E9 </B_Debye>
430  * </activityCoefficients>
431  * @endcode
432  *
433  * Currently, \f$ B_{Debye} \f$ is a constant in the model, specified either by
434  * a default water value, or through the input file. This may have to be looked
435  * at, in the future.
436  *
437  * ## %Application within Kinetics Managers
438  *
439  * For the time being, we have set the standard concentration for all species in
440  * this phase equal to the default concentration of the solvent at 298 K and 1
441  * atm. This means that the kinetics operator essentially works on an activities
442  * basis, with units specified as if it were on a concentration basis.
443  *
444  * For example, a bulk-phase binary reaction between liquid species j and k,
445  * producing a new liquid species l would have the following equation for its
446  * rate of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
447  *
448  * \f[
449  * R^1 = k^1 C_j^a C_k^a = k^1 (C_o a_j) (C_o a_k)
450  * \f]
451  * where
452  * \f[
453  * C_j^a = C_o a_j \quad and \quad C_k^a = C_o a_k
454  * \f]
455  *
456  * \f$ C_j^a \f$ is the activity concentration of species j, and
457  * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C_o \f$
458  * is the concentration of water at 298 K and 1 atm. \f$ a_j \f$ is the activity
459  * of species j at the current temperature and pressure and concentration of the
460  * liquid phase. \f$k^1 \f$ has units of m3 kmol-1 s-1.
461  *
462  * The reverse rate constant can then be obtained from the law of microscopic
463  * reversibility and the equilibrium expression for the system.
464  *
465  * \f[
466  * \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
467  * \f]
468  *
469  * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant.
470  *
471  * \f[
472  * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o a_l)
473  * \f]
474  * where
475  * \f[
476  * k^{-1} = k^1 K^{o,1} C_o
477  * \f]
478  *
479  * \f$k^{-1} \f$ has units of s-1.
480  *
481  * Note, this treatment may be modified in the future, as events dictate.
482  *
483  * ## Instantiation of the Class
484  *
485  * The constructor for this phase is NOT located in the default ThermoFactory
486  * for %Cantera. However, a new DebyeHuckel object may be created by
487  * the following code snippets:
488  *
489  * @code
490  * DebyeHuckel *DH = new DebyeHuckel("DH_NaCl.xml", "NaCl_electrolyte");
491  * @endcode
492  *
493  * or
494  *
495  * @code
496  * XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
497  * DebyeHuckel *dh = new DebyeHuckel(*xm);
498  * @endcode
499  *
500  * or by the following call to importPhase():
501  *
502  * @code
503  * XML_Node *xm = get_XML_NameID("phase", "DH_NaCl.xml#NaCl_electrolyte", 0);
504  * DebyeHuckel dhphase;
505  * importPhase(*xm, &dhphase);
506  * @endcode
507  *
508  * ## XML Example
509  *
510  * The phase model name for this is called StoichSubstance. It must be supplied
511  * as the model attribute of the thermo XML element entry. Within the phase XML
512  * block, the density of the phase must be specified. An example of an XML file
513  * this phase is given below.
514  *
515  * @code
516  * <phase id="NaCl_electrolyte" dim="3">
517  * <speciesArray datasrc="#species_waterSolution">
518  * H2O(L) Na+ Cl- H+ OH- NaCl(aq) NaOH(aq)
519  * </speciesArray>
520  * <state>
521  * <temperature units="K"> 300 </temperature>
522  * <pressure units="Pa">101325.0</pressure>
523  * <soluteMolalities>
524  * Na+:3.0
525  * Cl-:3.0
526  * H+:1.0499E-8
527  * OH-:1.3765E-6
528  * NaCl(aq):0.98492
529  * NaOH(aq):3.8836E-6
530  * </soluteMolalities>
531  * </state>
532  * <!-- thermo model identifies the inherited class
533  * from ThermoPhase that will handle the thermodynamics.
534  * -->
535  * <thermo model="DebyeHuckel">
536  * <standardConc model="solvent_volume" />
537  * <activityCoefficients model="Beta_ij">
538  * <!-- A_Debye units = sqrt(kg/gmol) -->
539  * <A_Debye> 1.172576 </A_Debye>
540  * <!-- B_Debye units = sqrt(kg/gmol)/m -->
541  * <B_Debye> 3.28640E9 </B_Debye>
542  * <ionicRadius default="3.042843" units="Angstroms">
543  * </ionicRadius>
544  * <DHBetaMatrix>
545  * H+:Cl-:0.27
546  * Na+:Cl-:0.15
547  * Na+:OH-:0.06
548  * </DHBetaMatrix>
549  * <stoichIsMods>
550  * NaCl(aq):-1.0
551  * </stoichIsMods>
552  * <electrolyteSpeciesType>
553  * H+:chargedSpecies
554  * NaCl(aq):weakAcidAssociated
555  * </electrolyteSpeciesType>
556  * </activityCoefficients>
557  * <solvent> H2O(L) </solvent>
558  * </thermo>
559  * <elementArray datasrc="elements.xml"> O H Na Cl </elementArray>
560  * </phase>
561  * @endcode
562  */
564 {
565 public:
566  //! Default Constructor
567  DebyeHuckel();
568 
569  DebyeHuckel(const DebyeHuckel&);
570  DebyeHuckel& operator=(const DebyeHuckel&);
571  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
572  virtual ~DebyeHuckel();
573 
574  //! Full constructor for creating the phase.
575  /*!
576  * @param inputFile File name containing the XML description of the phase
577  * @param id id attribute containing the name of the phase.
578  */
579  DebyeHuckel(const std::string& inputFile, const std::string& id = "");
580 
581  //! Full constructor for creating the phase.
582  /*!
583  * @param phaseRef XML phase node containing the description of the phase
584  * @param id id attribute containing the name of the phase.
585  */
586  DebyeHuckel(XML_Node& phaseRef, const std::string& id = "");
587 
588  //! @name Utilities
589  //! @{
590 
591  virtual int eosType() const;
592  virtual std::string type() const {
593  return "DebyeHuckel";
594  }
595 
596  //! @}
597  //! @name Molar Thermodynamic Properties of the Solution
598  //! @{
599 
600  virtual doublereal enthalpy_mole() const;
601 
602  /// Molar entropy. Units: J/kmol/K.
603  /**
604  * For an ideal, constant partial molar volume solution mixture with
605  * pure species phases which exhibit zero volume expansivity:
606  * \f[
607  * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T)
608  * - \hat R \sum_k X_k log(X_k)
609  * \f]
610  * The reference-state pure-species entropies
611  * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the
612  * species thermodynamic
613  * property manager. The pure species entropies are independent of
614  * temperature since the volume expansivities are equal to zero.
615  * @see MultiSpeciesThermo
616  */
617  virtual doublereal entropy_mole() const;
618 
619  virtual doublereal gibbs_mole() const;
620  virtual doublereal cp_mole() const;
621 
622  //@}
623  /** @name Mechanical Equation of State Properties
624  //@{
625  * In this equation of state implementation, the density is a function only
626  * of the mole fractions. Therefore, it can't be an independent variable.
627  * Instead, the pressure is used as the independent variable. Functions
628  * which try to set the thermodynamic state by calling setDensity() may
629  * cause an exception to be thrown.
630  */
631 
632 protected:
633  virtual void calcDensity();
634 
635 public:
636  //! Set the internally stored density (gm/m^3) of the phase.
637  /*!
638  * Overridden setDensity() function is necessary because the density is not
639  * an independent variable.
640  *
641  * This function will now throw an error condition
642  *
643  * @internal May have to adjust the strategy here to make the eos for these
644  * materials slightly compressible, in order to create a condition where
645  * the density is a function of the pressure.
646  *
647  * This function will now throw an error condition if the input isn't
648  * exactly equal to the current density.
649  *
650  * @todo Now have a compressible ss equation for liquid water. Therefore,
651  * this phase is compressible. May still want to change the
652  * independent variable however.
653  *
654  * @param rho Input density (kg/m^3).
655  */
656  virtual void setDensity(const doublereal rho);
657 
658  //! Set the internally stored molar density (kmol/m^3) of the phase.
659  /**
660  * Overridden setMolarDensity() function is necessary because the density
661  * is not an independent variable.
662  *
663  * This function will now throw an error condition if the input isn't
664  * exactly equal to the current molar density.
665  *
666  * @param conc Input molar density (kmol/m^3).
667  */
668  virtual void setMolarDensity(const doublereal conc);
669 
670  /**
671  * @}
672  * @name Activities, Standard States, and Activity Concentrations
673  *
674  * The activity \f$a_k\f$ of a species in solution is related to the
675  * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
676  * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
677  * which depends only on temperature and the pressure. Activity is assumed
678  * to be molality-based here.
679  * @{
680  */
681 
682  virtual void getActivityConcentrations(doublereal* c) const;
683 
684  //! Return the standard concentration for the kth species
685  /*!
686  * The standard concentration \f$ C^0_k \f$ used to normalize the activity
687  * (i.e., generalized) concentration in kinetics calculations.
688  *
689  * For the time being, we will use the concentration of pure solvent for the
690  * the standard concentration of all species. This has the effect of making
691  * reaction rates based on the molality of species proportional to the
692  * molality of the species.
693  *
694  * @param k Optional parameter indicating the species. The default is to
695  * assume this refers to species 0.
696  * @return the standard Concentration in units of m^3/kmol
697  */
698  virtual doublereal standardConcentration(size_t k=0) const;
699 
700  //! Get the array of non-dimensional activities at the current solution
701  //! temperature, pressure, and solution concentration.
702  /*!
703  * (note solvent activity coefficient is on molar scale).
704  *
705  * @param ac Output vector of activities. Length: m_kk.
706  */
707  virtual void getActivities(doublereal* ac) const;
708 
709  //! Get the array of non-dimensional molality-based activity coefficients at
710  //! the current solution temperature, pressure, and solution concentration.
711  /*!
712  * note solvent is on molar scale. The solvent molar based activity
713  * coefficient is returned.
714  *
715  * Note, most of the work is done in an internal private routine
716  *
717  * @param acMolality Vector of Molality-based activity coefficients
718  * Length: m_kk
719  */
720  virtual void getMolalityActivityCoefficients(doublereal* acMolality) const;
721 
722  //@}
723  /// @name Partial Molar Properties of the Solution
724  //@{
725 
726  //! Get the species chemical potentials. Units: J/kmol.
727  /*!
728  *
729  * This function returns a vector of chemical potentials of the species in
730  * solution.
731  *
732  * \f[
733  * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k)
734  * \f]
735  *
736  * @param mu Output vector of species chemical
737  * potentials. Length: m_kk. Units: J/kmol
738  */
739  virtual void getChemPotentials(doublereal* mu) const;
740 
741  //! Returns an array of partial molar enthalpies for the species
742  //! in the mixture. Units (J/kmol)
743  /*!
744  * For this phase, the partial molar enthalpies are equal to the
745  * standard state enthalpies modified by the derivative of the
746  * molality-based activity coefficient wrt temperature
747  *
748  * \f[
749  * \bar h_k(T,P) = h^{\triangle}_k(T,P) - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT}
750  * \f]
751  * The solvent partial molar enthalpy is equal to
752  * \f[
753  * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o}{dT}
754  * \f]
755  *
756  * The temperature dependence of the activity coefficients currently
757  * only occurs through the temperature dependence of the Debye constant.
758  *
759  * @param hbar Output vector of species partial molar enthalpies.
760  * Length: m_kk. units are J/kmol.
761  */
762  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
763 
764  //! Returns an array of partial molar entropies of the species in the
765  //! solution. Units: J/kmol/K.
766  /**
767  * Maxwell's equations provide an insight in how to calculate this
768  * (p.215 Smith and Van Ness)
769  * \f[
770  * \frac{d\mu_i}{dT} = -\bar{s}_i
771  * \f]
772  *
773  * For this phase, the partial molar entropies are equal to the SS species
774  * entropies plus the ideal solution contribution:
775  * \f[
776  * \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k])
777  * \f]
778  * \f[
779  * \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T)
780  * - R ((xmolSolvent - 1.0) / xmolSolvent)
781  * \f]
782  *
783  * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, at the
784  * reference pressure, \f$ P_{ref} \f$, are computed by the species
785  * thermodynamic property manager. They are polynomial functions of
786  * temperature.
787  * @see MultiSpeciesThermo
788  *
789  * @param sbar Output vector of species partial molar entropies.
790  * Length = m_kk. units are J/kmol/K.
791  */
792  virtual void getPartialMolarEntropies(doublereal* sbar) const;
793 
794  virtual void getPartialMolarCp(doublereal* cpbar) const;
795 
796  //! Return an array of partial molar volumes for the species in the mixture.
797  //! Units: m^3/kmol.
798  /*!
799  * For this solution, the partial molar volumes are normally equal to the
800  * constant species molar volumes, except when the activity coefficients
801  * depend on pressure.
802  *
803  * The general relation is
804  *
805  * vbar_i = d(chemPot_i)/dP at const T, n
806  * = V0_i + d(Gex)/dP)_T,M
807  * = V0_i + RT d(lnActCoeffi)dP _T,M
808  *
809  * @param vbar Output vector of species partial molar volumes.
810  * Length = m_kk. units are m^3/kmol.
811  */
812  virtual void getPartialMolarVolumes(doublereal* vbar) const;
813 
814  //@}
815 
816  /*
817  * -------------- Utilities -------------------------------
818  */
819 
820  virtual bool addSpecies(shared_ptr<Species> spec);
821  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
822 
823  //! Return the Debye Huckel constant as a function of temperature
824  //! and pressure (Units = sqrt(kg/gmol))
825  /*!
826  * The default is to assume that it is constant, given in the
827  * initialization process, and stored in the member double, m_A_Debye.
828  * Optionally, a full water treatment may be employed that makes
829  * \f$ A_{Debye} \f$ a full function of T and P.
830  *
831  * \f[
832  * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2}
833  * \f]
834  * where
835  * \f[
836  * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}}
837  * \f]
838  * Therefore:
839  * \f[
840  * A_{Debye} = \frac{1}{8 \pi}
841  * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2}
842  * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
843  * \f]
844  *
845  * where
846  * - Units = sqrt(kg/gmol)
847  * - \f$ N_a \f$ is Avogadro's number
848  * - \f$ \rho_w \f$ is the density of water
849  * - \f$ e \f$ is the electronic charge
850  * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
851  * - \f$ K \f$ is the dielectric constant of water,
852  * - \f$ \epsilon_o \f$ is the permittivity of free space.
853  * - \f$ \rho_o \f$ is the density of the solvent in its standard state.
854  *
855  * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)^(1/2)
856  * based on:
857  * - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
858  * - T = 298.15 K
859  * - B_Debye = 3.28640E9 (kg/gmol)^(1/2)/m
860  *
861  * @param temperature Temperature in kelvin. Defaults to -1, in which
862  * case the temperature of the phase is assumed.
863  * @param pressure Pressure (Pa). Defaults to -1, in which
864  * case the pressure of the phase is assumed.
865  */
866  virtual double A_Debye_TP(double temperature = -1.0,
867  double pressure = -1.0) const;
868 
869  //! Value of the derivative of the Debye Huckel constant with
870  //! respect to temperature.
871  /*!
872  * This is a function of temperature and pressure. See A_Debye_TP() for
873  * a definition of \f$ A_{Debye} \f$.
874  *
875  * Units = sqrt(kg/gmol) K-1
876  *
877  * @param temperature Temperature in kelvin. Defaults to -1, in which
878  * case the temperature of the phase is assumed.
879  * @param pressure Pressure (Pa). Defaults to -1, in which
880  * case the pressure of the phase is assumed.
881  */
882  virtual double dA_DebyedT_TP(double temperature = -1.0,
883  double pressure = -1.0) const;
884 
885  //! Value of the 2nd derivative of the Debye Huckel constant with
886  //! respect to temperature as a function of temperature and pressure.
887  /*!
888  * This is a function of temperature and pressure. See A_Debye_TP() for
889  * a definition of \f$ A_{Debye} \f$.
890  *
891  * Units = sqrt(kg/gmol) K-2
892  *
893  * @param temperature Temperature in kelvin. Defaults to -1, in which
894  * case the temperature of the phase is assumed.
895  * @param pressure Pressure (Pa). Defaults to -1, in which
896  * case the pressure of the phase is assumed.
897  */
898  virtual double d2A_DebyedT2_TP(double temperature = -1.0,
899  double pressure = -1.0) const;
900 
901  //! Value of the derivative of the Debye Huckel constant with
902  //! respect to pressure, as a function of temperature and pressure.
903  /*!
904  * This is a function of temperature and pressure. See A_Debye_TP() for
905  * a definition of \f$ A_{Debye} \f$.
906  *
907  * Units = sqrt(kg/gmol) Pa-1
908  *
909  * @param temperature Temperature in kelvin. Defaults to -1, in which
910  * case the temperature of the phase is assumed.
911  * @param pressure Pressure (Pa). Defaults to -1, in which
912  * case the pressure of the phase is assumed.
913  */
914  virtual double dA_DebyedP_TP(double temperature = -1.0,
915  double pressure = -1.0) const;
916 
917  //! Reports the ionic radius of the kth species
918  /*!
919  * @param k species index.
920  */
921  double AionicRadius(int k = 0) const;
922 
923  //! Returns the form of the Debye-Huckel parameterization used
924  int formDH() const {
925  return m_formDH;
926  }
927 
928  //! Returns a reference to M_Beta_ij
930  return m_Beta_ij;
931  }
932 
933 private:
934  //! Static function that implements the non-polar species salt-out
935  //! modifications.
936  /*!
937  * Returns the calculated activity coefficients.
938  *
939  * @param IionicMolality Value of the ionic molality (sqrt(gmol/kg))
940  */
941  static double _nonpolarActCoeff(double IionicMolality);
942 
943  //! Formula for the osmotic coefficient that occurs in the GWB.
944  /*!
945  * It is originally from Helgeson for a variable NaCl brine. It's to be
946  * used with extreme caution.
947  */
948  double _osmoticCoeffHelgesonFixedForm() const;
949 
950  //! Formula for the log of the water activity that occurs in the GWB.
951  /*!
952  * It is originally from Helgeson for a variable NaCl brine. It's to be
953  * used with extreme caution.
954  */
955  double _lnactivityWaterHelgesonFixedForm() const;
956  //@}
957 
958 protected:
959  //! form of the Debye-Huckel parameterization used in the model.
960  /*!
961  * The options are described at the top of this document,
962  * and in the general documentation.
963  * The list is repeated here:
964  *
965  * DHFORM_DILUTE_LIMIT = 0 (default)
966  * DHFORM_BDOT_AK = 1
967  * DHFORM_BDOT_AUNIFORM = 2
968  * DHFORM_BETAIJ = 3
969  * DHFORM_PITZER_BETAIJ = 4
970  */
971  int m_formDH;
972 
973  /**
974  * Format for the generalized concentration:
975  *
976  * 0 = unity
977  * 1 = molar_volume
978  * 2 = solvent_volume (default)
979  *
980  * The generalized concentrations can have three different forms
981  * depending on the value of the member attribute m_formGC, which
982  * is supplied in the constructor.
983  *
984  * | m_formGC | GeneralizedConc | StandardConc |
985  * | -------- | --------------- | ------------ |
986  * | 0 | X_k | 1.0 |
987  * | 1 | X_k / V_k | 1.0 / V_k |
988  * | 2 | X_k / V_N | 1.0 / V_N |
989  *
990  * The value and form of the generalized concentration will affect reaction
991  * rate constants involving species in this phase.
992  *
993  * (HKM Note: Using option #1 may lead to spurious results and has been
994  * included only with warnings. The reason is that it molar volumes of
995  * electrolytes may often be negative. The molar volume of H+ is defined to
996  * be zero too. Either options 0 or 2 are the appropriate choice. Option 0
997  * leads to bulk reaction rate constants which have units of s-1. Option 2
998  * leads to bulk reaction rate constants for bimolecular rxns which have
999  * units of m-3 kmol-1 s-1.)
1000  */
1002 
1003  //! Vector containing the electrolyte species type
1004  /*!
1005  * The possible types are:
1006  * - solvent
1007  * - Charged Species
1008  * - weakAcidAssociated
1009  * - strongAcidAssociated
1010  * - polarNeutral
1011  * - nonpolarNeutral
1012  * .
1013  */
1015 
1016  //! a_k = Size of the ionic species in the DH formulation. units = meters
1018 
1019  //! Current value of the ionic strength on the molality scale
1020  mutable double m_IionicMolality;
1021 
1022  //! Maximum value of the ionic strength allowed in the calculation of the
1023  //! activity coefficients.
1025 
1026 public:
1027  //! If true, then the fixed for of Helgeson's activity for water is used
1028  //! instead of the rigorous form obtained from Gibbs-Duhem relation. This
1029  //! should be used with caution, and is really only included as a validation
1030  //! exercise.
1032 protected:
1033  //! Stoichiometric ionic strength on the molality scale
1034  mutable double m_IionicMolalityStoich;
1035 
1036 public:
1037  /**
1038  * Form of the constant outside the Debye-Huckel term
1039  * called A. It's normally a function of temperature
1040  * and pressure. However, it can be set from the
1041  * input file in order to aid in numerical comparisons.
1042  * Acceptable forms:
1043  *
1044  * A_DEBYE_CONST 0
1045  * A_DEBYE_WATER 1
1046  *
1047  * The A_DEBYE_WATER form may be used for water solvents
1048  * with needs to cover varying temperatures and pressures.
1049  * Note, the dielectric constant of water is a relatively
1050  * strong function of T, and its variability must be
1051  * accounted for,
1052  */
1054 
1055 protected:
1056  //! Current value of the Debye Constant, A_Debye
1057  /**
1058  * A_Debye -> this expression appears on the top of the ln actCoeff term in
1059  * the general Debye-Huckel expression It depends on temperature
1060  * and pressure.
1061  *
1062  * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1063  *
1064  * Units = sqrt(kg/gmol)
1065  *
1066  * Nominal value(298K, atm) = 1.172576 sqrt(kg/gmol)
1067  * based on:
1068  * epsilon/epsilon_0 = 78.54
1069  * (water at 25C)
1070  * T = 298.15 K
1071  * B_Debye = 3.28640E9 sqrt(kg/gmol)/m
1072  *
1073  * note in Pitzer's nomenclature, A_phi = A_Debye/3.0
1074  */
1075  mutable double m_A_Debye;
1076 
1077  //! Current value of the constant that appears in the denominator
1078  /**
1079  * B_Debye -> this expression appears on the bottom of the ln actCoeff term
1080  * in the general Debye-Huckel expression It depends on
1081  * temperature
1082  *
1083  * B_Bebye = F / sqrt( epsilon R T / 2 )
1084  *
1085  * Units = sqrt(kg/gmol) / m
1086  *
1087  * Nominal value = 3.28640E9 sqrt(kg/gmol) / m
1088  * based on:
1089  * epsilon/epsilon_0 = 78.54
1090  * (water at 25C)
1091  * T = 298.15 K
1092  */
1093  double m_B_Debye;
1094 
1095  //! Array of B_Dot values
1096  /**
1097  * This expression is an extension of the Debye-Huckel expression used
1098  * in some formulations to extend DH to higher molalities. B_dot is
1099  * specific to the major ionic pair.
1100  */
1102 
1103  //! Pointer to the Water standard state object
1104  /*!
1105  * derived from the equation of state for water.
1106  */
1108 
1109  //! Storage for the density of water's standard state
1110  /*!
1111  * Density depends on temperature and pressure.
1112  */
1114 
1115  //! Pointer to the water property calculator
1116  std::unique_ptr<WaterProps> m_waterProps;
1117 
1118  //! vector of size m_kk, used as a temporary holding area.
1120 
1121  /**
1122  * Stoichiometric species charge -> This is for calculations
1123  * of the ionic strength which ignore ion-ion pairing into
1124  * neutral molecules. The Stoichiometric species charge is the
1125  * charge of one of the ion that would occur if the species broke
1126  * into two charged ion pairs.
1127  * NaCl -> m_speciesCharge_Stoich = -1;
1128  * HSO4- -> H+ + SO42- = -2
1129  * -> The other charge is calculated.
1130  * For species that aren't ion pairs, it's equal to the
1131  * m_speciesCharge[] value.
1132  */
1134 
1135  /**
1136  * Array of 2D data used in the DHFORM_BETAIJ formulation
1137  * Beta_ij.value(i,j) is the coefficient of the jth species
1138  * for the specification of the chemical potential of the ith
1139  * species.
1140  */
1142 
1143  //! Logarithm of the activity coefficients on the molality scale.
1144  /*!
1145  * mutable because we change this if the composition or temperature or
1146  * pressure changes.
1147  */
1149 
1150  //! Derivative of log act coeff wrt T
1152 
1153  //! 2nd Derivative of log act coeff wrt T
1155 
1156  //! Derivative of log act coeff wrt P
1158 
1159 private:
1160  //! Calculate the log activity coefficients
1161  /*!
1162  * This function updates the internally stored natural logarithm of the
1163  * molality activity coefficients. This is the main routine for
1164  * implementing the activity coefficient formulation.
1165  */
1166  void s_update_lnMolalityActCoeff() const;
1167 
1168  //! Calculation of temperature derivative of activity coefficient
1169  /*!
1170  * Using internally stored values, this function calculates the temperature
1171  * derivative of the logarithm of the activity coefficient for all species
1172  * in the mechanism.
1173  *
1174  * We assume that the activity coefficients are current in this routine. The
1175  * solvent activity coefficient is on the molality scale. Its derivative is
1176  * too.
1177  */
1178  void s_update_dlnMolalityActCoeff_dT() const;
1179 
1180  //! Calculate the temperature 2nd derivative of the activity coefficient
1181  /*!
1182  * Using internally stored values, this function calculates the temperature
1183  * 2nd derivative of the logarithm of the activity coefficient for all
1184  * species in the mechanism.
1185  *
1186  * We assume that the activity coefficients are current in this routine.
1187  * Solvent activity coefficient is on the molality scale. Its derivatives
1188  * are too.
1189  */
1190  void s_update_d2lnMolalityActCoeff_dT2() const;
1191 
1192  //! Calculate the pressure derivative of the activity coefficient
1193  /*!
1194  * Using internally stored values, this function calculates the pressure
1195  * derivative of the logarithm of the activity coefficient for all species
1196  * in the mechanism.
1197  *
1198  * We assume that the activity coefficients, molalities, and A_Debye are
1199  * current. Solvent activity coefficient is on the molality scale. Its
1200  * derivatives are too.
1201  */
1202  void s_update_dlnMolalityActCoeff_dP() const;
1203 };
1204 
1205 }
1206 
1207 #endif
double m_IionicMolalityStoich
Stoichiometric ionic strength on the molality scale.
Definition: DebyeHuckel.h:1034
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
Definition: DebyeHuckel.h:1053
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
static double _nonpolarActCoeff(double IionicMolality)
Static function that implements the non-polar species salt-out modifications.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
vector_fp m_dlnActCoeffMolaldT
Derivative of log act coeff wrt T.
Definition: DebyeHuckel.h:1151
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
Definition: DebyeHuckel.h:1116
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
bool m_useHelgesonFixedForm
If true, then the fixed for of Helgeson&#39;s activity for water is used instead of the rigorous form obt...
Definition: DebyeHuckel.h:1031
virtual double dA_DebyedP_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to pressure, as a function of tempe...
void s_update_lnMolalityActCoeff() const
Calculate the log activity coefficients.
int formDH() const
Returns the form of the Debye-Huckel parameterization used.
Definition: DebyeHuckel.h:924
double _osmoticCoeffHelgesonFixedForm() const
Formula for the osmotic coefficient that occurs in the GWB.
virtual void setDensity(const doublereal rho)
Set the internally stored density (gm/m^3) of the phase.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Definition: Array.h:31
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
DebyeHuckel()
Default Constructor.
Definition: DebyeHuckel.cpp:28
Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys the Debye Huckel formulati...
Definition: DebyeHuckel.h:563
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
Header file for class Cantera::Array2D.
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: DebyeHuckel.h:592
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:159
virtual int eosType() const
Equation of state type flag.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
virtual double dA_DebyedT_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the derivative of the Debye Huckel constant with respect to temperature. ...
Array2D m_Beta_ij
Array of 2D data used in the DHFORM_BETAIJ formulation Beta_ij.value(i,j) is the coefficient of the j...
Definition: DebyeHuckel.h:1141
vector_fp m_Aionic
a_k = Size of the ionic species in the DH formulation. units = meters
Definition: DebyeHuckel.h:1017
Class for the liquid water pressure dependent standard state.
Definition: PDSS_Water.h:49
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
Definition: DebyeHuckel.h:1024
int m_formDH
form of the Debye-Huckel parameterization used in the model.
Definition: DebyeHuckel.h:971
double m_A_Debye
Current value of the Debye Constant, A_Debye.
Definition: DebyeHuckel.h:1075
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
double AionicRadius(int k=0) const
Reports the ionic radius of the kth species.
vector_fp m_lnActCoeffMolal
Logarithm of the activity coefficients on the molality scale.
Definition: DebyeHuckel.h:1148
void s_update_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the activity coefficient.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
PDSS_Water * m_waterSS
Pointer to the Water standard state object.
Definition: DebyeHuckel.h:1107
vector_fp m_B_Dot
Array of B_Dot values.
Definition: DebyeHuckel.h:1101
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Array2D & get_Beta_ij()
Returns a reference to M_Beta_ij.
Definition: DebyeHuckel.h:929
void s_update_d2lnMolalityActCoeff_dT2() const
Calculate the temperature 2nd derivative of the activity coefficient.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
int m_formGC
Format for the generalized concentration:
Definition: DebyeHuckel.h:1001
virtual double A_Debye_TP(double temperature=-1.0, double pressure=-1.0) const
Return the Debye Huckel constant as a function of temperature and pressure (Units = sqrt(kg/gmol)) ...
void s_update_dlnMolalityActCoeff_dT() const
Calculation of temperature derivative of activity coefficient.
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
virtual doublereal pressure() const
Returns the current pressure of the phase.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
vector_int m_electrolyteSpeciesType
Vector containing the electrolyte species type.
Definition: DebyeHuckel.h:1014
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
vector_fp m_speciesCharge_Stoich
Stoichiometric species charge -> This is for calculations of the ionic strength which ignore ion-ion ...
Definition: DebyeHuckel.h:1133
double m_IionicMolality
Current value of the ionic strength on the molality scale.
Definition: DebyeHuckel.h:1020
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
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
vector_fp m_d2lnActCoeffMolaldT2
2nd Derivative of log act coeff wrt T
Definition: DebyeHuckel.h:1154
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
Definition: DebyeHuckel.h:1119
double m_B_Debye
Current value of the constant that appears in the denominator.
Definition: DebyeHuckel.h:1093
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual double d2A_DebyedT2_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the 2nd derivative of the Debye Huckel constant with respect to temperature as a function of...
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
vector_fp m_dlnActCoeffMolaldP
Derivative of log act coeff wrt P.
Definition: DebyeHuckel.h:1157
Namespace for the Cantera kernel.
Definition: application.cpp:29
double _lnactivityWaterHelgesonFixedForm() const
Formula for the log of the water activity that occurs in the GWB.
virtual bool addSpecies(shared_ptr< Species > spec)
double m_densWaterSS
Storage for the density of water&#39;s standard state.
Definition: DebyeHuckel.h:1113
virtual void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) of the phase.