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