Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MixedSolventElectrolyte.h
Go to the documentation of this file.
1 /**
2  * @file MixedSolventElectrolyte.h
3  * Header for intermediate ThermoPhase object for phases which
4  * employ Gibbs excess free energy based formulations
5  * (see \ref thermoprops
6  * and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
7  *
8  * Header file for a derived class of ThermoPhase that handles
9  * variable pressure standard state methods for calculating
10  * thermodynamic properties that are further based upon activities
11  * based on the molality scale. These include most of the methods for
12  * calculating liquid electrolyte thermodynamics.
13  */
14 /*
15  * Copyright (2006) Sandia Corporation. Under the terms of
16  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
17  * U.S. Government retains certain rights in this software.
18  */
19 
20 #ifndef CT_MIXEDSOLVENTELECTROLYTEVPSSTP_H
21 #define CT_MIXEDSOLVENTELECTROLYTEVPSSTP_H
22 
23 #include "MolarityIonicVPSSTP.h"
24 
25 namespace Cantera
26 {
27 /**
28  * @ingroup thermoprops
29  */
30 
31 //! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs
32 //! the DH and local Marguless approximations for the excess Gibbs free energy
33 /*!
34  *
35  * MixedSolventElectrolyte derives from class GibbsExcessVPSSTP which is derived
36  * from VPStandardStateTP,
37  * and overloads the virtual methods defined there with ones that
38  * use expressions appropriate for the Margules Excess Gibbs free energy
39  * approximation.
40  *
41  * The independent unknowns are pressure, temperature, and mass fraction.
42  *
43  * Several concepts are introduced. The first concept is there are temporary
44  * variables for holding the species standard state values
45  * of Cp, H, S, G, and V at the
46  * last temperature and pressure called. These functions are not recalculated
47  * if a new call is made using the previous temperature and pressure. Currently,
48  * these variables and the calculation method are handled by the VPSSMgr class,
49  * for which VPStandardStateTP owns a pointer to.
50  *
51  * To support the above functionality, pressure and temperature variables,
52  * m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature
53  * used in the evaluation of standard state properties.
54  *
55  * This class is usually used for nearly incompressible phases. For those phases, it
56  * makes sense to change the equation of state independent variable from
57  * density to pressure. The variable m_Pcurrent contains the current value of the
58  * pressure within the phase.
59  *
60  *
61  * <HR>
62  * <H2> Specification of Species Standard State Properties </H2>
63  * <HR>
64  *
65  * All species are defined to have standard states that depend upon both
66  * the temperature and the pressure. The Margules approximation assumes
67  * symmetric standard states, where all of the standard state assume
68  * that the species are in pure component states at the temperature
69  * and pressure of the solution. I don't think it prevents, however,
70  * some species from being dilute in the solution.
71  *
72  *
73  * <HR>
74  * <H2> Specification of Solution Thermodynamic Properties </H2>
75  * <HR>
76  *
77  * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions <I>i</I>.
78  * Each of the interactions are binary interactions involving two of the species in the phase, denoted, <I>Ai</I>
79  * and <I>Bi</I>.
80  * This is the generalization of the Margules formulation for a phase
81  * that has more than 2 species.
82  *
83  * \f[
84  * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right)
85  * \f]
86  * \f[
87  * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
88  * \f]
89  * \f[
90  * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
91  * \f]
92  *
93  * where n is the total moles in the solution.
94  *
95  * The activity of a species defined in the phase is given by an excess
96  * Gibbs free energy formulation.
97  *
98  * \f[
99  * a_k = \gamma_k X_k
100  * \f]
101  *
102  * where
103  *
104  * \f[
105  * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
106  * \f]
107  *
108  * Taking the derivatives results in the following expression
109  *
110  * \f[
111  * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
112  * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
113  * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right)
114  * \f]
115  * where
116  * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$
117  * and where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
118  *
119  * This object inherits from the class VPStandardStateTP. Therefore, the specification and
120  * calculation of all standard state and reference state values are handled at that level. Various functional
121  * forms for the standard state are permissible.
122  * The chemical potential for species <I>k</I> is equal to
123  *
124  * \f[
125  * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
126  * \f]
127  *
128  * The partial molar entropy for species <I>k</I> is given by the following relation,
129  *
130  * \f[
131  * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
132  * - R T \frac{d \ln(\gamma_k) }{dT}
133  * \f]
134  *
135  * The partial molar enthalpy for species <I>k</I> is given by
136  *
137  * \f[
138  * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
139  * \f]
140  *
141  * The partial molar volume for species <I>k</I> is
142  *
143  * \f[
144  * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
145  * \f]
146  *
147  * The partial molar Heat Capacity for species <I>k</I> is
148  *
149  * \f[
150  * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
151  * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
152  * \f]
153  *
154  * <HR>
155  * <H2> %Application within Kinetics Managers </H2>
156  * <HR>
157  *
158  * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
159  * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
160  * defined below and \f$ a_k \f$ are activities used in the
161  * thermodynamic functions. These activity (or generalized)
162  * concentrations are used
163  * by kinetics manager classes to compute the forward and
164  * reverse rates of elementary reactions.
165  * The activity concentration,\f$ C^a_k \f$,is given by the following expression.
166  *
167  * \f[
168  * C^a_k = C^s_k X_k = \frac{P}{R T} X_k
169  * \f]
170  *
171  * The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
172  *
173  * \f[
174  * C^s_k = C^s = \frac{P}{R T}
175  * \f]
176  *
177  * For example, a bulk-phase binary gas reaction between species j and k, producing
178  * a new gas species l would have the
179  * following equation for its rate of progress variable, \f$ R^1 \f$, which has
180  * units of kmol m-3 s-1.
181  *
182  * \f[
183  * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
184  * \f]
185  * where
186  * \f[
187  * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
188  * \f]
189  *
190  *
191  * \f$ C_j^a \f$ is the activity concentration of species j, and
192  * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
193  * is the standard concentration. \f$ a_j \f$ is
194  * the activity of species j which is equal to the mole fraction of j.
195  *
196  * The reverse rate constant can then be obtained from the law of microscopic reversibility
197  * and the equilibrium expression for the system.
198  *
199  * \f[
200  * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
201  * \f]
202  *
203  * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
204  * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
205  * \f$ a_l \f$, repeated here:
206  *
207  * \f[
208  * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
209  * \f]
210  *
211  * We can switch over to expressing the equilibrium constant in terms of the reference
212  * state chemical potentials
213  *
214  * \f[
215  * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
216  * \f]
217  *
218  * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
219  * to activity concentrations. When this is done:
220  *
221  * \f[
222  * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
223  * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
224  * \f]
225  *
226  * Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
227  * using the second and third part of the above expression as a definition for the concentration
228  * equilibrium constant.
229  *
230  * For completeness, the pressure equilibrium constant may be obtained as well
231  *
232  * \f[
233  * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
234  * \f]
235  *
236  * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
237  * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
238  * used instead because it is completely general.
239  *
240  * The reverse rate of progress may be written down as
241  * \f[
242  * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
243  * \f]
244  *
245  * where we can use the concept of microscopic reversibility to
246  * write the reverse rate constant in terms of the
247  * forward reate constant and the concentration equilibrium
248  * constant, \f$ K_c \f$.
249  *
250  * \f[
251  * k^{-1} = k^1 K^1_c
252  * \f]
253  *
254  * \f$k^{-1} \f$ has units of s-1.
255  *
256  * @ingroup thermoprops
257  *
258  */
260 {
261 public:
262  //! Constructor
263  /*!
264  * This doesn't do much more than initialize constants with
265  * default values for water at 25C. Water molecular weight
266  * comes from the default elements.xml file. It actually
267  * differs slightly from the IAPWS95 value of 18.015268. However,
268  * density conservation and therefore element conservation
269  * is the more important principle to follow.
270  */
272 
273  //! Construct and initialize a MixedSolventElectrolyte ThermoPhase object
274  //! directly from an XML input file
275  /*!
276  * @param inputFile Name of the input file containing the phase XML data
277  * to set up the object
278  * @param id ID of the phase in the input file. Defaults to the
279  * empty string.
280  */
281  MixedSolventElectrolyte(const std::string& inputFile,
282  const std::string& id = "");
283 
284  //! Construct and initialize a MixedSolventElectrolyte ThermoPhase object
285  //! directly from an XML database
286  /*!
287  * @param phaseRef XML phase node containing the description of the phase
288  * @param id id attribute containing the name of the phase.
289  * (default is the empty string)
290  */
291  MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = "");
292 
293  //! Special constructor for a hard-coded problem
294  /*!
295  * @param testProb Hard-coded value. Only the value of 1 is used. It's
296  * for a LiKCl system -> test to predict the eutectic and
297  * liquidus correctly.
298  * @deprecated To be removed after Cantera 2.2.
299  */
300  MixedSolventElectrolyte(int testProb);
301 
302  //! Copy constructor
303  /*!
304  * @param b class to be copied
305  */
307 
308  //! Assignment operator
309  /*!
310  * @param b class to be copied.
311  */
313 
314  //! Duplication routine for objects which inherit from ThermoPhase.
315  /*!
316  * This virtual routine can be used to duplicate ThermoPhase objects
317  * inherited from ThermoPhase even if the application only has
318  * a pointer to ThermoPhase to work with.
319  */
320  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
321 
322  //! @name Molar Thermodynamic Properties
323  //! @{
324 
325  /// Molar enthalpy. Units: J/kmol.
326  virtual doublereal enthalpy_mole() const;
327 
328  /// Molar entropy. Units: J/kmol.
329  virtual doublereal entropy_mole() const;
330 
331  /// Molar heat capacity at constant pressure. Units: J/kmol/K.
332  virtual doublereal cp_mole() const;
333 
334  /// Molar heat capacity at constant volume. Units: J/kmol/K.
335  virtual doublereal cv_mole() const;
336 
337  /**
338  * @}
339  * @name Activities, Standard States, and Activity Concentrations
340  *
341  * The activity \f$a_k\f$ of a species in solution is
342  * related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
343  * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
344  * the chemical potential at unit activity, which depends only
345  * on temperature and pressure.
346  * @{
347  */
348 
349  //! Get the array of non-dimensional molar-based activity coefficients at
350  //! the current solution temperature, pressure, and solution concentration.
351  /*!
352  * @param ac Output vector of activity coefficients. Length: m_kk.
353  */
354  virtual void getActivityCoefficients(doublereal* ac) const;
355 
356  //@}
357  /// @name Partial Molar Properties of the Solution
358  //@{
359 
360  //! Get the species chemical potentials. Units: J/kmol.
361  /*!
362  * This function returns a vector of chemical potentials of the
363  * species in solution at the current temperature, pressure
364  * and mole fraction of the solution.
365  *
366  * @param mu Output vector of species chemical
367  * potentials. Length: m_kk. Units: J/kmol
368  */
369  virtual void getChemPotentials(doublereal* mu) const;
370 
371  //! Returns an array of partial molar enthalpies for the species
372  //! in the mixture.
373  /*!
374  * Units (J/kmol)
375  *
376  * For this phase, the partial molar enthalpies are equal to the
377  * standard state enthalpies modified by the derivative of the
378  * molality-based activity coefficient wrt temperature
379  *
380  * \f[
381  * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
382  * \f]
383  *
384  * @param hbar Vector of returned partial molar enthalpies
385  * (length m_kk, units = J/kmol)
386  */
387  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
388 
389  //! Returns an array of partial molar entropies for the species
390  //! in the mixture.
391  /*!
392  * Units (J/kmol)
393  *
394  * For this phase, the partial molar enthalpies are equal to the
395  * standard state enthalpies modified by the derivative of the
396  * activity coefficient wrt temperature
397  *
398  * \f[
399  * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
400  * - R \ln( \gamma_k X_k)
401  * - R T \frac{d \ln(\gamma_k) }{dT}
402  * \f]
403  *
404  * @param sbar Vector of returned partial molar entropies
405  * (length m_kk, units = J/kmol/K)
406  */
407  virtual void getPartialMolarEntropies(doublereal* sbar) const;
408 
409  //! Returns an array of partial molar entropies for the species
410  //! in the mixture.
411  /*!
412  * Units (J/kmol)
413  *
414  * For this phase, the partial molar enthalpies are equal to the
415  * standard state enthalpies modified by the derivative of the
416  * activity coefficient wrt temperature
417  *
418  * \f[
419  * ???????????????
420  * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
421  * - R \ln( \gamma_k X_k)
422  * - R T \frac{d \ln(\gamma_k) }{dT}
423  * ???????????????
424  * \f]
425  *
426  * @param cpbar Vector of returned partial molar heat capacities
427  * (length m_kk, units = J/kmol/K)
428  */
429  virtual void getPartialMolarCp(doublereal* cpbar) const;
430 
431  //! Return an array of partial molar volumes for the
432  //! species in the mixture. Units: m^3/kmol.
433  /*!
434  * Frequently, for this class of thermodynamics representations,
435  * the excess Volume due to mixing is zero. Here, we set it as
436  * a default. It may be overridden in derived classes.
437  *
438  * @param vbar Output vector of species partial molar volumes.
439  * Length = m_kk. units are m^3/kmol.
440  */
441  virtual void getPartialMolarVolumes(doublereal* vbar) const;
442 
443  //! Get the species electrochemical potentials.
444  /*!
445  * These are partial molar quantities.
446  * This method adds a term \f$ Fz_k \phi_k \f$ to the
447  * to each chemical potential.
448  *
449  * Units: J/kmol
450  *
451  * @param mu output vector containing the species electrochemical potentials.
452  * Length: m_kk., units = J/kmol
453  */
454  void getElectrochemPotentials(doublereal* mu) const;
455 
456  //! Get the array of temperature second derivatives of the log activity coefficients
457  /*!
458  * This function is a virtual class, but it first appears in GibbsExcessVPSSTP
459  * class and derived classes from GibbsExcessVPSSTP.
460  *
461  * units = 1/Kelvin
462  *
463  * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
464  * log Activity Coefficients. length = m_kk
465  *
466  */
467  virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
468 
469  //! Get the array of temperature derivatives of the log activity coefficients
470  /*!
471  * This function is a virtual class, but it first appears in GibbsExcessVPSSTP
472  * class and derived classes from GibbsExcessVPSSTP.
473  *
474  * units = 1/Kelvin
475  *
476  * @param dlnActCoeffdT Output vector of temperature derivatives of the
477  * log Activity Coefficients. length = m_kk
478  */
479  virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
480 
481  //! @}
482  //! @name Initialization
483  /// The following methods are used in the process of constructing
484  /// the phase and setting its parameters from a specification in an
485  /// input file. They are not normally used in application programs.
486  /// To see how they are used, see importPhase().
487  /// @{
488 
489  /*!
490  * @internal Initialize. This method is provided to allow
491  * subclasses to perform any initialization required after all
492  * species have been added. For example, it might be used to
493  * resize internal work arrays that must have an entry for
494  * each species. The base class implementation does nothing,
495  * and subclasses that do not require initialization do not
496  * need to overload this method. When importing a CTML phase
497  * description, this method is called just prior to returning
498  * from function importPhase().
499  */
500  virtual void initThermo();
501 
502  /**
503  * Import and initialize a ThermoPhase object
504  *
505  * @param phaseNode This object must be the phase node of a
506  * complete XML tree
507  * description of the phase, including all of the
508  * species data. In other words while "phase" must
509  * point to an XML phase object, it must have
510  * sibling nodes "speciesData" that describe
511  * the species in the phase.
512  * @param id ID of the phase. If nonnull, a check is done
513  * to see if phaseNode is pointing to the phase
514  * with the correct id.
515  */
516  void initThermoXML(XML_Node& phaseNode, const std::string& id);
517 
518  /**
519  * @}
520  * @name Derivatives of Thermodynamic Variables needed for Applications
521  * @{
522  */
523 
524  //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
525  //! a line in parameter space or along a line in physical space
526  /*!
527  *
528  * @param dTds Input of temperature change along the path
529  * @param dXds Input vector of changes in mole fraction along the path. length = m_kk
530  * Along the path length it must be the case that the mole fractions sum to one.
531  * @param dlnActCoeffds Output vector of the directional derivatives of the
532  * log Activity Coefficients along the path. length = m_kk
533  * units are 1/units(s). if s is a physical coordinate then the units are 1/m.
534  */
535  virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const;
536 
537  //! Get the array of log concentration-like derivatives of the
538  //! log activity coefficients - diagonal component
539  /*!
540  * This function is a virtual method. For ideal mixtures
541  * (unity activity coefficients), this can return zero.
542  * Implementations should take the derivative of the
543  * logarithm of the activity coefficient with respect to the
544  * logarithm of the mole fraction.
545  *
546  * units = dimensionless
547  *
548  * @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
549  * derivatives of the log Activity Coefficients.
550  * length = m_kk
551  */
552  virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
553 
554  //! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
555  /*!
556  * This function is a virtual method. For ideal mixtures
557  * (unity activity coefficients), this can return zero.
558  * Implementations should take the derivative of the
559  * logarithm of the activity coefficient with respect to the
560  * logarithm of the concentration-like variable (i.e. mole fraction,
561  * molality, etc.) that represents the standard state.
562  *
563  * units = dimensionless
564  *
565  * @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
566  * derivatives of the log Activity Coefficients.
567  * length = m_kk
568  */
569  virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
570 
571  //! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers
572  /*!
573  * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
574  * log of a species mole number (with all other species mole numbers held constant)
575  *
576  * units = 1 / kmol
577  *
578  * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
579  * species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
580  *
581  * \f[
582  * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
583  * \f]
584  *
585  * @param ld Number of rows in the matrix
586  * @param dlnActCoeffdlnN Output vector of derivatives of the
587  * log Activity Coefficients. length = m_kk * m_kk
588  */
589  virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
590  //@}
591 
592 private:
593  //! Process an XML node called "binaryNeutralSpeciesParameters"
594  /*!
595  * This node contains all of the parameters necessary to describe
596  * the Margules model for a particular binary interaction.
597  * This function reads the XML file and writes the coefficients
598  * it finds to an internal data structures.
599  *
600  * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
601  * containing the binary interaction
602  */
603  void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
604 
605  //! Resize internal arrays within the object that depend upon the number
606  //! of binary Margules interaction terms
607  /*!
608  * @param num Number of binary Margules interaction terms
609  */
610  void resizeNumInteractions(const size_t num);
611 
612  //! Initialize lengths of local variables after all species have
613  //! been identified.
614  void initLengths();
615 
616  //! Update the activity coefficients
617  /*!
618  * This function will be called to update the internally stored
619  * natural logarithm of the activity coefficients
620  */
621  void s_update_lnActCoeff() const;
622 
623  //! Update the derivative of the log of the activity coefficients wrt T
624  /*!
625  * This function will be called to update the internally stored
626  * derivative of the natural logarithm of the activity coefficients
627  * wrt temperature.
628  */
629  void s_update_dlnActCoeff_dT() const;
630 
631  //! Update the derivative of the log of the activity coefficients
632  //! wrt log(mole fraction)
633  /*!
634  * This function will be called to update the internally stored
635  * derivative of the natural logarithm of the activity coefficients
636  * wrt logarithm of the mole fractions.
637  */
638  void s_update_dlnActCoeff_dlnX_diag() const;
639 
640  //! Update the derivative of the log of the activity coefficients
641  //! wrt log(moles) - diagonal only
642  /*!
643  * This function will be called to update the internally stored diagonal entries for the
644  * derivative of the natural logarithm of the activity coefficients
645  * wrt logarithm of the moles.
646  */
647  void s_update_dlnActCoeff_dlnN_diag() const;
648 
649  //! Update the derivative of the log of the activity coefficients wrt log(moles_m)
650  /*!
651  * This function will be called to update the internally stored
652  * derivative of the natural logarithm of the activity coefficients
653  * wrt logarithm of the mole number of species
654  */
655  void s_update_dlnActCoeff_dlnN() const;
656 
657 protected:
658  //! number of binary interaction expressions
660 
661  //! Enthalpy term for the binary mole fraction interaction of the
662  //! excess Gibbs free energy expression
664 
665  //! Enthalpy term for the ternary mole fraction interaction of the
666  //! excess Gibbs free energy expression
668 
669  //! Enthalpy term for the quaternary mole fraction interaction of the
670  //! excess Gibbs free energy expression
672 
673  //! Entropy term for the binary mole fraction interaction of the
674  //! excess Gibbs free energy expression
676 
677  //! Entropy term for the ternary mole fraction interaction of the
678  //! excess Gibbs free energy expression
680 
681  //! Entropy term for the quaternary mole fraction interaction of the
682  //! excess Gibbs free energy expression
684 
685  //! Enthalpy term for the binary mole fraction interaction of the
686  //! excess Gibbs free energy expression
688 
689  //! Enthalpy term for the ternary mole fraction interaction of the
690  //! excess Gibbs free energy expression
692 
693  //! Enthalpy term for the quaternary mole fraction interaction of the
694  //! excess Gibbs free energy expression
696 
697  //! Entropy term for the binary mole fraction interaction of the
698  //! excess Gibbs free energy expression
700 
701  //! Entropy term for the ternary mole fraction interaction of the
702  //! excess Gibbs free energy expression
704 
705  //! Entropy term for the quaternary mole fraction interaction of the
706  //! excess Gibbs free energy expression
708 
709  //! vector of species indices representing species A in the interaction
710  /*!
711  * Each Margules excess Gibbs free energy term involves two species, A and B.
712  * This vector identifies species A.
713  */
714  std::vector<size_t> m_pSpecies_A_ij;
715 
716  //! vector of species indices representing species B in the interaction
717  /*!
718  * Each Margules excess Gibbs free energy term involves two species, A and B.
719  * This vector identifies species B.
720  */
721  std::vector<size_t> m_pSpecies_B_ij;
722 
723  //! form of the Margules interaction expression
724  /*!
725  * Currently there is only one form.
726  */
728 
729  //! form of the temperature dependence of the Margules interaction expression
730  /*!
731  * Currently there is only one form -> constant wrt temperature.
732  */
734 };
735 
736 }
737 
738 #endif
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only...
void s_update_dlnActCoeff_dlnN_diag() const
Update the derivative of the log of the activity coefficients wrt log(moles) - diagonal only...
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies for the species in the mixture.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
void s_update_dlnActCoeff_dlnN() const
Update the derivative of the log of the activity coefficients wrt log(moles_m)
virtual void getd2lnActCoeffdT2(doublereal *d2lnActCoeffdT2) const
Get the array of temperature second derivatives of the log activity coefficients. ...
void s_update_dlnActCoeff_dlnX_diag() const
Update the derivative of the log of the activity coefficients wrt log(mole fraction) ...
void s_update_lnActCoeff() const
Update the activity coefficients.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
vector_fp m_HE_d_ij
Enthalpy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
vector_fp m_SE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
Header for intermediate ThermoPhase object for phases which employ Gibbs excess free energy based for...
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
void readXMLBinarySpecies(XML_Node &xmlBinarySpecies)
Process an XML node called "binaryNeutralSpeciesParameters".
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients w.r.t.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar entropies for the species in the mixture.
void initLengths()
Initialize lengths of local variables after all species have been identified.
int formTempModel_
form of the temperature dependence of the Margules interaction expression
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of log concentration-like derivatives of the log activity coefficients - diagonal compo...
void s_update_dlnActCoeff_dT() const
Update the derivative of the log of the activity coefficients wrt T.
vector_fp m_HE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object.
MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs the DH and local Margule...
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the ln species mole num...
vector_fp m_VHE_d_ij
Enthalpy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
void resizeNumInteractions(const size_t num)
Resize internal arrays within the object that depend upon the number of binary Margules interaction t...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
vector_fp m_VHE_b_ij
Enthalpy term for the binary mole fraction interaction of the excess Gibbs free energy expression...
int formMargules_
form of the Margules interaction expression
vector_fp m_VHE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const
Get the array of temperature derivatives of the log activity coefficients.
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
vector_fp m_VSE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp m_VSE_d_ij
Entropy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
std::vector< size_t > m_pSpecies_B_ij
vector of species indices representing species B in the interaction
vector_fp m_SE_c_ij
Entropy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
vector_fp m_HE_c_ij
Enthalpy term for the ternary mole fraction interaction of the excess Gibbs free energy expression...
size_t numBinaryInteractions_
number of binary interaction expressions
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
std::vector< size_t > m_pSpecies_A_ij
vector of species indices representing species A in the interaction
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
vector_fp m_SE_d_ij
Entropy term for the quaternary mole fraction interaction of the excess Gibbs free energy expression...
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
MixedSolventElectrolyte & operator=(const MixedSolventElectrolyte &b)
Assignment operator.
vector_fp m_VSE_b_ij
Entropy term for the binary mole fraction interaction of the excess Gibbs free energy expression...