Cantera  2.4.0
MetalSHEelectrons.h
Go to the documentation of this file.
1 /**
2  * @file MetalSHEelectrons.h
3  * Header file for the MetalSHEElectrons class, which represents the
4  * electrons in a metal that are consistent with the
5  * SHE electrode (see \ref thermoprops and
6  * class \link Cantera::MetalSHEelectrons MetalSHEelectrons\endlink)
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_METALSHEELECTRONS_H
13 #define CT_METALSHEELECTRONS_H
14 
15 #include "SingleSpeciesTP.h"
16 
17 namespace Cantera
18 {
19 
20 //! Class MetalSHEelectrons represents electrons within a metal, adjacent to an
21 //! aqueous electrolyte, that are consistent with the SHE reference electrode.
22 /*!
23  *
24  * @attention This class currently does not have any test cases or examples. Its
25  * implementation may be incomplete, and future changes to Cantera may
26  * unexpectedly cause this class to stop working. If you use this class,
27  * please consider contributing examples or test cases. In the absence of
28  * new tests or examples, this class may be deprecated and removed in a
29  * future version of Cantera. See
30  * https://github.com/Cantera/cantera/issues/267 for additional information.
31  *
32  * @deprecated To be removed after Cantera 2.4
33  *
34  * The class is based on the electron having a chemical potential equal to one-
35  * half of the entropy of the H2 gas at the system pressure
36  *
37  * ## Specification of Species Standard State Properties
38  *
39  * This class inherits from SingleSpeciesTP. It is assumed that the reference
40  * state thermodynamics may be obtained by a pointer to a populated species
41  * thermodynamic property manager class (see ThermoPhase::m_spthermo). How to
42  * relate pressure changes to the reference state thermodynamics is resolved at
43  * this level.
44  *
45  * The enthalpy function is given by the following relation.
46  *
47  * \f[
48  * h^o_k(T,P) = h^{ref}_k(T)
49  * \f]
50  *
51  * The standard state constant-pressure heat capacity is independent of pressure:
52  *
53  * \f[
54  * Cp^o_k(T,P) = Cp^{ref}_k(T)
55  * \f]
56  *
57  * The standard state entropy depends in the following fashion on pressure:
58  *
59  * \f[
60  * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}})
61  * \f]
62  *
63  * The standard state Gibbs free energy is obtained from the enthalpy and
64  * entropy functions:
65  *
66  * \f[
67  * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T
68  * \f]
69  *
70  * \f[
71  * \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}})
72  * \f]
73  *
74  * where
75  * \f[
76  * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T)
77  * \f]
78  *
79  * The standard state internal energy is obtained from the enthalpy function also
80  *
81  * \f[
82  * u^o_k(T,P) = h^o_k(T) - R T
83  * \f]
84  *
85  * ## Specification of Solution Thermodynamic Properties
86  *
87  * All solution properties are obtained from the standard state species
88  * functions, since there is only one species in the phase.
89  *
90  * ## %Application within Kinetics Managers
91  *
92  * The standard concentration is equal to 1.0. This means that the kinetics
93  * operator works on an activities basis. Since this is a stoichiometric
94  * substance, this means that the concentration of this phase drops out of
95  * kinetics expressions since the activity is always equal to one.
96  *
97  * This is what is expected of electrons. The only effect that this class will
98  * have on reactions is in terms of the standard state chemical potential, which
99  * is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned to
100  * the electron, which is the voltage of the metal.
101  *
102  * ## Instantiation of the Class
103  *
104  * The constructor for this phase is located in the default ThermoFactory for
105  * %Cantera. A new MetalSHEelectrons object may be created by the following code
106  * snippets, where the file metalSHEelectrons.xml exists in a local directory:
107  *
108  * @code
109  * MetalSHEelectrons *eMetal = new MetalSHEelectrons("metalSHEelectrons.xml", "");
110  * @endcode
111  *
112  * or by the following call to importPhase():
113  *
114  * @code
115  * XML_Node *xm = get_XML_NameID("phase", iFile + "#MetalSHEelectrons", 0);
116  * MetalSHEelectrons eMetal;
117  * importPhase(*xm, &eMetal);
118  * @endcode
119  *
120  * @code
121  * ThermoPhase *eMetal = newPhase("MetalSHEelectrons.xml", "MetalSHEelectrons");
122  * @endcode
123  *
124  * Additionally, this phase may be created without including an XML file with
125  * the special command, where the default file is embedded into this object.
126  *
127  * @code
128  * MetalSHEelectrons *eMetal = new MetalSHEelectrons("MetalSHEelectrons_default.xml", "");
129  * @endcode
130  *
131  * ## XML Example
132  *
133  * The phase model name for this is called MetalSHEelectrons. It must be
134  * supplied as the model attribute of the thermo XML element entry. Within the
135  * phase XML block, the density of the phase must be specified though it's not
136  * used. An example of an XML file this phase is given below.
137  *
138  * @code
139  * <?xml version="1.0"?>
140  * <ctml>
141  * <validate reactions="yes" species="yes"/>
142  *
143  * <phase dim="3" id="MetalSHEelectrons">
144  * <elementArray datasrc="elements.xml">
145  * E
146  * </elementArray>
147  * <speciesArray datasrc="#species_Metal_SHEelectrons"> she_electron </speciesArray>
148  * <thermo model="metalSHEelectrons">
149  * <density units="g/cm3">2.165</density>
150  * </thermo>
151  * <transport model="None"/>
152  * <kinetics model="none"/>
153  * </phase>
154  *
155  * <!-- species definitions -->
156  * <speciesData id="species_Metal_SHEelectrons">
157  * <species name="she_electron">
158  * <atomArray> E:1 </atomArray>
159  * <charge> -1 </charge>
160  * <thermo>
161  * <NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
162  * <floatArray name="coeffs" size="7">
163  * 1.172165560E+00, 3.990260375E-03, -9.739075500E-06, 1.007860470E-08,
164  * -3.688058805E-12, -4.589675865E+02, 3.415051190E-01
165  * </floatArray>
166  * </NASA>
167  * <NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
168  * <floatArray name="coeffs" size="7">
169  * 1.466432895E+00, 4.133039835E-04, -7.320116750E-08, 7.705017950E-12,
170  * -3.444022160E-16, -4.065327985E+02, -5.121644350E-01
171  * </floatArray>
172  * </NASA>
173  * </thermo>
174  * <density units="g/cm3">2.165</density>
175  * </species>
176  * </speciesData>
177  * </ctml>
178  * @endcode
179  *
180  * The model attribute, "MetalSHEelectrons", on the thermo element identifies
181  * the phase as being a MetalSHEelectrons object.
182  *
183  * @ingroup thermoprops
184  */
186 {
187 public:
188  //! Default constructor for the MetalSHEelectrons class
190 
191  //! Construct and initialize a MetalSHEelectrons ThermoPhase object
192  //! directly from an ASCII input file
193  /*!
194  * @param infile name of the input file
195  * @param id name of the phase id in the file.
196  * If this is blank, the first phase in the file is used.
197  */
198  MetalSHEelectrons(const std::string& infile, const std::string& id = "");
199 
200  //! Construct and initialize a MetalSHEelectrons ThermoPhase object
201  //! directly from an XML database
202  /*!
203  * @param phaseRef XML node pointing to a MetalSHEelectrons description
204  * @param id Id of the phase.
205  */
206  MetalSHEelectrons(XML_Node& phaseRef, const std::string& id = "");
207 
208  //! @name Mechanical Equation of State
209  //! @{
210 
211  //! Report the Pressure. Units: Pa.
212  /*!
213  * For an incompressible substance, the density is independent of pressure.
214  * This method simply returns the stored pressure value.
215  */
216  virtual doublereal pressure() const;
217 
218  //! Set the pressure at constant temperature. Units: Pa.
219  /*!
220  * For an incompressible substance, the density is independent of pressure.
221  * Therefore, this method only stores the specified pressure value. It does
222  * not modify the density.
223  *
224  * @param p Pressure (units - Pa)
225  */
226  virtual void setPressure(doublereal p);
227 
228  virtual doublereal isothermalCompressibility() const;
229  virtual doublereal thermalExpansionCoeff() const;
230 
231  //! @}
232  //! @name Activities, Standard States, and Activity Concentrations
233  //!
234  //! This section is largely handled by parent classes, since there
235  //! is only one species. Therefore, the activity is equal to one.
236  //! @{
237 
238  //! This method returns an array of generalized concentrations
239  /*!
240  * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where
241  * \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$
242  * are activities used in the thermodynamic functions. These activity (or
243  * generalized) concentrations are used by kinetics manager classes to
244  * compute the forward and reverse rates of elementary reactions.
245  *
246  * For a stoichiometric substance, there is only one species, and the
247  * generalized concentration is 1.0.
248  *
249  * @param c Output array of generalized concentrations. The units depend
250  * upon the implementation of the reaction rate expressions within
251  * the phase.
252  */
253  virtual void getActivityConcentrations(doublereal* c) const;
254 
255  //! Return the standard concentration for the kth species
256  /*!
257  * The standard concentration \f$ C^0_k \f$ used to normalize the activity
258  * (i.e., generalized) concentration. This phase assumes that the kinetics
259  * operator works on an dimensionless basis. Thus, the standard
260  * concentration is equal to 1.0.
261  *
262  * @param k Optional parameter indicating the species. The default
263  * is to assume this refers to species 0.
264  * @return
265  * Returns The standard Concentration as 1.0
266  */
267  virtual doublereal standardConcentration(size_t k=0) const;
268 
269  //! Natural logarithm of the standard concentration of the kth species.
270  /*!
271  * @param k index of the species (defaults to zero)
272  */
273  virtual doublereal logStandardConc(size_t k=0) const;
274 
275  //! Get the array of chemical potentials at unit activity for the species at
276  //! their standard states at the current *T* and *P* of the solution.
277  /*!
278  * For a stoichiometric substance, there is no activity term in the chemical
279  * potential expression, and therefore the standard chemical potential and
280  * the chemical potential are both equal to the molar Gibbs function.
281  *
282  * These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$.
283  * The values are evaluated at the current temperature and pressure of the
284  * solution
285  *
286  * @param mu0 Output vector of chemical potentials.
287  * Length: m_kk.
288  */
289  virtual void getStandardChemPotentials(doublereal* mu0) const;
290 
291  //@}
292  /// @name Properties of the Standard State of the Species in the Solution
293  //@{
294 
295  virtual void getEnthalpy_RT(doublereal* hrt) const;
296  virtual void getEntropy_R(doublereal* sr) const;
297  virtual void getGibbs_RT(doublereal* grt) const;
298  virtual void getCp_R(doublereal* cpr) const;
299 
300  //! Returns the vector of nondimensional Internal Energies of the standard
301  //! state species at the current *T* and *P* of the solution
302  /*!
303  * For an incompressible, stoichiometric substance, the molar internal
304  * energy is independent of pressure. Since the thermodynamic properties are
305  * specified by giving the standard-state enthalpy, the term \f$ P_{ref}
306  * \hat v\f$ is subtracted from the specified reference molar enthalpy to
307  * compute the standard state molar internal energy.
308  *
309  * @param urt output vector of nondimensional standard state
310  * internal energies of the species. Length: m_kk.
311  */
312  virtual void getIntEnergy_RT(doublereal* urt) const;
313 
314  //@}
315  /// @name Thermodynamic Values for the Species Reference States
316  //@{
317 
318  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
319  // @}
320 
321  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
322 
323  //! Make the default XML tree
324  /*!
325  * @returns a new XML tree containing the default info.
326  */
327  static XML_Node* makeDefaultXMLTree();
328 
329  //! Set the equation of state parameters
330  /*!
331  * @internal
332  *
333  * @param n number of parameters
334  * @param c array of \a n coefficients
335  * c[0] = density of phase [ kg/m3 ]
336  */
337  virtual void setParameters(int n, doublereal* const c);
338 
339  //! Get the equation of state parameters in a vector
340  /*!
341  * @internal
342  *
343  * @param n number of parameters
344  * @param c array of \a n coefficients
345  *
346  * For this phase:
347  * - n = 1
348  * - c[0] = density of phase [ kg/m3 ]
349  */
350  virtual void getParameters(int& n, doublereal* const c) const;
351 
352  //! Set equation of state parameter values from XML entries.
353  /*!
354  * For this phase, the density of the phase is specified in this block.
355  *
356  * @param eosdata An XML_Node object corresponding to
357  * the "thermo" entry for this phase in the input file.
358  *
359  * eosdata points to the thermo block, and looks like this:
360  *
361  * @code
362  * <phase id="stoichsolid" >
363  * <thermo model="StoichSubstance">
364  * <density units="g/cm3">3.52</density>
365  * </thermo>
366  * </phase>
367  * @endcode
368  */
369  virtual void setParametersFromXML(const XML_Node& eosdata);
370 };
371 
372 }
373 #endif
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
MetalSHEelectrons()
Default constructor for the MetalSHEelectrons class.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
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 setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Class MetalSHEelectrons represents electrons within a metal, adjacent to an aqueous electrolyte...
virtual doublereal pressure() const
Report the Pressure. Units: Pa.
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Header for the SingleSpeciesTP class, which is a filter class for ThermoPhase, that eases the constru...
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
static XML_Node * makeDefaultXMLTree()
Make the default XML tree.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
The SingleSpeciesTP class is a filter class for ThermoPhase.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...