Cantera  2.4.0
FixedChemPotSSTP.h
Go to the documentation of this file.
1 /**
2  * @file FixedChemPotSSTP.h
3  * Header file for the FixedChemPotSSTP class, which represents a fixed-composition
4  * incompressible substance with a constant chemical potential (see \ref thermoprops and
5  * class \link Cantera::FixedChemPotSSTP FixedChemPotSSTP\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_FIXEDCHEMPOTSSTP_H
12 #define CT_FIXEDCHEMPOTSSTP_H
13 
14 #include "SingleSpeciesTP.h"
15 
16 namespace Cantera
17 {
18 
19 //! Class FixedChemPotSSTP represents a stoichiometric (fixed composition)
20 //! incompressible substance.
21 /*!
22  * This class internally changes the independent degree of freedom from density
23  * to pressure. This is necessary because the phase is incompressible. It uses a
24  * zero volume approximation.
25  *
26  * ## Specification of Species Standard State Properties
27  *
28  * This class inherits from SingleSpeciesTP. It uses a single value for the
29  * chemical potential which is assumed to be constant with respect to
30  * temperature and pressure.
31  *
32  * The reference state thermodynamics is inherited from SingleSpeciesTP.
33  * However, it's only used to set the initial chemical potential to the value of
34  * the chemical potential at the starting conditions. Thereafter, it is ignored.
35  *
36  * For a zero volume material, the internal energy and the enthalpy are equal to
37  * the chemical potential. The entropy, the heat capacity, and the molar volume
38  * are equal to zero.
39  *
40  * ## Specification of Solution Thermodynamic Properties
41  *
42  * All solution properties are obtained from the standard state species
43  * functions, since there is only one species in the phase.
44  *
45  * ## Application within Kinetics Managers
46  *
47  * The standard concentration is equal to 1.0. This means that the kinetics
48  * operator works on an (activities basis). Since this is a stoichiometric
49  * substance, this means that the concentration of this phase drops out of
50  * kinetics expressions.
51  *
52  * An example of a reaction using this is a sticking coefficient reaction of a
53  * substance in an ideal gas phase on a surface with a bulk phase species in
54  * this phase. In this case, the rate of progress for this reaction, \f$ R_s
55  * \f$, may be expressed via the following equation:
56  * \f[
57  * R_s = k_s C_{gas}
58  * \f]
59  * where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units
60  * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has units of
61  * m s-1. Nowhere does the concentration of the bulk phase appear in the rate
62  * constant expression, since it's a stoichiometric phase, and the activity is
63  * always equal to 1.0.
64  *
65  * ## Instantiation of the Class
66  *
67  * This phase may be instantiated by calling the default ThermoFactory routine
68  * for %Cantera. This new FixedChemPotSSTP object must then have a standalone
69  * XML file description an example of which is given below.
70  *
71  * It may also be created by the following code snippets. The code includes the
72  * special member function setChemicalPotential( chempot), which sets the
73  * chemical potential to a specific value in J / kmol.
74  *
75  * @code
76  * XML_Node *xm = get_XML_NameID("phase", iFile + "#Li(Fixed)", 0);
77  * FixedChemPotSSTP *LiFixed = new FixedChemPotSSTP(*xm);
78  * // Set the chemical potential to -2.3E7 J/kmol
79  * LiFixed->setChemicalPotential(-2.3E7.)
80  * @endcode
81  *
82  * or by the following call to importPhase():
83  *
84  * @code
85  * XML_Node *xm = get_XML_NameID("phase", iFile + "#NaCl(S)", 0);
86  * FixedChemPotSSTP solid;
87  * importPhase(*xm, &solid);
88  * @endcode
89  *
90  * The phase may also be created by a special constructor so that element
91  * potentials may be set. The constructor takes the name of the element and
92  * the value of the element chemical potential. An example is given below.
93  *
94  * @code
95  * FixedChemPotSSTP *LiFixed = new FixedChemPotSSTP("Li", -2.3E7);
96  * @endcode
97  *
98  * ## XML Example
99  *
100  * The phase model name for this is called FixedChemPot. It must be supplied
101  * as the model attribute of the thermo XML element entry.
102  *
103  * @code
104  * <?xml version="1.0"?>
105  * <ctml>
106  * <validate reactions="yes" species="yes"/>
107  *
108  * <!-- phase NaCl(S) -->
109  * <phase dim="3" id="LiFixed">
110  * <elementArray datasrc="elements.xml">
111  * Li
112  * </elementArray>
113  * <speciesArray datasrc="#species_Li(Fixed)">
114  * LiFixed
115  * </speciesArray>
116  * <thermo model="FixedChemPot">
117  * <chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
118  * </thermo>
119  * <transport model="None"/>
120  * <kinetics model="none"/>
121  * </phase>
122  *
123  * <!-- species definitions -->
124  * <speciesData id="species_Li(Fixed)">
125  * <species name="LiFixed">
126  * <atomArray> Li:1 </atomArray>
127  * <thermo>
128  * <Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
129  * <floatArray size="7">
130  * 50.72389, 6.672267, -2.517167,
131  * 10.15934, -0.200675, -427.2115,
132  * 130.3973
133  * </floatArray>
134  * </Shomate>
135  * </thermo>
136  * </species>
137  * </speciesData>
138  * </ctml>
139  * @endcode
140  *
141  * The model attribute, "FixedChemPot", on the thermo element
142  * identifies the phase as being a FixedChemPotSSTP object.
143  *
144  * @ingroup thermoprops
145  */
147 {
148 public:
149  //! Default constructor for the FixedChemPotSSTP class
151 
152  //! Construct and initialize a FixedChemPotSSTP ThermoPhase object
153  //! directly from an ASCII input file
154  /*!
155  * @param infile name of the input file
156  * @param id name of the phase id in the file.
157  * If this is blank, the first phase in the file is used.
158  */
159  FixedChemPotSSTP(const std::string& infile, const std::string& id = "");
160 
161  //! Construct and initialize a FixedChemPotSSTP ThermoPhase object
162  //! directly from an XML database
163  /*!
164  * @param phaseRef XML node pointing to a FixedChemPotSSTP description
165  * @param id Id of the phase.
166  */
167  FixedChemPotSSTP(XML_Node& phaseRef, const std::string& id = "");
168 
169  //! Special constructor for the FixecChemPotSSTP class setting an element
170  //! chemical potential directly
171  /*!
172  * This will create a FixedChemPotSSTP consisting of a single species with the
173  * stoichiometry of one of the specified atom. It will have a chemical potential
174  * that is given by the second argument.
175  *
176  * @param Ename String name of the element
177  * @param chemPot Value of the chemical potential of that element (J/kmol)
178  */
179  FixedChemPotSSTP(const std::string& Ename, doublereal chemPot);
180 
181  virtual std::string type() const {
182  return "FixedChemPot";
183  }
184 
185  //! @}
186  //! @name Mechanical Equation of State
187  //! @{
188 
189  //! Report the Pressure. Units: Pa.
190  /*!
191  * For an incompressible substance, the density is independent of pressure.
192  * This method simply returns the stored pressure value.
193  */
194  virtual doublereal pressure() const;
195 
196  //! Set the pressure at constant temperature. Units: Pa.
197  /*!
198  * For an incompressible substance, the density is independent of pressure.
199  * Therefore, this method only stores the specified pressure value. It does
200  * not modify the density.
201  *
202  * @param p Pressure (units - Pa)
203  */
204  virtual void setPressure(doublereal p);
205 
206  virtual doublereal isothermalCompressibility() const;
207  virtual doublereal thermalExpansionCoeff() const;
208 
209  /**
210  * @}
211  * @name Activities, Standard States, and Activity Concentrations
212  *
213  * This section is largely handled by parent classes, since there
214  * is only one species. Therefore, the activity is equal to one.
215  * @{
216  */
217 
218  //! @copydoc ThermoPhase::getActivityConcentrations
219  /*!
220  * For a stoichiometric substance, there is only one species, and the
221  * generalized concentration is 1.0.
222  */
223  virtual void getActivityConcentrations(doublereal* c) const;
224 
225  //! Return the standard concentration for the kth species
226  /*!
227  * The standard concentration \f$ C^0_k \f$ used to normalize the activity
228  * (i.e., generalized) concentration. This phase assumes that the kinetics
229  * operator works on an dimensionless basis. Thus, the standard
230  * concentration is equal to 1.0.
231  *
232  * @param k Optional parameter indicating the species. The default is to
233  * assume this refers to species 0.
234  * @return
235  * Returns The standard Concentration as 1.0
236  */
237  virtual doublereal standardConcentration(size_t k=0) const;
238  virtual doublereal logStandardConc(size_t k=0) const;
239 
240  //! Get the array of chemical potentials at unit activity for the species at
241  //! their standard states at the current *T* and *P* of the solution.
242  /*!
243  * For a stoichiometric substance, there is no activity term in the chemical
244  * potential expression, and therefore the standard chemical potential and
245  * the chemical potential are both equal to the molar Gibbs function.
246  *
247  * These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$.
248  * The values are evaluated at the current temperature and pressure of the
249  * solution
250  *
251  * @param mu0 Output vector of chemical potentials. Length: m_kk.
252  */
253  virtual void getStandardChemPotentials(doublereal* mu0) const;
254 
255  //@}
256  /// @name Partial Molar Properties of the Solution
257  /// These properties are handled by the parent class, SingleSpeciesTP
258  //@{
259 
260  //! Get the species partial molar volumes. Units: m^3/kmol.
261  /*!
262  * This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$.
263  *
264  * set to zero.
265  *
266  * @param vbar On return, contains the molar volume of the single species
267  * and the phase. Units are m^3 / kmol. Length = 1
268  */
269  virtual void getPartialMolarVolumes(doublereal* vbar) const;
270 
271  //@}
272  /// @name Properties of the Standard State of the Species in the Solution
273  //@{
274 
275  virtual void getEnthalpy_RT(doublereal* hrt) const;
276  virtual void getEntropy_R(doublereal* sr) const;
277  virtual void getGibbs_RT(doublereal* grt) const;
278  virtual void getCp_R(doublereal* cpr) const;
279 
280  //! Returns the vector of nondimensional Internal Energies of the standard
281  //! state species at the current *T* and *P* of the solution
282  /*!
283  * For an incompressible, stoichiometric substance, the molar internal
284  * energy is independent of pressure. Since the thermodynamic properties are
285  * specified by giving the standard-state enthalpy, the term \f$ P_{ref}
286  * \hat v\f$ is subtracted from the specified reference molar enthalpy to
287  * compute the standard state molar internal energy.
288  *
289  * @param urt output vector of nondimensional standard state
290  * internal energies of the species. Length: m_kk.
291  */
292  virtual void getIntEnergy_RT(doublereal* urt) const;
293 
294  //! Get the molar volumes of each species in their standard states at the
295  //! current *T* and *P* of the solution.
296  /*
297  * units = m^3 / kmol
298  *
299  * We set this to zero
300  *
301  * @param vbar On output this contains the standard volume of the species
302  * and phase (m^3/kmol). Vector of length 1
303  */
304  virtual void getStandardVolumes(doublereal* vbar) const;
305 
306  //@}
307  /// @name Thermodynamic Values for the Species Reference States
308  //@{
309 
310  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
311  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
312  virtual void getGibbs_RT_ref(doublereal* grt) const;
313  virtual void getGibbs_ref(doublereal* g) const;
314  virtual void getEntropy_R_ref(doublereal* er) const;
315  virtual void getCp_R_ref(doublereal* cprt) const;
316 
317  //@}
318 
319  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
320 
321  //! Set the equation of state parameters
322  /*!
323  * @internal
324  * @param n number of parameters = 1
325  * @param c array of \a n coefficients
326  * c[0] = density of phase [ kg/m3 ]
327  */
328  virtual void setParameters(int n, doublereal* const c);
329 
330  //! Get the equation of state parameters in a vector
331  /*!
332  * @internal
333  *
334  * @param n number of parameters
335  * @param c array of \a n coefficients
336  *
337  * For this phase:
338  * - n = 1
339  * - c[0] = density of phase [ kg/m3 ]
340  */
341  virtual void getParameters(int& n, doublereal* const c) const;
342 
343  //! Set equation of state parameter values from XML entries.
344  /*!
345  * This method is called by function importPhase() when processing a phase
346  * definition in an input file. It should be overloaded in subclasses to set
347  * any parameters that are specific to that particular phase model. Note,
348  * this method is called before the phase is initialized with elements
349  * and/or species.
350  *
351  * For this phase, the chemical potential is set.
352  *
353  * @param eosdata An XML_Node object corresponding to
354  * the "thermo" entry for this phase in the input file.
355  *
356  * eosdata points to the thermo block, and looks like this:
357  *
358  * @code
359  * <phase id="stoichsolid" >
360  * <thermo model="FixedChemPot">
361  * <chemicalPotential units="J/kmol"> -2.7E7 </chemicalPotential>
362  * </thermo>
363  * </phase>
364  * @endcode
365  */
366  virtual void setParametersFromXML(const XML_Node& eosdata);
367 
368  //! Function to set the chemical potential directly
369  /*!
370  * @param chemPot Value of the chemical potential (units J/kmol)
371  */
372  void setChemicalPotential(doublereal chemPot);
373 
374 protected:
375  //! Value of the chemical potential of the bath species
376  /*!
377  * units are J/kmol
378  */
379  doublereal chemPot_;
380 };
381 
382 }
383 
384 #endif
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 void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
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 thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
doublereal chemPot_
Value of the chemical potential of the bath species.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
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 doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
Class FixedChemPotSSTP represents a stoichiometric (fixed composition) incompressible substance...
virtual doublereal pressure() const
Report the Pressure. Units: Pa.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
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 getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
FixedChemPotSSTP()
Default constructor for the FixedChemPotSSTP class.
Header for the SingleSpeciesTP class, which is a filter class for ThermoPhase, that eases the constru...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
void setChemicalPotential(doublereal chemPot)
Function to set the chemical potential directly.
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
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 getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void getStandardVolumes(doublereal *vbar) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
virtual void getPartialMolarVolumes(doublereal *vbar) const
Get the species partial molar volumes. Units: m^3/kmol.
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...
The SingleSpeciesTP class is a filter class for ThermoPhase.