Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticePhase.h
Go to the documentation of this file.
1 /**
2  * @file LatticePhase.h
3  * Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase,
4  * assuming a lattice of solid atoms
5  * (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink).
6  */
7 
8 // Copyright 2005 California Institute of Technology
9 
10 #ifndef CT_LATTICE_H
11 #define CT_LATTICE_H
12 
13 #include "mix_defs.h"
14 #include "ThermoPhase.h"
15 
16 namespace Cantera
17 {
18 
19 //! A simple thermodynamic model for a bulk phase,
20 //! assuming a lattice of solid atoms
21 /*!
22  * The bulk consists of a matrix of equivalent sites whose molar density
23  * does not vary with temperature or pressure. The thermodynamics
24  * obeys the ideal solution laws. The phase and the pure species phases which
25  * comprise the standard states of the species are assumed to have
26  * zero volume expansivity and zero isothermal compressibility.
27  *
28  * The density of matrix sites is given by the variable \f$ C_o \f$,
29  * which has SI units of kmol m-3.
30  *
31  * <b> Specification of Species Standard State Properties </b>
32  *
33  * It is assumed that the reference state thermodynamics may be
34  * obtained by a pointer to a populated species thermodynamic property
35  * manager class (see ThermoPhase::m_spthermo). However, how to relate pressure
36  * changes to the reference state thermodynamics is within this class.
37  *
38  * Pressure is defined as an independent variable in this phase. However, it has
39  * no effect on any quantities, as the molar concentration is a constant.
40  *
41  * The standard state enthalpy function is given by the following relation,
42  * which has a weak dependence on the system pressure, \f$P\f$.
43  *
44  * \f[
45  * h^o_k(T,P) =
46  * h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
47  * \f]
48  *
49  * For an incompressible substance, the molar internal energy is
50  * independent of pressure. Since the thermodynamic properties
51  * are specified by giving the standard-state enthalpy, the
52  * term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted from the specified reference molar
53  * enthalpy to compute the standard state molar internal energy:
54  *
55  * \f[
56  * u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o}
57  * \f]
58  *
59  * The standard state heat capacity, internal energy, and entropy are independent
60  * of pressure. The standard state Gibbs free energy is obtained
61  * from the enthalpy and entropy functions.
62  *
63  * The standard state molar volume is independent of temperature, pressure,
64  * and species identity:
65  *
66  * \f[
67  * V^o_k(T,P) = \frac{1.0}{C_o}
68  * \f]
69  *
70  * <HR>
71  * <H2> Specification of Solution Thermodynamic Properties </H2>
72  * <HR>
73  *
74  * The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is
75  * given by the ideal solution law:
76  *
77  * \f[
78  * a_k = X_k ,
79  * \f]
80  *
81  * where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
82  * The chemical potential for species <I>k</I> is equal to
83  *
84  * \f[
85  * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
86  * \f]
87  *
88  * The partial molar entropy for species <I>k</I> is given by the following relation,
89  *
90  * \f[
91  * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k)
92  * \f]
93  *
94  * The partial molar enthalpy for species <I>k</I> is
95  *
96  * \f[
97  * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
98  * \f]
99  *
100  * The partial molar Internal Energy for species <I>k</I> is
101  *
102  * \f[
103  * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
104  * \f]
105  *
106  * The partial molar Heat Capacity for species <I>k</I> is
107  *
108  * \f[
109  * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
110  * \f]
111  *
112  * The partial molar volume is independent of temperature, pressure,
113  * and species identity:
114  *
115  * \f[
116  * \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o}
117  * \f]
118  *
119  * It is assumed that the reference state thermodynamics may be
120  * obtained by a pointer to a populated species thermodynamic property
121  * manager class (see ThermoPhase::m_spthermo). How to relate pressure
122  * changes to the reference state thermodynamics is resolved at this level.
123  *
124  * Pressure is defined as an independent variable in this phase. However, it only
125  * has a weak dependence on the enthalpy, and doesn't effect the molar
126  * concentration.
127  *
128  * <HR>
129  * <H2> %Application within Kinetics Managers </H2>
130  * <HR>
131  *
132  * \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$
133  * \f$ C^s_k \f$, the standard concentration, is
134  * defined to be equal to one. \f$ a_k \f$ are activities used in the
135  * thermodynamic functions. These activity (or generalized)
136  * concentrations are used
137  * by kinetics manager classes to compute the forward and
138  * reverse rates of elementary reactions.
139  * The activity concentration,\f$ C^a_k \f$, is given by the following expression.
140  *
141  * \f[
142  * C^a_k = C^s_k X_k = X_k
143  * \f]
144  *
145  * The standard concentration for species <I>k</I> is identically one
146  *
147  * \f[
148  * C^s_k = C^s = 1.0
149  * \f]
150  *
151  * For example, a bulk-phase binary gas reaction between species j and k, producing
152  * a new species l would have the
153  * following equation for its rate of progress variable, \f$ R^1 \f$, which has
154  * units of kmol m-3 s-1.
155  *
156  * \f[
157  * R^1 = k^1 C_j^a C_k^a = k^1 X_j X_k
158  * \f]
159  *
160  * The reverse rate constant can then be obtained from the law of microscopic reversibility
161  * and the equilibrium expression for the system.
162  *
163  * \f[
164  * \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
165  * \f]
166  *
167  * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
168  * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
169  * \f$ a_l \f$, repeated here:
170  *
171  * \f[
172  * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
173  * \f]
174  *
175  * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
176  * to activity concentrations. When this is done:
177  *
178  * \f[
179  * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
180  * \exp(\frac{\mu^{o}_l - \mu^{o}_j - \mu^{o}_k}{R T} )
181  * \f]
182  *
183  *
184  * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
185  * using the second and third part of the above expression as a definition for the concentration
186  * equilibrium constant.
187  *
188  * <HR>
189  * <H2> Instantiation of the Class </H2>
190  * <HR>
191  *
192  * The constructor for this phase is located in the default ThermoFactory
193  * for %Cantera. A new LatticePhase object may be created by the following code snippet:
194  *
195  * @code
196  * XML_Node *xc = get_XML_File("O_lattice_SiO2.xml");
197  * XML_Node * const xs = xc->findNameID("phase", "O_lattice_SiO2");
198  * ThermoPhase *tp = newPhase(*xs);
199  * LatticePhase *o_lattice = dynamic_cast <LatticPhase *>(tp);
200  * @endcode
201  *
202  * or by the following constructor:
203  *
204  * @code
205  * XML_Node *xc = get_XML_File("O_lattice_SiO2.xml");
206  * XML_Node * const xs = xc->findNameID("phase", "O_lattice_SiO2");
207  * LatticePhase *o_lattice = new LatticePhase(*xs);
208  * @endcode
209  *
210  * The XML file used in this example is listed in the next section
211  *
212  * <HR>
213  * <H2> XML Example </H2>
214  * <HR>
215  *
216  * An example of an XML Element named phase setting up a LatticePhase object named "O_lattice_SiO2"
217  * is given below.
218  *
219  * @code
220  * <!-- phase O_lattice_SiO2 -->
221  * <phase dim="3" id="O_lattice_SiO2">
222  * <elementArray datasrc="elements.xml"> Si H He </elementArray>
223  * <speciesArray datasrc="#species_data">
224  * O_O Vac_O
225  * </speciesArray>
226  * <reactionArray datasrc="#reaction_data"/>
227  * <thermo model="Lattice">
228  * <site_density> 73.159 </site_density>
229  * <vacancy_species> Vac_O </vacancy_species>
230  * </thermo>
231  * <kinetics model="BulkKinetics"/>
232  * <transport model="None"/>
233  * </phase>
234  * @endcode
235  *
236  * The model attribute "Lattice" of the thermo XML element identifies the phase as
237  * being of the type handled by the LatticePhase object.
238  *
239  * @ingroup thermoprops
240  */
241 class LatticePhase : public ThermoPhase
242 {
243 public:
244  //! Base Empty constructor
245  LatticePhase();
246 
247  //! Copy Constructor
248  /*!
249  * @param right Object to be copied
250  */
251  LatticePhase(const LatticePhase& right);
252 
253  //! Assignment operator
254  /*!
255  * @param right Object to be copied
256  */
257  LatticePhase& operator=(const LatticePhase& right);
258 
259  //! Full constructor for a lattice phase
260  /*!
261  * @param inputFile String name of the input file
262  * @param id string id of the phase name
263  */
264  LatticePhase(const std::string& inputFile, const std::string& id = "");
265 
266  //! Full constructor for a water phase
267  /*!
268  * @param phaseRef XML node referencing the lattice phase.
269  * @param id string id of the phase name
270  */
271  LatticePhase(XML_Node& phaseRef, const std::string& id = "");
272 
273  //! Duplication function
274  /*!
275  * This virtual function is used to create a duplicate of the
276  * current phase. It's used to duplicate the phase when given
277  * a ThermoPhase pointer to the phase.
278  */
280 
281  //! Equation of state flag. Returns the value cLattice
282  virtual int eosType() const {
283  return cLattice;
284  }
285 
286  //! @name Molar Thermodynamic Properties of the Solution
287  //! @{
288 
289  //! Return the Molar Enthalpy. Units: J/kmol.
290  /*!
291  * For an ideal solution,
292  *
293  * \f[
294  * \hat h(T,P) = \sum_k X_k \hat h^0_k(T,P),
295  * \f]
296  *
297  * The standard-state pure-species Enthalpies
298  * \f$ \hat h^0_k(T,P) \f$ are computed first by the species reference
299  * state thermodynamic property manager and then a small pressure dependent term is
300  * added in.
301  *
302  * \see SpeciesThermo
303  */
304  virtual doublereal enthalpy_mole() const;
305 
306  //! Molar entropy of the solution. Units: J/kmol/K
307  /*!
308  * For an ideal, constant partial molar volume solution mixture with
309  * pure species phases which exhibit zero volume expansivity:
310  * \f[
311  * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k)
312  * \f]
313  * The reference-state pure-species entropies
314  * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic
315  * property manager. The pure species entropies are independent of
316  * pressure since the volume expansivities are equal to zero.
317  *
318  * Units: J/kmol/K.
319  *
320  * @see SpeciesThermo
321  */
322  virtual doublereal entropy_mole() const;
323 
324  //! Molar heat capacity at constant pressure of the solution.
325  //! Units: J/kmol/K.
326  /*!
327  * For an ideal, constant partial molar volume solution mixture with
328  * pure species phases which exhibit zero volume expansivity:
329  * \f[
330  * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) .
331  * \f]
332  * The heat capacity is independent of pressure.
333  * The reference-state pure-species heat capacities
334  * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
335  * property manager.
336  *
337  * @see SpeciesThermo
338  */
339  virtual doublereal cp_mole() const;
340 
341  //! Molar heat capacity at constant volume of the solution.
342  //! Units: J/kmol/K.
343  /*!
344  * For an ideal, constant partial molar volume solution mixture with
345  * pure species phases which exhibit zero volume expansivity:
346  * \f[
347  * \hat c_v(T,P) = \hat c_p(T,P)
348  * \f]
349  *
350  * The two heat capacities are equal.
351  */
352  virtual doublereal cv_mole() const;
353 
354  //@}
355  /// @name Mechanical Equation of State Properties
356  /**
357  * In this equation of state implementation, the density is a
358  * function only of the mole fractions. Therefore, it can't be
359  * an independent variable. Instead, the pressure is used as the
360  * independent variable. Functions which try to set the thermodynamic
361  * state by calling setDensity() may cause an exception to be
362  * thrown.
363  */
364  //@{
365 
366  //! Pressure. Units: Pa.
367  /*!
368  * For this incompressible system, we return the internally stored
369  * independent value of the pressure.
370  */
371  virtual doublereal pressure() const {
372  return m_Pcurrent;
373  }
374 
375  //! Set the internally stored pressure (Pa) at constant
376  //! temperature and composition
377  /*!
378  * This method sets the pressure within the object.
379  * The mass density is not a function of pressure.
380  *
381  * @param p Input Pressure (Pa)
382  */
383  virtual void setPressure(doublereal p);
384 
385  //! Calculate the density of the mixture using the partial
386  //! molar volumes and mole fractions as input
387  /*!
388  * The formula for this is
389  *
390  * \f[
391  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
392  * \f]
393  *
394  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
395  * the molecular weights, and \f$V_k\f$ are the pure species
396  * molar volumes.
397  *
398  * Note, the basis behind this formula is that in an ideal
399  * solution the partial molar volumes are equal to the pure
400  * species molar volumes. We have additionally specified
401  * in this class that the pure species molar volumes are
402  * independent of temperature and pressure.
403  */
404  doublereal calcDensity();
405 
406  //! Set the mole fractions
407  /*!
408  * @param x Input vector of mole fractions.
409  * Length: m_kk.
410  */
411  virtual void setMoleFractions(const doublereal* const x);
412 
413  //! Set the mole fractions, but don't normalize them to one.
414  /*!
415  * @param x Input vector of mole fractions.
416  * Length: m_kk.
417  */
418  virtual void setMoleFractions_NoNorm(const doublereal* const x);
419 
420  //! Set the mass fractions, and normalize them to one.
421  /*!
422  * @param y Input vector of mass fractions.
423  * Length: m_kk.
424  */
425  virtual void setMassFractions(const doublereal* const y);
426 
427  //! Set the mass fractions, but don't normalize them to one
428  /*!
429  * @param y Input vector of mass fractions.
430  * Length: m_kk.
431  */
432  virtual void setMassFractions_NoNorm(const doublereal* const y);
433 
434  //! Set the concentration,
435  /*!
436  * @param c Input vector of concentrations.
437  * Length: m_kk.
438  */
439  virtual void setConcentrations(const doublereal* const c);
440 
441  //@}
442  /// @name Activities, Standard States, and Activity Concentrations
443  /**
444  * The activity \f$a_k\f$ of a species in solution is
445  * related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
446  * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
447  * the chemical potential at unit activity, which depends only
448  * on temperature and the pressure.
449  * Activity is assumed to be molality-based here.
450  */
451  //@{
452 
453  /**
454  * This method returns an array of generalized concentrations
455  * \f$ C_k\f$ that are defined such that
456  * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
457  * is a standard concentration
458  * defined below. These generalized concentrations are used
459  * by kinetics manager classes to compute the forward and
460  * reverse rates of elementary reactions.
461  *
462  * @param c Array of generalized concentrations. The
463  * units depend upon the implementation of the
464  * reaction rate expressions within the phase.
465  */
466  virtual void getActivityConcentrations(doublereal* c) const;
467 
468  //! Return the standard concentration for the kth species
469  /*!
470  * The standard concentration \f$ C^0_k \f$ used to normalize
471  * the activity (i.e., generalized) concentration for use
472  *
473  * For the time being, we will use the concentration of pure
474  * solvent for the the standard concentration of all species.
475  * This has the effect of making mass-action reaction rates
476  * based on the molality of species proportional to the
477  * molality of the species.
478  *
479  * @param k Optional parameter indicating the species. The default
480  * is to assume this refers to species 0.
481  * @return
482  * Returns the standard Concentration in units of
483  * m<SUP>3</SUP> kmol<SUP>-1</SUP>.
484  *
485  * @param k Species index
486  */
487  virtual doublereal standardConcentration(size_t k=0) const;
488 
489  //! Returns the natural logarithm of the standard
490  //! concentration of the kth species
491  /*!
492  * @param k Species index
493  */
494  virtual doublereal logStandardConc(size_t k=0) const;
495 
496  //! Get the array of non-dimensional activity coefficients at
497  //! the current solution temperature, pressure, and solution concentration.
498  /*!
499  * For this phase, the activity coefficients are all equal to one.
500  *
501  * @param ac Output vector of activity coefficients. Length: m_kk.
502  */
503  virtual void getActivityCoefficients(doublereal* ac) const;
504 
505  //@}
506  /// @name Partial Molar Properties of the Solution
507  //@{
508 
509  //! Get the species chemical potentials. Units: J/kmol.
510  /*!
511  * This function returns a vector of chemical potentials of the
512  * species in solid solution at the current temperature, pressure
513  * and mole fraction of the solid solution.
514  *
515  * @param mu Output vector of species chemical
516  * potentials. Length: m_kk. Units: J/kmol
517  */
518  virtual void getChemPotentials(doublereal* mu) const;
519 
520  //@}
521  /// @name Partial Molar Properties of the Solution
522  //@{
523 
524  /**
525  * Returns an array of partial molar enthalpies for the species
526  * in the mixture.
527  * Units (J/kmol)
528  * For this phase, the partial molar enthalpies are equal to the
529  * pure species enthalpies
530  * \f[
531  * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
532  * \f]
533  * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
534  * at the reference pressure,\f$ P_{ref} \f$,
535  * are computed by the species thermodynamic
536  * property manager. They are polynomial functions of temperature.
537  * @see SpeciesThermo
538  *
539  * @param hbar Output vector containing partial molar enthalpies.
540  * Length: m_kk.
541  */
542  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
543 
544  /**
545  * Returns an array of partial molar entropies of the species in the
546  * solution. Units: J/kmol/K.
547  * For this phase, the partial molar entropies are equal to the
548  * pure species entropies plus the ideal solution contribution.
549  * \f[
550  * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
551  * \f]
552  * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$,
553  * at the reference pressure, \f$ P_{ref} \f$, are computed by the
554  * species thermodynamic
555  * property manager. They are polynomial functions of temperature.
556  * @see SpeciesThermo
557  *
558  * @param sbar Output vector containing partial molar entropies.
559  * Length: m_kk.
560  */
561  virtual void getPartialMolarEntropies(doublereal* sbar) const;
562 
563  /**
564  * Returns an array of partial molar Heat Capacities at constant
565  * pressure of the species in the
566  * solution. Units: J/kmol/K.
567  * For this phase, the partial molar heat capacities are equal
568  * to the standard state heat capacities.
569  *
570  * @param cpbar Output vector of partial heat capacities. Length: m_kk.
571  */
572  virtual void getPartialMolarCp(doublereal* cpbar) const;
573 
574  //! Return an array of partial molar volumes for the
575  //! species in the mixture. Units: m^3/kmol.
576  /*!
577  * @param vbar Output vector of species partial molar volumes.
578  * Length = m_kk. units are m^3/kmol.
579  */
580  virtual void getPartialMolarVolumes(doublereal* vbar) const;
581 
582  //! Get the array of chemical potentials at unit activity for the
583  //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
584  /*!
585  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
586  * \f$. The values are evaluated at the current
587  * temperature and pressure of the solution
588  *
589  * @param mu Output vector of chemical potentials.
590  * Length: m_kk.
591  */
592  virtual void getStandardChemPotentials(doublereal* mu) const;
593 
594  //! Get the Gibbs functions for the standard
595  //! state of the species at the current <I>T</I> and <I>P</I> of the solution
596  /*!
597  * Units are Joules/kmol
598  * @param gpure Output vector of standard state Gibbs free energies
599  * Length: m_kk.
600  */
601  virtual void getPureGibbs(doublereal* gpure) const;
602 
603  //@}
604  /// @name Properties of the Standard State of the Species in the Solution
605  //@{
606 
607  //! Get the nondimensional Enthalpy functions for the species standard states
608  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
609  /*!
610  * A small pressure dependent term is added onto the reference state enthalpy
611  * to get the pressure dependence of this term.
612  *
613  * \f[
614  * h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
615  * \f]
616  *
617  * The reference state thermodynamics is
618  * obtained by a pointer to a populated species thermodynamic property
619  * manager class (see ThermoPhase::m_spthermo). How to relate pressure
620  * changes to the reference state thermodynamics is resolved at this level.
621  *
622  * @param hrt Output vector of nondimensional standard state enthalpies.
623  * Length: m_kk.
624  */
625  virtual void getEnthalpy_RT(doublereal* hrt) const;
626 
627  //! Get the array of nondimensional Entropy functions for the
628  //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
629  /*!
630  * The entropy of the standard state is defined as independent of
631  * pressure here.
632  *
633  * \f[
634  * s^o_k(T,P) = s^{ref}_k(T)
635  * \f]
636  *
637  * The reference state thermodynamics is
638  * obtained by a pointer to a populated species thermodynamic property
639  * manager class (see ThermoPhase::m_spthermo). How to relate pressure
640  * changes to the reference state thermodynamics is resolved at this level.
641  *
642  * @param sr Output vector of nondimensional standard state entropies.
643  * Length: m_kk.
644  */
645  virtual void getEntropy_R(doublereal* sr) const;
646 
647  //! Get the nondimensional Gibbs functions for the species
648  //! standard states at the current <I>T</I> and <I>P</I> of the solution.
649  /*!
650  * The standard Gibbs free energies are obtained from the enthalpy
651  * and entropy formulation.
652  *
653  * \f[
654  * g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P)
655  * \f]
656  *
657  * @param grt Output vector of nondimensional standard state Gibbs free energies
658  * Length: m_kk.
659  */
660  virtual void getGibbs_RT(doublereal* grt) const;
661 
662  //! Get the nondimensional Heat Capacities at constant
663  //! pressure for the species standard states
664  //! at the current <I>T</I> and <I>P</I> of the solution
665  /*!
666  * The heat capacity of the standard state is independent of pressure
667  *
668  * \f[
669  * Cp^o_k(T,P) = Cp^{ref}_k(T)
670  * \f]
671  *
672  * The reference state thermodynamics is
673  * obtained by a pointer to a populated species thermodynamic property
674  * manager class (see ThermoPhase::m_spthermo). How to relate pressure
675  * changes to the reference state thermodynamics is resolved at this level.
676  *
677  * @param cpr Output vector of nondimensional standard state heat capacities
678  * Length: m_kk.
679  */
680  virtual void getCp_R(doublereal* cpr) const;
681 
682  //! Get the molar volumes of the species standard states at the current
683  //! <I>T</I> and <I>P</I> of the solution.
684  /*!
685  * units = m^3 / kmol
686  *
687  * @param vol Output vector containing the standard state volumes.
688  * Length: m_kk.
689  */
690  virtual void getStandardVolumes(doublereal* vol) const;
691 
692  //@}
693  /// @name Thermodynamic Values for the Species Reference States
694  //@{
695 
696  //! Returns the vector of nondimensional
697  //! Enthalpies of the reference state at the current temperature
698  //! of the solution and the reference pressure for the phase.
699  /*!
700  * @return Output vector of nondimensional reference state
701  * Enthalpies of the species.
702  * Length: m_kk
703  */
704  const vector_fp& enthalpy_RT_ref() const;
705 
706  //! Returns a reference to the dimensionless reference state Gibbs free energy vector.
707  /*!
708  * This function is part of the layer that checks/recalculates the reference
709  * state thermo functions.
710  */
711  const vector_fp& gibbs_RT_ref() const;
712 
713  //! Returns the vector of nondimensional
714  //! Gibbs Free Energies of the reference state at the current temperature
715  //! of the solution and the reference pressure for the species.
716  /*!
717  * @param grt Output vector containing the nondimensional reference state
718  * Gibbs Free energies. Length: m_kk.
719  */
720  virtual void getGibbs_RT_ref(doublereal* grt) const;
721 
722  //! Returns the vector of the Gibbs function of the reference state at the current temperature
723  //! of the solution and the reference pressure for the species.
724  /*!
725  * units = J/kmol
726  *
727  * @param g Output vector containing the reference state
728  * Gibbs Free energies. Length: m_kk. Units: J/kmol.
729  */
730  virtual void getGibbs_ref(doublereal* g) const;
731 
732  //! Returns a reference to the dimensionless reference state Entropy vector.
733  /*!
734  * This function is part of the layer that checks/recalculates the reference
735  * state thermo functions.
736  */
737  const vector_fp& entropy_R_ref() const;
738 
739  //! Returns a reference to the dimensionless reference state Heat Capacity vector.
740  /*!
741  * This function is part of the layer that checks/recalculates the reference
742  * state thermo functions.
743  */
744  const vector_fp& cp_R_ref() const;
745 
746  //@}
747  /// @name Utilities for Initialization of the Object
748  //@{
749 
750  //! Initialize the ThermoPhase object after all species have been set up
751  /*!
752  * @internal Initialize.
753  *
754  * This method performs any initialization required after all
755  * species have been added. For example, it is used to
756  * resize internal work arrays that must have an entry for
757  * each species.
758  * This method is called from ThermoPhase::initThermoXML(),
759  * which is called from importPhase(),
760  * just prior to returning from the function, importPhase().
761  */
762  virtual void initThermo();
763 
764  //! Import and initialize a ThermoPhase object using an XML tree.
765  /*!
766  * Here we read extra information about the XML description
767  * of a phase. Regular information about elements and species
768  * and their reference state thermodynamic information
769  * have already been read at this point.
770  * For example, we do not need to call this function for
771  * ideal gas equations of state.
772  * This function is called from importPhase()
773  * after the elements and the
774  * species are initialized with default ideal solution
775  * level data.
776  *
777  * @param phaseNode This object must be the phase node of a
778  * complete XML tree
779  * description of the phase, including all of the
780  * species data. In other words while "phase" must
781  * point to an XML phase object, it must have
782  * sibling nodes "speciesData" that describe
783  * the species in the phase.
784  * @param id ID of the phase. If nonnull, a check is done
785  * to see if phaseNode is pointing to the phase
786  * with the correct id.
787  */
788  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
789 
790  //! Set the equation of state parameters from the argument list
791  /*!
792  * @internal
793  * Set equation of state parameters.
794  *
795  * @param n number of parameters. Must be one
796  * @param c array of \a n coefficients
797  * c[0] = The bulk lattice density (kmol m-3)
798  */
799  virtual void setParameters(int n, doublereal* const c);
800 
801  //! Get the equation of state parameters in a vector
802  /*!
803  * @internal
804  *
805  * @param n number of parameters
806  * @param c array of \a n coefficients
807  *
808  * For this phase:
809  * - n = 1
810  * - c[0] = molar density of phase [ kmol/m^3 ]
811  */
812  virtual void getParameters(int& n, doublereal* const c) const;
813 
814  //! Set equation of state parameter values from XML entries.
815  /*!
816  * This method is called by function importPhase() when processing a phase
817  * definition in an input file. It should be overloaded in subclasses to set
818  * any parameters that are specific to that particular phase
819  * model. Note, this method is called before the phase is
820  * initialized with elements and/or species.
821  *
822  * For this phase, the molar density of the phase is specified in this block,
823  * and is a required parameter.
824  *
825  * @param eosdata An XML_Node object corresponding to
826  * the "thermo" entry for this phase in the input file.
827  *
828  * eosdata points to the thermo block, and looks like this:
829  *
830  * @code
831  * <phase id="O_lattice_SiO2" >
832  * <thermo model="Lattice">
833  * <site_density units="kmol/m^3"> 73.159 </site_density>
834  * <vacancy_species> "O_vacancy" </vacancy_species>
835  * </thermo>
836  * </phase>
837  * @endcode
838  */
839  virtual void setParametersFromXML(const XML_Node& eosdata);
840  //@}
841 
842 protected:
843  //! Reference state pressure
844  doublereal m_Pref;
845 
846  //! The current pressure
847  /*!
848  * Since the density isn't a function of pressure, but only of the
849  * mole fractions, we need to independently specify the pressure.
850  * The density variable which is inherited as part of the State class,
851  * m_dens, is always kept current whenever T, P, or X[] change.
852  */
853  doublereal m_Pcurrent;
854 
855  //! Reference state enthalpies / RT
857 
858  //! Temporary storage for the reference state heat capacities
860 
861  //! Temporary storage for the reference state Gibbs energies
863 
864  //! Temporary storage for the reference state entropies at the current temperature
865  mutable vector_fp m_s0_R;
866 
867  //! String name for the species which represents a vacancy
868  //! in the lattice
869  /*!
870  * This string is currently unused
871  */
872  std::string m_vacancy;
873 
874  //! Vector of molar volumes for each species in the solution
875  /**
876  * Species molar volumes \f$ m^3 kmol^-1 \f$
877  */
879 
880  //! Site Density of the lattice solid
881  /*!
882  * Currently, this is imposed as a function of T, P or composition
883  *
884  * units are kmol m-3
885  */
886  doublereal m_site_density;
887 
888 private:
889  //! Update the species reference state thermodynamic functions
890  /*!
891  * The polynomials for the standard state functions are only
892  * reevaluated if the temperature has changed.
893  */
894  void _updateThermo() const;
895 };
896 }
897 
898 #endif
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
doublereal m_site_density
Site Density of the lattice solid.
Definition: LatticePhase.h:886
doublereal m_Pref
Reference state pressure.
Definition: LatticePhase.h:844
virtual void getActivityConcentrations(doublereal *c) const
The activity of a species in solution is related to the chemical potential by The quantity is the ...
doublereal calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
vector_fp m_g0_RT
Temporary storage for the reference state Gibbs energies.
Definition: LatticePhase.h:862
vector_fp m_s0_R
Temporary storage for the reference state entropies at the current temperature.
Definition: LatticePhase.h:865
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species standard states at the current T and P of the ...
vector_fp m_h0_RT
Reference state enthalpies / RT.
Definition: LatticePhase.h:856
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
virtual int eosType() const
Equation of state flag. Returns the value cLattice.
Definition: LatticePhase.h:282
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters from the argument list.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
A simple thermodynamic model for a bulk phase, assuming a lattice of solid atoms. ...
Definition: LatticePhase.h:241
virtual doublereal entropy_mole() const
Molar entropy of the solution. Units: J/kmol/K.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
std::string m_vacancy
String name for the species which represents a vacancy in the lattice.
Definition: LatticePhase.h:872
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions, but don't normalize them to one.
LatticePhase & operator=(const LatticePhase &right)
Assignment operator.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution...
doublereal m_Pcurrent
The current pressure.
Definition: LatticePhase.h:853
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions.
vector_fp m_cp0_R
Temporary storage for the reference state heat capacities.
Definition: LatticePhase.h:859
virtual doublereal cv_mole() const
Molar heat capacity at constant volume of the solution.
virtual doublereal pressure() const
In this equation of state implementation, the density is a function only of the mole fractions...
Definition: LatticePhase.h:371
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
void _updateThermo() const
Update the species reference state thermodynamic functions.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the dimensionless reference state Gibbs free energy vector.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the species standard states at the current T an...
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 void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species standard states at the current ...
const vector_fp & enthalpy_RT_ref() const
Returns the vector of nondimensional Enthalpies of the reference state at the current temperature of ...
virtual doublereal enthalpy_mole() const
Return the Molar Enthalpy. Units: J/kmol.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
Definition: LatticePhase.h:878
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species standard states at their standard states at...
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
const vector_fp & entropy_R_ref() const
Returns a reference to the dimensionless reference state Entropy vector.
virtual void setConcentrations(const doublereal *const c)
Set the concentration,.
const vector_fp & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature, pressure, and solution concentration.
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions, but don't normalize them to one.
LatticePhase()
Base Empty constructor.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions, and normalize them to one.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.