Cantera  2.5.1
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 https://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 definition 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  * @deprecated The XML input format is deprecated and will be removed in
579  * Cantera 3.0.
580  */
581  DebyeHuckel(XML_Node& phaseRef, const std::string& id = "");
582 
583  //! @name Utilities
584  //! @{
585 
586  virtual std::string type() const {
587  return "DebyeHuckel";
588  }
589 
590  //! @}
591  //! @name Molar Thermodynamic Properties of the Solution
592  //! @{
593 
594  virtual doublereal enthalpy_mole() const;
595 
596  /// Molar entropy. Units: J/kmol/K.
597  /**
598  * For an ideal, constant partial molar volume solution mixture with
599  * pure species phases which exhibit zero volume expansivity:
600  * \f[
601  * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T)
602  * - \hat R \sum_k X_k log(X_k)
603  * \f]
604  * The reference-state pure-species entropies
605  * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the
606  * species thermodynamic
607  * property manager. The pure species entropies are independent of
608  * temperature since the volume expansivities are equal to zero.
609  * @see MultiSpeciesThermo
610  */
611  virtual doublereal entropy_mole() const;
612 
613  virtual doublereal gibbs_mole() const;
614  virtual doublereal cp_mole() const;
615 
616  //@}
617  /** @name Mechanical Equation of State Properties
618  //@{
619  * In this equation of state implementation, the density is a function only
620  * of the mole fractions. Therefore, it can't be an independent variable.
621  * Instead, the pressure is used as the independent variable. Functions
622  * which try to set the thermodynamic state by calling setDensity() will
623  * cause an exception to be thrown.
624  */
625 
626 protected:
627  virtual void calcDensity();
628 
629 public:
630  //! Set the internally stored density (gm/m^3) of the phase.
631  /*!
632  * Overridden setDensity() function is necessary because the density is not
633  * an independent variable.
634  *
635  * This function will now throw an error condition
636  *
637  * @internal May have to adjust the strategy here to make the eos for these
638  * materials slightly compressible, in order to create a condition where
639  * the density is a function of the pressure.
640  *
641  * This function will now throw an error condition if the input isn't
642  * exactly equal to the current density.
643  *
644  * @todo Now have a compressible ss equation for liquid water. Therefore,
645  * this phase is compressible. May still want to change the
646  * independent variable however.
647  *
648  * @param rho Input density (kg/m^3).
649  * @deprecated Functionality merged with base function after Cantera 2.5.
650  * (superseded by isCompressible check in Phase::setDensity)
651  */
652  virtual void setDensity(const doublereal rho);
653 
654  //! Set the internally stored molar density (kmol/m^3) of the phase.
655  /**
656  * Overridden setMolarDensity() function is necessary because the density
657  * is not an independent variable.
658  *
659  * This function will now throw an error condition if the input isn't
660  * exactly equal to the current molar density.
661  *
662  * @param conc Input molar density (kmol/m^3).
663  * @deprecated Functionality merged with base function after Cantera 2.5.
664  * (superseded by isCompressible check in Phase::setDensity)
665  */
666  virtual void setMolarDensity(const doublereal conc);
667 
668  /**
669  * @}
670  * @name Activities, Standard States, and Activity Concentrations
671  *
672  * The activity \f$a_k\f$ of a species in solution is related to the
673  * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
674  * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
675  * which depends only on temperature and the pressure. Activity is assumed
676  * to be molality-based here.
677  * @{
678  */
679 
680  virtual void getActivityConcentrations(doublereal* c) const;
681 
682  //! Return the standard concentration for the kth species
683  /*!
684  * The standard concentration \f$ C^0_k \f$ used to normalize the activity
685  * (i.e., generalized) concentration in kinetics calculations.
686  *
687  * For the time being, we will use the concentration of pure solvent for the
688  * the standard concentration of all species. This has the effect of making
689  * reaction rates based on the molality of species proportional to the
690  * molality of the species.
691  *
692  * @param k Optional parameter indicating the species. The default is to
693  * assume this refers to species 0.
694  * @return the standard Concentration in units of m^3/kmol
695  */
696  virtual doublereal standardConcentration(size_t k=0) const;
697 
698  //! Get the array of non-dimensional activities at the current solution
699  //! temperature, pressure, and solution concentration.
700  /*!
701  * (note solvent activity coefficient is on molar scale).
702  *
703  * @param ac Output vector of activities. Length: m_kk.
704  */
705  virtual void getActivities(doublereal* ac) const;
706 
707  //! Get the array of non-dimensional molality-based activity coefficients at
708  //! the current solution temperature, pressure, and solution concentration.
709  /*!
710  * note solvent is on molar scale. The solvent molar based activity
711  * coefficient is returned.
712  *
713  * Note, most of the work is done in an internal private routine
714  *
715  * @param acMolality Vector of Molality-based activity coefficients
716  * Length: m_kk
717  */
718  virtual void getMolalityActivityCoefficients(doublereal* acMolality) const;
719 
720  //@}
721  /// @name Partial Molar Properties of the Solution
722  //@{
723 
724  //! Get the species chemical potentials. Units: J/kmol.
725  /*!
726  *
727  * This function returns a vector of chemical potentials of the species in
728  * solution.
729  *
730  * \f[
731  * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k)
732  * \f]
733  *
734  * @param mu Output vector of species chemical
735  * potentials. Length: m_kk. Units: J/kmol
736  */
737  virtual void getChemPotentials(doublereal* mu) const;
738 
739  //! Returns an array of partial molar enthalpies for the species
740  //! in the mixture. Units (J/kmol)
741  /*!
742  * For this phase, the partial molar enthalpies are equal to the
743  * standard state enthalpies modified by the derivative of the
744  * molality-based activity coefficient wrt temperature
745  *
746  * \f[
747  * \bar h_k(T,P) = h^{\triangle}_k(T,P) - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT}
748  * \f]
749  * The solvent partial molar enthalpy is equal to
750  * \f[
751  * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o}{dT}
752  * \f]
753  *
754  * The temperature dependence of the activity coefficients currently
755  * only occurs through the temperature dependence of the Debye constant.
756  *
757  * @param hbar Output vector of species partial molar enthalpies.
758  * Length: m_kk. units are J/kmol.
759  */
760  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
761 
762  //! Returns an array of partial molar entropies of the species in the
763  //! solution. Units: J/kmol/K.
764  /**
765  * Maxwell's equations provide an insight in how to calculate this
766  * (p.215 Smith and Van Ness)
767  * \f[
768  * \frac{d\mu_i}{dT} = -\bar{s}_i
769  * \f]
770  *
771  * For this phase, the partial molar entropies are equal to the SS species
772  * entropies plus the ideal solution contribution:
773  * \f[
774  * \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k])
775  * \f]
776  * \f[
777  * \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T)
778  * - R ((xmolSolvent - 1.0) / xmolSolvent)
779  * \f]
780  *
781  * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, at the
782  * reference pressure, \f$ P_{ref} \f$, are computed by the species
783  * thermodynamic property manager. They are polynomial functions of
784  * temperature.
785  * @see MultiSpeciesThermo
786  *
787  * @param sbar Output vector of species partial molar entropies.
788  * Length = m_kk. units are J/kmol/K.
789  */
790  virtual void getPartialMolarEntropies(doublereal* sbar) const;
791 
792  virtual void getPartialMolarCp(doublereal* cpbar) const;
793 
794  //! Return an array of partial molar volumes for the species in the mixture.
795  //! Units: m^3/kmol.
796  /*!
797  * For this solution, the partial molar volumes are normally equal to the
798  * constant species molar volumes, except when the activity coefficients
799  * depend on pressure.
800  *
801  * The general relation is
802  *
803  * vbar_i = d(chemPot_i)/dP at const T, n
804  * = V0_i + d(Gex)/dP)_T,M
805  * = V0_i + RT d(lnActCoeffi)dP _T,M
806  *
807  * @param vbar Output vector of species partial molar volumes.
808  * Length = m_kk. units are m^3/kmol.
809  */
810  virtual void getPartialMolarVolumes(doublereal* vbar) const;
811 
812  //@}
813 
814  /*
815  * -------------- Utilities -------------------------------
816  */
817 
818  virtual bool addSpecies(shared_ptr<Species> spec);
819  virtual void initThermo();
820  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
821 
822  //! Return the Debye Huckel constant as a function of temperature
823  //! and pressure (Units = sqrt(kg/gmol))
824  /*!
825  * The default is to assume that it is constant, given in the
826  * initialization process, and stored in the member double, m_A_Debye.
827  * Optionally, a full water treatment may be employed that makes
828  * \f$ A_{Debye} \f$ a full function of T and P.
829  *
830  * \f[
831  * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2}
832  * \f]
833  * where
834  * \f[
835  * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}}
836  * \f]
837  * Therefore:
838  * \f[
839  * A_{Debye} = \frac{1}{8 \pi}
840  * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2}
841  * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
842  * \f]
843  *
844  * where
845  * - Units = sqrt(kg/gmol)
846  * - \f$ N_a \f$ is Avogadro's number
847  * - \f$ \rho_w \f$ is the density of water
848  * - \f$ e \f$ is the electronic charge
849  * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
850  * - \f$ K \f$ is the dielectric constant of water,
851  * - \f$ \epsilon_o \f$ is the permittivity of free space.
852  * - \f$ \rho_o \f$ is the density of the solvent in its standard state.
853  *
854  * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)^(1/2)
855  * based on:
856  * - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
857  * - T = 298.15 K
858  * - B_Debye = 3.28640E9 (kg/gmol)^(1/2)/m
859  *
860  * @param temperature Temperature in kelvin. Defaults to -1, in which
861  * case the temperature of the phase is assumed.
862  * @param pressure Pressure (Pa). Defaults to -1, in which
863  * case the pressure of the phase is assumed.
864  */
865  virtual double A_Debye_TP(double temperature = -1.0,
866  double pressure = -1.0) const;
867 
868  //! Value of the derivative of the Debye Huckel constant with
869  //! respect to temperature.
870  /*!
871  * This is a function of temperature and pressure. See A_Debye_TP() for
872  * a definition of \f$ A_{Debye} \f$.
873  *
874  * Units = sqrt(kg/gmol) K-1
875  *
876  * @param temperature Temperature in kelvin. Defaults to -1, in which
877  * case the temperature of the phase is assumed.
878  * @param pressure Pressure (Pa). Defaults to -1, in which
879  * case the pressure of the phase is assumed.
880  */
881  virtual double dA_DebyedT_TP(double temperature = -1.0,
882  double pressure = -1.0) const;
883 
884  //! Value of the 2nd derivative of the Debye Huckel constant with
885  //! respect to temperature as a function of temperature and pressure.
886  /*!
887  * This is a function of temperature and pressure. See A_Debye_TP() for
888  * a definition of \f$ A_{Debye} \f$.
889  *
890  * Units = sqrt(kg/gmol) K-2
891  *
892  * @param temperature Temperature in kelvin. Defaults to -1, in which
893  * case the temperature of the phase is assumed.
894  * @param pressure Pressure (Pa). Defaults to -1, in which
895  * case the pressure of the phase is assumed.
896  */
897  virtual double d2A_DebyedT2_TP(double temperature = -1.0,
898  double pressure = -1.0) const;
899 
900  //! Value of the derivative of the Debye Huckel constant with
901  //! respect to pressure, as a function of temperature and pressure.
902  /*!
903  * This is a function of temperature and pressure. See A_Debye_TP() for
904  * a definition of \f$ A_{Debye} \f$.
905  *
906  * Units = sqrt(kg/gmol) Pa-1
907  *
908  * @param temperature Temperature in kelvin. Defaults to -1, in which
909  * case the temperature of the phase is assumed.
910  * @param pressure Pressure (Pa). Defaults to -1, in which
911  * case the pressure of the phase is assumed.
912  */
913  virtual double dA_DebyedP_TP(double temperature = -1.0,
914  double pressure = -1.0) const;
915 
916  //! Reports the ionic radius of the kth species
917  /*!
918  * @param k species index.
919  */
920  double AionicRadius(int k = 0) const;
921 
922  //! Set the DebyeHuckel parameterization form. Must be one of
923  //! 'dilute-limit', 'B-dot-with-variable-a', 'B-dot-with-common-a',
924  //! 'beta_ij', or 'Pitzer-with-beta_ij'.
925  void setDebyeHuckelModel(const std::string& form);
926 
927  //! Returns the form of the Debye-Huckel parameterization used
928  int formDH() const {
929  return m_formDH;
930  }
931 
932  //! Set the A_Debye parameter. If a negative value is provided, enables
933  //! calculation of A_Debye using the detailed water equation of state.
934  void setA_Debye(double A);
935 
936  void setB_Debye(double B) { m_B_Debye = B; }
937  void setB_dot(double bdot);
938  void setMaxIonicStrength(double Imax) { m_maxIionicStrength = Imax; }
939  void useHelgesonFixedForm(bool mode=true) { m_useHelgesonFixedForm = mode; }
940 
941  //! Set the default ionic radius [m] for each species
942  void setDefaultIonicRadius(double value);
943 
944  //! Set the value for the beta interaction between species sp1 and sp2.
945  void setBeta(const std::string& sp1, const std::string& sp2, double value);
946 
947  //! Returns a reference to M_Beta_ij
949  return m_Beta_ij;
950  }
951 
952 private:
953  //! Static function that implements the non-polar species salt-out
954  //! modifications.
955  /*!
956  * Returns the calculated activity coefficients.
957  *
958  * @param IionicMolality Value of the ionic molality (sqrt(gmol/kg))
959  */
960  static double _nonpolarActCoeff(double IionicMolality);
961 
962  //! Formula for the osmotic coefficient 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 _osmoticCoeffHelgesonFixedForm() const;
968 
969  //! Formula for the log of the water activity that occurs in the GWB.
970  /*!
971  * It is originally from Helgeson for a variable NaCl brine. It's to be
972  * used with extreme caution.
973  */
974  double _lnactivityWaterHelgesonFixedForm() const;
975  //@}
976 
977 protected:
978  //! form of the Debye-Huckel parameterization used in the model.
979  /*!
980  * The options are described at the top of this document,
981  * and in the general documentation.
982  * The list is repeated here:
983  *
984  * DHFORM_DILUTE_LIMIT = 0 (default)
985  * DHFORM_BDOT_AK = 1
986  * DHFORM_BDOT_AUNIFORM = 2
987  * DHFORM_BETAIJ = 3
988  * DHFORM_PITZER_BETAIJ = 4
989  */
990  int m_formDH;
991 
992  //! Vector containing the electrolyte species type
993  /*!
994  * The possible types are:
995  * - solvent
996  * - Charged Species
997  * - weakAcidAssociated
998  * - strongAcidAssociated
999  * - polarNeutral
1000  * - nonpolarNeutral
1001  * .
1002  */
1004 
1005  //! a_k = Size of the ionic species in the DH formulation. units = meters
1007 
1008  //! Current value of the ionic strength on the molality scale
1009  mutable double m_IionicMolality;
1010 
1011  //! Maximum value of the ionic strength allowed in the calculation of the
1012  //! activity coefficients.
1014 
1015 public:
1016  //! If true, then the fixed for of Helgeson's activity for water is used
1017  //! instead of the rigorous form obtained from Gibbs-Duhem relation. This
1018  //! should be used with caution, and is really only included as a validation
1019  //! exercise.
1021 protected:
1022  //! Stoichiometric ionic strength on the molality scale
1023  mutable double m_IionicMolalityStoich;
1024 
1025 public:
1026  /**
1027  * Form of the constant outside the Debye-Huckel term
1028  * called A. It's normally a function of temperature
1029  * and pressure. However, it can be set from the
1030  * input file in order to aid in numerical comparisons.
1031  * Acceptable forms:
1032  *
1033  * A_DEBYE_CONST 0
1034  * A_DEBYE_WATER 1
1035  *
1036  * The A_DEBYE_WATER form may be used for water solvents
1037  * with needs to cover varying temperatures and pressures.
1038  * Note, the dielectric constant of water is a relatively
1039  * strong function of T, and its variability must be
1040  * accounted for,
1041  */
1043 
1044 protected:
1045  //! Current value of the Debye Constant, A_Debye
1046  /**
1047  * A_Debye -> this expression appears on the top of the ln actCoeff term in
1048  * the general Debye-Huckel expression It depends on temperature
1049  * and pressure.
1050  *
1051  * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1052  *
1053  * Units = sqrt(kg/gmol)
1054  *
1055  * Nominal value(298K, atm) = 1.172576 sqrt(kg/gmol)
1056  * based on:
1057  * epsilon/epsilon_0 = 78.54
1058  * (water at 25C)
1059  * T = 298.15 K
1060  * B_Debye = 3.28640E9 sqrt(kg/gmol)/m
1061  *
1062  * note in Pitzer's nomenclature, A_phi = A_Debye/3.0
1063  */
1064  mutable double m_A_Debye;
1065 
1066  //! Current value of the constant that appears in the denominator
1067  /**
1068  * B_Debye -> this expression appears on the bottom of the ln actCoeff term
1069  * in the general Debye-Huckel expression It depends on
1070  * temperature
1071  *
1072  * B_Bebye = F / sqrt( epsilon R T / 2 )
1073  *
1074  * Units = sqrt(kg/gmol) / m
1075  *
1076  * Nominal value = 3.28640E9 sqrt(kg/gmol) / m
1077  * based on:
1078  * epsilon/epsilon_0 = 78.54
1079  * (water at 25C)
1080  * T = 298.15 K
1081  */
1082  double m_B_Debye;
1083 
1084  //! Array of B_Dot values
1085  /**
1086  * This expression is an extension of the Debye-Huckel expression used
1087  * in some formulations to extend DH to higher molalities. B_dot is
1088  * specific to the major ionic pair.
1089  */
1091 
1092  //! Pointer to the Water standard state object
1093  /*!
1094  * derived from the equation of state for water.
1095  */
1097 
1098  //! Storage for the density of water's standard state
1099  /*!
1100  * Density depends on temperature and pressure.
1101  */
1103 
1104  //! Pointer to the water property calculator
1105  std::unique_ptr<WaterProps> m_waterProps;
1106 
1107  //! vector of size m_kk, used as a temporary holding area.
1109 
1110  /**
1111  * Stoichiometric species charge -> This is for calculations
1112  * of the ionic strength which ignore ion-ion pairing into
1113  * neutral molecules. The Stoichiometric species charge is the
1114  * charge of one of the ion that would occur if the species broke
1115  * into two charged ion pairs.
1116  * NaCl -> m_speciesCharge_Stoich = -1;
1117  * HSO4- -> H+ + SO42- = -2
1118  * -> The other charge is calculated.
1119  * For species that aren't ion pairs, it's equal to the
1120  * m_speciesCharge[] value.
1121  */
1123 
1124  /**
1125  * Array of 2D data used in the DHFORM_BETAIJ formulation
1126  * Beta_ij.value(i,j) is the coefficient of the jth species
1127  * for the specification of the chemical potential of the ith
1128  * species.
1129  */
1131 
1132  //! Logarithm of the activity coefficients on the molality scale.
1133  /*!
1134  * mutable because we change this if the composition or temperature or
1135  * pressure changes.
1136  */
1138 
1139  //! Derivative of log act coeff wrt T
1141 
1142  //! 2nd Derivative of log act coeff wrt T
1144 
1145  //! Derivative of log act coeff wrt P
1147 
1148 private:
1149  //! Calculate the log activity coefficients
1150  /*!
1151  * This function updates the internally stored natural logarithm of the
1152  * molality activity coefficients. This is the main routine for
1153  * implementing the activity coefficient formulation.
1154  */
1155  void s_update_lnMolalityActCoeff() const;
1156 
1157  //! Calculation of temperature derivative of activity coefficient
1158  /*!
1159  * Using internally stored values, this function calculates the temperature
1160  * derivative of the logarithm of the activity coefficient for all species
1161  * in the mechanism.
1162  *
1163  * We assume that the activity coefficients are current in this routine. The
1164  * solvent activity coefficient is on the molality scale. Its derivative is
1165  * too.
1166  */
1167  void s_update_dlnMolalityActCoeff_dT() const;
1168 
1169  //! Calculate the temperature 2nd derivative of the activity coefficient
1170  /*!
1171  * Using internally stored values, this function calculates the temperature
1172  * 2nd derivative of the logarithm of the activity coefficient for all
1173  * species in the mechanism.
1174  *
1175  * We assume that the activity coefficients are current in this routine.
1176  * Solvent activity coefficient is on the molality scale. Its derivatives
1177  * are too.
1178  */
1179  void s_update_d2lnMolalityActCoeff_dT2() const;
1180 
1181  //! Calculate the pressure derivative of the activity coefficient
1182  /*!
1183  * Using internally stored values, this function calculates the pressure
1184  * derivative of the logarithm of the activity coefficient for all species
1185  * in the mechanism.
1186  *
1187  * We assume that the activity coefficients, molalities, and A_Debye are
1188  * current. Solvent activity coefficient is on the molality scale. Its
1189  * derivatives are too.
1190  */
1191  void s_update_dlnMolalityActCoeff_dP() const;
1192 };
1193 
1194 }
1195 
1196 #endif
Header file for class Cantera::Array2D.
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Definition: Array.h:32
Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys the Debye Huckel formulati...
Definition: DebyeHuckel.h:559
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:1130
int m_formDH
form of the Debye-Huckel parameterization used in the model.
Definition: DebyeHuckel.h:990
double m_A_Debye
Current value of the Debye Constant, A_Debye.
Definition: DebyeHuckel.h:1064
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...
vector_fp m_d2lnActCoeffMolaldT2
2nd Derivative of log act coeff wrt T
Definition: DebyeHuckel.h:1143
double m_IionicMolality
Current value of the ionic strength on the molality scale.
Definition: DebyeHuckel.h:1009
double _osmoticCoeffHelgesonFixedForm() const
Formula for the osmotic coefficient that occurs in the GWB.
double m_densWaterSS
Storage for the density of water's standard state.
Definition: DebyeHuckel.h:1102
DebyeHuckel()
Default Constructor.
Definition: DebyeHuckel.cpp:29
void s_update_d2lnMolalityActCoeff_dT2() const
Calculate the temperature 2nd derivative of the activity coefficient.
vector_fp m_speciesCharge_Stoich
Stoichiometric species charge -> This is for calculations of the ionic strength which ignore ion-ion ...
Definition: DebyeHuckel.h:1122
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
Definition: DebyeHuckel.h:1042
bool m_useHelgesonFixedForm
If true, then the fixed for of Helgeson's activity for water is used instead of the rigorous form obt...
Definition: DebyeHuckel.h:1020
static double _nonpolarActCoeff(double IionicMolality)
Static function that implements the non-polar species salt-out modifications.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: DebyeHuckel.cpp:98
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of non-dimensional molality-based activity coefficients at the current solution tempera...
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Array2D & get_Beta_ij()
Returns a reference to M_Beta_ij.
Definition: DebyeHuckel.h:948
int formDH() const
Returns the form of the Debye-Huckel parameterization used.
Definition: DebyeHuckel.h:928
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
double m_B_Debye
Current value of the constant that appears in the denominator.
Definition: DebyeHuckel.h:1082
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: DebyeHuckel.cpp:80
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
double AionicRadius(int k=0) const
Reports the ionic radius of the kth species.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
void s_update_dlnMolalityActCoeff_dT() const
Calculation of temperature derivative of activity coefficient.
void s_update_lnMolalityActCoeff() const
Calculate the log activity coefficients.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
void setBeta(const std::string &sp1, const std::string &sp2, double value)
Set the value for the beta interaction between species sp1 and sp2.
vector_fp m_dlnActCoeffMolaldP
Derivative of log act coeff wrt P.
Definition: DebyeHuckel.h:1146
virtual void setMolarDensity(const doublereal conc)
Set the internally stored molar density (kmol/m^3) of the phase.
void setDebyeHuckelModel(const std::string &form)
Set the DebyeHuckel parameterization form.
void setA_Debye(double A)
Set the A_Debye parameter.
vector_fp m_dlnActCoeffMolaldT
Derivative of log act coeff wrt T.
Definition: DebyeHuckel.h:1140
virtual void setDensity(const doublereal rho)
Set the internally stored density (gm/m^3) of the phase.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: DebyeHuckel.cpp:86
vector_int m_electrolyteSpeciesType
Vector containing the electrolyte species type.
Definition: DebyeHuckel.h:1003
virtual void initThermo()
vector_fp m_B_Dot
Array of B_Dot values.
Definition: DebyeHuckel.h:1090
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: DebyeHuckel.h:586
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
Definition: DebyeHuckel.h:1013
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: DebyeHuckel.cpp:92
double _lnactivityWaterHelgesonFixedForm() const
Formula for the log of the water activity that occurs in the GWB.
vector_fp m_Aionic
a_k = Size of the ionic species in the DH formulation. units = meters
Definition: DebyeHuckel.h:1006
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.
void setDefaultIonicRadius(double value)
Set the default ionic radius [m] for each species.
void s_update_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the activity coefficient.
PDSS_Water * m_waterSS
Pointer to the Water standard state object.
Definition: DebyeHuckel.h:1096
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
double m_IionicMolalityStoich
Stoichiometric ionic strength on the molality scale.
Definition: DebyeHuckel.h:1023
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
Definition: DebyeHuckel.h:1105
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
Definition: DebyeHuckel.h:1108
vector_fp m_lnActCoeffMolal
Logarithm of the activity coefficients on the molality scale.
Definition: DebyeHuckel.h:1137
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))
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...
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Class for the liquid water pressure dependent standard state.
Definition: PDSS_Water.h:50
doublereal temperature() const
Temperature (K).
Definition: Phase.h:667
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
Definition: Phase.cpp:833
virtual doublereal pressure() const
Returns the current pressure of the phase.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:104
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:182
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:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264