Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaskellSolidSolnPhase.h
Go to the documentation of this file.
1 /**
2  * @file MaskellSolidSolnPhase.h Header file for a solid solution model
3  * following Maskell, Shaw, and Tye. Electrochimica Acta 1982
4  *
5  * This class inherits from the Cantera class ThermoPhase and implements a
6  * non-ideal solid solution model with incompressible thermodynamics.
7  */
8 /*
9  * Copyright 2006 Sandia Corporation. Under the terms of Contract
10  * DE-AC04-94AL85000, with Sandia Corporation, the U.S. Government
11  * retains certain rights in this software.
12  */
13 
14 #ifndef CT_MASKELLSOLIDSOLNPHASE_H
15 #define CT_MASKELLSOLIDSOLNPHASE_H
16 
17 #include "VPStandardStateTP.h"
18 
19 namespace Cantera
20 {
21 
22 /**
23  * Class MaskellSolidSolnPhase represents a condensed phase
24  * non-ideal solution with 2 species following the thermodynamic
25  * model described in Maskell, Shaw, and Tye, Manganese Dioxide Electrode -- IX,
26  * Electrochimica Acta 28(2) pp 231-235, 1983.
27  *
28  * @ingroup thermoprops
29  */
31 {
32 public:
34 
35  //! Copy Constructor
37 
38  //! Assignment operator
40 
41  /*!
42  * Base Class Duplication Function
43  *
44  * Given a pointer to ThermoPhase, this function can duplicate the object.
45  */
46  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
47 
48  /**
49  * This method returns the array of generalized
50  * concentrations. The generalized concentrations are used
51  * in the evaluation of the rates of progress for reactions
52  * involving species in this phase. The generalized
53  * concentration divided by the standard concentration is also
54  * equal to the activity of species.
55  *
56  * @param c Pointer to array of doubles of length m_kk, which on exit
57  * will contain the generalized concentrations.
58  */
59  virtual void getActivityConcentrations(doublereal* c) const;
60 
61  //! Return the standard concentration for the kth species
62  /*!
63  * The standard concentration \f$ C^0_k \f$ used to normalize the
64  * generalized concentration.
65  *
66  * @param k Species number: this is an optional parameter,
67  */
68  virtual doublereal standardConcentration(size_t k=0) const { return 1.0; }
69 
70  //! Natural logarithm of the standard concentration of the kth species.
71  /*!
72  * @param k index of the species (defaults to zero)
73  */
74  virtual doublereal logStandardConc(size_t k=0) const { return 0.0; }
75 
76  //! @name Molar Thermodynamic Properties of the Solution
77  //! @{
78  /**
79  * Molar enthalpy of the solution. Units: J/kmol.
80  */
81  virtual doublereal enthalpy_mole() const;
82 
83  /**
84  * Molar entropy of the solution. Units: J/kmol/K.
85  */
86  virtual doublereal entropy_mole() const;
87 
88  /**
89  * Molar heat capacity at constant pressure of the solution.
90  * Units: J/kmol/K.
91  */
92  //virtual doublereal cp_mole() const;
93 
94  /**
95  * Molar heat capacity at constant volume of the solution.
96  * Units: J/kmol/K.
97  */
98  //virtual doublereal cv_mole() const {
99  // return cp_mole();
100  //}
101 
102  //@}
103  /** @name Mechanical Equation of State Properties
104  *
105  * In this equation of state implementation, the density is a
106  * function only of the mole fractions. Therefore, it can't be
107  * an independent variable. Instead, the pressure is used as the
108  * independent variable. Functions which try to set the thermodynamic
109  * state by calling setDensity() may cause an exception to be
110  * thrown.
111  */
112  //@{
113 
114  /**
115  * Pressure. Units: Pa.
116  * For this incompressible system, we return the internally stored
117  * independent value of the pressure.
118  */
119  virtual doublereal pressure() const {
120  return m_Pcurrent;
121  }
122 
123  /**
124  * Set the pressure at constant temperature. Units: Pa.
125  * This method sets a constant within the object.
126  * The mass density is not a function of pressure.
127  *
128  * @param p Input Pressure (Pa)
129  */
130  virtual void setPressure(doublereal p);
131 
132  /**
133  * Overwritten setDensity() function is necessary because the
134  * density is not an independent variable.
135  *
136  * This function will now throw an error condition
137  *
138  * @internal May have to adjust the strategy here to make
139  * the eos for these materials slightly compressible, in order
140  * to create a condition where the density is a function of
141  * the pressure.
142  *
143  * @param rho Input density
144  */
145  virtual void setDensity(const doublereal rho);
146 
147  virtual void calcDensity();
148 
149  /**
150  * Overwritten setMolarDensity() function is necessary because the
151  * density is not an independent variable.
152  *
153  * This function will now throw an error condition.
154  *
155  * @param rho Input Density
156  */
157  virtual void setMolarDensity(const doublereal rho);
158 
159  //@}
160 
161  /**
162  * @name Chemical Potentials and Activities
163  * @{
164  */
165 
166  //! Get the array of species activity coefficients
167  /*!
168  * @param ac output vector of activity coefficients. Length: m_kk
169  */
170  virtual void getActivityCoefficients(doublereal* ac) const;
171 
172  /**
173  * Get the species chemical potentials. Units: J/kmol.
174  *
175  * @param mu Output vector of chemical potentials.
176  */
177  virtual void getChemPotentials(doublereal* mu) const;
178 
179  /**
180  * Get the array of non-dimensional species solution
181  * chemical potentials at the current T and P
182  *
183  * @param mu Output vector of dimensionless chemical potentials. Length = m_kk.
184  */
185  virtual void getChemPotentials_RT(doublereal* mu) const;
186 
187  //@}
188  /// @name Partial Molar Properties of the Solution
189  //@{
190 
191  //! Returns an array of partial molar enthalpies for the species in the mixture.
192  /*!
193  * Units (J/kmol)
194  *
195  * @param hbar Output vector containing partial molar enthalpies.
196  * Length: m_kk.
197  */
198  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
199 
200  /**
201  * Returns an array of partial molar entropies of the species in the
202  * solution. Units: J/kmol/K.
203  *
204  * @param sbar Output vector containing partial molar entropies.
205  * Length: m_kk.
206  */
207  virtual void getPartialMolarEntropies(doublereal* sbar) const;
208 
209  /**
210  * Returns an array of partial molar Heat Capacities at constant
211  * pressure of the species in the
212  * solution. Units: J/kmol/K.
213  *
214  * @param cpbar Output vector of partial heat capacities. Length: m_kk.
215  */
216  virtual void getPartialMolarCp(doublereal* cpbar) const;
217 
218  /**
219  * returns an array of partial molar volumes of the species
220  * in the solution. Units: m^3 kmol-1.
221  *
222  * @param vbar Output vector of partial molar volumes. Length: m_kk.
223  */
224  virtual void getPartialMolarVolumes(doublereal* vbar) const;
225 
226  //! Get the Gibbs functions for the standard
227  //! state of the species at the current <I>T</I> and <I>P</I> of the solution
228  /*!
229  * Units are Joules/kmol
230  * @param gpure Output vector of standard state Gibbs free energies
231  * Length: m_kk.
232  */
233  virtual void getPureGibbs(doublereal* gpure) const;
234 
235  //! Get the array of chemical potentials at unit activity for the species
236  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
237  /*!
238  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
239  * \f$. The values are evaluated at the current
240  * temperature and pressure of the solution
241  *
242  * @param mu Output vector of chemical potentials.
243  * Length: m_kk.
244  */
245  virtual void getStandardChemPotentials(doublereal* mu) const;
246 
247  //@}
248  /// @name Utility Functions
249  //@{
250 
251  /**
252  * @internal Import and initialize a ThermoPhase object using an XML
253  * tree. Here we read extra information about the XML description of a
254  * phase. Regular information about elements and species and their
255  * reference state thermodynamic information have already been read at
256  * this point. For example, we do not need to call this function for
257  * ideal gas equations of state. This function is called from
258  * importPhase() after the elements and the species are initialized
259  * with default ideal solution level data.
260  *
261  * @param phaseNode This object must be the phase node of a complete XML
262  * tree description of the phase, including all of the
263  * species data. In other words while "phase" must point to
264  * an XML phase object, it must have sibling nodes
265  * "speciesData" that describe the species in the phase.
266  * @param id ID of the phase. If nonnull, a check is done to see if
267  * phaseNode is pointing to the phase with the correct id.
268  */
269  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
270 
271 
272  void set_h_mix(const doublereal hmix) { h_mixing = hmix; }
273  //@}
274 
275 private:
276  /**
277  * m_Pcurrent = The current pressure
278  * Since the density isn't a function of pressure, but only of the
279  * mole fractions, we need to independently specify the pressure.
280  */
281  doublereal m_Pcurrent;
282 
283  /**
284  * Function to call through to m_spthermo->update and fill m_h0_RT,
285  * m_cp0_R, m_g0_RT, m_s0_R.
286  */
287  void _updateThermo() const;
288 
289  //! Vector containing the species reference enthalpies at T = m_tlast
291 
292  /**
293  * Vector containing the species reference constant pressure
294  * heat capacities at T = m_tlast
295  */
297 
298  //! Vector containing the species reference Gibbs functions at T = m_tlast
300 
301  //! Vector containing the species reference entropies at T = m_tlast
302  mutable vector_fp m_s0_R;
303 
304  //! Value of the enthalpy change on mixing due to protons changing from type B to type A configurations.
305  doublereal h_mixing;
306 
307  //! Index of the species whose mole fraction defines the extent of reduction r
309  int reactant_species_index;
310 
311  // Functions to calculate some of the pieces of the mixing terms.
312  doublereal s() const;
313  doublereal fm(const doublereal r) const;
314  doublereal p(const doublereal r) const;
315 };
316 }
317 
318 #endif
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
void _updateThermo() const
Function to call through to m_spthermo->update and fill m_h0_RT, m_cp0_R, m_g0_RT, m_s0_R.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
virtual void setMolarDensity(const doublereal rho)
Overwritten setMolarDensity() function is necessary because the density is not an independent variabl...
MaskellSolidSolnPhase & operator=(const MaskellSolidSolnPhase &)
Assignment operator.
virtual doublereal pressure() const
Pressure.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
doublereal h_mixing
Value of the enthalpy change on mixing due to protons changing from type B to type A configurations...
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
int product_species_index
Index of the species whose mole fraction defines the extent of reduction r.
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
virtual void setDensity(const doublereal rho)
Overwritten setDensity() function is necessary because the density is not an independent variable...
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
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
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
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
Class MaskellSolidSolnPhase represents a condensed phase non-ideal solution with 2 species following ...
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P...
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.