Cantera 2.6.0

HMWSoln.h
Go to the documentation of this file.
1/**
2 * @file HMWSoln.h
3 * Headers for the HMWSoln ThermoPhase object, which models concentrated
4 * electrolyte solutions
5 * (see \ref thermoprops and \link Cantera::HMWSoln HMWSoln \endlink) .
6 *
7 * Class HMWSoln represents a concentrated liquid electrolyte phase which
8 * obeys the Pitzer formulation for nonideality using molality-based
9 * standard states.
10 */
11
12// This file is part of Cantera. See License.txt in the top-level directory or
13// at https://cantera.org/license.txt for license and copyright information.
14
15#ifndef CT_HMWSOLN_H
16#define CT_HMWSOLN_H
17
18#include "MolalityVPSSTP.h"
19#include "cantera/base/Array.h"
20
21 namespace Cantera
22{
23
24/*!
25 * @name Temperature Dependence of the Pitzer Coefficients
26 *
27 * Note, the temperature dependence of the Gibbs free energy also depends on the
28 * temperature dependence of the standard state and the temperature dependence
29 * of the Debye-Huckel constant, which includes the dielectric constant and the
30 * density. Therefore, this expression defines only part of the temperature
31 * dependence for the mixture thermodynamic functions.
32 *
33 * PITZER_TEMP_CONSTANT
34 * All coefficients are considered constant wrt temperature
35 * PITZER_TEMP_LINEAR
36 * All coefficients are assumed to have a linear dependence
37 * wrt to temperature.
38 * PITZER_TEMP_COMPLEX1
39 * All coefficients are assumed to have a complex functional
40 * based dependence wrt temperature; See:
41 * (Silvester, Pitzer, J. Phys. Chem. 81, 19 1822 (1977)).
42 *
43 * beta0 = q0 + q3(1/T - 1/Tr) + q4(ln(T/Tr)) +
44 * q1(T - Tr) + q2(T**2 - Tr**2)
45 */
46//! @{
47#define PITZER_TEMP_CONSTANT 0
48#define PITZER_TEMP_LINEAR 1
49#define PITZER_TEMP_COMPLEX1 2
50//! @}
51
52/*!
53 * @name ways to calculate the value of A_Debye
54 *
55 * These defines determine the way A_Debye is calculated
56 */
57//! @{
58#define A_DEBYE_CONST 0
59#define A_DEBYE_WATER 1
60//! @}
61
62 class WaterProps;
63
64/**
65 * Class HMWSoln represents a dilute or concentrated liquid electrolyte
66 * phase which obeys the Pitzer formulation for nonideality.
67 *
68 * As a prerequisite to the specification of thermodynamic quantities,
69 * The concentrations of the ionic species are assumed to obey the
70 * electroneutrality condition.
71 *
72 * ## Specification of Species Standard State Properties
73 *
74 * The solvent is assumed to be liquid water. A real model for liquid water
75 * (IAPWS 1995 formulation) is used as its standard state. All standard state
76 * properties for the solvent are based on this real model for water, and
77 * involve function calls to the object that handles the real water model,
78 * #Cantera::WaterPropsIAPWS.
79 *
80 * The standard states for solutes are on the unit molality basis. Therefore, in
81 * the documentation below, the normal \f$ o \f$ superscript is replaced with
82 * the \f$ \triangle \f$ symbol. The reference state symbol is now
83 * \f$ \triangle, ref \f$.
84 *
85 * It is assumed that the reference state thermodynamics may be obtained by a
86 * pointer to a populated species thermodynamic property manager class (see
87 * ThermoPhase::m_spthermo). How to relate pressure changes to the reference
88 * state thermodynamics is resolved at this level.
89 *
90 * For solutes that rely on ThermoPhase::m_spthermo, are assumed to have an
91 * incompressible standard state mechanical property. In other words, the molar
92 * volumes are independent of temperature and pressure.
93 *
94 * For these incompressible, standard states, the molar internal energy is
95 * independent of pressure. Since the thermodynamic properties are specified by
96 * giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted
97 * from the specified molar enthalpy to compute the molar internal energy. The
98 * entropy is assumed to be independent of the pressure.
99 *
100 * The enthalpy function is given by the following relation.
101 *
102 * \f[
103 * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T)
104 * + \tilde{v}_k \left( P - P_{ref} \right)
105 * \f]
106 *
107 * For an incompressible, stoichiometric substance, the molar internal energy is
108 * independent of pressure. Since the thermodynamic properties are specified by
109 * giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is
110 * subtracted from the specified reference molar enthalpy to compute the molar
111 * internal energy.
112 *
113 * \f[
114 * u^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - P_{ref} \tilde{v}_k
115 * \f]
116 *
117 * The solute standard state heat capacity and entropy are independent of
118 * pressure. The solute standard state Gibbs free energy is obtained from the
119 * enthalpy and entropy functions.
120 *
121 * The current model assumes that an incompressible molar volume for all
122 * solutes. The molar volume for the water solvent, however, is obtained from a
123 * pure water equation of state, waterSS. Therefore, the water standard state
124 * varies with both T and P. It is an error to request standard state water
125 * properties at a T and P where the water phase is not a stable phase, that is,
126 * beyond its spinodal curve.
127 *
128 * ## Specification of Solution Thermodynamic Properties
129 *
130 * Chemical potentials of the solutes, \f$ \mu_k \f$, and the solvent, \f$ \mu_o
131 * \f$, which are based on the molality form, have the following general format:
132 *
133 * \f[
134 * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle})
135 * \f]
136 * \f[
137 * \mu_o = \mu^o_o(T,P) + RT ln(a_o)
138 * \f]
139 *
140 * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient
141 * for species \f$k\f$.
142 *
143 * Individual activity coefficients of ions can not be independently measured.
144 * Instead, only binary pairs forming electroneutral solutions can be measured.
145 * This problem leads to a redundancy in the evaluation of species standard
146 * state properties. The redundancy issue is resolved by setting the standard
147 * state chemical potential enthalpy, entropy, and volume for the hydrogen ion,
148 * H+, to zero, for every temperature and pressure. After this convention is
149 * applied, all other standard state properties of ionic species contain
150 * meaningful information.
151 *
152 * ### Ionic Strength
153 *
154 * Most of the parameterizations within the model use the ionic strength as a
155 * key variable. The ionic strength, \f$ I\f$ is defined as follows
156 *
157 * \f[
158 * I = \frac{1}{2} \sum_k{m_k z_k^2}
159 * \f]
160 *
161 * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge of
162 * the kth species. Note, the ionic strength is a defined units quantity. The
163 * molality has defined units of gmol kg-1, and therefore the ionic strength has
164 * units of sqrt(gmol/kg).
165 *
166 * ### Specification of the Excess Gibbs Free Energy
167 *
168 * Pitzer's formulation may best be represented as a specification of the excess
169 * Gibbs free energy, \f$ G^{ex} \f$, defined as the deviation of the total
170 * Gibbs free energy from that of an ideal molal solution.
171 * \f[
172 * G = G^{id} + G^{ex}
173 * \f]
174 *
175 * The ideal molal solution contribution, not equal to an ideal solution
176 * contribution and in fact containing a singularity at the zero solvent mole
177 * fraction limit, is given below.
178 * \f[
179 * G^{id} = n_o \mu^o_o + \sum_{k\ne o} n_k \mu_k^{\triangle}
180 * + \tilde{M}_o n_o ( RT (\sum{m_i(\ln(m_i)-1)}))
181 * \f]
182 *
183 * From the excess Gibbs free energy formulation, the activity coefficient
184 * expression and the osmotic coefficient expression for the solvent may be
185 * defined, by taking the appropriate derivatives. Using this approach
186 * guarantees that the entire system will obey the Gibbs-Duhem relations.
187 *
188 * Pitzer employs the following general expression for the excess Gibbs free
189 * energy
190 *
191 * \f[
192 * \begin{array}{cclc}
193 * \frac{G^{ex}}{\tilde{M}_o n_o RT} &= &
194 * \left( \frac{4A_{Debye}I}{3b} \right) \ln(1 + b \sqrt{I})
195 * + 2 \sum_c \sum_a m_c m_a B_{ca}
196 * + \sum_c \sum_a m_c m_a Z C_{ca}
197 * \\&&
198 * + \sum_{c < c'} \sum m_c m_{c'} \left[ 2 \Phi_{c{c'}} + \sum_a m_a \Psi_{c{c'}a} \right]
199 * + \sum_{a < a'} \sum m_a m_{a'} \left[ 2 \Phi_{a{a'}} + \sum_c m_c \Psi_{a{a'}c} \right]
200 * \\&&
201 * + 2 \sum_n \sum_c m_n m_c \lambda_{nc} + 2 \sum_n \sum_a m_n m_a \lambda_{na}
202 * + 2 \sum_{n < n'} \sum m_n m_{n'} \lambda_{n{n'}}
203 * + \sum_n m^2_n \lambda_{nn}
204 * \end{array}
205 * \f]
206 *
207 * *a* is a subscript over all anions, *c* is a subscript extending over all
208 * cations, and *i* is a subscript that extends over all anions and cations.
209 * *n* is a subscript that extends only over neutral solute molecules. The
210 * second line contains cross terms where cations affect cations and/or
211 * cation/anion pairs, and anions affect anions or cation/anion pairs. Note part
212 * of the coefficients, \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ stem from
213 * the theory of unsymmetrical mixing of electrolytes with different charges.
214 * This theory depends on the total ionic strength of the solution, and
215 * therefore, \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ will depend on
216 * *I*, the ionic strength. \f$ B_{ca}\f$ is a strong function of the
217 * total ionic strength, *I*, of the electrolyte. The rest of the coefficients
218 * are assumed to be independent of the molalities or ionic strengths. However,
219 * all coefficients are potentially functions of the temperature and pressure
220 * of the solution.
221 *
222 * *A* is the Debye-Huckel constant. Its specification is described in its
223 * own section below.
224 *
225 * \f$ I\f$ is the ionic strength of the solution, and is given by:
226 *
227 * \f[
228 * I = \frac{1}{2} \sum_k{m_k z_k^2}
229 * \f]
230 *
231 * In contrast to several other Debye-Huckel implementations (see \ref
232 * DebyeHuckel), the parameter \f$ b\f$ in the above equation is a constant that
233 * does not vary with respect to ion identity. This is an important
234 * simplification as it avoids troubles with satisfaction of the Gibbs-Duhem
235 * analysis.
236 *
237 * The function \f$ Z \f$ is given by
238 *
239 * \f[
240 * Z = \sum_i m_i \left| z_i \right|
241 * \f]
242 *
243 * The value of \f$ B_{ca}\f$ is given by the following function
244 *
245 * \f[
246 * B_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} g(\alpha^{(1)}_{ca} \sqrt{I})
247 * + \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I})
248 * \f]
249 *
250 * where
251 *
252 * \f[
253 * g(x) = 2 \frac{(1 - (1 + x)\exp[-x])}{x^2}
254 * \f]
255 *
256 * The formulation for \f$ B_{ca}\f$ combined with the formulation of the Debye-
257 * Huckel term in the eqn. for the excess Gibbs free energy stems essentially
258 * from an empirical fit to the ionic strength dependent data based over a wide
259 * sampling of binary electrolyte systems. \f$ C_{ca} \f$, \f$ \lambda_{nc} \f$,
260 * \f$ \lambda_{na} \f$, \f$ \lambda_{nn} \f$, \f$ \Psi_{c{c'}a} \f$, \f$
261 * \Psi_{a{a'}c} \f$ are experimentally derived coefficients that may have
262 * pressure and/or temperature dependencies.
263 *
264 * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ formulations are slightly
265 * more complicated. \f$ b \f$ is a universal constant defined to be equal to
266 * \f$ 1.2\ kg^{1/2}\ gmol^{-1/2} \f$. The exponential coefficient \f$
267 * \alpha^{(1)}_{ca} \f$ is usually fixed at \f$ \alpha^{(1)}_{ca} = 2.0\
268 * kg^{1/2} gmol^{-1/2}\f$ except for 2-2 electrolytes, while other parameters
269 * were fit to experimental data. For 2-2 electrolytes, \f$ \alpha^{(1)}_{ca} =
270 * 1.4\ kg^{1/2}\ gmol^{-1/2}\f$ is used in combination with either \f$
271 * \alpha^{(2)}_{ca} = 12\ kg^{1/2}\ gmol^{-1/2}\f$ or \f$ \alpha^{(2)}_{ca} = k
272 * A_\psi \f$, where *k* is a constant. For electrolytes other than 2-2
273 * electrolytes the \f$ \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I}) \f$ term
274 * is not used in the fitting procedure; it is only used for divalent metal
275 * solfates and other high-valence electrolytes which exhibit significant
276 * association at low ionic strengths.
277 *
278 * The \f$ \beta^{(0)}_{ca} \f$, \f$ \beta^{(1)}_{ca}\f$, \f$ \beta^{(2)}_{ca}
279 * \f$, and \f$ C_{ca} \f$ binary coefficients are referred to as ion-
280 * interaction or Pitzer parameters. These Pitzer parameters may vary with
281 * temperature and pressure but they do not depend on the ionic strength. Their
282 * values and temperature derivatives of their values have been tabulated for a
283 * range of electrolytes
284 *
285 * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ contributions, which
286 * capture cation-cation and anion-anion interactions, also have an ionic
287 * strength dependence.
288 *
289 * Ternary contributions \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{a{a'}c} \f$ have
290 * been measured also for some systems. The success of the Pitzer method lies in
291 * its ability to model nonlinear activity coefficients of complex
292 * multicomponent systems with just binary and minor ternary contributions,
293 * which can be independently measured in binary or ternary subsystems.
294 *
295 * ### Multicomponent Activity Coefficients for Solutes
296 *
297 * The formulas for activity coefficients of solutes may be obtained by taking
298 * the following derivative of the excess Gibbs Free Energy formulation
299 * described above:
300 *
301 * \f[
302 * \ln(\gamma_k^\triangle) = \frac{d\left( \frac{G^{ex}}{M_o n_o RT} \right)}{d(m_k)}\Bigg|_{n_i}
303 * \f]
304 *
305 * In the formulas below the following conventions are used. The subscript *M*
306 * refers to a particular cation. The subscript X refers to a particular anion,
307 * whose activity is being currently evaluated. the subscript *a* refers to a
308 * summation over all anions in the solution, while the subscript *c* refers to
309 * a summation over all cations in the solutions.
310 *
311 * The activity coefficient for a particular cation *M* is given by
312 *
313 * \f[
314 * \ln(\gamma_M^\triangle) = -z_M^2(F) + \sum_a m_a \left( 2 B_{Ma} + Z C_{Ma} \right)
315 * + z_M \left( \sum_a \sum_c m_a m_c C_{ca} \right)
316 * + \sum_c m_c \left[ 2 \Phi_{Mc} + \sum_a m_a \Psi_{Mca} \right]
317 * + \sum_{a < a'} \sum m_a m_{a'} \Psi_{Ma{a'}}
318 * + 2 \sum_n m_n \lambda_{nM}
319 * \f]
320 *
321 * The activity coefficient for a particular anion *X* is given by
322 *
323 * \f[
324 * \ln(\gamma_X^\triangle) = -z_X^2(F) + \sum_a m_c \left( 2 B_{cX} + Z C_{cX} \right)
325 * + \left|z_X \right| \left( \sum_a \sum_c m_a m_c C_{ca} \right)
326 * + \sum_a m_a \left[ 2 \Phi_{Xa} + \sum_c m_c \Psi_{cXa} \right]
327 * + \sum_{c < c'} \sum m_c m_{c'} \Psi_{c{c'}X}
328 * + 2 \sum_n m_n \lambda_{nM}
329 * \f]
330 * where the function \f$ F \f$ is given by
331 *
332 * \f[
333 * F = - A_{\phi} \left[ \frac{\sqrt{I}}{1 + b \sqrt{I}}
334 * + \frac{2}{b} \ln{\left(1 + b\sqrt{I}\right)} \right]
335 * + \sum_a \sum_c m_a m_c B'_{ca}
336 * + \sum_{c < c'} \sum m_c m_{c'} \Phi'_{c{c'}}
337 * + \sum_{a < a'} \sum m_a m_{a'} \Phi'_{a{a'}}
338 * \f]
339 *
340 * We have employed the definition of \f$ A_{\phi} \f$, also used by Pitzer
341 * which is equal to
342 *
343 * \f[
344 * A_{\phi} = \frac{A_{Debye}}{3}
345 * \f]
346 *
347 * In the above formulas, \f$ \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$ are the
348 * ionic strength derivatives of \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$,
349 * respectively.
350 *
351 * The function \f$ B'_{MX} \f$ is defined as:
352 *
353 * \f[
354 * B'_{MX} = \left( \frac{\beta^{(1)}_{MX} h(\alpha^{(1)}_{MX} \sqrt{I})}{I} \right)
355 * \left( \frac{\beta^{(2)}_{MX} h(\alpha^{(2)}_{MX} \sqrt{I})}{I} \right)
356 * \f]
357 *
358 * where \f$ h(x) \f$ is defined as
359 *
360 * \f[
361 * h(x) = g'(x) \frac{x}{2} =
362 * \frac{2\left(1 - \left(1 + x + \frac{x^2}{2} \right)\exp(-x) \right)}{x^2}
363 * \f]
364 *
365 * The activity coefficient for neutral species *N* is given by
366 *
367 * \f[
368 * \ln(\gamma_N^\triangle) = 2 \left( \sum_i m_i \lambda_{iN}\right)
369 * \f]
370 *
371 * ### Activity of the Water Solvent
372 *
373 * The activity for the solvent water,\f$ a_o \f$, is not independent and must
374 * be determined either from the Gibbs-Duhem relation or from taking the
375 * appropriate derivative of the same excess Gibbs free energy function as was
376 * used to formulate the solvent activity coefficients. Pitzer's description
377 * follows the later approach to derive a formula for the osmotic coefficient,
378 * \f$ \phi \f$.
379 *
380 * \f[
381 * \phi - 1 = - \left( \frac{d\left(\frac{G^{ex}}{RT} \right)}{d(\tilde{M}_o n_o)} \right)
382 * \frac{1}{\sum_{i \ne 0} m_i}
383 * \f]
384 *
385 * The osmotic coefficient may be related to the water activity by the following relation:
386 *
387 * \f[
388 * \phi = - \frac{1}{\tilde{M}_o \sum_{i \neq o} m_i} \ln(a_o)
389 * = - \frac{n_o}{\sum_{i \neq o}n_i} \ln(a_o)
390 * \f]
391 *
392 * The result is the following
393 *
394 * \f[
395 * \begin{array}{ccclc}
396 * \phi - 1 &= &
397 * \frac{2}{\sum_{i \ne 0} m_i}
398 * \bigg[ &
399 * - A_{\phi} \frac{I^{3/2}}{1 + b \sqrt{I}}
400 * + \sum_c \sum_a m_c m_a \left( B^{\phi}_{ca} + Z C_{ca}\right)
401 * \\&&&
402 * + \sum_{c < c'} \sum m_c m_{c'} \left[ \Phi^{\phi}_{c{c'}} + \sum_a m_a \Psi_{c{c'}a} \right]
403 * + \sum_{a < a'} \sum m_a m_{a'} \left[ \Phi^{\phi}_{a{a'}} + \sum_c m_c \Psi_{a{a'}c} \right]
404 * \\&&&
405 * + \sum_n \sum_c m_n m_c \lambda_{nc} + \sum_n \sum_a m_n m_a \lambda_{na}
406 * + \sum_{n < n'} \sum m_n m_{n'} \lambda_{n{n'}}
407 * + \frac{1}{2} \left( \sum_n m^2_n \lambda_{nn}\right)
408 * \bigg]
409 * \end{array}
410 * \f]
411 *
412 * It can be shown that the expression
413 *
414 * \f[
415 * B^{\phi}_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} \exp{(- \alpha^{(1)}_{ca} \sqrt{I})}
416 * + \beta^{(2)}_{ca} \exp{(- \alpha^{(2)}_{ca} \sqrt{I} )}
417 * \f]
418 *
419 * is consistent with the expression \f$ B_{ca} \f$ in the \f$ G^{ex} \f$
420 * expression after carrying out the derivative wrt \f$ m_M \f$.
421 *
422 * Also taking into account that \f$ {\Phi}_{c{c'}} \f$ and
423 * \f$ {\Phi}_{a{a'}} \f$ has an ionic strength dependence.
424 *
425 * \f[
426 * \Phi^{\phi}_{c{c'}} = {\Phi}_{c{c'}} + I \frac{d{\Phi}_{c{c'}}}{dI}
427 * \f]
428 *
429 * \f[
430 * \Phi^{\phi}_{a{a'}} = \Phi_{a{a'}} + I \frac{d\Phi_{a{a'}}}{dI}
431 * \f]
432 *
433 * ### Temperature and Pressure Dependence of the Pitzer Parameters
434 *
435 * In general most of the coefficients introduced in the previous section may
436 * have a temperature and pressure dependence. The temperature and pressure
437 * dependence of these coefficients strongly influence the value of the excess
438 * Enthalpy and excess Volumes of Pitzer solutions. Therefore, these are readily
439 * measurable quantities. HMWSoln provides several different methods for putting
440 * these dependencies into the coefficients. HMWSoln has an implementation
441 * described by Silverter and Pitzer (1977), which was used to fit experimental
442 * data for NaCl over an extensive range, below the critical temperature of
443 * water. They found a temperature functional form for fitting the 3 following
444 * coefficients that describe the Pitzer parameterization for a single salt to
445 * be adequate to describe how the excess Gibbs free energy values for the
446 * binary salt changes with respect to temperature. The following functional
447 * form was used to fit the temperature dependence of the Pitzer Coefficients
448 * for each cation - anion pair, M X.
449 *
450 * \f[
451 * \beta^{(0)}_{MX} = q^{b0}_0
452 * + q^{b0}_1 \left( T - T_r \right)
453 * + q^{b0}_2 \left( T^2 - T_r^2 \right)
454 * + q^{b0}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right)
455 * + q^{b0}_4 \ln \left( \frac{T}{T_r} \right)
456 * \f]
457 * \f[
458 * \beta^{(1)}_{MX} = q^{b1}_0 + q^{b1}_1 \left( T - T_r \right)
459 * + q^{b1}_{2} \left( T^2 - T_r^2 \right)
460 * \f]
461 * \f[
462 * C^{\phi}_{MX} = q^{Cphi}_0
463 * + q^{Cphi}_1 \left( T - T_r \right)
464 * + q^{Cphi}_2 \left( T^2 - T_r^2 \right)
465 * + q^{Cphi}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right)
466 * + q^{Cphi}_4 \ln \left( \frac{T}{T_r} \right)
467 * \f]
468 *
469 * where
470 *
471 * \f[
472 * C^{\phi}_{MX} = 2 {\left| z_M z_X \right|}^{1/2} C_{MX}
473 * \f]
474 *
475 * In later papers, Pitzer has added additional temperature dependencies to all
476 * of the other remaining second and third order virial coefficients. Some of
477 * these dependencies are justified and motivated by theory. Therefore, a
478 * formalism wherein all of the coefficients in the base theory have temperature
479 * dependencies associated with them has been implemented within the HMWSoln
480 * object. Much of the formalism, however, has been unexercised.
481 *
482 * In the HMWSoln object, the temperature dependence of the Pitzer parameters
483 * are specified in the following way.
484 *
485 * - PIZTER_TEMP_CONSTANT - string name "CONSTANT"
486 * - Assumes that all coefficients are independent of temperature
487 * and pressure
488 * - PIZTER_TEMP_COMPLEX1 - string name "COMPLEX" or "COMPLEX1"
489 * - Uses the full temperature dependence for the
490 * \f$\beta^{(0)}_{MX} \f$ (5 coeffs),
491 * the \f$\beta^{(1)}_{MX} \f$ (3 coeffs),
492 * and \f$ C^{\phi}_{MX} \f$ (5 coeffs) parameters described above.
493 * - PITZER_TEMP_LINEAR - string name "LINEAR"
494 * - Uses just the temperature dependence for the
495 * \f$\beta^{(0)}_{MX} \f$, the \f$\beta^{(1)}_{MX} \f$,
496 * and \f$ C^{\phi}_{MX} \f$ coefficients described above.
497 * There are 2 coefficients for each term.
498 *
499 * The temperature dependence is specified in an attributes field in the
500 * `activityCoefficients` XML block, called `TempModel`. Permissible values for
501 * that attribute are `CONSTANT`, `COMPLEX1`, and `LINEAR`.
502 *
503 * The specification of the binary interaction between a cation and an anion is
504 * given by the coefficients, \f$ B_{MX}\f$ and \f$ C_{MX}\f$ The specification
505 * of \f$ B_{MX}\f$ is a function of \f$\beta^{(0)}_{MX} \f$,
506 * \f$\beta^{(1)}_{MX} \f$, \f$\beta^{(2)}_{MX} \f$, \f$\alpha^{(1)}_{MX} \f$,
507 * and \f$\alpha^{(2)}_{MX} \f$. \f$ C_{MX}\f$ is calculated from
508 * \f$C^{\phi}_{MX} \f$ from the formula above. All of the underlying
509 * coefficients are specified in the XML element block `binarySaltParameters`,
510 * which has the attribute `cation` and `anion` to identify the interaction. XML
511 * elements named `beta0, beta1, beta2, Cphi, Alpha1, Alpha2` within each
512 * `binarySaltParameters` block specify the parameters. Within each of these
513 * blocks multiple parameters describing temperature or pressure dependence are
514 * serially listed in the order that they appear in the equation in this
515 * document. An example of the `beta0` block that fits the `COMPLEX1`
516 * temperature dependence given above is
517 *
518 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
519 *
520 * @code
521 * <binarySaltParameters cation="Na+" anion="OH-">
522 * <beta0> q0, q1, q2, q3, q4 </beta0>
523 * </binarySaltParameters>
524 * @endcode
525 *
526 * The parameters for \f$ \beta^{(0)}\f$ fit the following equation:
527 *
528 * \f[
529 * \beta^{(0)} = q_0^{{\beta}0} + q_1^{{\beta}0} \left( T - T_r \right)
530 * + q_2^{{\beta}0} \left( T^2 - T_r^2 \right)
531 * + q_3^{{\beta}0} \left( \frac{1}{T} - \frac{1}{T_r} \right)
532 * + q_4^{{\beta}0} \ln \left( \frac{T}{T_r} \right)
533 * \f]
534 *
535 * This same `COMPLEX1` temperature dependence given above is used for the
536 * following parameters:
537 * \f$ \beta^{(0)}_{MX} \f$, \f$ \beta^{(1)}_{MX} \f$,
538 * \f$ \beta^{(2)}_{MX} \f$, \f$ \Theta_{cc'} \f$, \f$\Theta_{aa'} \f$,
539 * \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$.
540 *
541 * ### Like-Charged Binary Ion Parameters and the Mixing Parameters
542 *
543 * The previous section contained the functions, \f$ \Phi_{c{c'}} \f$,
544 * \f$ \Phi_{a{a'}} \f$ and their derivatives wrt the ionic strength, \f$
545 * \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$. Part of these terms come from
546 * theory.
547 *
548 * Since like charged ions repel each other and are generally not near each
549 * other, the virial coefficients for same-charged ions are small. However,
550 * Pitzer doesn't ignore these in his formulation. Relatively larger and longer
551 * range terms between like-charged ions exist however, which appear only for
552 * unsymmetrical mixing of same-sign charged ions with different charges. \f$
553 * \Phi_{ij} \f$, where \f$ ij \f$ is either \f$ a{a'} \f$ or \f$ c{c'} \f$ is
554 * given by
555 *
556 * \f[
557 * {\Phi}_{ij} = \Theta_{ij} + \,^E \Theta_{ij}(I)
558 * \f]
559 *
560 * \f$ \Theta_{ij} \f$ is the small virial coefficient expansion term. Dependent
561 * in general on temperature and pressure, its ionic strength dependence is
562 * ignored in Pitzer's approach. \f$ \,^E\Theta_{ij}(I) \f$ accounts for the
563 * electrostatic unsymmetrical mixing effects and is dependent only on the
564 * charges of the ions i, j, the total ionic strength and on the dielectric
565 * constant and density of the solvent. This seems to be a relatively well-
566 * documented part of the theory. They theory below comes from Pitzer summation
567 * (Pitzer) in the appendix. It's also mentioned in Bethke's book (Bethke), and
568 * the equations are summarized in Harvie & Weare (1980). Within the code, \f$
569 * \,^E\Theta_{ij}(I) \f$ is evaluated according to the algorithm described in
570 * Appendix B [Pitzer] as
571 *
572 * \f[
573 * \,^E\Theta_{ij}(I) = \left( \frac{z_i z_j}{4I} \right)
574 * \left( J(x_{ij}) - \frac{1}{2} J(x_{ii})
575 * - \frac{1}{2} J(x_{jj}) \right)
576 * \f]
577 *
578 * where \f$ x_{ij} = 6 z_i z_j A_{\phi} \sqrt{I} \f$ and
579 *
580 * \f[
581 * J(x) = \frac{1}{x} \int_0^{\infty}{\left( 1 + q +
582 * \frac{1}{2} q^2 - e^q \right) y^2 dy}
583 * \f]
584 *
585 * and \f$ q = - (\frac{x}{y}) e^{-y} \f$. \f$ J(x) \f$ is evaluated by
586 * numerical integration.
587 *
588 * The \f$ \Theta_{ij} \f$ term is a constant that is specified by the XML
589 * element `thetaCation` and `thetaAnion`, which has the attribute `cation1`,
590 * `cation2` and `anion1`, `anion2` respectively to identify the interaction. No
591 * temperature or pressure dependence of this parameter is currently allowed. An
592 * example of the block is presented below.
593 *
594 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
595 *
596 * @code
597 * <thetaCation cation1="Na+" cation2="H+">
598 * <Theta> 0.036 </Theta>
599 * </thetaCation>
600 * @endcode
601 *
602 * ### Ternary Pitzer Parameters
603 *
604 * The \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$ terms represent ternary
605 * interactions between two cations and an anion and two anions and a cation,
606 * respectively. In Pitzer's implementation these terms are usually small in
607 * absolute size. Currently these parameters do not have any dependence on
608 * temperature, pressure, or ionic strength.
609 *
610 * Their values are input using the XML element `psiCommonCation` and
611 * `psiCommonAnion`. The species id's are specified in attribute fields in the
612 * XML element. The fields `cation`, `anion1`, and `anion2` are used for
613 * `psiCommonCation`. The fields `anion`, `cation1` and `cation2` are used for
614 * `psiCommonAnion`. An example block is given below. The `Theta` field below is
615 * a duplicate of the `thetaAnion` field mentioned above. The two fields are
616 * input into the same block for convenience, and because their data are highly
617 * correlated, in practice. It is an error for the two blocks to specify
618 * different information about thetaAnion (or thetaCation) in different blocks.
619 * It's ok to specify duplicate but consistent information in multiple blocks.
620 *
621 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
622 *
623 * @code
624 * <psiCommonCation cation="Na+" anion1="Cl-" anion2="OH-">
625 * <Theta> -0.05 </Theta>
626 * <Psi> -0.006 </Psi>
627 * </psiCommonCation>
628 * @endcode
629 *
630 * ### Treatment of Neutral Species
631 *
632 * Binary virial-coefficient-like interactions between two neutral species may
633 * be specified in the \f$ \lambda_{mn} \f$ terms that appear in the formulas
634 * above. Currently these interactions are independent of temperature, pressure,
635 * and ionic strength. Also, currently, the neutrality of the species are not
636 * checked. Therefore, this interaction may involve charged species in the
637 * solution as well. The identity of the species is specified by the `species1`
638 * and `species2` attributes to the XML `lambdaNeutral` node. These terms are
639 * symmetrical; `species1` and `species2` may be reversed and the term will be
640 * the same. An example is given below.
641 *
642 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
643 *
644 * @code
645 * <lambdaNeutral species1="CO2" species2="CH4">
646 * <lambda> 0.05 </lambda>
647 * </lambdaNeutral>
648 * @endcode
649 *
650 * ## Example of the Specification of Parameters for the Activity Coefficients
651 *
652 * An example is given below.
653 *
654 * An example `activityCoefficients` XML block for this formulation is supplied
655 * below
656 *
657 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
658 *
659 * @code
660 * <activityCoefficients model="Pitzer" TempModel="complex1">
661 * <!-- Pitzer Coefficients
662 * These coefficients are from Pitzer's main
663 * paper, in his book.
664 * -->
665 * <A_Debye model="water" />
666 * <ionicRadius default="3.042843" units="Angstroms">
667 * </ionicRadius>
668 * <binarySaltParameters cation="Na+" anion="Cl-">
669 * <beta0> 0.0765, 0.008946, -3.3158E-6,
670 * -777.03, -4.4706
671 * </beta0>
672 * <beta1> 0.2664, 6.1608E-5, 1.0715E-6, 0.0, 0.0 </beta1>
673 * <beta2> 0.0, 0.0, 0.0, 0.0, 0.0 </beta2>
674 * <Cphi> 0.00127, -4.655E-5, 0.0,
675 * 33.317, 0.09421
676 * </Cphi>
677 * <Alpha1> 2.0 </Alpha1>
678 * </binarySaltParameters>
679 *
680 * <binarySaltParameters cation="H+" anion="Cl-">
681 * <beta0> 0.1775, 0.0, 0.0, 0.0, 0.0 </beta0>
682 * <beta1> 0.2945, 0.0, 0.0, 0.0, 0.0 </beta1>
683 * <beta2> 0.0, 0.0, 0.0, 0.0, 0.0 </beta2>
684 * <Cphi> 0.0008, 0.0, 0.0, 0.0, 0.0 </Cphi>
685 * <Alpha1> 2.0 </Alpha1>
686 * </binarySaltParameters>
687 *
688 * <binarySaltParameters cation="Na+" anion="OH-">
689 * <beta0> 0.0864, 0.0, 0.0, 0.0, 0.0 </beta0>
690 * <beta1> 0.253, 0.0, 0.0 0.0, 0.0 </beta1>
691 * <beta2> 0.0 0.0, 0.0, 0.0, 0.0 </beta2>
692 * <Cphi> 0.0044, 0.0, 0.0, 0.0, 0.0 </Cphi>
693 * <Alpha1> 2.0 </Alpha1>
694 * </binarySaltParameters>
695 *
696 * <thetaAnion anion1="Cl-" anion2="OH-">
697 * <Theta> -0.05, 0.0, 0.0, 0.0, 0.0 </Theta>
698 * </thetaAnion>
699 *
700 * <psiCommonCation cation="Na+" anion1="Cl-" anion2="OH-">
701 * <Theta> -0.05, 0.0, 0.0, 0.0, 0.0 </Theta>
702 * <Psi> -0.006 </Psi>
703 * </psiCommonCation>
704 *
705 * <thetaCation cation1="Na+" cation2="H+">
706 * <Theta> 0.036, 0.0, 0.0, 0.0, 0.0 </Theta>
707 * </thetaCation>
708 *
709 * <psiCommonAnion anion="Cl-" cation1="Na+" cation2="H+">
710 * <Theta> 0.036, 0.0, 0.0, 0.0, 0.0 </Theta>
711 * <Psi> -0.004 </Psi>
712 * </psiCommonAnion>
713 * </activityCoefficients>
714 * @endcode
715 *
716 * ### Specification of the Debye-Huckel Constant
717 *
718 * In the equations above, the formula for \f$ A_{Debye} \f$ is needed. The
719 * HMWSoln object uses two methods for specifying these quantities. The default
720 * method is to assume that \f$ A_{Debye} \f$ is a constant, given in the
721 * initialization process, and stored in the member double, m_A_Debye.
722 * Optionally, a full water treatment may be employed that makes
723 * \f$ A_{Debye} \f$ a full function of *T* and *P* and creates nontrivial
724 * entries for the excess heat capacity, enthalpy, and excess volumes of
725 * solution.
726 *
727 * \f[
728 * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2}
729 * \f]
730 * where
731 *
732 * \f[
733 * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}}
734 * \f]
735 * Therefore:
736 * \f[
737 * A_{Debye} = \frac{1}{8 \pi}
738 * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2}
739 * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
740 * \f]
741 *
742 * Units = sqrt(kg/gmol)
743 *
744 * where
745 * - \f$ N_a \f$ is Avogadro's number
746 * - \f$ \rho_w \f$ is the density of water
747 * - \f$ e \f$ is the electronic charge
748 * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
749 * - \f$ K \f$ is the dielectric constant of water,
750 * - \f$ \epsilon_o \f$ is the permittivity of free space.
751 * - \f$ \rho_o \f$ is the density of the solvent in its standard state.
752 *
753 * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)^(1/2)
754 * based on:
755 * - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
756 * - T = 298.15 K
757 * - B_Debye = 3.28640E9 (kg/gmol)^(1/2) / m
758 *
759 * An example of a fixed value implementation is given below.
760 *
761 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
762 *
763 * @code
764 * <activityCoefficients model="Pitzer">
765 * <!-- A_Debye units = sqrt(kg/gmol) -->
766 * <A_Debye> 1.172576 </A_Debye>
767 * <!-- object description continues -->
768 * </activityCoefficients>
769 * @endcode
770 *
771 * An example of a variable value implementation within the HMWSoln object is
772 * given below. The model attribute, "water", triggers the full implementation.
773 *
774 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
775 *
776 * @code
777 * <activityCoefficients model="Pitzer">
778 * <!-- A_Debye units = sqrt(kg/gmol) -->
779 * <A_Debye model="water" />
780 * <!-- object description continues -->
781 * </activityCoefficients>
782 * @endcode
783 *
784 * ### Temperature and Pressure Dependence of the Activity Coefficients
785 *
786 * Temperature dependence of the activity coefficients leads to nonzero terms
787 * for the excess enthalpy and entropy of solution. This means that the partial
788 * molar enthalpies, entropies, and heat capacities are all non-trivial to
789 * compute. The following formulas are used.
790 *
791 * The partial molar enthalpy, \f$ \bar s_k(T,P) \f$:
792 *
793 * \f[
794 * \bar h_k(T,P) = h^{\triangle}_k(T,P)
795 * - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT}
796 * \f]
797 * The solvent partial molar enthalpy is equal to
798 * \f[
799 * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o)}{dT}
800 * = h^{o}_o(T,P)
801 * + R T^2 (\sum_{k \neq o} m_k) \tilde{M_o} (\frac{d \phi}{dT})
802 * \f]
803 *
804 * The partial molar entropy, \f$ \bar s_k(T,P) \f$:
805 *
806 * \f[
807 * \bar s_k(T,P) = s^{\triangle}_k(T,P)
808 * - R \ln( \gamma^{\triangle}_k \frac{m_k}{m^{\triangle}}))
809 * - R T \frac{d \ln(\gamma^{\triangle}_k) }{dT}
810 * \f]
811 * \f[
812 * \bar s_o(T,P) = s^o_o(T,P) - R \ln(a_o)
813 * - R T \frac{d \ln(a_o)}{dT}
814 * \f]
815 *
816 * The partial molar heat capacity, \f$ C_{p,k}(T,P)\f$:
817 *
818 * \f[
819 * \bar C_{p,k}(T,P) = C^{\triangle}_{p,k}(T,P)
820 * - 2 R T \frac{d \ln( \gamma^{\triangle}_k)}{dT}
821 * - R T^2 \frac{d^2 \ln(\gamma^{\triangle}_k) }{{dT}^2}
822 * \f]
823 * \f[
824 * \bar C_{p,o}(T,P) = C^o_{p,o}(T,P)
825 * - 2 R T \frac{d \ln(a_o)}{dT}
826 * - R T^2 \frac{d^2 \ln(a_o)}{{dT}^2}
827 * \f]
828 *
829 * The pressure dependence of the activity coefficients leads to non-zero terms
830 * for the excess Volume of the solution. Therefore, the partial molar volumes
831 * are functions of the pressure derivatives of the activity coefficients.
832 * \f[
833 * \bar V_k(T,P) = V^{\triangle}_k(T,P)
834 * + R T \frac{d \ln(\gamma^{\triangle}_k) }{dP}
835 * \f]
836 * \f[
837 * \bar V_o(T,P) = V^o_o(T,P)
838 * + R T \frac{d \ln(a_o)}{dP}
839 * \f]
840 *
841 * The majority of work for these functions take place in the internal routines
842 * that calculate the first and second derivatives of the log of the activity
843 * coefficients wrt temperature, s_update_dlnMolalityActCoeff_dT(),
844 * s_update_d2lnMolalityActCoeff_dT2(), and the first derivative of the log
845 * activity coefficients wrt pressure, s_update_dlnMolalityActCoeff_dP().
846 *
847 * ## %Application within Kinetics Managers
848 *
849 * For the time being, we have set the standard concentration for all solute
850 * species in this phase equal to the default concentration of the solvent at
851 * the system temperature and pressure multiplied by Mnaught (kg solvent / gmol
852 * solvent). The solvent standard concentration is just equal to its standard
853 * state concentration.
854 *
855 * This means that the kinetics operator essentially works on an generalized
856 * concentration basis (kmol / m3), with units for the kinetic rate constant
857 * specified as if all reactants (solvent or solute) are on a concentration
858 * basis (kmol /m3). The concentration will be modified by the activity
859 * coefficients.
860 *
861 * For example, a bulk-phase binary reaction between liquid solute species *j*
862 * and *k*, producing a new liquid solute species *l* would have the following
863 * equation for its rate of progress variable, \f$ R^1 \f$, which has units of
864 * kmol m-3 s-1.
865 *
866 * \f[
867 * R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k)
868 * \f]
869 *
870 * where
871 *
872 * \f[
873 * C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k
874 * \f]
875 *
876 * \f$ C_j^a \f$ is the activity concentration of species *j*, and
877 * \f$ C_k^a \f$ is the activity concentration of species *k*. \f$ C^o_o \f$ is
878 * the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ has units
879 * of kg solvent per gmol solvent and is equal to
880 *
881 * \f[
882 * \tilde{M}_o = \frac{M_o}{1000}
883 * \f]
884 *
885 * \f$ a_j \f$ is the activity of species *j* at the current temperature and
886 * pressure and concentration of the liquid phase is given by the molality based
887 * activity coefficient multiplied by the molality of the jth species.
888 *
889 * \f[
890 * a_j = \gamma_j^\triangle m_j = \gamma_j^\triangle \frac{n_j}{\tilde{M}_o n_o}
891 * \f]
892 *
893 * \f$k^1 \f$ has units of m^3/kmol/s.
894 *
895 * Therefore the generalized activity concentration of a solute species has the following form
896 *
897 * \f[
898 * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
899 * \f]
900 *
901 * The generalized activity concentration of the solvent has the same units, but it's a simpler form
902 *
903 * \f[
904 * C_o^a = C^o_o a_o
905 * \f]
906 *
907 * The reverse rate constant can then be obtained from the law of microscopic reversibility
908 * and the equilibrium expression for the system.
909 *
910 * \f[
911 * \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
912 * \f]
913 *
914 * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant.
915 *
916 * \f[
917 * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o \tilde{M}_o a_l)
918 * \f]
919 *
920 * where
921 *
922 * \f[
923 * k^{-1} = k^1 K^{o,1} C_o \tilde{M}_o
924 * \f]
925 *
926 * \f$ k^{-1} \f$ has units of 1/s.
927 *
928 * Note, this treatment may be modified in the future, as events dictate.
929 *
930 * ## XML Example
931 *
932 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
933 *
934 * The phase model name for this is called StoichSubstance. It must be supplied
935 * as the model attribute of the thermo XML element entry. Within the phase XML
936 * block, the density of the phase must be specified. An example of an XML file
937 * this phase is given below.
938 *
939 * @code
940 * <phase id="NaCl_electrolyte" dim="3">
941 * <speciesArray datasrc="#species_waterSolution">
942 * H2O(L) Na+ Cl- H+ OH-
943 * </speciesArray>
944 * <state>
945 * <temperature units="K"> 300 </temperature>
946 * <pressure units="Pa">101325.0</pressure>
947 * <soluteMolalities>
948 * Na+:3.0
949 * Cl-:3.0
950 * H+:1.0499E-8
951 * OH-:1.3765E-6
952 * </soluteMolalities>
953 * </state>
954 * <!-- thermo model identifies the inherited class
955 * from ThermoPhase that will handle the thermodynamics.
956 * -->
957 * <thermo model="HMW">
958 * <standardConc model="solvent_volume" />
959 * <activityCoefficients model="Pitzer" TempModel="complex1">
960 * <!-- Pitzer Coefficients
961 * These coefficients are from Pitzer's main
962 * paper, in his book.
963 * -->
964 * <A_Debye model="water" />
965 * <ionicRadius default="3.042843" units="Angstroms">
966 * </ionicRadius>
967 * <binarySaltParameters cation="Na+" anion="Cl-">
968 * <beta0> 0.0765, 0.008946, -3.3158E-6,
969 * -777.03, -4.4706
970 * </beta0>
971 * <beta1> 0.2664, 6.1608E-5, 1.0715E-6 </beta1>
972 * <beta2> 0.0 </beta2>
973 * <Cphi> 0.00127, -4.655E-5, 0.0,
974 * 33.317, 0.09421
975 * </Cphi>
976 * <Alpha1> 2.0 </Alpha1>
977 * </binarySaltParameters>
978 *
979 * <binarySaltParameters cation="H+" anion="Cl-">
980 * <beta0> 0.1775, 0.0, 0.0, 0.0, 0.0</beta0>
981 * <beta1> 0.2945, 0.0, 0.0 </beta1>
982 * <beta2> 0.0 </beta2>
983 * <Cphi> 0.0008, 0.0, 0.0, 0.0, 0.0 </Cphi>
984 * <Alpha1> 2.0 </Alpha1>
985 * </binarySaltParameters>
986 *
987 * <binarySaltParameters cation="Na+" anion="OH-">
988 * <beta0> 0.0864, 0.0, 0.0, 0.0, 0.0 </beta0>
989 * <beta1> 0.253, 0.0, 0.0 </beta1>
990 * <beta2> 0.0 </beta2>
991 * <Cphi> 0.0044, 0.0, 0.0, 0.0, 0.0 </Cphi>
992 * <Alpha1> 2.0 </Alpha1>
993 * </binarySaltParameters>
994 *
995 * <thetaAnion anion1="Cl-" anion2="OH-">
996 * <Theta> -0.05 </Theta>
997 * </thetaAnion>
998 *
999 * <psiCommonCation cation="Na+" anion1="Cl-" anion2="OH-">
1000 * <Theta> -0.05 </Theta>
1001 * <Psi> -0.006 </Psi>
1002 * </psiCommonCation>
1003 *
1004 * <thetaCation cation1="Na+" cation2="H+">
1005 * <Theta> 0.036 </Theta>
1006 * </thetaCation>
1007 *
1008 * <psiCommonAnion anion="Cl-" cation1="Na+" cation2="H+">
1009 * <Theta> 0.036 </Theta>
1010 * <Psi> -0.004 </Psi>
1011 * </psiCommonAnion>
1012 *
1013 * </activityCoefficients>
1014 *
1015 * <solvent> H2O(L) </solvent>
1016 * </thermo>
1017 * <elementArray datasrc="elements.xml"> O H Na Cl </elementArray>
1018 * <kinetics model="none" >
1019 * </kinetics>
1020 * </phase>
1021 * @endcode
1022 * @ingroup thermoprops
1023 */
1024 class HMWSoln : public MolalityVPSSTP
1025{
1026 public:
1027 ~HMWSoln();
1028
1029 //! Construct and initialize an HMWSoln ThermoPhase object
1030 //! directly from an ASCII input file
1031 /*!
1032 * This constructor is a shell that calls the routine initThermo(), with
1033 * a reference to the parsed input file to get the info for the phase.
1034 *
1035 * @param inputFile Name of the input file containing the phase definition
1036 * to set up the object. If blank, an empty phase will be
1037 * created.
1038 * @param id ID of the phase in the input file. Defaults to the
1039 * empty string.
1040 */
1041 explicit HMWSoln(const std::string& inputFile="", const std::string& id="");
1042
1043 //! Construct and initialize an HMWSoln ThermoPhase object
1044 //! directly from an XML database
1045 /*!
1046 * @param phaseRef XML phase node containing the description of the phase
1047 * @param id id attribute containing the name of the phase.
1048 * (default is the empty string)
1049 *
1050 * @deprecated The XML input format is deprecated and will be removed in
1051 * Cantera 3.0.
1052 */
1053 HMWSoln(XML_Node& phaseRef, const std::string& id = "");
1054
1055 //! @name Utilities
1056 //! @{
1057
1058 virtual std::string type() const {
1059 return "HMWSoln";
1060 }
1061
1062 //! @}
1063 //! @name Molar Thermodynamic Properties of the Solution
1064 //! @{
1065
1066 /// Molar enthalpy. Units: J/kmol.
1067 /**
1068 * Molar enthalpy of the solution. Units: J/kmol.
1069 * (HKM -> Bump up to Parent object)
1070 */
1071 virtual doublereal enthalpy_mole() const;
1072
1073 /**
1074 * Excess molar enthalpy of the solution from
1075 * the mixing process. Units: J/ kmol.
1076 *
1077 * Note this is kmol of the total solution.
1078 */
1079 virtual doublereal relative_enthalpy() const;
1080
1081 /**
1082 * Excess molar enthalpy of the solution from
1083 * the mixing process on a molality basis.
1084 * Units: J/ (kmol add salt).
1085 *
1086 * Note this is kmol of the guessed at salt composition
1087 */
1088 virtual doublereal relative_molal_enthalpy() const;
1089
1090 /// Molar entropy. Units: J/kmol/K.
1091 /**
1092 * Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant
1093 * partial molar volume solution mixture with pure species phases which
1094 * exhibit zero volume expansivity:
1095 * \f[
1096 * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T)
1097 * - \hat R \sum_k X_k log(X_k)
1098 * \f]
1099 * The reference-state pure-species entropies \f$ \hat s^0_k(T,p_{ref}) \f$
1100 * are computed by the species thermodynamic property manager. The pure
1101 * species entropies are independent of temperature since the volume
1102 * expansivities are equal to zero.
1103 * @see MultiSpeciesThermo
1104 *
1105 * (HKM -> Bump up to Parent object)
1106 */
1107 virtual doublereal entropy_mole() const;
1108
1109 /// Molar Gibbs function. Units: J/kmol.
1110 /*!
1111 * (HKM -> Bump up to Parent object)
1112 */
1113 virtual doublereal gibbs_mole() const;
1114
1115 virtual doublereal cp_mole() const;
1116
1117 /// Molar heat capacity at constant volume. Units: J/kmol/K.
1118 /*!
1119 * (HKM -> Bump up to Parent object)
1120 */
1121 virtual doublereal cv_mole() const;
1122
1123 //!@}
1124 //! @name Mechanical Equation of State Properties
1125 /*!
1126 * In this equation of state implementation, the density is a function
1127 * only of the mole fractions. Therefore, it can't be an independent
1128 * variable. Instead, the pressure is used as the independent variable.
1129 * Functions which try to set the thermodynamic state by calling
1130 * setDensity() will cause an exception to be thrown.
1131 */
1132 //!@{
1133
1134 protected:
1135 /**
1136 * Calculate the density of the mixture using the partial
1137 * molar volumes and mole fractions as input
1138 *
1139 * The formula for this is
1140 *
1141 * \f[
1142 * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
1143 * \f]
1144 *
1145 * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
1146 * weights, and \f$V_k\f$ are the pure species molar volumes.
1147 *
1148 * Note, the basis behind this formula is that in an ideal solution the
1149 * partial molar volumes are equal to the pure species molar volumes. We
1150 * have additionally specified in this class that the pure species molar
1151 * volumes are independent of temperature and pressure.
1152 *
1153 * NOTE: This is a non-virtual function, which is not a member of the
1154 * ThermoPhase base class.
1155 */
1156 void calcDensity();
1157
1158 public:
1159 /**
1160 * @}
1161 * @name Activities, Standard States, and Activity Concentrations
1162 *
1163 * The activity \f$a_k\f$ of a species in solution is related to the
1164 * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
1165 * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
1166 * which depends only on temperature and the pressure. Activity is assumed
1167 * to be molality-based here.
1168 * @{
1169 */
1170
1171 //! This method returns an array of generalized activity concentrations
1172 /*!
1173 * The generalized activity concentrations, \f$ C_k^a\f$, are defined such
1174 * that \f$ a_k = C^a_k / C^0_k, \f$ where \f$ C^0_k \f$ is a standard
1175 * concentration defined below. These generalized concentrations are used
1176 * by kinetics manager classes to compute the forward and reverse rates of
1177 * elementary reactions.
1178 *
1179 * The generalized activity concentration of a solute species has the
1180 * following form
1181 *
1182 * \f[
1183 * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
1184 * \f]
1185 *
1186 * The generalized activity concentration of the solvent has the same units,
1187 * but it's a simpler form
1188 *
1189 * \f[
1190 * C_o^a = C^o_o a_o
1191 * \f]
1192 *
1193 * @param c Array of generalized concentrations. The
1194 * units are kmol m-3 for both the solvent and the solute species
1195 */
1196 virtual void getActivityConcentrations(doublereal* c) const;
1197
1198 //! Return the standard concentration for the kth species
1199 /*!
1200 * The standard concentration \f$ C^0_k \f$ used to normalize the activity
1201 * (that is, generalized) concentration for use
1202 *
1203 * We have set the standard concentration for all solute species in this
1204 * phase equal to the default concentration of the solvent at the system
1205 * temperature and pressure multiplied by Mnaught (kg solvent / gmol
1206 * solvent). The solvent standard concentration is just equal to its
1207 * standard state concentration.
1208 *
1209 * \f[
1210 * C_j^0 = C^o_o \tilde{M}_o \quad and C_o^0 = C^o_o
1211 * \f]
1212 *
1213 * The consequence of this is that the standard concentrations have unequal
1214 * units between the solvent and the solute. However, both the solvent and
1215 * the solute activity concentrations will have the same units of kmol/kg^3.
1216 *
1217 * This means that the kinetics operator essentially works on an generalized
1218 * concentration basis (kmol / m3), with units for the kinetic rate constant
1219 * specified as if all reactants (solvent or solute) are on a concentration
1220 * basis (kmol /m3). The concentration will be modified by the activity
1221 * coefficients.
1222 *
1223 * For example, a bulk-phase binary reaction between liquid solute species
1224 * *j* and *k*, producing a new liquid solute species *l* would have the
1225 * following equation for its rate of progress variable, \f$ R^1 \f$, which
1226 * has units of kmol m-3 s-1.
1227 *
1228 * \f[
1229 * R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k)
1230 * \f]
1231 *
1232 * where
1233 *
1234 * \f[
1235 * C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k
1236 * \f]
1237 *
1238 * \f$ C_j^a \f$ is the activity concentration of species *j*, and
1239 * \f$ C_k^a \f$ is the activity concentration of species *k*. \f$ C^o_o \f$
1240 * is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ has
1241 * units of kg solvent per gmol solvent and is equal to
1242 *
1243 * \f[
1244 * \tilde{M}_o = \frac{M_o}{1000}
1245 * \f]
1246 *
1247 * \f$ a_j \f$ is
1248 * the activity of species *j* at the current temperature and pressure
1249 * and concentration of the liquid phase is given by the molality based
1250 * activity coefficient multiplied by the molality of the jth species.
1251 *
1252 * \f[
1253 * a_j = \gamma_j^\triangle m_j = \gamma_j^\triangle \frac{n_j}{\tilde{M}_o n_o}
1254 * \f]
1255 *
1256 * \f$k^1 \f$ has units of m^3/kmol/s.
1257 *
1258 * Therefore the generalized activity concentration of a solute species has
1259 * the following form
1260 *
1261 * \f[
1262 * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
1263 * \f]
1264 *
1265 * The generalized activity concentration of the solvent has the same units,
1266 * but it's a simpler form
1267 *
1268 * \f[
1269 * C_o^a = C^o_o a_o
1270 * \f]
1271 *
1272 * @param k Optional parameter indicating the species. The default is to
1273 * assume this refers to species 0.
1274 * @returns the standard Concentration in units of m^3/kmol.
1275 */
1276 virtual doublereal standardConcentration(size_t k=0) const;
1277
1278 //! Get the array of non-dimensional activities at the current solution
1279 //! temperature, pressure, and solution concentration.
1280 /*!
1281 *
1282 * We resolve this function at this level by calling on the
1283 * activityConcentration function. However, derived classes may want to
1284 * override this default implementation.
1285 *
1286 * (note solvent is on molar scale).
1287 *
1288 * @param ac Output vector of activities. Length: m_kk.
1289 */
1290 virtual void getActivities(doublereal* ac) const;
1291
1292 //! @}
1293 //! @name Partial Molar Properties of the Solution
1294 //! @{
1295
1296 //! Get the species chemical potentials. Units: J/kmol.
1297 /*!
1298 *
1299 * This function returns a vector of chemical potentials of the
1300 * species in solution.
1301 *
1302 * \f[
1303 * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k)
1304 * \f]
1305 *
1306 * @param mu Output vector of species chemical
1307 * potentials. Length: m_kk. Units: J/kmol
1308 */
1309 virtual void getChemPotentials(doublereal* mu) const;
1310
1311 //! Returns an array of partial molar enthalpies for the species
1312 //! in the mixture. Units (J/kmol)
1313 /*!
1314 * For this phase, the partial molar enthalpies are equal to the standard
1315 * state enthalpies modified by the derivative of the molality-based
1316 * activity coefficient wrt temperature
1317 *
1318 * \f[
1319 * \bar h_k(T,P) = h^{\triangle}_k(T,P)
1320 * - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT}
1321 * \f]
1322 * The solvent partial molar enthalpy is equal to
1323 * \f[
1324 * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o)}{dT}
1325 * = h^{o}_o(T,P)
1326 * + R T^2 (\sum_{k \neq o} m_k) \tilde{M_o} (\frac{d \phi}{dT})
1327 * \f]
1328 *
1329 * @param hbar Output vector of species partial molar enthalpies.
1330 * Length: m_kk. units are J/kmol.
1331 */
1332 virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
1333
1334 //! Returns an array of partial molar entropies of the species in the
1335 //! solution. Units: J/kmol/K.
1336 /*!
1337 * Maxwell's equations provide an answer for how calculate this
1338 * (p.215 Smith and Van Ness)
1339 *
1340 * d(chemPot_i)/dT = -sbar_i
1341 *
1342 * For this phase, the partial molar entropies are equal to the SS species
1343 * entropies plus the ideal solution contribution plus complicated functions
1344 * of the temperature derivative of the activity coefficients.
1345 *
1346 * \f[
1347 * \bar s_k(T,P) = s^{\triangle}_k(T,P)
1348 * - R \ln( \gamma^{\triangle}_k \frac{m_k}{m^{\triangle}}))
1349 * - R T \frac{d \ln(\gamma^{\triangle}_k) }{dT}
1350 * \f]
1351 * \f[
1352 * \bar s_o(T,P) = s^o_o(T,P) - R \ln(a_o)
1353 * - R T \frac{d \ln(a_o)}{dT}
1354 * \f]
1355 *
1356 * @param sbar Output vector of species partial molar entropies.
1357 * Length = m_kk. units are J/kmol/K.
1358 */
1359 virtual void getPartialMolarEntropies(doublereal* sbar) const;
1360
1361 //! Return an array of partial molar volumes for the species in the mixture.
1362 //! Units: m^3/kmol.
1363 /*!
1364 * For this solution, the partial molar volumes are functions of the
1365 * pressure derivatives of the activity coefficients.
1366 *
1367 * \f[
1368 * \bar V_k(T,P) = V^{\triangle}_k(T,P)
1369 * + R T \frac{d \ln(\gamma^{\triangle}_k) }{dP}
1370 * \f]
1371 * \f[
1372 * \bar V_o(T,P) = V^o_o(T,P)
1373 * + R T \frac{d \ln(a_o)}{dP}
1374 * \f]
1375 *
1376 * @param vbar Output vector of species partial molar volumes.
1377 * Length = m_kk. units are m^3/kmol.
1378 */
1379 virtual void getPartialMolarVolumes(doublereal* vbar) const;
1380
1381 //! Return an array of partial molar heat capacities for the species in the
1382 //! mixture. Units: J/kmol/K
1383 /*!
1384 * The following formulas are implemented within the code.
1385 *
1386 * \f[
1387 * \bar C_{p,k}(T,P) = C^{\triangle}_{p,k}(T,P)
1388 * - 2 R T \frac{d \ln( \gamma^{\triangle}_k)}{dT}
1389 * - R T^2 \frac{d^2 \ln(\gamma^{\triangle}_k) }{{dT}^2}
1390 * \f]
1391 * \f[
1392 * \bar C_{p,o}(T,P) = C^o_{p,o}(T,P)
1393 * - 2 R T \frac{d \ln(a_o)}{dT}
1394 * - R T^2 \frac{d^2 \ln(a_o)}{{dT}^2}
1395 * \f]
1396 *
1397 * @param cpbar Output vector of species partial molar heat capacities at
1398 * constant pressure. Length = m_kk. units are J/kmol/K.
1399 */
1400 virtual void getPartialMolarCp(doublereal* cpbar) const;
1401
1402 public:
1403 //! @}
1404
1405 //! Get the saturation pressure for a given temperature.
1406 /*!
1407 * Note the limitations of this function. Stability considerations
1408 * concerning multiphase equilibrium are ignored in this calculation.
1409 * Therefore, the call is made directly to the SS of water underneath. The
1410 * object is put back into its original state at the end of the call.
1411 *
1412 * @todo This is probably not implemented correctly. The stability of the
1413 * salt should be added into this calculation. The underlying water
1414 * model may be called to get the stability of the pure water
1415 * solution, if needed.
1416 *
1417 * @param T Temperature (kelvin)
1418 */
1419 virtual doublereal satPressure(doublereal T);
1420
1421 /*
1422 * -------------- Utilities -------------------------------
1423 */
1424
1425 void setBinarySalt(const std::string& sp1, const std::string& sp2,
1426 size_t nParams, double* beta0, double* beta1, double* beta2,
1427 double* Cphi, double alpha1, double alpha2);
1428 void setTheta(const std::string& sp1, const std::string& sp2,
1429 size_t nParams, double* theta);
1430 void setPsi(const std::string& sp1, const std::string& sp2,
1431 const std::string& sp3, size_t nParams, double* psi);
1432 void setLambda(const std::string& sp1, const std::string& sp2,
1433 size_t nParams, double* lambda);
1434 void setMunnn(const std::string& sp, size_t nParams, double* munnn);
1435 void setZeta(const std::string& sp1, const std::string& sp2,
1436 const std::string& sp3, size_t nParams, double* psi);
1437
1438 void setPitzerTempModel(const std::string& model);
1439 void setPitzerRefTemperature(double Tref) {
1440 m_TempPitzerRef = Tref;
1441 }
1442
1443 //! Set the A_Debye parameter. If a negative value is provided, enables
1444 //! calculation of A_Debye using the detailed water equation of state.
1445 void setA_Debye(double A);
1446
1447 void setMaxIonicStrength(double Imax) {
1448 m_maxIionicStrength = Imax;
1449 }
1450
1451 void setCroppingCoefficients(double ln_gamma_k_min, double ln_gamma_k_max,
1452 double ln_gamma_o_min, double ln_gamma_o_max);
1453
1454 virtual void initThermo();
1455 virtual void getParameters(AnyMap& phaseNode) const;
1456
1457 //! Initialize the phase parameters from an XML file.
1458 /*!
1459 * This gets called from importPhase(). It processes the XML file after the
1460 * species are set up. This is the main routine for reading in activity
1461 * coefficient parameters.
1462 *
1463 * @param phaseNode This object must be the phase node of a complete XML
1464 * tree description of the phase, including all of the species
1465 * data. In other words while "phase" must point to an XML phase
1466 * object, it must have sibling nodes "speciesData" that
1467 * describe the species in the phase.
1468 * @param id ID of the phase. If nonnull, a check is done to see if
1469 * phaseNode is pointing to the phase with the correct id.
1470 *
1471 * @deprecated The XML input format is deprecated and will be removed in
1472 * Cantera 3.0.
1473 */
1474 virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
1475
1476 //! Value of the Debye Huckel constant as a function of temperature
1477 //! and pressure.
1478 /*!
1479 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1480 *
1481 * Units = sqrt(kg/gmol)
1482 *
1483 * @param temperature Temperature of the derivative calculation
1484 * or -1 to indicate the current temperature
1485 * @param pressure Pressure of the derivative calculation
1486 * or -1 to indicate the current pressure
1487 */
1488 virtual double A_Debye_TP(double temperature = -1.0,
1489 double pressure = -1.0) const;
1490
1491 //! Value of the derivative of the Debye Huckel constant with respect to
1492 //! temperature as a function of temperature and pressure.
1493 /*!
1494 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1495 *
1496 * Units = sqrt(kg/gmol)
1497 *
1498 * @param temperature Temperature of the derivative calculation
1499 * or -1 to indicate the current temperature
1500 * @param pressure Pressure of the derivative calculation
1501 * or -1 to indicate the current pressure
1502 */
1503 virtual double dA_DebyedT_TP(double temperature = -1.0,
1504 double pressure = -1.0) const;
1505
1506 /**
1507 * Value of the derivative of the Debye Huckel constant with respect to
1508 * pressure, as a function of temperature and pressure.
1509 *
1510 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1511 *
1512 * Units = sqrt(kg/gmol)
1513 *
1514 * @param temperature Temperature of the derivative calculation
1515 * or -1 to indicate the current temperature
1516 * @param pressure Pressure of the derivative calculation
1517 * or -1 to indicate the current pressure
1518 */
1519 virtual double dA_DebyedP_TP(double temperature = -1.0,
1520 double pressure = -1.0) const;
1521
1522 /**
1523 * Return Pitzer's definition of A_L. This is basically the
1524 * derivative of the A_phi multiplied by 4 R T**2
1525 *
1526 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1527 * dA_phidT = d(A_Debye)/dT / 3.0
1528 * A_L = dA_phidT * (4 * R * T * T)
1529 *
1530 * Units = sqrt(kg/gmol) (RT)
1531 *
1532 * @param temperature Temperature of the derivative calculation
1533 * or -1 to indicate the current temperature
1534 * @param pressure Pressure of the derivative calculation
1535 * or -1 to indicate the current pressure
1536 */
1537 double ADebye_L(double temperature = -1.0,
1538 double pressure = -1.0) const;
1539
1540 /**
1541 * Return Pitzer's definition of A_J. This is basically the temperature
1542 * derivative of A_L, and the second derivative of A_phi
1543 *
1544 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1545 * dA_phidT = d(A_Debye)/dT / 3.0
1546 * A_J = 2 A_L/T + 4 * R * T * T * d2(A_phi)/dT2
1547 *
1548 * Units = sqrt(kg/gmol) (R)
1549 *
1550 * @param temperature Temperature of the derivative calculation
1551 * or -1 to indicate the current temperature
1552 * @param pressure Pressure of the derivative calculation
1553 * or -1 to indicate the current pressure
1554 */
1555 double ADebye_J(double temperature = -1.0,
1556 double pressure = -1.0) const;
1557
1558 /**
1559 * Return Pitzer's definition of A_V. This is the derivative wrt pressure of
1560 * A_phi multiplied by - 4 R T
1561 *
1562 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1563 * dA_phidT = d(A_Debye)/dP / 3.0
1564 * A_V = - dA_phidP * (4 * R * T)
1565 *
1566 * Units = sqrt(kg/gmol) (RT) / Pascal
1567 *
1568 * @param temperature Temperature of the derivative calculation
1569 * or -1 to indicate the current temperature
1570 * @param pressure Pressure of the derivative calculation
1571 * or -1 to indicate the current pressure
1572 */
1573 double ADebye_V(double temperature = -1.0,
1574 double pressure = -1.0) const;
1575
1576 //! Value of the 2nd derivative of the Debye Huckel constant with respect to
1577 //! temperature as a function of temperature and pressure.
1578 /*!
1579 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1580 *
1581 * Units = sqrt(kg/gmol)
1582 *
1583 * @param temperature Temperature of the derivative calculation
1584 * or -1 to indicate the current temperature
1585 * @param pressure Pressure of the derivative calculation
1586 * or -1 to indicate the current pressure
1587 */
1588 virtual double d2A_DebyedT2_TP(double temperature = -1.0,
1589 double pressure = -1.0) const;
1590
1591 //! Print out all of the input Pitzer coefficients.
1592 void printCoeffs() const;
1593
1594 //! Get the array of unscaled non-dimensional molality based
1595 //! activity coefficients at the current solution temperature,
1596 //! pressure, and solution concentration.
1597 /*!
1598 * See Denbigh p. 278 for a thorough discussion. This class must be
1599 * overridden in classes which derive from MolalityVPSSTP. This function
1600 * takes over from the molar-based activity coefficient calculation,
1601 * getActivityCoefficients(), in derived classes.
1602 *
1603 * @param acMolality Output vector containing the molality based activity coefficients.
1604 * length: m_kk.
1605 */
1606 void getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const;
1607
1608 private:
1609 //! Apply the current phScale to a set of activity Coefficients
1610 /*!
1611 * See the Eq3/6 Manual for a thorough discussion.
1612 */
1613 void s_updateScaling_pHScaling() const;
1614
1615 //! Apply the current phScale to a set of derivatives of the activity
1616 //! Coefficients wrt temperature
1617 /*!
1618 * See the Eq3/6 Manual for a thorough discussion of the need
1619 */
1620 void s_updateScaling_pHScaling_dT() const;
1621
1622 //! Apply the current phScale to a set of 2nd derivatives of the activity
1623 //! Coefficients wrt temperature
1624 /*!
1625 * See the Eq3/6 Manual for a thorough discussion of the need
1626 */
1627 void s_updateScaling_pHScaling_dT2() const;
1628
1629 //! Apply the current phScale to a set of derivatives of the activity
1630 //! Coefficients wrt pressure
1631 /*!
1632 * See the Eq3/6 Manual for a thorough discussion of the need
1633 */
1634 void s_updateScaling_pHScaling_dP() const;
1635
1636 //! Calculate the Chlorine activity coefficient on the NBS scale
1637 /*!
1638 * We assume here that the m_IionicMolality variable is up to date.
1639 */
1640 doublereal s_NBS_CLM_lnMolalityActCoeff() const;
1641
1642 //! Calculate the temperature derivative of the Chlorine activity
1643 //! coefficient on the NBS scale
1644 /*!
1645 * We assume here that the m_IionicMolality variable is up to date.
1646 */
1647 doublereal s_NBS_CLM_dlnMolalityActCoeff_dT() const;
1648
1649 //! Calculate the second temperature derivative of the Chlorine activity
1650 //! coefficient on the NBS scale
1651 /*!
1652 * We assume here that the m_IionicMolality variable is up to date.
1653 */
1654 doublereal s_NBS_CLM_d2lnMolalityActCoeff_dT2() const;
1655
1656 //! Calculate the pressure derivative of the Chlorine activity coefficient
1657 /*!
1658 * We assume here that the m_IionicMolality variable is up to date.
1659 */
1660 doublereal s_NBS_CLM_dlnMolalityActCoeff_dP() const;
1661
1662 private:
1663 /**
1664 * This is the form of the temperature dependence of Pitzer parameterization
1665 * used in the model.
1666 *
1667 * PITZER_TEMP_CONSTANT 0
1668 * PITZER_TEMP_LINEAR 1
1669 * PITZER_TEMP_COMPLEX1 2
1670 */
1671 int m_formPitzerTemp;
1672
1673 //! Current value of the ionic strength on the molality scale Associated
1674 //! Salts, if present in the mechanism, don't contribute to the value of the
1675 //! ionic strength in this version of the Ionic strength.
1676 mutable double m_IionicMolality;
1677
1678 //! Maximum value of the ionic strength allowed in the calculation of the
1679 //! activity coefficients.
1680 double m_maxIionicStrength;
1681
1682 //! Reference Temperature for the Pitzer formulations.
1683 double m_TempPitzerRef;
1684
1685 public:
1686 /**
1687 * Form of the constant outside the Debye-Huckel term called A. It's
1688 * normally a function of temperature and pressure. However, it can be set
1689 * from the input file in order to aid in numerical comparisons. Acceptable
1690 * forms:
1691 *
1692 * A_DEBYE_CONST 0
1693 * A_DEBYE_WATER 1
1694 *
1695 * The A_DEBYE_WATER form may be used for water solvents with needs to cover
1696 * varying temperatures and pressures. Note, the dielectric constant of
1697 * water is a relatively strong function of T, and its variability must be
1698 * accounted for,
1699 */
1700 int m_form_A_Debye;
1701
1702 private:
1703 /**
1704 * A_Debye: this expression appears on the top of the ln actCoeff term in
1705 * the general Debye-Huckel expression It depends on temperature.
1706 * And, therefore, most be recalculated whenever T or P changes.
1707 * This variable is a local copy of the calculation.
1708 *
1709 * A_Debye = (F e B_Debye) / (8 Pi epsilon R T)
1710 *
1711 * where B_Debye = F / sqrt(epsilon R T/2)
1712 * (dw/1000)^(1/2)
1713 *
1714 * A_Debye = (1/ (8 Pi)) (2 Na * dw/1000)^(1/2)
1715 * (e * e / (epsilon * kb * T))^(3/2)
1716 *
1717 * Units = sqrt(kg/gmol)
1718 *
1719 * Nominal value = 1.172576 sqrt(kg/gmol)
1720 * based on:
1721 * epsilon/epsilon_0 = 78.54
1722 * (water at 25C)
1723 * epsilon_0 = 8.854187817E-12 C2 N-1 m-2
1724 * e = 1.60217653 E-19 C
1725 * F = 9.6485309E7 C kmol-1
1726 * R = 8.314472E3 kg m2 s-2 kmol-1 K-1
1727 * T = 298.15 K
1728 * B_Debye = 3.28640E9 sqrt(kg/gmol)/m
1729 * dw = C_0 * M_0 (density of water) (kg/m3)
1730 * = 1.0E3 at 25C
1731 */
1732 mutable double m_A_Debye;
1733
1734 //! Water standard state calculator
1735 /*!
1736 * derived from the equation of state for water.
1737 */
1738 PDSS* m_waterSS;
1739
1740 //! Pointer to the water property calculator
1741 std::unique_ptr<WaterProps> m_waterProps;
1742
1743 //! vector of size m_kk, used as a temporary holding area.
1744 mutable vector_fp m_tmpV;
1745
1746 /**
1747 * Array of 2D data used in the Pitzer/HMW formulation. Beta0_ij[i][j] is
1748 * the value of the Beta0 coefficient for the ij salt. It will be nonzero
1749 * iff i and j are both charged and have opposite sign. The array is also
1750 * symmetric. counterIJ where counterIJ = m_counterIJ[i][j] is used to
1751 * access this array.
1752 */
1753 mutable vector_fp m_Beta0MX_ij;
1754
1755 //! Derivative of Beta0_ij[i][j] wrt T. Vector index is counterIJ
1756 mutable vector_fp m_Beta0MX_ij_L;
1757
1758 //! Derivative of Beta0_ij[i][j] wrt TT. Vector index is counterIJ
1759 mutable vector_fp m_Beta0MX_ij_LL;
1760
1761 //! Derivative of Beta0_ij[i][j] wrt P. Vector index is counterIJ
1762 mutable vector_fp m_Beta0MX_ij_P;
1763
1764 //! Array of coefficients for Beta0, a variable in Pitzer's papers
1765 /*!
1766 * Column index is counterIJ. m_Beta0MX_ij_coeff.ptrColumn(counterIJ) is a
1767 * double* containing the vector of coefficients for the counterIJ
1768 * interaction.
1769 */
1770 mutable Array2D m_Beta0MX_ij_coeff;
1771
1772 //! Array of 2D data used in the Pitzer/HMW formulation. Beta1_ij[i][j] is
1773 //! the value of the Beta1 coefficient for the ij salt. It will be nonzero
1774 //! iff i and j are both charged and have opposite sign. The array is also
1775 //! symmetric. counterIJ where counterIJ = m_counterIJ[i][j] is used to
1776 //! access this array.
1777 mutable vector_fp m_Beta1MX_ij;
1778
1779 //! Derivative of Beta1_ij[i][j] wrt T. Vector index is counterIJ
1780 mutable vector_fp m_Beta1MX_ij_L;
1781
1782 //! Derivative of Beta1_ij[i][j] wrt TT. Vector index is counterIJ
1783 mutable vector_fp m_Beta1MX_ij_LL;
1784
1785 //! Derivative of Beta1_ij[i][j] wrt P. Vector index is counterIJ
1786 mutable vector_fp m_Beta1MX_ij_P;
1787
1788 //! Array of coefficients for Beta1, a variable in Pitzer's papers
1789 /*!
1790 * Column index is counterIJ. m_Beta1MX_ij_coeff.ptrColumn(counterIJ) is a
1791 * double* containing the vector of coefficients for the counterIJ
1792 * interaction.
1793 */
1794 mutable Array2D m_Beta1MX_ij_coeff;
1795
1796 //! Array of 2D data used in the Pitzer/HMW formulation. Beta2_ij[i][j] is
1797 //! the value of the Beta2 coefficient for the ij salt. It will be nonzero
1798 //! iff i and j are both charged and have opposite sign, and i and j both
1799 //! have charges of 2 or more. The array is also symmetric. counterIJ where
1800 //! counterIJ = m_counterIJ[i][j] is used to access this array.
1801 mutable vector_fp m_Beta2MX_ij;
1802
1803 //! Derivative of Beta2_ij[i][j] wrt T. Vector index is counterIJ
1804 mutable vector_fp m_Beta2MX_ij_L;
1805
1806 //! Derivative of Beta2_ij[i][j] wrt TT. Vector index is counterIJ
1807 mutable vector_fp m_Beta2MX_ij_LL;
1808
1809 //! Derivative of Beta2_ij[i][j] wrt P. Vector index is counterIJ
1810 mutable vector_fp m_Beta2MX_ij_P;
1811
1812 //! Array of coefficients for Beta2, a variable in Pitzer's papers
1813 /*!
1814 * column index is counterIJ. m_Beta2MX_ij_coeff.ptrColumn(counterIJ) is a
1815 * double* containing the vector of coefficients for the counterIJ
1816 * interaction. This was added for the YMP database version of the code
1817 * since it contains temperature-dependent parameters for some 2-2
1818 * electrolytes.
1819 */
1820 mutable Array2D m_Beta2MX_ij_coeff;
1821
1822 // Array of 2D data used in the Pitzer/HMW formulation. Alpha1MX_ij[i][j] is
1823 // the value of the alpha1 coefficient for the ij interaction. It will be
1824 // nonzero iff i and j are both charged and have opposite sign. It is
1825 // symmetric wrt i, j. counterIJ where counterIJ = m_counterIJ[i][j] is used
1826 // to access this array.
1827 vector_fp m_Alpha1MX_ij;
1828
1829 //! Array of 2D data used in the Pitzer/HMW formulation. Alpha2MX_ij[i][j]
1830 //! is the value of the alpha2 coefficient for the ij interaction. It will
1831 //! be nonzero iff i and j are both charged and have opposite sign, and i
1832 //! and j both have charges of 2 or more, usually. It is symmetric wrt i, j.
1833 //! counterIJ, where counterIJ = m_counterIJ[i][j], is used to access this
1834 //! array.
1835 vector_fp m_Alpha2MX_ij;
1836
1837 //! Array of 2D data used in the Pitzer/HMW formulation. CphiMX_ij[i][j] is
1838 //! the value of the Cphi coefficient for the ij interaction. It will be
1839 //! nonzero iff i and j are both charged and have opposite sign, and i and j
1840 //! both have charges of 2 or more. The array is also symmetric. counterIJ
1841 //! where counterIJ = m_counterIJ[i][j] is used to access this array.
1842 mutable vector_fp m_CphiMX_ij;
1843
1844 //! Derivative of Cphi_ij[i][j] wrt T. Vector index is counterIJ
1845 mutable vector_fp m_CphiMX_ij_L;
1846
1847 //! Derivative of Cphi_ij[i][j] wrt TT. Vector index is counterIJ
1848 mutable vector_fp m_CphiMX_ij_LL;
1849
1850 //! Derivative of Cphi_ij[i][j] wrt P. Vector index is counterIJ
1851 mutable vector_fp m_CphiMX_ij_P;
1852
1853 //! Array of coefficients for CphiMX, a parameter in the activity
1854 //! coefficient formulation
1855 /*!
1856 * Column index is counterIJ. m_CphiMX_ij_coeff.ptrColumn(counterIJ) is a
1857 * double* containing the vector of coefficients for the counterIJ
1858 * interaction.
1859 */
1860 mutable Array2D m_CphiMX_ij_coeff;
1861
1862 //! Array of 2D data for Theta_ij[i][j] in the Pitzer/HMW formulation.
1863 /*!
1864 * Array of 2D data used in the Pitzer/HMW formulation. Theta_ij[i][j] is
1865 * the value of the theta coefficient for the ij interaction. It will be
1866 * nonzero for charged ions with the same sign. It is symmetric. counterIJ
1867 * where counterIJ = m_counterIJ[i][j] is used to access this array.
1868 *
1869 * HKM Recent Pitzer papers have used a functional form for Theta_ij, which
1870 * depends on the ionic strength.
1871 */
1872 mutable vector_fp m_Theta_ij;
1873
1874 //! Derivative of Theta_ij[i][j] wrt T. Vector index is counterIJ
1875 mutable vector_fp m_Theta_ij_L;
1876
1877 //! Derivative of Theta_ij[i][j] wrt TT. Vector index is counterIJ
1878 mutable vector_fp m_Theta_ij_LL;
1879
1880 //! Derivative of Theta_ij[i][j] wrt P. Vector index is counterIJ
1881 mutable vector_fp m_Theta_ij_P;
1882
1883 //! Array of coefficients for Theta_ij[i][j] in the Pitzer/HMW formulation.
1884 /*!
1885 * Theta_ij[i][j] is the value of the theta coefficient for the ij
1886 * interaction. It will be nonzero for charged ions with the same sign. It
1887 * is symmetric. Column index is counterIJ. counterIJ where counterIJ =
1888 * m_counterIJ[i][j] is used to access this array.
1889 *
1890 * m_Theta_ij_coeff.ptrColumn(counterIJ) is a double* containing
1891 * the vector of coefficients for the counterIJ interaction.
1892 */
1893 Array2D m_Theta_ij_coeff;
1894
1895 //! Array of 3D data used in the Pitzer/HMW formulation.
1896 /*!
1897 * Psi_ijk[n] is the value of the psi coefficient for the
1898 * ijk interaction where
1899 *
1900 * n = k + j * m_kk + i * m_kk * m_kk;
1901 *
1902 * It is potentially nonzero everywhere. The first two coordinates are
1903 * symmetric wrt cations, and the last two coordinates are symmetric wrt
1904 * anions.
1905 */
1906 mutable vector_fp m_Psi_ijk;
1907
1908 //! Derivative of Psi_ijk[n] wrt T. See m_Psi_ijk for reference on the
1909 //! indexing into this variable.
1910 mutable vector_fp m_Psi_ijk_L;
1911
1912 //! Derivative of Psi_ijk[n] wrt TT. See m_Psi_ijk for reference on the
1913 //! indexing into this variable.
1914 mutable vector_fp m_Psi_ijk_LL;
1915
1916 //! Derivative of Psi_ijk[n] wrt P. See m_Psi_ijk for reference on the
1917 //! indexing into this variable.
1918 mutable vector_fp m_Psi_ijk_P;
1919
1920 //! Array of coefficients for Psi_ijk[n] in the Pitzer/HMW formulation.
1921 /*!
1922 * Psi_ijk[n] is the value of the psi coefficient for the
1923 * ijk interaction where
1924 *
1925 * n = k + j * m_kk + i * m_kk * m_kk;
1926 *
1927 * It is potentially nonzero everywhere. The first two coordinates are
1928 * symmetric wrt cations, and the last two coordinates are symmetric wrt
1929 * anions.
1930 *
1931 * m_Psi_ijk_coeff.ptrColumn(n) is a double* containing the vector of
1932 * coefficients for the n interaction.
1933 */
1934 Array2D m_Psi_ijk_coeff;
1935
1936 //! Lambda coefficient for the ij interaction
1937 /*!
1938 * Array of 2D data used in the Pitzer/HMW formulation. Lambda_nj[n][j]
1939 * represents the lambda coefficient for the ij interaction. This is a
1940 * general interaction representing neutral species. The neutral species
1941 * occupy the first index, that is, n. The charged species occupy the j
1942 * coordinate. neutral, neutral interactions are also included here.
1943 */
1944 mutable Array2D m_Lambda_nj;
1945
1946 //! Derivative of Lambda_nj[i][j] wrt T. see m_Lambda_ij
1947 mutable Array2D m_Lambda_nj_L;
1948
1949 //! Derivative of Lambda_nj[i][j] wrt TT
1950 mutable Array2D m_Lambda_nj_LL;
1951
1952 //! Derivative of Lambda_nj[i][j] wrt P
1953 mutable Array2D m_Lambda_nj_P;
1954
1955 //! Array of coefficients for Lambda_nj[i][j] in the Pitzer/HMW formulation.
1956 /*!
1957 * Array of 2D data used in the Pitzer/HMW formulation. Lambda_ij[i][j]
1958 * represents the lambda coefficient for the ij interaction. This is a
1959 * general interaction representing neutral species. The neutral species
1960 * occupy the first index, that is, i. The charged species occupy the j
1961 * coordinate. Neutral, neutral interactions are also included here.
1962 *
1963 * n = j + m_kk * i
1964 *
1965 * m_Lambda_ij_coeff.ptrColumn(n) is a double* containing the vector of
1966 * coefficients for the (i,j) interaction.
1967 */
1968 Array2D m_Lambda_nj_coeff;
1969
1970 //! Mu coefficient for the self-ternary neutral coefficient
1971 /*!
1972 * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn[i] represents
1973 * the Mu coefficient for the nnn interaction. This is a general interaction
1974 * representing neutral species interacting with itself.
1975 */
1976 mutable vector_fp m_Mu_nnn;
1977
1978 //! Mu coefficient temperature derivative for the self-ternary neutral
1979 //! coefficient
1980 /*!
1981 * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i]
1982 * represents the Mu coefficient temperature derivative for the nnn
1983 * interaction. This is a general interaction representing neutral species
1984 * interacting with itself.
1985 */
1986 mutable vector_fp m_Mu_nnn_L;
1987
1988 //! Mu coefficient 2nd temperature derivative for the self-ternary neutral
1989 //! coefficient
1990 /*!
1991 * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i]
1992 * represents the Mu coefficient 2nd temperature derivative for the nnn
1993 * interaction. This is a general interaction representing neutral species
1994 * interacting with itself.
1995 */
1996 mutable vector_fp m_Mu_nnn_LL;
1997
1998 //! Mu coefficient pressure derivative for the self-ternary neutral
1999 //! coefficient
2000 /*!
2001 * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i]
2002 * represents the Mu coefficient pressure derivative for the nnn
2003 * interaction. This is a general interaction representing neutral species
2004 * interacting with itself.
2005 */
2006 mutable vector_fp m_Mu_nnn_P;
2007
2008 //! Array of coefficients form_Mu_nnn term
2009 Array2D m_Mu_nnn_coeff;
2010
2011 //! Logarithm of the activity coefficients on the molality scale.
2012 /*!
2013 * mutable because we change this if the composition or temperature or
2014 * pressure changes. Index is the species index
2015 */
2016 mutable vector_fp m_lnActCoeffMolal_Scaled;
2017
2018 //! Logarithm of the activity coefficients on the molality scale.
2019 /*!
2020 * mutable because we change this if the composition or temperature or
2021 * pressure changes. Index is the species index
2022 */
2023 mutable vector_fp m_lnActCoeffMolal_Unscaled;
2024
2025 //! Derivative of the Logarithm of the activity coefficients on the molality
2026 //! scale wrt T. Index is the species index
2027 mutable vector_fp m_dlnActCoeffMolaldT_Scaled;
2028
2029 //! Derivative of the Logarithm of the activity coefficients on the molality
2030 //! scale wrt T. Index is the species index
2031 mutable vector_fp m_dlnActCoeffMolaldT_Unscaled;
2032
2033 //! Derivative of the Logarithm of the activity coefficients on the molality
2034 //! scale wrt TT. Index is the species index.
2035 mutable vector_fp m_d2lnActCoeffMolaldT2_Scaled;
2036
2037 //! Derivative of the Logarithm of the activity coefficients on the molality
2038 //! scale wrt TT. Index is the species index
2039 mutable vector_fp m_d2lnActCoeffMolaldT2_Unscaled;
2040
2041 //! Derivative of the Logarithm of the activity coefficients on the
2042 //! molality scale wrt P. Index is the species index
2043 mutable vector_fp m_dlnActCoeffMolaldP_Scaled;
2044
2045 //! Derivative of the Logarithm of the activity coefficients on the
2046 //! molality scale wrt P. Index is the species index
2047 mutable vector_fp m_dlnActCoeffMolaldP_Unscaled;
2048
2049 // -------- Temporary Variables Used in the Activity Coeff Calc
2050
2051 //! Cropped and modified values of the molalities used in activity
2052 //! coefficient calculations
2053 mutable vector_fp m_molalitiesCropped;
2054
2055 //! Boolean indicating whether the molalities are cropped or are modified
2056 mutable bool m_molalitiesAreCropped;
2057
2058 //! a counter variable for keeping track of symmetric binary
2059 //! interactions amongst the solute species.
2060 /*!
2061 * n = m_kk*i + j
2062 * m_CounterIJ[n] = counterIJ
2063 */
2064 mutable vector_int m_CounterIJ;
2065
2066 //! This is elambda, MEC
2067 mutable double elambda[17];
2068
2069 //! This is elambda1, MEC
2070 mutable double elambda1[17];
2071
2072 /**
2073 * Various temporary arrays used in the calculation of the Pitzer activity
2074 * coefficients. The subscript, L, denotes the same quantity's derivative
2075 * wrt temperature
2076 */
2077
2078 //! This is the value of g(x) in Pitzer's papers. Vector index is counterIJ
2079 mutable vector_fp m_gfunc_IJ;
2080
2081 //! This is the value of g2(x2) in Pitzer's papers. Vector index is counterIJ
2082 mutable vector_fp m_g2func_IJ;
2083
2084 //! hfunc, was called gprime in Pitzer's paper. However, it's not the
2085 //! derivative of gfunc(x), so I renamed it. Vector index is counterIJ
2086 mutable vector_fp m_hfunc_IJ;
2087
2088 //! hfunc2, was called gprime in Pitzer's paper. However, it's not the
2089 //! derivative of gfunc(x), so I renamed it. Vector index is counterIJ
2090 mutable vector_fp m_h2func_IJ;
2091
2092 //! Intermediate variable called BMX in Pitzer's paper. This is the basic
2093 //! cation - anion interaction. Vector index is counterIJ
2094 mutable vector_fp m_BMX_IJ;
2095
2096 //! Derivative of BMX_IJ wrt T. Vector index is counterIJ
2097 mutable vector_fp m_BMX_IJ_L;
2098
2099 //! Derivative of BMX_IJ wrt TT. Vector index is counterIJ
2100 mutable vector_fp m_BMX_IJ_LL;
2101
2102 //! Derivative of BMX_IJ wrt P. Vector index is counterIJ
2103 mutable vector_fp m_BMX_IJ_P;
2104
2105 //! Intermediate variable called BprimeMX in Pitzer's paper. Vector index is
2106 //! counterIJ
2107 mutable vector_fp m_BprimeMX_IJ;
2108
2109 //! Derivative of BprimeMX wrt T. Vector index is counterIJ
2110 mutable vector_fp m_BprimeMX_IJ_L;
2111
2112 //! Derivative of BprimeMX wrt TT. Vector index is counterIJ
2113 mutable vector_fp m_BprimeMX_IJ_LL;
2114
2115 //! Derivative of BprimeMX wrt P. Vector index is counterIJ
2116 mutable vector_fp m_BprimeMX_IJ_P;
2117
2118 //! Intermediate variable called BphiMX in Pitzer's paper. Vector index is
2119 //! counterIJ
2120 mutable vector_fp m_BphiMX_IJ;
2121
2122 //! Derivative of BphiMX_IJ wrt T. Vector index is counterIJ
2123 mutable vector_fp m_BphiMX_IJ_L;
2124
2125 //! Derivative of BphiMX_IJ wrt TT. Vector index is counterIJ
2126 mutable vector_fp m_BphiMX_IJ_LL;
2127
2128 //! Derivative of BphiMX_IJ wrt P. Vector index is counterIJ
2129 mutable vector_fp m_BphiMX_IJ_P;
2130
2131 //! Intermediate variable called Phi in Pitzer's paper. Vector index is
2132 //! counterIJ
2133 mutable vector_fp m_Phi_IJ;
2134
2135 //! Derivative of m_Phi_IJ wrt T. Vector index is counterIJ
2136 mutable vector_fp m_Phi_IJ_L;
2137
2138 //! Derivative of m_Phi_IJ wrt TT. Vector index is counterIJ
2139 mutable vector_fp m_Phi_IJ_LL;
2140
2141 //! Derivative of m_Phi_IJ wrt P. Vector index is counterIJ
2142 mutable vector_fp m_Phi_IJ_P;
2143
2144 //! Intermediate variable called Phiprime in Pitzer's paper. Vector index is
2145 //! counterIJ
2146 mutable vector_fp m_Phiprime_IJ;
2147
2148 //! Intermediate variable called PhiPhi in Pitzer's paper. Vector index is
2149 //! counterIJ
2150 mutable vector_fp m_PhiPhi_IJ;
2151
2152 //! Derivative of m_PhiPhi_IJ wrt T. Vector index is counterIJ
2153 mutable vector_fp m_PhiPhi_IJ_L;
2154
2155 //! Derivative of m_PhiPhi_IJ wrt TT. Vector index is counterIJ
2156 mutable vector_fp m_PhiPhi_IJ_LL;
2157
2158 //! Derivative of m_PhiPhi_IJ wrt P. Vector index is counterIJ
2159 mutable vector_fp m_PhiPhi_IJ_P;
2160
2161 //! Intermediate variable called CMX in Pitzer's paper. Vector index is
2162 //! counterIJ
2163 mutable vector_fp m_CMX_IJ;
2164
2165 //! Derivative of m_CMX_IJ wrt T. Vector index is counterIJ
2166 mutable vector_fp m_CMX_IJ_L;
2167
2168 //! Derivative of m_CMX_IJ wrt TT. Vector index is counterIJ
2169 mutable vector_fp m_CMX_IJ_LL;
2170
2171 //! Derivative of m_CMX_IJ wrt P. Vector index is counterIJ
2172 mutable vector_fp m_CMX_IJ_P;
2173
2174 //! Intermediate storage of the activity coefficient itself. Vector index is
2175 //! the species index
2176 mutable vector_fp m_gamma_tmp;
2177
2178 //! Logarithm of the molal activity coefficients. Normally these are all
2179 //! one. However, stability schemes will change that
2180 mutable vector_fp IMS_lnActCoeffMolal_;
2181
2182 //! value of the solute mole fraction that centers the cutoff polynomials
2183 //! for the cutoff =1 process;
2184 doublereal IMS_X_o_cutoff_;
2185
2186 //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
2187 doublereal IMS_cCut_;
2188
2189 //! Parameter in the polyExp cutoff treatment
2190 /*!
2191 * This is the slope of the g function at the zero solvent point
2192 * Default value is 0.0
2193 */
2194 doublereal IMS_slopegCut_;
2195
2196 //! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay
2197 //! @{
2198 doublereal IMS_dfCut_;
2199 doublereal IMS_efCut_;
2200 doublereal IMS_afCut_;
2201 doublereal IMS_bfCut_;
2202 doublereal IMS_dgCut_;
2203 doublereal IMS_egCut_;
2204 doublereal IMS_agCut_;
2205 doublereal IMS_bgCut_;
2206 //! @}
2207
2208 //! value of the solvent mole fraction that centers the cutoff polynomials
2209 //! for the cutoff =1 process;
2210 doublereal MC_X_o_cutoff_;
2211
2212 //! @name Parameters in the Molality Exp cutoff treatment
2213 //! @{
2214 doublereal MC_dpCut_;
2215 doublereal MC_epCut_;
2216 doublereal MC_apCut_;
2217 doublereal MC_bpCut_;
2218 doublereal MC_cpCut_;
2219 doublereal CROP_ln_gamma_o_min;
2220 doublereal CROP_ln_gamma_o_max;
2221 doublereal CROP_ln_gamma_k_min;
2222 doublereal CROP_ln_gamma_k_max;
2223
2224 //! This is a boolean-type vector indicating whether
2225 //! a species's activity coefficient is in the cropped regime
2226 /*!
2227 * * 0 = Not in cropped regime
2228 * * 1 = In a transition regime where it is altered but there
2229 * still may be a temperature or pressure dependence
2230 * * 2 = In a cropped regime where there is no temperature
2231 * or pressure dependence
2232 */
2233 mutable vector_int CROP_speciesCropped_;
2234 //! @}
2235
2236 //! Initialize all of the species-dependent lengths in the object
2237 void initLengths();
2238
2239 //! Apply the current phScale to a set of activity Coefficients or
2240 //! activities
2241 /*!
2242 * See the Eq3/6 Manual for a thorough discussion.
2243 *
2244 * @param acMolality input/Output vector containing the molality based
2245 * activity coefficients. length: m_kk.
2246 */
2247 virtual void applyphScale(doublereal* acMolality) const;
2248
2249 private:
2250 /*
2251 * This function will be called to update the internally stored
2252 * natural logarithm of the molality activity coefficients
2253 */
2254 void s_update_lnMolalityActCoeff() const;
2255
2256 //! This function calculates the temperature derivative of the
2257 //! natural logarithm of the molality activity coefficients.
2258 /*!
2259 * This function does all of the direct work. The solvent activity
2260 * coefficient is on the molality scale. It's derivative is too.
2261 */
2262 void s_update_dlnMolalityActCoeff_dT() const;
2263
2264 /**
2265 * This function calculates the temperature second derivative of the natural
2266 * logarithm of the molality activity coefficients.
2267 */
2268 void s_update_d2lnMolalityActCoeff_dT2() const;
2269
2270 /**
2271 * This function calculates the pressure derivative of the
2272 * natural logarithm of the molality activity coefficients.
2273 *
2274 * Assumes that the activity coefficients are current.
2275 */
2276 void s_update_dlnMolalityActCoeff_dP() const;
2277
2278 //! This function will be called to update the internally stored
2279 //! natural logarithm of the molality activity coefficients
2280 /*
2281 * Normally they are all one. However, sometimes they are not,
2282 * due to stability schemes
2283 *
2284 * gamma_k_molar = gamma_k_molal / Xmol_solvent
2285 *
2286 * gamma_o_molar = gamma_o_molal
2287 */
2288 void s_updateIMS_lnMolalityActCoeff() const;
2289
2290 private:
2291 //! Calculate the Pitzer portion of the activity coefficients.
2292 /**
2293 * This is the main routine in the whole module. It calculates the molality
2294 * based activity coefficients for the solutes, and the activity of water.
2295 */
2296 void s_updatePitzer_lnMolalityActCoeff() const;
2297
2298 //! Calculates the temperature derivative of the natural logarithm of the
2299 //! molality activity coefficients.
2300 /*!
2301 * Public function makes sure that all dependent data is
2302 * up to date, before calling a private function
2303 */
2304 void s_updatePitzer_dlnMolalityActCoeff_dT() const;
2305
2306 /**
2307 * This function calculates the temperature second derivative of the
2308 * natural logarithm of the molality activity coefficients.
2309 *
2310 * It is assumed that the Pitzer activity coefficient and first derivative
2311 * routine are called immediately preceding the call to this routine.
2312 */
2313 void s_updatePitzer_d2lnMolalityActCoeff_dT2() const;
2314
2315 //! Calculates the Pressure derivative of the natural logarithm of the
2316 //! molality activity coefficients.
2317 /*!
2318 * It is assumed that the Pitzer activity coefficient and first derivative
2319 * routine are called immediately preceding the calling of this routine.
2320 */
2321 void s_updatePitzer_dlnMolalityActCoeff_dP() const;
2322
2323 //! Calculates the Pitzer coefficients' dependence on the temperature.
2324 /*!
2325 * It will also calculate the temperature derivatives of the coefficients,
2326 * as they are important in the calculation of the latent heats and the heat
2327 * capacities of the mixtures.
2328 *
2329 * @param doDerivs If >= 1, then the routine will calculate the first
2330 * derivative. If >= 2, the routine will calculate the first
2331 * and second temperature derivative. default = 2
2332 */
2333 void s_updatePitzer_CoeffWRTemp(int doDerivs = 2) const;
2334
2335 //! Calculate the lambda interactions.
2336 /*!
2337 * Calculate E-lambda terms for charge combinations of like sign, using
2338 * method of Pitzer (1975). This implementation is based on Bethke,
2339 * Appendix 2.
2340 *
2341 * @param is Ionic strength
2342 */
2343 void calc_lambdas(double is) const;
2344 mutable doublereal m_last_is;
2345
2346 /**
2347 * Calculate etheta and etheta_prime
2348 *
2349 * This interaction accounts for the mixing effects of like-signed ions with
2350 * different charges. This interaction will be nonzero for species with the
2351 * same charge. this routine is not to be called for neutral species; it
2352 * core dumps or error exits.
2353 *
2354 * MEC implementation routine.
2355 *
2356 * @param z1 charge of the first molecule
2357 * @param z2 charge of the second molecule
2358 * @param etheta return pointer containing etheta
2359 * @param etheta_prime Return pointer containing etheta_prime.
2360 *
2361 * This routine uses the internal variables, elambda[] and elambda1[].
2362 */
2363 void calc_thetas(int z1, int z2,
2364 double* etheta, double* etheta_prime) const;
2365
2366 //! Set up a counter variable for keeping track of symmetric binary
2367 //! interactions amongst the solute species.
2368 /*!
2369 * The purpose of this is to squeeze the ij parameters into a
2370 * compressed single counter.
2371 *
2372 * n = m_kk*i + j
2373 * m_Counter[n] = counter
2374 */
2375 void counterIJ_setup() const;
2376
2377 //! Calculate the cropped molalities
2378 /*!
2379 * This is an internal routine that calculates values of m_molalitiesCropped
2380 * from m_molalities
2381 */
2382 void calcMolalitiesCropped() const;
2383
2384 //! Process an XML node called "binarySaltParameters"
2385 /*!
2386 * This node contains all of the parameters necessary to describe the Pitzer
2387 * model for that particular binary salt. This function reads the XML file
2388 * and writes the coefficients it finds to an internal data structures.
2389 *
2390 * @param BinSalt reference to the XML_Node named binarySaltParameters
2391 * containing the anion - cation interaction
2392 */
2393 void readXMLBinarySalt(XML_Node& BinSalt);
2394
2395 //! Process an XML node called "thetaAnion" or "thetaCation"
2396 /*!
2397 * This node contains all of the parameters necessary to describe the binary
2398 * interactions between two anions or two cations.
2399 *
2400 * @param BinSalt reference to the XML_Node named thetaAnion containing the
2401 * anion - anion interaction
2402 */
2403 void readXMLTheta(XML_Node& BinSalt);
2404
2405 //! Process an XML node called "psiCommonAnion" or "psiCommonCation"
2406 /*!
2407 * This node contains all of the parameters necessary to describe
2408 * the ternary interactions between one anion and two cations or two anions
2409 * and one cation.
2410 *
2411 * @param BinSalt reference to the XML_Node named psiCommonAnion containing
2412 * the anion - cation1 - cation2 interaction
2413 */
2414 void readXMLPsi(XML_Node& BinSalt);
2415
2416 //! Process an XML node called "lambdaNeutral"
2417 /*!
2418 * This node contains all of the parameters necessary to describe the binary
2419 * interactions between one neutral species and any other species (neutral
2420 * or otherwise) in the mechanism.
2421 *
2422 * @param BinSalt reference to the XML_Node named lambdaNeutral containing
2423 * multiple Neutral - species interactions
2424 */
2425 void readXMLLambdaNeutral(XML_Node& BinSalt);
2426
2427 //! Process an XML node called "MunnnNeutral"
2428 /*!
2429 * This node contains all of the parameters necessary to describe
2430 * the self-ternary interactions for one neutral species.
2431 *
2432 * @param BinSalt reference to the XML_Node named Munnn containing the
2433 * self-ternary interaction
2434 */
2435 void readXMLMunnnNeutral(XML_Node& BinSalt);
2436
2437 //! Process an XML node called "zetaCation"
2438 /*!
2439 * This node contains all of the parameters necessary to describe
2440 * the ternary interactions between one neutral, one cation, and one anion.
2441 *
2442 * @param BinSalt reference to the XML_Node named psiCommonCation
2443 * containing the neutral - cation - anion interaction
2444 */
2445 void readXMLZetaCation(const XML_Node& BinSalt);
2446
2447 //! Precalculate the IMS Cutoff parameters for typeCutoff = 2
2448 void calcIMSCutoffParams_();
2449
2450 //! Calculate molality cut-off parameters
2451 void calcMCCutoffParams_();
2452};
2453
2454}
2455
2456#endif
Array.h
Header file for class Cantera::Array2D.
MolalityVPSSTP.h
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
Cantera::Array2D
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Definition: Array.h:30
Cantera::HMWSoln
Class HMWSoln represents a dilute or concentrated liquid electrolyte phase which obeys the Pitzer for...
Definition: HMWSoln.h:1025
Cantera::HMWSoln::m_CMX_IJ_P
vector_fp m_CMX_IJ_P
Derivative of m_CMX_IJ wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2172
Cantera::HMWSoln::calcIMSCutoffParams_
void calcIMSCutoffParams_()
Precalculate the IMS Cutoff parameters for typeCutoff = 2.
Definition: HMWSoln.cpp:1859
Cantera::HMWSoln::m_Theta_ij_coeff
Array2D m_Theta_ij_coeff
Array of coefficients for Theta_ij[i][j] in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1893
Cantera::HMWSoln::m_BphiMX_IJ_P
vector_fp m_BphiMX_IJ_P
Derivative of BphiMX_IJ wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2129
Cantera::HMWSoln::MC_X_o_cutoff_
doublereal MC_X_o_cutoff_
value of the solvent mole fraction that centers the cutoff polynomials for the cutoff =1 process;
Definition: HMWSoln.h:2210
Cantera::HMWSoln::applyphScale
virtual void applyphScale(doublereal *acMolality) const
Apply the current phScale to a set of activity Coefficients or activities.
Definition: HMWSoln.cpp:4393
Cantera::HMWSoln::m_Beta0MX_ij_coeff
Array2D m_Beta0MX_ij_coeff
Array of coefficients for Beta0, a variable in Pitzer's papers.
Definition: HMWSoln.h:1770
Cantera::HMWSoln::m_PhiPhi_IJ
vector_fp m_PhiPhi_IJ
Intermediate variable called PhiPhi in Pitzer's paper.
Definition: HMWSoln.h:2150
Cantera::HMWSoln::m_Theta_ij_L
vector_fp m_Theta_ij_L
Derivative of Theta_ij[i][j] wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:1875
Cantera::HMWSoln::m_BMX_IJ_L
vector_fp m_BMX_IJ_L
Derivative of BMX_IJ wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2097
Cantera::HMWSoln::m_BMX_IJ_P
vector_fp m_BMX_IJ_P
Derivative of BMX_IJ wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2103
Cantera::HMWSoln::m_A_Debye
double m_A_Debye
A_Debye: this expression appears on the top of the ln actCoeff term in the general Debye-Huckel expre...
Definition: HMWSoln.h:1732
Cantera::HMWSoln::readXMLLambdaNeutral
void readXMLLambdaNeutral(XML_Node &BinSalt)
Process an XML node called "lambdaNeutral".
Definition: HMWSoln.cpp:1769
Cantera::HMWSoln::d2A_DebyedT2_TP
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...
Definition: HMWSoln.cpp:1265
Cantera::HMWSoln::m_Phi_IJ_LL
vector_fp m_Phi_IJ_LL
Derivative of m_Phi_IJ wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2139
Cantera::HMWSoln::getParameters
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition: HMWSoln.cpp:814
Cantera::HMWSoln::m_Beta0MX_ij_P
vector_fp m_Beta0MX_ij_P
Derivative of Beta0_ij[i][j] wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:1762
Cantera::HMWSoln::m_Lambda_nj_P
Array2D m_Lambda_nj_P
Derivative of Lambda_nj[i][j] wrt P.
Definition: HMWSoln.h:1953
Cantera::HMWSoln::s_updateScaling_pHScaling_dT
void s_updateScaling_pHScaling_dT() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt temperature.
Definition: HMWSoln.cpp:4422
Cantera::HMWSoln::m_IionicMolality
double m_IionicMolality
Current value of the ionic strength on the molality scale Associated Salts, if present in the mechani...
Definition: HMWSoln.h:1676
Cantera::HMWSoln::m_PhiPhi_IJ_L
vector_fp m_PhiPhi_IJ_L
Derivative of m_PhiPhi_IJ wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2153
Cantera::HMWSoln::calcMCCutoffParams_
void calcMCCutoffParams_()
Calculate molality cut-off parameters.
Definition: HMWSoln.cpp:1912
Cantera::HMWSoln::m_dlnActCoeffMolaldT_Scaled
vector_fp m_dlnActCoeffMolaldT_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T.
Definition: HMWSoln.h:2027
Cantera::HMWSoln::m_Beta2MX_ij_coeff
Array2D m_Beta2MX_ij_coeff
Array of coefficients for Beta2, a variable in Pitzer's papers.
Definition: HMWSoln.h:1820
Cantera::HMWSoln::m_BphiMX_IJ_LL
vector_fp m_BphiMX_IJ_LL
Derivative of BphiMX_IJ wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2126
Cantera::HMWSoln::HMWSoln
HMWSoln(const std::string &inputFile="", const std::string &id="")
Construct and initialize an HMWSoln ThermoPhase object directly from an ASCII input file.
Definition: HMWSoln.cpp:43
Cantera::HMWSoln::s_update_d2lnMolalityActCoeff_dT2
void s_update_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
Definition: HMWSoln.cpp:3216
Cantera::HMWSoln::IMS_cCut_
doublereal IMS_cCut_
Parameter in the polyExp cutoff treatment having to do with rate of exp decay.
Definition: HMWSoln.h:2187
Cantera::HMWSoln::IMS_slopegCut_
doublereal IMS_slopegCut_
Parameter in the polyExp cutoff treatment.
Definition: HMWSoln.h:2194
Cantera::HMWSoln::m_form_A_Debye
int m_form_A_Debye
Form of the constant outside the Debye-Huckel term called A.
Definition: HMWSoln.h:1700
Cantera::HMWSoln::getUnscaledMolalityActivityCoefficients
void getUnscaledMolalityActivityCoefficients(doublereal *acMolality) const
Get the array of unscaled non-dimensional molality based activity coefficients at the current solutio...
Definition: HMWSoln.cpp:259
Cantera::HMWSoln::CROP_speciesCropped_
vector_int CROP_speciesCropped_
This is a boolean-type vector indicating whether a species's activity coefficient is in the cropped r...
Definition: HMWSoln.h:2233
Cantera::HMWSoln::m_Psi_ijk_L
vector_fp m_Psi_ijk_L
Derivative of Psi_ijk[n] wrt T.
Definition: HMWSoln.h:1910
Cantera::HMWSoln::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: HMWSoln.cpp:185
Cantera::HMWSoln::m_Phiprime_IJ
vector_fp m_Phiprime_IJ
Intermediate variable called Phiprime in Pitzer's paper.
Definition: HMWSoln.h:2146
Cantera::HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dP
doublereal s_NBS_CLM_dlnMolalityActCoeff_dP() const
Calculate the pressure derivative of the Chlorine activity coefficient.
Definition: HMWSoln.cpp:4489
Cantera::HMWSoln::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: HMWSoln.cpp:292
Cantera::HMWSoln::getPartialMolarEntropies
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: HMWSoln.cpp:311
Cantera::HMWSoln::m_Beta1MX_ij
vector_fp m_Beta1MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1777
Cantera::HMWSoln::m_lnActCoeffMolal_Unscaled
vector_fp m_lnActCoeffMolal_Unscaled
Logarithm of the activity coefficients on the molality scale.
Definition: HMWSoln.h:2023
Cantera::HMWSoln::m_Lambda_nj_L
Array2D m_Lambda_nj_L
Derivative of Lambda_nj[i][j] wrt T. see m_Lambda_ij.
Definition: HMWSoln.h:1947
Cantera::HMWSoln::initThermoXML
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize the phase parameters from an XML file.
Definition: HMWSoln.cpp:1044
Cantera::HMWSoln::m_BprimeMX_IJ_P
vector_fp m_BprimeMX_IJ_P
Derivative of BprimeMX wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2116
Cantera::HMWSoln::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: HMWSoln.cpp:115
Cantera::HMWSoln::m_h2func_IJ
vector_fp m_h2func_IJ
hfunc2, was called gprime in Pitzer's paper.
Definition: HMWSoln.h:2090
Cantera::HMWSoln::m_Alpha2MX_ij
vector_fp m_Alpha2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1835
Cantera::HMWSoln::IMS_X_o_cutoff_
doublereal IMS_X_o_cutoff_
value of the solute mole fraction that centers the cutoff polynomials for the cutoff =1 process;
Definition: HMWSoln.h:2184
Cantera::HMWSoln::m_Psi_ijk_P
vector_fp m_Psi_ijk_P
Derivative of Psi_ijk[n] wrt P.
Definition: HMWSoln.h:1918
Cantera::HMWSoln::getPartialMolarVolumes
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: HMWSoln.cpp:346
Cantera::HMWSoln::m_dlnActCoeffMolaldT_Unscaled
vector_fp m_dlnActCoeffMolaldT_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt T.
Definition: HMWSoln.h:2031
Cantera::HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dT
doublereal s_NBS_CLM_dlnMolalityActCoeff_dT() const
Calculate the temperature derivative of the Chlorine activity coefficient on the NBS scale.
Definition: HMWSoln.cpp:4475
Cantera::HMWSoln::m_PhiPhi_IJ_LL
vector_fp m_PhiPhi_IJ_LL
Derivative of m_PhiPhi_IJ wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2156
Cantera::HMWSoln::m_CMX_IJ_L
vector_fp m_CMX_IJ_L
Derivative of m_CMX_IJ wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2166
Cantera::HMWSoln::s_updateScaling_pHScaling_dP
void s_updateScaling_pHScaling_dP() const
Apply the current phScale to a set of derivatives of the activity Coefficients wrt pressure.
Definition: HMWSoln.cpp:4452
Cantera::HMWSoln::printCoeffs
void printCoeffs() const
Print out all of the input Pitzer coefficients.
Definition: HMWSoln.cpp:4349
Cantera::HMWSoln::cv_mole
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: HMWSoln.cpp:191
Cantera::HMWSoln::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized activity concentrations.
Definition: HMWSoln.cpp:220
Cantera::HMWSoln::m_BphiMX_IJ
vector_fp m_BphiMX_IJ
Intermediate variable called BphiMX in Pitzer's paper.
Definition: HMWSoln.h:2120
Cantera::HMWSoln::s_update_dlnMolalityActCoeff_dT
void s_update_dlnMolalityActCoeff_dT() const
This function calculates the temperature derivative of the natural logarithm of the molality activity...
Definition: HMWSoln.cpp:2697
Cantera::HMWSoln::m_CphiMX_ij
vector_fp m_CphiMX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1842
Cantera::HMWSoln::m_CphiMX_ij_L
vector_fp m_CphiMX_ij_L
Derivative of Cphi_ij[i][j] wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:1845
Cantera::HMWSoln::ADebye_V
double ADebye_V(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_V.
Definition: HMWSoln.cpp:1242
Cantera::HMWSoln::m_Beta0MX_ij_L
vector_fp m_Beta0MX_ij_L
Derivative of Beta0_ij[i][j] wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:1756
Cantera::HMWSoln::getPartialMolarCp
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: HMWSoln.cpp:359
Cantera::HMWSoln::m_Phi_IJ_P
vector_fp m_Phi_IJ_P
Derivative of m_Phi_IJ wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2142
Cantera::HMWSoln::counterIJ_setup
void counterIJ_setup() const
Set up a counter variable for keeping track of symmetric binary interactions amongst the solute speci...
Definition: HMWSoln.cpp:1611
Cantera::HMWSoln::m_hfunc_IJ
vector_fp m_hfunc_IJ
hfunc, was called gprime in Pitzer's paper.
Definition: HMWSoln.h:2086
Cantera::HMWSoln::m_Theta_ij_P
vector_fp m_Theta_ij_P
Derivative of Theta_ij[i][j] wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:1881
Cantera::HMWSoln::m_Beta1MX_ij_LL
vector_fp m_Beta1MX_ij_LL
Derivative of Beta1_ij[i][j] wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:1783
Cantera::HMWSoln::m_Mu_nnn
vector_fp m_Mu_nnn
Mu coefficient for the self-ternary neutral coefficient.
Definition: HMWSoln.h:1976
Cantera::HMWSoln::m_d2lnActCoeffMolaldT2_Scaled
vector_fp m_d2lnActCoeffMolaldT2_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT.
Definition: HMWSoln.h:2035
Cantera::HMWSoln::m_Psi_ijk_coeff
Array2D m_Psi_ijk_coeff
Array of coefficients for Psi_ijk[n] in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1934
Cantera::HMWSoln::readXMLZetaCation
void readXMLZetaCation(const XML_Node &BinSalt)
Process an XML node called "zetaCation".
Definition: HMWSoln.cpp:1824
Cantera::HMWSoln::m_CphiMX_ij_LL
vector_fp m_CphiMX_ij_LL
Derivative of Cphi_ij[i][j] wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:1848
Cantera::HMWSoln::m_Beta2MX_ij_L
vector_fp m_Beta2MX_ij_L
Derivative of Beta2_ij[i][j] wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:1804
Cantera::HMWSoln::readXMLPsi
void readXMLPsi(XML_Node &BinSalt)
Process an XML node called "psiCommonAnion" or "psiCommonCation".
Definition: HMWSoln.cpp:1720
Cantera::HMWSoln::setA_Debye
void setA_Debye(double A)
Set the A_Debye parameter.
Definition: HMWSoln.cpp:601
Cantera::HMWSoln::m_formPitzerTemp
int m_formPitzerTemp
This is the form of the temperature dependence of Pitzer parameterization used in the model.
Definition: HMWSoln.h:1671
Cantera::HMWSoln::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: HMWSoln.cpp:173
Cantera::HMWSoln::m_Mu_nnn_LL
vector_fp m_Mu_nnn_LL
Mu coefficient 2nd temperature derivative for the self-ternary neutral coefficient.
Definition: HMWSoln.h:1996
Cantera::HMWSoln::m_BMX_IJ_LL
vector_fp m_BMX_IJ_LL
Derivative of BMX_IJ wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2100
Cantera::HMWSoln::s_updatePitzer_CoeffWRTemp
void s_updatePitzer_CoeffWRTemp(int doDerivs=2) const
Calculates the Pitzer coefficients' dependence on the temperature.
Definition: HMWSoln.cpp:1948
Cantera::HMWSoln::m_molalitiesCropped
vector_fp m_molalitiesCropped
Cropped and modified values of the molalities used in activity coefficient calculations.
Definition: HMWSoln.h:2053
Cantera::HMWSoln::m_Psi_ijk_LL
vector_fp m_Psi_ijk_LL
Derivative of Psi_ijk[n] wrt TT.
Definition: HMWSoln.h:1914
Cantera::HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2
doublereal s_NBS_CLM_d2lnMolalityActCoeff_dT2() const
Calculate the second temperature derivative of the Chlorine activity coefficient on the NBS scale.
Definition: HMWSoln.cpp:4482
Cantera::HMWSoln::initThermo
virtual void initThermo()
Definition: HMWSoln.cpp:638
Cantera::HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP
void s_updatePitzer_dlnMolalityActCoeff_dP() const
Calculates the Pressure derivative of the natural logarithm of the molality activity coefficients.
Definition: HMWSoln.cpp:3751
Cantera::HMWSoln::m_Beta2MX_ij_P
vector_fp m_Beta2MX_ij_P
Derivative of Beta2_ij[i][j] wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:1810
Cantera::HMWSoln::m_Lambda_nj
Array2D m_Lambda_nj
Lambda coefficient for the ij interaction.
Definition: HMWSoln.h:1944
Cantera::HMWSoln::m_Phi_IJ
vector_fp m_Phi_IJ
Intermediate variable called Phi in Pitzer's paper.
Definition: HMWSoln.h:2133
Cantera::HMWSoln::m_Beta2MX_ij
vector_fp m_Beta2MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1801
Cantera::HMWSoln::m_BprimeMX_IJ_L
vector_fp m_BprimeMX_IJ_L
Derivative of BprimeMX wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2110
Cantera::HMWSoln::m_PhiPhi_IJ_P
vector_fp m_PhiPhi_IJ_P
Derivative of m_PhiPhi_IJ wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:2159
Cantera::HMWSoln::calc_thetas
void calc_thetas(int z1, int z2, double *etheta, double *etheta_prime) const
Calculate etheta and etheta_prime.
Definition: HMWSoln.cpp:4280
Cantera::HMWSoln::m_Beta2MX_ij_LL
vector_fp m_Beta2MX_ij_LL
Derivative of Beta2_ij[i][j] wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:1807
Cantera::HMWSoln::m_d2lnActCoeffMolaldT2_Unscaled
vector_fp m_d2lnActCoeffMolaldT2_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt TT.
Definition: HMWSoln.h:2039
Cantera::HMWSoln::m_Mu_nnn_coeff
Array2D m_Mu_nnn_coeff
Array of coefficients form_Mu_nnn term.
Definition: HMWSoln.h:2009
Cantera::HMWSoln::ADebye_L
double ADebye_L(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_L.
Definition: HMWSoln.cpp:1231
Cantera::HMWSoln::m_Mu_nnn_P
vector_fp m_Mu_nnn_P
Mu coefficient pressure derivative for the self-ternary neutral coefficient.
Definition: HMWSoln.h:2006
Cantera::HMWSoln::m_CMX_IJ
vector_fp m_CMX_IJ
Intermediate variable called CMX in Pitzer's paper.
Definition: HMWSoln.h:2163
Cantera::HMWSoln::m_waterSS
PDSS * m_waterSS
Water standard state calculator.
Definition: HMWSoln.h:1738
Cantera::HMWSoln::calc_lambdas
void calc_lambdas(double is) const
Calculate the lambda interactions.
Definition: HMWSoln.cpp:4236
Cantera::HMWSoln::elambda1
double elambda1[17]
This is elambda1, MEC.
Definition: HMWSoln.h:2070
Cantera::HMWSoln::type
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: HMWSoln.h:1058
Cantera::HMWSoln::relative_molal_enthalpy
virtual doublereal relative_molal_enthalpy() const
Excess molar enthalpy of the solution from the mixing process on a molality basis.
Definition: HMWSoln.cpp:133
Cantera::HMWSoln::m_Phi_IJ_L
vector_fp m_Phi_IJ_L
Derivative of m_Phi_IJ wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2136
Cantera::HMWSoln::m_Theta_ij_LL
vector_fp m_Theta_ij_LL
Derivative of Theta_ij[i][j] wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:1878
Cantera::HMWSoln::m_maxIionicStrength
double m_maxIionicStrength
Maximum value of the ionic strength allowed in the calculation of the activity coefficients.
Definition: HMWSoln.h:1680
Cantera::HMWSoln::m_BphiMX_IJ_L
vector_fp m_BphiMX_IJ_L
Derivative of BphiMX_IJ wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:2123
Cantera::HMWSoln::gibbs_mole
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: HMWSoln.cpp:179
Cantera::HMWSoln::m_dlnActCoeffMolaldP_Unscaled
vector_fp m_dlnActCoeffMolaldP_Unscaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P.
Definition: HMWSoln.h:2047
Cantera::HMWSoln::m_BprimeMX_IJ_LL
vector_fp m_BprimeMX_IJ_LL
Derivative of BprimeMX wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2113
Cantera::HMWSoln::IMS_lnActCoeffMolal_
vector_fp IMS_lnActCoeffMolal_
Logarithm of the molal activity coefficients.
Definition: HMWSoln.h:2180
Cantera::HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT
void s_updatePitzer_dlnMolalityActCoeff_dT() const
Calculates the temperature derivative of the natural logarithm of the molality activity coefficients.
Definition: HMWSoln.cpp:2725
Cantera::HMWSoln::s_updatePitzer_lnMolalityActCoeff
void s_updatePitzer_lnMolalityActCoeff() const
Calculate the Pitzer portion of the activity coefficients.
Definition: HMWSoln.cpp:2194
Cantera::HMWSoln::m_CMX_IJ_LL
vector_fp m_CMX_IJ_LL
Derivative of m_CMX_IJ wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:2169
Cantera::HMWSoln::m_gamma_tmp
vector_fp m_gamma_tmp
Intermediate storage of the activity coefficient itself.
Definition: HMWSoln.h:2176
Cantera::HMWSoln::m_Psi_ijk
vector_fp m_Psi_ijk
Array of 3D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1906
Cantera::HMWSoln::readXMLMunnnNeutral
void readXMLMunnnNeutral(XML_Node &BinSalt)
Process an XML node called "MunnnNeutral".
Definition: HMWSoln.cpp:1799
Cantera::HMWSoln::dA_DebyedT_TP
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 as a function of tem...
Definition: HMWSoln.cpp:1175
Cantera::HMWSoln::relative_enthalpy
virtual doublereal relative_enthalpy() const
Excess molar enthalpy of the solution from the mixing process.
Definition: HMWSoln.cpp:121
Cantera::HMWSoln::m_Beta1MX_ij_P
vector_fp m_Beta1MX_ij_P
Derivative of Beta1_ij[i][j] wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:1786
Cantera::HMWSoln::m_Mu_nnn_L
vector_fp m_Mu_nnn_L
Mu coefficient temperature derivative for the self-ternary neutral coefficient.
Definition: HMWSoln.h:1986
Cantera::HMWSoln::m_Lambda_nj_LL
Array2D m_Lambda_nj_LL
Derivative of Lambda_nj[i][j] wrt TT.
Definition: HMWSoln.h:1950
Cantera::HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2
void s_updatePitzer_d2lnMolalityActCoeff_dT2() const
This function calculates the temperature second derivative of the natural logarithm of the molality a...
Definition: HMWSoln.cpp:3244
Cantera::HMWSoln::readXMLTheta
void readXMLTheta(XML_Node &BinSalt)
Process an XML node called "thetaAnion" or "thetaCation".
Definition: HMWSoln.cpp:1680
Cantera::HMWSoln::m_Lambda_nj_coeff
Array2D m_Lambda_nj_coeff
Array of coefficients for Lambda_nj[i][j] in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1968
Cantera::HMWSoln::m_Theta_ij
vector_fp m_Theta_ij
Array of 2D data for Theta_ij[i][j] in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1872
Cantera::HMWSoln::initLengths
void initLengths()
Initialize all of the species-dependent lengths in the object.
Definition: HMWSoln.cpp:1293
Cantera::HMWSoln::m_Beta0MX_ij
vector_fp m_Beta0MX_ij
Array of 2D data used in the Pitzer/HMW formulation.
Definition: HMWSoln.h:1753
Cantera::HMWSoln::m_BMX_IJ
vector_fp m_BMX_IJ
Intermediate variable called BMX in Pitzer's paper.
Definition: HMWSoln.h:2094
Cantera::HMWSoln::m_Beta0MX_ij_LL
vector_fp m_Beta0MX_ij_LL
Derivative of Beta0_ij[i][j] wrt TT. Vector index is counterIJ.
Definition: HMWSoln.h:1759
Cantera::HMWSoln::m_gfunc_IJ
vector_fp m_gfunc_IJ
Various temporary arrays used in the calculation of the Pitzer activity coefficients.
Definition: HMWSoln.h:2079
Cantera::HMWSoln::s_update_dlnMolalityActCoeff_dP
void s_update_dlnMolalityActCoeff_dP() const
This function calculates the pressure derivative of the natural logarithm of the molality activity co...
Definition: HMWSoln.cpp:3727
Cantera::HMWSoln::m_TempPitzerRef
double m_TempPitzerRef
Reference Temperature for the Pitzer formulations.
Definition: HMWSoln.h:1683
Cantera::HMWSoln::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: HMWSoln.cpp:272
Cantera::HMWSoln::m_Beta1MX_ij_L
vector_fp m_Beta1MX_ij_L
Derivative of Beta1_ij[i][j] wrt T. Vector index is counterIJ.
Definition: HMWSoln.h:1780
Cantera::HMWSoln::readXMLBinarySalt
void readXMLBinarySalt(XML_Node &BinSalt)
Process an XML node called "binarySaltParameters".
Definition: HMWSoln.cpp:1634
Cantera::HMWSoln::satPressure
virtual doublereal satPressure(doublereal T)
Get the saturation pressure for a given temperature.
Definition: HMWSoln.cpp:379
Cantera::HMWSoln::elambda
double elambda[17]
This is elambda, MEC.
Definition: HMWSoln.h:2067
Cantera::HMWSoln::m_waterProps
std::unique_ptr< WaterProps > m_waterProps
Pointer to the water property calculator.
Definition: HMWSoln.h:1741
Cantera::HMWSoln::m_BprimeMX_IJ
vector_fp m_BprimeMX_IJ
Intermediate variable called BprimeMX in Pitzer's paper.
Definition: HMWSoln.h:2107
Cantera::HMWSoln::s_updateIMS_lnMolalityActCoeff
void s_updateIMS_lnMolalityActCoeff() const
This function will be called to update the internally stored natural logarithm of the molality activi...
Definition: HMWSoln.cpp:4306
Cantera::HMWSoln::calcMolalitiesCropped
void calcMolalitiesCropped() const
Calculate the cropped molalities.
Definition: HMWSoln.cpp:1470
Cantera::HMWSoln::getActivities
virtual void getActivities(doublereal *ac) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
Definition: HMWSoln.cpp:243
Cantera::HMWSoln::m_CphiMX_ij_P
vector_fp m_CphiMX_ij_P
Derivative of Cphi_ij[i][j] wrt P. Vector index is counterIJ.
Definition: HMWSoln.h:1851
Cantera::HMWSoln::m_tmpV
vector_fp m_tmpV
vector of size m_kk, used as a temporary holding area.
Definition: HMWSoln.h:1744
Cantera::HMWSoln::ADebye_J
double ADebye_J(double temperature=-1.0, double pressure=-1.0) const
Return Pitzer's definition of A_J.
Definition: HMWSoln.cpp:1253
Cantera::HMWSoln::s_updateScaling_pHScaling_dT2
void s_updateScaling_pHScaling_dT2() const
Apply the current phScale to a set of 2nd derivatives of the activity Coefficients wrt temperature.
Definition: HMWSoln.cpp:4437
Cantera::HMWSoln::m_Beta1MX_ij_coeff
Array2D m_Beta1MX_ij_coeff
Array of coefficients for Beta1, a variable in Pitzer's papers.
Definition: HMWSoln.h:1794
Cantera::HMWSoln::s_NBS_CLM_lnMolalityActCoeff
doublereal s_NBS_CLM_lnMolalityActCoeff() const
Calculate the Chlorine activity coefficient on the NBS scale.
Definition: HMWSoln.cpp:4467
Cantera::HMWSoln::s_updateScaling_pHScaling
void s_updateScaling_pHScaling() const
Apply the current phScale to a set of activity Coefficients.
Definition: HMWSoln.cpp:4407
Cantera::HMWSoln::m_CphiMX_ij_coeff
Array2D m_CphiMX_ij_coeff
Array of coefficients for CphiMX, a parameter in the activity coefficient formulation.
Definition: HMWSoln.h:1860
Cantera::HMWSoln::m_g2func_IJ
vector_fp m_g2func_IJ
This is the value of g2(x2) in Pitzer's papers. Vector index is counterIJ.
Definition: HMWSoln.h:2082
Cantera::HMWSoln::A_Debye_TP
virtual double A_Debye_TP(double temperature=-1.0, double pressure=-1.0) const
Value of the Debye Huckel constant as a function of temperature and pressure.
Definition: HMWSoln.cpp:1143
Cantera::HMWSoln::dA_DebyedP_TP
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...
Definition: HMWSoln.cpp:1199
Cantera::HMWSoln::calcDensity
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Definition: HMWSoln.cpp:203
Cantera::HMWSoln::m_dlnActCoeffMolaldP_Scaled
vector_fp m_dlnActCoeffMolaldP_Scaled
Derivative of the Logarithm of the activity coefficients on the molality scale wrt P.
Definition: HMWSoln.h:2043
Cantera::HMWSoln::m_CounterIJ
vector_int m_CounterIJ
a counter variable for keeping track of symmetric binary interactions amongst the solute species.
Definition: HMWSoln.h:2064
Cantera::HMWSoln::m_lnActCoeffMolal_Scaled
vector_fp m_lnActCoeffMolal_Scaled
Logarithm of the activity coefficients on the molality scale.
Definition: HMWSoln.h:2016
Cantera::HMWSoln::m_molalitiesAreCropped
bool m_molalitiesAreCropped
Boolean indicating whether the molalities are cropped or are modified.
Definition: HMWSoln.h:2056
Cantera::HMWSoln::standardConcentration
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: HMWSoln.cpp:233
Cantera::MolalityVPSSTP
Definition: MolalityVPSSTP.h:182
Cantera::PDSS
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:148
Cantera::Phase::temperature
doublereal temperature() const
Temperature (K).
Definition: Phase.h:654
Cantera::VPStandardStateTP::pressure
virtual doublereal pressure() const
Returns the current pressure of the phase.
Definition: VPStandardStateTP.h:140
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::vector_int
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:186
Cantera::vector_fp
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184