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