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