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