Cantera  2.4.0
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 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
12 #ifndef CT_MASKELLSOLIDSOLNPHASE_H
13 #define CT_MASKELLSOLIDSOLNPHASE_H
14 
15 #include "VPStandardStateTP.h"
16 
17 namespace Cantera
18 {
19 /**
20  * Class MaskellSolidSolnPhase represents a condensed phase non-ideal solution
21  * with 2 species following the thermodynamic model described in Maskell, Shaw,
22  * and Tye, Manganese Dioxide Electrode -- IX, Electrochimica Acta 28(2) pp
23  * 231-235, 1983.
24  *
25  * @ingroup thermoprops
26  */
28 {
29 public:
31 
32  virtual std::string type() const {
33  return "MaskellSolidsoln";
34  }
35 
36  virtual void getActivityConcentrations(doublereal* c) const;
37  virtual doublereal standardConcentration(size_t k=0) const { return 1.0; }
38  virtual doublereal logStandardConc(size_t k=0) const { return 0.0; }
39 
40  //! @name Molar Thermodynamic Properties of the Solution
41  //! @{
42 
43  virtual doublereal enthalpy_mole() const;
44  virtual doublereal entropy_mole() const;
45 
46  //@}
47  /** @name Mechanical Equation of State Properties
48  *
49  * In this equation of state implementation, the density is a function only
50  * of the mole fractions. Therefore, it can't be an independent variable.
51  * Instead, the pressure is used as the independent variable. Functions
52  * which try to set the thermodynamic state by calling setDensity() may
53  * cause an exception to be thrown.
54  */
55  //@{
56 
57  /**
58  * Pressure. Units: Pa.
59  * For this incompressible system, we return the internally stored
60  * independent value of the pressure.
61  */
62  virtual doublereal pressure() const {
63  return m_Pcurrent;
64  }
65 
66  /**
67  * Set the pressure at constant temperature. Units: Pa. This method sets a
68  * constant within the object. The mass density is not a function of
69  * pressure.
70  *
71  * @param p Input Pressure (Pa)
72  */
73  virtual void setPressure(doublereal p);
74 
75  /**
76  * Overridden setDensity() function is necessary because the density is not
77  * an independent variable.
78  *
79  * This function will now throw an error condition
80  *
81  * @param rho Input density
82  */
83  virtual void setDensity(const doublereal rho);
84 
85  virtual void calcDensity();
86 
87  /**
88  * Overridden setMolarDensity() function is necessary because the density
89  * is not an independent variable.
90  *
91  * This function will now throw an error condition.
92  *
93  * @param rho Input Density
94  */
95  virtual void setMolarDensity(const doublereal rho);
96 
97  //@}
98 
99  /**
100  * @name Chemical Potentials and Activities
101  * @{
102  */
103 
104  virtual void getActivityCoefficients(doublereal* ac) const;
105  virtual void getChemPotentials(doublereal* mu) const;
106  virtual void getChemPotentials_RT(doublereal* mu) const;
107 
108  //@}
109  /// @name Partial Molar Properties of the Solution
110  //@{
111 
112  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
113  virtual void getPartialMolarEntropies(doublereal* sbar) const;
114  virtual void getPartialMolarCp(doublereal* cpbar) const;
115  virtual void getPartialMolarVolumes(doublereal* vbar) const;
116  virtual void getPureGibbs(doublereal* gpure) const;
117  virtual void getStandardChemPotentials(doublereal* mu) const;
118 
119  //@}
120  /// @name Utility Functions
121  //@{
122 
123  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
124 
125  void set_h_mix(const doublereal hmix) { h_mixing = hmix; }
126 
127  //! Set the product Species. Must be called after species have been added.
128  void setProductSpecies(const std::string& name);
129  //@}
130 
131 private:
132  /**
133  * m_Pcurrent = The current pressure. Since the density isn't a function of
134  * pressure, but only of the mole fractions, we need to independently
135  * specify the pressure.
136  */
137  doublereal m_Pcurrent;
138 
139  /**
140  * Function to call through to m_spthermo->update and fill m_h0_RT,
141  * m_cp0_R, m_g0_RT, m_s0_R.
142  */
143  void _updateThermo() const;
144 
145  //! Vector containing the species reference enthalpies at T = m_tlast
147 
148  //! Vector containing the species reference constant pressure heat
149  //! capacities at T = m_tlast
151 
152  //! Vector containing the species reference Gibbs functions at T = m_tlast
154 
155  //! Vector containing the species reference entropies at T = m_tlast
156  mutable vector_fp m_s0_R;
157 
158  //! Value of the enthalpy change on mixing due to protons changing from type
159  //! B to type A configurations.
160  doublereal h_mixing;
161 
162  //! Index of the species whose mole fraction defines the extent of reduction r
164  int reactant_species_index;
165 
166  // Functions to calculate some of the pieces of the mixing terms.
167  doublereal s() const;
168  doublereal fm(const doublereal r) const;
169  doublereal p(const doublereal r) const;
170 };
171 }
172 
173 #endif
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
void setProductSpecies(const std::string &name)
Set the product Species. Must be called after species have been added.
virtual std::string type() const
String indicating the thermodynamic model implemented.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
doublereal h_mixing
Value of the enthalpy change on mixing due to protons changing from type B to type A configurations...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
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...
int product_species_index
Index of the species whose mole fraction defines the extent of reduction r.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void setDensity(const doublereal rho)
Overridden 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 getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual doublereal pressure() const
Pressure.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species chemical potentials.
doublereal m_Pcurrent
m_Pcurrent = The current pressure.
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
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
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 enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:78
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Class MaskellSolidSolnPhase represents a condensed phase non-ideal solution with 2 species following ...
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.