Cantera 2.6.0
SurfPhase.h
Go to the documentation of this file.
1/**
2 * @file SurfPhase.h
3 * Header for a simple thermodynamics model of a surface phase
4 * derived from ThermoPhase,
5 * assuming an ideal solution model
6 * (see \ref thermoprops and class \link Cantera::SurfPhase SurfPhase\endlink).
7 */
8
9// This file is part of Cantera. See License.txt in the top-level directory or
10// at https://cantera.org/license.txt for license and copyright information.
11
12#ifndef CT_SURFPHASE_H
13#define CT_SURFPHASE_H
14
15#include "ThermoPhase.h"
16
17namespace Cantera
18{
19
20//! A simple thermodynamic model for a surface phase, assuming an ideal solution
21//! model.
22/*!
23 * The surface consists of a grid of equivalent sites. Surface species may be
24 * defined to occupy one or more sites. The surface species are assumed to be
25 * independent, and thus the species form an ideal solution.
26 *
27 * The density of surface sites is given by the variable \f$ n_0 \f$,
28 * which has SI units of kmol m-2.
29 *
30 * ## Specification of Species Standard State Properties
31 *
32 * It is assumed that the reference state thermodynamics may be obtained by a
33 * pointer to a populated species thermodynamic property manager class (see
34 * ThermoPhase::m_spthermo). How to relate pressure changes to the reference
35 * state thermodynamics is resolved at this level.
36 *
37 * Pressure is defined as an independent variable in this phase. However, it has
38 * no effect on any quantities, as the molar concentration is a constant.
39 *
40 * Therefore, The standard state internal energy for species *k* is equal to the
41 * enthalpy for species *k*.
42 *
43 * \f[
44 * u^o_k = h^o_k
45 * \f]
46 *
47 * Also, the standard state chemical potentials, entropy, and heat capacities
48 * are independent of pressure. The standard state Gibbs free energy is obtained
49 * from the enthalpy and entropy functions.
50 *
51 * ## Specification of Solution Thermodynamic Properties
52 *
53 * The activity of species defined in the phase is given by
54 * \f[
55 * a_k = \theta_k
56 * \f]
57 *
58 * The chemical potential for species *k* is equal to
59 * \f[
60 * \mu_k(T,P) = \mu^o_k(T) + R T \log(\theta_k)
61 * \f]
62 *
63 * Pressure is defined as an independent variable in this phase. However, it has
64 * no effect on any quantities, as the molar concentration is a constant.
65 *
66 * The internal energy for species k is equal to the enthalpy for species *k*
67 * \f[
68 * u_k = h_k
69 * \f]
70 *
71 * The entropy for the phase is given by the following relation, which is
72 * independent of the pressure:
73 *
74 * \f[
75 * s_k(T,P) = s^o_k(T) - R \log(\theta_k)
76 * \f]
77 *
78 * ## %Application within Kinetics Managers
79 *
80 * The activity concentration,\f$ C^a_k \f$, used by the kinetics manager, is equal to
81 * the actual concentration, \f$ C^s_k \f$, and is given by the following
82 * expression.
83 * \f[
84 * C^a_k = C^s_k = \frac{\theta_k n_0}{s_k}
85 * \f]
86 *
87 * The standard concentration for species *k* is:
88 * \f[
89 * C^0_k = \frac{n_0}{s_k}
90 * \f]
91 *
92 * ## XML Example
93 *
94 * *Note: The XML input format is deprecated and will be removed in %Cantera 3.0*
95 *
96 * An example of an XML Element named phase setting up a SurfPhase object named
97 * diamond_100 is given below.
98 *
99 * @code
100 * <phase dim="2" id="diamond_100">
101 * <elementArray datasrc="elements.xml">H C</elementArray>
102 * <speciesArray datasrc="#species_data">c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B </speciesArray>
103 * <reactionArray datasrc="#reaction_data"/>
104 * <state>
105 * <temperature units="K">1200.0</temperature>
106 * <coverages>c6H*:0.1, c6HH:0.9</coverages>
107 * </state>
108 * <thermo model="Surface">
109 * <site_density units="mol/cm2">3e-09</site_density>
110 * </thermo>
111 * <kinetics model="Interface"/>
112 * <transport model="None"/>
113 * <phaseArray>
114 * gas_phase diamond_bulk
115 * </phaseArray>
116 * </phase>
117 * @endcode
118 *
119 * The model attribute, "Surface", on the thermo element identifies the phase as being
120 * a SurfPhase object.
121 *
122 * @ingroup thermoprops
123 */
124class SurfPhase : public ThermoPhase
125{
126public:
127 //! Constructor.
128 /*!
129 * @param n0 Site Density of the Surface Phase
130 * Units: kmol m-2.
131 * @deprecated The `n0` constructor argument is deprecated and will be
132 * removed after Cantera 2.6. Use setSiteDensity() instead.
133 */
134 SurfPhase(doublereal n0 = -1.0);
135
136 //! Construct and initialize a SurfPhase ThermoPhase object directly from an
137 //! ASCII input file
138 /*!
139 * @param infile name of the input file
140 * @param id name of the phase id in the file.
141 * If this is blank, the first phase in the file is used.
142 */
143 explicit SurfPhase(const std::string& infile, const std::string& id="");
144
145 //! Construct and initialize a SurfPhase ThermoPhase object directly from an
146 //! XML database
147 /*!
148 * @param xmlphase XML node pointing to a SurfPhase description
149 *
150 * @deprecated The XML input format is deprecated and will be removed in
151 * Cantera 3.0.
152 */
153 SurfPhase(XML_Node& xmlphase);
154
155 virtual std::string type() const {
156 return "Surf";
157 }
158
159 //! Return the Molar Enthalpy. Units: J/kmol.
160 /*!
161 * For an ideal solution,
162 * \f[
163 * \hat h(T,P) = \sum_k X_k \hat h^0_k(T),
164 * \f]
165 * and is a function only of temperature. The standard-state pure-species
166 * Enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species
167 * thermodynamic property manager.
168 *
169 * \see MultiSpeciesThermo
170 */
171 virtual doublereal enthalpy_mole() const;
172
173 //! Return the Molar Internal Energy. Units: J/kmol
174 /**
175 * For a surface phase, the pressure is not a relevant thermodynamic
176 * variable, and so the Enthalpy is equal to the Internal Energy.
177 */
178 virtual doublereal intEnergy_mole() const;
179
180 //! Return the Molar Entropy. Units: J/kmol-K
181 /**
182 * \f[
183 * \hat s(T,P) = \sum_k X_k (\hat s^0_k(T) - R \log(\theta_k))
184 * \f]
185 */
186 virtual doublereal entropy_mole() const;
187
188 virtual doublereal cp_mole() const;
189 virtual doublereal cv_mole() const;
190
191 virtual void getChemPotentials(doublereal* mu) const;
192 virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
193 virtual void getPartialMolarEntropies(doublereal* sbar) const;
194 virtual void getPartialMolarCp(doublereal* cpbar) const;
195 virtual void getPartialMolarVolumes(doublereal* vbar) const;
196 virtual void getStandardChemPotentials(doublereal* mu0) const;
197
198 //! Return a vector of activity concentrations for each species
199 /*!
200 * For this phase the activity concentrations,\f$ C^a_k \f$, are defined to
201 * be equal to the actual concentrations, \f$ C^s_k \f$. Activity
202 * concentrations are
203 *
204 * \f[
205 * C^a_k = C^s_k = \frac{\theta_k n_0}{s_k}
206 * \f]
207 *
208 * where \f$ \theta_k \f$ is the surface site fraction for species k,
209 * \f$ n_0 \f$ is the surface site density for the phase, and
210 * \f$ s_k \f$ is the surface size of species k.
211 *
212 * \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k / C^0_k, \f$
213 * where \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k
214 * \f$ are activities used in the thermodynamic functions. These activity
215 * concentrations are used by kinetics manager classes to compute the
216 * forward and reverse rates of elementary reactions. Note that they may or
217 * may not have units of concentration --- they might be partial pressures,
218 * mole fractions, or surface coverages,
219 *
220 * @param c vector of activity concentration (kmol m-2).
221 */
222 virtual void getActivityConcentrations(doublereal* c) const;
223
224 //! Return the standard concentration for the kth species
225 /*!
226 * The standard concentration \f$ C^0_k \f$ used to normalize the activity
227 * (that is, generalized) concentration. For this phase, the standard
228 * concentration is species- specific
229 *
230 * \f[
231 * C^0_k = \frac{n_0}{s_k}
232 * \f]
233 *
234 * This definition implies that the activity is equal to \f$ \theta_k \f$.
235 *
236 * @param k Optional parameter indicating the species. The default
237 * is to assume this refers to species 0.
238 * @return
239 * Returns the standard Concentration in units of m3 kmol-1.
240 */
241 virtual doublereal standardConcentration(size_t k = 0) const;
242 virtual doublereal logStandardConc(size_t k=0) const;
243
244 //! Set the equation of state parameters from the argument list
245 /*!
246 * @internal
247 * Set equation of state parameters.
248 *
249 * @param n number of parameters. Must be one
250 * @param c array of \a n coefficients
251 * c[0] = The site density (kmol m-2)
252 * @deprecated To be removed after Cantera 2.6
253 */
254 virtual void setParameters(int n, doublereal* const c);
255
256 //! Set the Equation-of-State parameters by reading an XML Node Input
257 /*!
258 * The Equation-of-State data consists of one item, the site density.
259 *
260 * @param thermoData Reference to an XML_Node named thermo containing the
261 * equation-of-state data. The XML_Node is within the
262 * phase XML_Node describing the SurfPhase object.
263 *
264 * An example of the contents of the thermoData XML_Node is provided below.
265 * The units attribute is used to supply the units of the site density in
266 * any convenient form. Internally it is changed into MKS form.
267 *
268 * @code
269 * <thermo model="Surface">
270 * <site_density units="mol/cm2"> 3e-09 </site_density>
271 * </thermo>
272 * @endcode
273 *
274 * @deprecated The XML input format is deprecated and will be removed in
275 * Cantera 3.0.
276 */
277 virtual void setParametersFromXML(const XML_Node& thermoData);
278 virtual void initThermo();
279 virtual void getParameters(AnyMap& phaseNode) const;
280
281 virtual bool addSpecies(shared_ptr<Species> spec);
282
283 //! Set the initial state of the Surface Phase from an XML_Node
284 /*!
285 * State variables that can be set by this routine are the temperature and
286 * the surface site coverages.
287 *
288 * @param state XML_Node containing the state information
289 *
290 * An example of the XML code block is given below.
291 *
292 * @code
293 * <state>
294 * <temperature units="K">1200.0</temperature>
295 * <coverages>c6H*:0.1, c6HH:0.9</coverages>
296 * </state>
297 * @endcode
298 *
299 * @deprecated The XML input format is deprecated and will be removed in
300 * Cantera 3.0.
301 */
302 virtual void setStateFromXML(const XML_Node& state);
303
304 //! Returns the site density
305 /*!
306 * Site density kmol m-2
307 */
308 double siteDensity() const {
309 return m_n0;
310 }
311
312 //! Returns the number of sites occupied by one molecule of species *k*.
313 virtual double size(size_t k) const {
314 return m_speciesSize[k];
315 }
316
317 //! Set the site density of the surface phase (kmol m-2)
318 /*!
319 * @param n0 Site density of the surface phase (kmol m-2)
320 */
321 void setSiteDensity(doublereal n0);
322
323 virtual void getGibbs_RT(doublereal* grt) const;
324 virtual void getEnthalpy_RT(doublereal* hrt) const;
325 virtual void getEntropy_R(doublereal* sr) const;
326 virtual void getCp_R(doublereal* cpr) const;
327 virtual void getStandardVolumes(doublereal* vol) const;
328
329 //! Return the thermodynamic pressure (Pa).
330 virtual doublereal pressure() const {
331 return m_press;
332 }
333
334 //! Set the internally stored pressure (Pa) at constant temperature and
335 //! composition
336 /*!
337 * @param p input Pressure (Pa)
338 */
339 virtual void setPressure(doublereal p) {
340 m_press = p;
341 }
342
343 virtual void getPureGibbs(doublereal* g) const;
344 virtual void getGibbs_RT_ref(doublereal* grt) const;
345 virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
346 virtual void getEntropy_R_ref(doublereal* er) const;
347 virtual void getCp_R_ref(doublereal* cprt) const;
348
349 //! Set the surface site fractions to a specified state.
350 /*!
351 * This routine converts to concentrations in kmol/m2, using m_n0, the
352 * surface site density, and size(k), which is defined to be the number of
353 * surface sites occupied by the kth molecule. It then calls
354 * Phase::setConcentrations to set the internal concentration in the object.
355 *
356 * @param theta This is the surface site fraction for the kth species in
357 * the surface phase. This is a dimensionless quantity.
358 *
359 * This routine normalizes the theta's to 1, before application
360 */
361 void setCoverages(const doublereal* theta);
362
363 //! Set the surface site fractions to a specified state.
364 /*!
365 * This routine converts to concentrations in kmol/m2, using m_n0, the
366 * surface site density, and size(k), which is defined to be the number of
367 * surface sites occupied by the kth molecule. It then calls
368 * Phase::setConcentrations to set the internal concentration in the object.
369 *
370 * @param theta This is the surface site fraction for the kth species in
371 * the surface phase. This is a dimensionless quantity.
372 */
373 void setCoveragesNoNorm(const doublereal* theta);
374
375 //! Set the coverages from a string of colon-separated name:value pairs.
376 /*!
377 * @param cov String containing colon-separated name:value pairs
378 */
379 void setCoveragesByName(const std::string& cov);
380
381 //! Set the coverages from a map of name:value pairs
382 void setCoveragesByName(const compositionMap& cov);
383
384 //! Return a vector of surface coverages
385 /*!
386 * Get the coverages.
387 *
388 * @param theta Array theta must be at least as long as the number of
389 * species.
390 */
391 void getCoverages(doublereal* theta) const;
392
393 //! @copydoc ThermoPhase::setState
394 /*!
395 * Additionally uses the key `coverages` to set the fractional coverages.
396 */
397 virtual void setState(const AnyMap& state);
398
399protected:
400 //! Surface site density (kmol m-2)
401 doublereal m_n0;
402
403 //! Vector of species sizes (number of sites occupied). length m_kk.
405
406 //! log of the surface site density
407 doublereal m_logn0;
408
409 //! Current value of the pressure (Pa)
410 doublereal m_press;
411
412 //! Temporary storage for the reference state enthalpies
414
415 //! Temporary storage for the reference state entropies
417
418 //! Temporary storage for the reference state heat capacities
420
421 //! Temporary storage for the reference state Gibbs energies
423
424 //! Temporary work array
426
427 //! vector storing the log of the size of each species.
428 /*!
429 * The size of each species is defined as the number of surface sites each
430 * species occupies.
431 */
433
434private:
435 //! Update the species reference state thermodynamic functions
436 /*!
437 * The polynomials for the standard state functions are only reevaluated if
438 * the temperature has changed.
439 *
440 * @param force Boolean, which if true, forces a reevaluation of the thermo
441 * polynomials. default = false.
442 */
443 void _updateThermo(bool force=false) const;
444};
445
446}
447
448#endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition: SurfPhase.h:125
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the Surface Phase from an XML_Node.
Definition: SurfPhase.cpp:358
void setCoveragesNoNorm(const doublereal *theta)
Set the surface site fractions to a specified state.
Definition: SurfPhase.cpp:269
void setCoveragesByName(const std::string &cov)
Set the coverages from a string of colon-separated name:value pairs.
Definition: SurfPhase.cpp:285
doublereal m_press
Current value of the pressure (Pa)
Definition: SurfPhase.h:410
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: SurfPhase.cpp:223
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition: SurfPhase.cpp:203
vector_fp m_s0
Temporary storage for the reference state entropies.
Definition: SurfPhase.h:416
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition: SurfPhase.cpp:351
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition: SurfPhase.cpp:171
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
Definition: SurfPhase.cpp:308
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: SurfPhase.cpp:81
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: SurfPhase.cpp:92
vector_fp m_speciesSize
Vector of species sizes (number of sites occupied). length m_kk.
Definition: SurfPhase.h:404
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: SurfPhase.cpp:100
virtual doublereal enthalpy_mole() const
Return the Molar Enthalpy. Units: J/kmol.
Definition: SurfPhase.cpp:56
SurfPhase(doublereal n0=-1.0)
Constructor.
Definition: SurfPhase.cpp:24
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: SurfPhase.cpp:149
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: SurfPhase.cpp:118
void getCoverages(doublereal *theta) const
Return a vector of surface coverages.
Definition: SurfPhase.cpp:277
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
Definition: SurfPhase.cpp:195
void setSiteDensity(doublereal n0)
Set the site density of the surface phase (kmol m-2)
Definition: SurfPhase.cpp:242
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: SurfPhase.cpp:87
virtual void getActivityConcentrations(doublereal *c) const
Return a vector of activity concentrations for each species.
Definition: SurfPhase.cpp:139
virtual void setParametersFromXML(const XML_Node &thermoData)
Set the Equation-of-State parameters by reading an XML Node Input.
Definition: SurfPhase.cpp:335
doublereal m_n0
Surface site density (kmol m-2)
Definition: SurfPhase.h:401
doublereal m_logn0
log of the surface site density
Definition: SurfPhase.h:407
vector_fp m_h0
Temporary storage for the reference state enthalpies.
Definition: SurfPhase.h:413
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition: SurfPhase.cpp:189
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: SurfPhase.cpp:108
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: SurfPhase.cpp:123
virtual double size(size_t k) const
Returns the number of sites occupied by one molecule of species k.
Definition: SurfPhase.h:313
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition: SurfPhase.cpp:183
virtual doublereal entropy_mole() const
Return the Molar Entropy. Units: J/kmol-K.
Definition: SurfPhase.cpp:70
double siteDensity() const
Returns the site density.
Definition: SurfPhase.h:308
vector_fp m_work
Temporary work array.
Definition: SurfPhase.h:425
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: SurfPhase.cpp:342
vector_fp m_mu0
Temporary storage for the reference state Gibbs energies.
Definition: SurfPhase.h:422
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition: SurfPhase.cpp:213
void _updateThermo(bool force=false) const
Update the species reference state thermodynamic functions.
Definition: SurfPhase.cpp:319
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: SurfPhase.h:155
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: SurfPhase.h:330
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition: SurfPhase.cpp:218
vector_fp m_cp0
Temporary storage for the reference state heat capacities.
Definition: SurfPhase.h:419
virtual void getPureGibbs(doublereal *g) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
Definition: SurfPhase.cpp:165
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters from the argument list.
Definition: SurfPhase.cpp:154
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: SurfPhase.cpp:129
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: SurfPhase.cpp:177
void setCoverages(const doublereal *theta)
Set the surface site fractions to a specified state.
Definition: SurfPhase.cpp:252
virtual doublereal intEnergy_mole() const
Return the Molar Internal Energy. Units: J/kmol.
Definition: SurfPhase.cpp:65
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: SurfPhase.h:339
vector_fp m_logsize
vector storing the log of the size of each species.
Definition: SurfPhase.h:432
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition: SurfPhase.cpp:208
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: SurfPhase.cpp:144
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
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:184
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:176