Cantera  3.3.0a1
Loading...
Searching...
No Matches
CoverageDependentSurfPhase.h
Go to the documentation of this file.
1/**
2 * @file CoverageDependentSurfPhase.h
3 * Header for a thermodynamics model of a coverage-dependent surface
4 * phase derived from SurfPhase, applying adsorbate lateral interaction
5 * correction factors to the SurfPhase thermodynamic properties.
6 * (see @ref thermoprops and class
7 * @link Cantera::CoverageDependentSurfPhase CoverageDependentSurfPhase@endlink).
8 */
9
10// This file is part of Cantera. See License.txt in the top-level directory or
11// at https://cantera.org/license.txt for license and copyright information.
12
13#ifndef CT_COVERAGEDEPENDENTSURFPHASE_H
14#define CT_COVERAGEDEPENDENTSURFPHASE_H
15
16#include "SurfPhase.h"
17#include "cantera/base/Array.h"
18
19namespace Cantera
20{
21
22//! A thermodynamic model for a coverage-dependent surface phase, applying surface
23//! species lateral interaction correction factors to the ideal surface phase
24//! properties.
25/*!
26 * The ideal surface phase assumes no lateral interaction among surface species.
27 * This coverage-dependent surface phase allows adding lateral interaction
28 * correction terms to the ideal surface phase (SurfPhase) thermodynamic properties
29 * so that more accurate surface species thermochemistry can be achieved.
30 *
31 * ## Coverage-dependent Thermodynamic Properties Formulations
32 *
33 * At a low-coverage limit, a surface species thermochemistry is the same as
34 * that of ideal surface species since there are no adsorbates in the vicinity
35 * to cause lateral interaction. Therefore, it is logical to set ideal surface
36 * species properties as the low-coverage limit and add lateral interaction terms
37 * to them as excess properties. Accordingly, standard state coverage-dependent
38 * enthalpy, entropy, and heat capacity of a surface species @f$ k @f$ can be
39 * formulated as follows.
40 *
41 * @f[
42 * h_k^o(T,\theta)
43 * = \underbrace{h_k^{o,ideal}(T)
44 * + \int_{298}^{T}c_{p,k}^{o,ideal}(T)dT}_{\text{low-coverage limit}}
45 * + \underbrace{h_k^{o,cov}(T,\theta)
46 * + \int_{298}^{T}c_{p,k}^{o,cov}(T,\theta)dT}_{\text{coverage dependence}}
47 *
48 * @f]
49 *
50 * @f[
51 * s_k^o(T,\theta)
52 * = \underbrace{s_k^{o,ideal}(T)
53 * + \int_{298}^{T}\frac{c_{p,k}^{o,ideal}(T)}{T}dT}_{\text{low-coverage limit}}
54 * + \underbrace{s_k^{o,cov}(T,\theta)
55 * + \int_{298}^{T}\frac{c_{p,k}^{o,cov}(T,\theta)}{T}dT}_{\text{coverage
56 * dependence}}
57 * @f]
58 *
59 * @f[
60 * c_{p,k}^o(T,\theta)
61 * = \underbrace{c_{p,k}^{o,ideal}(T)}_{\text{low-coverage limit}}
62 * + \underbrace{c_{p,k}^{o,cov}(T,\theta)}_{\text{coverage dependence}}
63 * @f]
64 *
65 * ## Mathematical Models for Coverage-dependent Correction Terms
66 *
67 * Coverage-dependent correction terms for enthalpy and entropy can be calculated
68 * with one of the four algebraic models: linear dependency model, polynomial
69 * dependency model, piecewise-linear, and interpolative dependency model.
70 * In the dependency model equations, a coverage-dependent correction term is denoted
71 * by @f$ f^{cov} @f$ where @f$ f @f$ can be either enthalpy (@f$ h^{cov} @f$) or
72 * entropy (@f$ s^{cov} @f$). Because lateral interaction can compose of both
73 * self- and cross- interactions, the total correction term of species @f$ k @f$
74 * is a sum of all interacting species @f$ j @f$ which can include itself.
75 * Coefficients @f$ c^{(1)}_{k,j}-c^{(6)}_{k,j} @f$ are user-provided parameters
76 * that can be given in a input yaml.
77 *
78 * Linear dependency model:
79 * @f[
80 * f^{cov}_k(\theta) = \sum_j c^{(1)}_{k,j} \theta_j
81 * @f]
82 *
83 * Polynomial dependency model:
84 * @f[
85 * f^{cov}_k(\theta) =
86 * \sum_j \left[c^{(1)}_{k,j}\theta_j + c^{(2)}_{k,j}\theta_j^2
87 * + c^{(3)}_{k,j}\theta_j^3 + c^{(4)}_{k,j}\theta_j^4\right]
88 * @f]
89 *
90 * Piecewise-linear dependency model:
91 * @f[
92 * f^{cov}_k(\theta) = \sum_j \left\{
93 * \begin{array}{ll}
94 * c^{(5)}_{k,j}\theta_j & \text{, } \theta_j \leq \theta^\text{change}_{k,j} \\
95 * \left[c^{(6)}_{k,j}(\theta_j - \theta^\text{change}_{k,j})
96 * + (c^{(5)}_{k,j}\theta^\text{change}_{k,j})\right]
97 * & \text{, } \theta_j > \theta^\text{change}_{k,j} \\
98 * \end{array}
99 * \right.
100 * @f]
101 *
102 * Interpolative dependency model:
103 * @f[
104 * f^{cov}_k(\theta) =
105 * \sum_j \left[\frac{f^{cov}_k(\theta^{higher}_j) - f^{cov}_k(\theta^{lower}_j)}
106 * {\theta^{higher}_j - \theta^{lower}_j}(\theta_j - \theta^{lower}_j)
107 * + f^{cov}_k (\theta^{lower}_j)\right] \\
108 * \text{where } \theta^{lower}_j \leq \theta_j < \theta^{higher}_j
109 * @f]
110 *
111 * Coverage-dependent heat capacity is calculated using an equation with a
112 * quadratic dependence on coverages and a logarithmic dependence on temperature.
113 * Temperature is nondimensionalized with a reference temperature of 1 K.
114 * The coverage-dependent heat capacity of species @f$ k @f$ is a sum of
115 * all quantities dependent on coverage of species @f$ j @f$. Coefficients
116 * @f$ c^{(a)}_{k,j} \text{ and } c^{(b)}_{k,j} @f$ are user-provided parameters
117 * that can be given in an input yaml.
118 *
119 * Coverage-dependent heat capacity model:
120 * @f[
121 * c^{cov}_{p,k}(\theta) =
122 * \sum_j \left(c^{(a)}_{k,j} \ln\left(\frac{T}{1\text{ K}}\right)
123 * + c^{(b)}_{k,j}\right) \theta_j^2
124 * @f]
125 */
127{
128public:
129 //! A struct to store sets of parameters used in coverage-dependent enthalpy
130 //! and entropy calculations by a polynomial equation or a linear equation
131 //! in CoverageDependentSurfPhase.
133 {
134 /*!
135 * @param k index of a target species whose enthalpy and entropy are calculated
136 * @param j index of a species whose coverage affects enthalpy and entropy of
137 * a target species
138 * @param dep_map map of coverage-dependency parameters
139 */
140 PolynomialDependency(size_t k, size_t j, const AnyMap& dep_map);
141
142 //! index of a target species whose enthalpy and entropy is calculated
143 size_t k;
144 //! index of a species whose coverage affects enthalpy and entropy of
145 //! a target species
146 size_t j;
147 //! array of polynomial coefficients describing coverage-dependent enthalpy
148 //! [J/kmol] in order of 1st-order, 2nd-order, 3rd-order, and 4th-order
149 //! coefficients (@f$ c^{(1)}, c^{(2)}, c^{(3)}, \text{ and } c^{(4)} @f$
150 //! in the linear or the polynomial dependency model)
151 vector<double> enthalpy_coeffs;
152 //! array of polynomial coefficients describing coverage-dependent entropy
153 //! [J/kmol/K] in order of 1st-order, 2nd-order, 3rd-order, and 4th-order
154 //! coefficients (@f$ c^{(1)}, c^{(2)}, c^{(3)}, \text{ and } c^{(4)} @f$
155 //! in the linear or the polynomial dependency model)
156 vector<double> entropy_coeffs;
157 //! boolean indicating whether the dependency is linear
159 };
160
161 //! A struct to store sets of parameters used in coverage-dependent enthalpy
162 //! and entropy calculations by a interpolative equation or a piecewise-linear
163 //! equation in CoverageDependentSurfPhase.
165 {
166 /*!
167 * @param k index of a target species whose enthalpy and entropy are calculated
168 * @param j index of a species whose coverage affects enthalpy and entropy of
169 * a target species
170 * @param dep_map map of coverage-dependency parameters
171 * @param node species node of a target species
172 */
173 InterpolativeDependency(size_t k, size_t j,
174 const AnyMap& dep_map, const AnyBase& node);
175
176 //! index of a target species whose enthalpy and entropy are calculated
177 size_t k;
178 //! index of a species whose coverage affects enthalpy and entropy of
179 //! a target species
180 size_t j;
181 //! map of <coverage[dimensionless], enthalpy[J/kmol]> pairs
182 map<double, double> enthalpy_map;
183 //! map of <coverage[dimensionless], entropy[J/kmol/K]> pairs
184 map<double, double> entropy_map;
185 //! boolean indicating whether the dependency is piecewise-linear
187 };
188
189 //! A struct to store sets of parameters used in coverage-dependent heat capacity
190 //! calculations by a log-quadratic equation in CoverageDependentSurfPhase.
192 {
193 /*!
194 * @param k index of a target species whose heat capacity is calculated
195 * @param j index of a species whose coverage affects heat capacity of
196 * a target species
197 */
198 HeatCapacityDependency(size_t k, size_t j):
199 k(k), j(j), coeff_a(0.0), coeff_b(0.0) {}
200 //! index of a target species whose heat capacity is calculated
201 size_t k;
202 //! index of a species whose coverage affects heat capacity of
203 //! a target species
204 size_t j;
205 //! coefficient @f$ c^{(a)} @f$ [J/kmol/K] in the coverage-dependent
206 //! heat capacity model
207 double coeff_a;
208 //! coefficient @f$ c^{(b)} @f$ [J/kmol/K] in the coverage-dependent
209 //! heat capacity model
210 double coeff_b;
211 };
212
213 //! Construct and initialize a CoverageDependentSurfPhase ThermoPhase object
214 //! directly from an ASCII input file.
215 /*!
216 * @param infile name of the input file. If blank, an empty phase will be created.
217 * @param id name of the phase id in the file. If blank, the first phase
218 * in the file is used.
219 */
220 explicit CoverageDependentSurfPhase(const string& infile="",
221 const string& id="");
222
223 string type() const override {
224 return "coverage-dependent-surface";
225 }
226
227 //! Add interpolative coverage dependence parameters for a species
228 /*!
229 * @param int_deps list of parameters as an InterpolativeDependency object
230 */
231 void addInterpolativeDependency(const InterpolativeDependency& int_deps);
232
233 void initThermo() override;
234 bool addSpecies(shared_ptr<Species> spec) override;
235 void getParameters(AnyMap& phaseNode) const override;
236 void getSpeciesParameters(const string& name, AnyMap& speciesNode) const override;
237
238 //! @name Methods calculating reference state thermodynamic properties
239 //! Reference state properties are evaluated at @f$ T \text{ and }
240 //! \theta^{ref} @f$. With coverage fixed at a reference value,
241 //! reference state properties are effectively only dependent on temperature.
242 //! @{
243 void getEnthalpy_RT_ref(double* hrt) const override;
244 void getEntropy_R_ref(double* sr) const override;
245 void getCp_R_ref(double* cpr) const override;
246 void getGibbs_RT_ref(double* grt) const override;
247 //! @}
248
249 //! @name Methods calculating standard state thermodynamic properties
250 //! Standard state properties are evaluated at @f$ T \text{ and } \theta @f$,
251 //! and thus are dependent both on temperature and coverage.
252 //! @{
253
254 //! Get the nondimensionalized standard state enthalpy vector.
255 /*!
256 * @f[
257 * \frac{h^o_k(T,\theta)}{RT}
258 * = \frac{h^{ref}_k(T) + h^{cov}_k(T,\theta)
259 * + \int_{298}^{T} c^{cov}_{p,k}(T,\theta)dT}{RT}
260 * @f]
261 */
262 void getEnthalpy_RT(double* hrt) const override;
263
264 //! Get the nondimensionalized standard state entropy vector.
265 /*!
266 * @f[
267 * \frac{s^o_k(T,\theta)}{R}
268 * = \frac{s^{ref}_k(T) + s^{cov}_k(T,\theta)
269 * + \int_{298}^{T}\frac{c^{cov}_{p,k}(T,\theta)}{T}dT}{R}
270 * - \ln\left(\frac{1}{\theta_{ref}}\right)
271 * @f]
272 */
273 void getEntropy_R(double* sr) const override;
274
275 //! Get the nondimensionalized standard state heat capacity vector.
276 /*!
277 * @f[
278 * \frac{c^o_{p,k}(T,\theta)}{RT}
279 * = \frac{c^{ref}_{p,k}(T) + c^{cov}_{p,k}(T,\theta)}{RT}
280 * @f]
281 */
282 void getCp_R(double* cpr) const override;
283
284 //! Get the nondimensionalized standard state gibbs free energy vector.
285 /*!
286 * @f[
287 * \frac{g^o_k(T,\theta)}{RT}
288 * = \frac{h^o_k(T,\theta)}{RT} + \frac{s^o_k(T,\theta)}{R}
289 * @f]
290 */
291 void getGibbs_RT(double* grt) const override;
292
293 //! Get the standard state chemical potential vector. Units: J/kmol.
294 /*!
295 * @f[
296 * \mu^o_k(T,\theta) = h^o_k(T,\theta) + Ts^o_k(T,\theta)
297 * @f]
298 */
299 void getStandardChemPotentials(double* mu0) const override;
300 //! @}
301
302 //! @name Methods calculating partial molar thermodynamic properties
303 //! Partial molar properties are evaluated at @f$ T \text{ and } \theta @f$,
304 //! and thus are dependent both on temperature and coverage.
305 //! @{
306
307 //! Get the partial molar enthalpy vector. Units: J/kmol.
308 /*!
309 * @f[
310 * \tilde{h}_k(T,\theta) = h^o_k(T,\theta)
311 * @f]
312 */
313 void getPartialMolarEnthalpies(double* hbar) const override;
314
315 //! Get the partial molar entropy vector. Units: J/kmol/K.
316 /*!
317 * @f[
318 * \tilde{s}_k(T,\theta) = s^o_k(T,\theta) - R\ln(\theta_k)
319 * @f]
320 */
321 void getPartialMolarEntropies(double* sbar) const override;
322
323 //! Get the partial molar heat capacity vector. Units: J/kmol/K.
324 /*!
325 * @f[
326 * \tilde{c}_{p,k}(T,\theta) = c^o_{p,k}(T,\theta)
327 * @f]
328 */
329 void getPartialMolarCp(double* cpbar) const override;
330
331 //! Get the chemical potential vector. Units: J/kmol.
332 /*!
333 * @f[
334 * \mu_k(T,\theta) = \mu^o_k(T,\theta) + RT\ln(\theta_k)
335 * @f]
336 */
337 void getChemPotentials(double* mu) const override;
338 //! @}
339
340 //! @name Methods calculating Phase thermodynamic properties
341 //! Phase properties are evaluated at @f$ T \text{ and } \theta @f$,
342 //! and thus are dependent both on temperature and coverage.
343
344 //! @{
345
346 //! Return the solution's molar enthalpy. Units: J/kmol
347 /*!
348 * @f[
349 * \hat h(T,\theta) = \sum_k \theta_k \tilde{h}_k(T,\theta)
350 * @f]
351 */
352 double enthalpy_mole() const override;
353
354 //! Return the solution's molar entropy. Units: J/kmol/K
355 /*!
356 * @f[
357 * \hat s(T,\theta) = \sum_k \theta_k \tilde{s}_k(T,\theta)
358 * @f]
359 */
360 double entropy_mole() const override;
361
362 //! Return the solution's molar heat capacity. Units: J/kmol/K
363 /*!
364 * @f[
365 * \hat{c_p}(T,\theta) = \sum_k \theta_k \tilde{c_p}_k(T,\theta)
366 * @f]
367 */
368 double cp_mole() const override;
369 //! @}
370
371protected:
372 //! Temporary storage for the coverages.
373 mutable vector<double> m_cov;
374
375 //! Temporary storage for the coverage-dependent enthalpies.
376 mutable vector<double> m_h_cov;
377
378 //! Temporary storage for the coverage-dependent entropies.
379 mutable vector<double> m_s_cov;
380
381 //! Temporary storage for the coverage-dependent heat capacities.
382 mutable vector<double> m_cp_cov;
383
384 //! Temporary storage for the coverage-dependent chemical potentials.
385 mutable vector<double> m_mu_cov;
386
387 //! Temporary storage for the sum of reference state enthalpies and
388 //! coverage-dependent enthalpies.
389 mutable vector<double> m_enthalpy;
390
391 //! Temporary storage for the sum of reference state entropies and
392 //! coverage-dependent entropies.
393 mutable vector<double> m_entropy;
394
395 //! Temporary storage for the sum of reference state heat capacities and
396 //! coverage-dependent heat capacities.
397 mutable vector<double> m_heatcapacity;
398
399 //! Temporary storage for the sum of reference state chemical potentials
400 //! and coverage-dependent chemical potentials.
401 mutable vector<double> m_chempot;
402
403 //! Array of enthalpy and entropy coverage dependency parameters used in
404 //! the linear and polynomial dependency equations.
405 vector<PolynomialDependency> m_PolynomialDependency;
406
407 //! Array of enthalpy and entropy coverage dependency parameters used in
408 //! the piecewise-linear and interpolative dependency equations.
409 vector<InterpolativeDependency> m_InterpolativeDependency;
410
411 //! Array of heat capacity coverage dependency parameters.
412 vector<HeatCapacityDependency> m_HeatCapacityDependency;
413
414private:
415 //! Storage for the user-defined reference state coverage which has to be
416 //! greater than 0.0 and less than or equal to 1.0. default = 1.0.
418
419 //! Last value of the state number processed.
420 mutable int m_stateNumlast;
421
422 //! Update the species coverage-dependent thermodynamic functions.
423 /*!
424 * The coverage-dependent enthalpy and entropy are only re-evaluated
425 * if the coverage has changed. The coverage-dependent heat capacity
426 * is only re-evaluated if the coverage or temperature has changed.
427 */
428 void _updateCovDepThermo() const;
429
430 //! Update the total (reference state + coverage-dependent)
431 //! thermodynamic functions.
432 /*!
433 * Calls subroutines for both ideal species thermodynamic update and
434 * coverage-dependent species thermodynamic update.
435 */
436 void _updateTotalThermo() const;
437
438};
439
440}
441
442#endif
Header file for class Cantera::Array2D.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Base class defining common data possessed by both AnyMap and AnyValue objects.
Definition AnyMap.h:34
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
A thermodynamic model for a coverage-dependent surface phase, applying surface species lateral intera...
void getStandardChemPotentials(double *mu0) const override
Get the standard state chemical potential vector. Units: J/kmol.
double enthalpy_mole() const override
Return the solution's molar enthalpy. Units: J/kmol.
vector< double > m_entropy
Temporary storage for the sum of reference state entropies and coverage-dependent entropies.
vector< InterpolativeDependency > m_InterpolativeDependency
Array of enthalpy and entropy coverage dependency parameters used in the piecewise-linear and interpo...
void getPartialMolarEnthalpies(double *hbar) const override
Get the partial molar enthalpy vector. Units: J/kmol.
void getChemPotentials(double *mu) const override
Get the chemical potential vector. Units: J/kmol.
void getSpeciesParameters(const string &name, AnyMap &speciesNode) const override
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
void getEntropy_R(double *sr) const override
Get the nondimensionalized standard state entropy vector.
vector< double > m_enthalpy
Temporary storage for the sum of reference state enthalpies and coverage-dependent enthalpies.
vector< HeatCapacityDependency > m_HeatCapacityDependency
Array of heat capacity coverage dependency parameters.
void getCp_R_ref(double *cpr) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
void getCp_R(double *cpr) const override
Get the nondimensionalized standard state heat capacity vector.
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
string type() const override
String indicating the thermodynamic model implemented.
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
vector< double > m_h_cov
Temporary storage for the coverage-dependent enthalpies.
void getEntropy_R_ref(double *sr) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
int m_stateNumlast
Last value of the state number processed.
vector< double > m_chempot
Temporary storage for the sum of reference state chemical potentials and coverage-dependent chemical ...
void addInterpolativeDependency(const InterpolativeDependency &int_deps)
Add interpolative coverage dependence parameters for a species.
vector< double > m_heatcapacity
Temporary storage for the sum of reference state heat capacities and coverage-dependent heat capaciti...
void _updateTotalThermo() const
Update the total (reference state + coverage-dependent) thermodynamic functions.
void getEnthalpy_RT(double *hrt) const override
Get the nondimensionalized standard state enthalpy vector.
double m_theta_ref
Storage for the user-defined reference state coverage which has to be greater than 0....
void _updateCovDepThermo() const
Update the species coverage-dependent thermodynamic functions.
void getGibbs_RT(double *grt) const override
Get the nondimensionalized standard state gibbs free energy vector.
double entropy_mole() const override
Return the solution's molar entropy. Units: J/kmol/K.
vector< double > m_mu_cov
Temporary storage for the coverage-dependent chemical potentials.
vector< double > m_s_cov
Temporary storage for the coverage-dependent entropies.
double cp_mole() const override
Return the solution's molar heat capacity. Units: J/kmol/K.
vector< double > m_cov
Temporary storage for the coverages.
void getPartialMolarCp(double *cpbar) const override
Get the partial molar heat capacity vector. Units: J/kmol/K.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void getGibbs_RT_ref(double *grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
vector< PolynomialDependency > m_PolynomialDependency
Array of enthalpy and entropy coverage dependency parameters used in the linear and polynomial depend...
vector< double > m_cp_cov
Temporary storage for the coverage-dependent heat capacities.
void getPartialMolarEntropies(double *sbar) const override
Get the partial molar entropy vector. Units: J/kmol/K.
void getEnthalpy_RT_ref(double *hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
string name() const
Return the name of the phase.
Definition Phase.cpp:20
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition SurfPhase.h:114
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
A struct to store sets of parameters used in coverage-dependent heat capacity calculations by a log-q...
double coeff_a
coefficient [J/kmol/K] in the coverage-dependent heat capacity model
size_t k
index of a target species whose heat capacity is calculated
size_t j
index of a species whose coverage affects heat capacity of a target species
double coeff_b
coefficient [J/kmol/K] in the coverage-dependent heat capacity model
A struct to store sets of parameters used in coverage-dependent enthalpy and entropy calculations by ...
map< double, double > enthalpy_map
map of <coverage[dimensionless], enthalpy[J/kmol]> pairs
size_t k
index of a target species whose enthalpy and entropy are calculated
bool isPiecewise
boolean indicating whether the dependency is piecewise-linear
size_t j
index of a species whose coverage affects enthalpy and entropy of a target species
map< double, double > entropy_map
map of <coverage[dimensionless], entropy[J/kmol/K]> pairs
A struct to store sets of parameters used in coverage-dependent enthalpy and entropy calculations by ...
vector< double > entropy_coeffs
array of polynomial coefficients describing coverage-dependent entropy [J/kmol/K] in order of 1st-ord...
vector< double > enthalpy_coeffs
array of polynomial coefficients describing coverage-dependent enthalpy [J/kmol] in order of 1st-orde...
size_t k
index of a target species whose enthalpy and entropy is calculated
size_t j
index of a species whose coverage affects enthalpy and entropy of a target species
bool isLinear
boolean indicating whether the dependency is linear