| Cantera 3.0.0

Loading...
Searching...
No Matches
CoverageDependentSurfPhase.cpp
Go to the documentation of this file.
1/**
2 * @file CoverageDependentSurfPhase.cpp
3 * Definitions 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#include "cantera/thermo/CoverageDependentSurfPhase.h"
14#include "cantera/thermo/SurfPhase.h"
15#include "cantera/thermo/ThermoFactory.h"
16#include "cantera/base/stringUtils.h"
17#include "cantera/base/utilities.h"
18#include "cantera/thermo/Species.h"
19
20 using namespace std;
21
22 namespace Cantera
23{
24
25 CoverageDependentSurfPhase::PolynomialDependency::PolynomialDependency(
26 size_t k, size_t j, const AnyMap& dep_map
27) :
28 k(k),
29 j(j),
30 enthalpy_coeffs({0.0, 0.0, 0.0, 0.0, 0.0}),
31 entropy_coeffs({0.0, 0.0, 0.0, 0.0, 0.0}),
32 isLinear(false)
33{
34 // For linear model
35 if (dep_map["model"] == "linear") {
36 if (dep_map.hasKey("enthalpy")) {
37 enthalpy_coeffs[1] = dep_map.convert("enthalpy", "J/kmol");
38 }
39 if (dep_map.hasKey("entropy")) {
40 entropy_coeffs[1] = dep_map.convert("entropy", "J/kmol/K");
41 }
42 isLinear = true;
43 // For polynomial(4th) model
44 } else if (dep_map["model"] == "polynomial") {
45 if (dep_map.hasKey("enthalpy-coefficients")) {
46 enthalpy_coeffs = dep_map.convertVector(
47 "enthalpy-coefficients", "J/kmol");
48 enthalpy_coeffs.insert(enthalpy_coeffs.begin(), 0.0);
49 }
50 if (dep_map.hasKey("entropy-coefficients")) {
51 entropy_coeffs = dep_map.convertVector(
52 "entropy-coefficients", "J/kmol/K");
53 entropy_coeffs.insert(entropy_coeffs.begin(), 0.0);
54 }
55 }
56}
57
58 CoverageDependentSurfPhase::InterpolativeDependency::InterpolativeDependency(
59 size_t k, size_t j, const AnyMap& dep_map, const AnyBase& node
60) :
61 k(k),
62 j(j),
63 enthalpy_map({{0.0, 0.0}, {1.0, 0.0}}),
64 entropy_map({{0.0, 0.0}, {1.0, 0.0}}),
65 isPiecewise(false)
66{
67 // For piecewise-linear model
68 // Piecewise-linear model coefficients are converted into
69 // a map <coverages: values>
70 if (dep_map["model"] == "piecewise-linear") {
71 if (dep_map.hasKey("enthalpy-low") ||
72 dep_map.hasKey("enthalpy-change") ||
73 dep_map.hasKey("enthalpy-high"))
74 {
75 auto cov_change = dep_map["enthalpy-change"].as<double>();
76 enthalpy_map[cov_change] =
77 dep_map.convert("enthalpy-low", "J/kmol") * cov_change;
78 enthalpy_map[1.0] = (1.0 - cov_change)
79 * dep_map.convert("enthalpy-high", "J/kmol")
80 + enthalpy_map[cov_change];
81 }
82 if (dep_map.hasKey("entropy-low") ||
83 dep_map.hasKey("entropy-change") ||
84 dep_map.hasKey("entropy-high"))
85 {
86 auto cov_change = dep_map["entropy-change"].as<double>();
87 entropy_map[cov_change] =
88 dep_map.convert("entropy-low", "J/kmol/K") * cov_change;
89 entropy_map[1.0] = (1.0 - cov_change)
90 * dep_map.convert("entropy-high", "J/kmol/K")
91 + entropy_map[cov_change];
92 }
93 isPiecewise = true;
94 // For interpolative model
95 } else if (dep_map["model"] == "interpolative") {
96 if (dep_map.hasKey("enthalpy-coverages") || dep_map.hasKey("enthalpies")) {
97 auto hcovs = dep_map["enthalpy-coverages"].as<vector<double>>();
98 vector<double> enthalpies = dep_map.convertVector("enthalpies", "J/kmol");
99 if (hcovs.size() != enthalpies.size()) {
100 throw InputFileError("CoverageDependentSurfPhase::"
101 "addInterpolativeDependency", node,
102 "Sizes of coverages array and enthalpies array are not equal.");
103 }
104 for (size_t i = 0; i < hcovs.size(); i++) {
105 enthalpy_map[hcovs[i]] = enthalpies[i];
106 }
107 }
108 if (dep_map.hasKey("entropy-coverages") || dep_map.hasKey("entropies")) {
109 auto scovs = dep_map["entropy-coverages"].as<vector<double>>();
110 vector<double> entropies = dep_map.convertVector("entropies",
111 "J/kmol/K");
112 if (scovs.size() != entropies.size()) {
113 throw InputFileError("CoverageDependentSurfPhase::"
114 "addInterpolativeDependency", node,
115 "Sizes of coverages array and entropies array are not equal.");
116 }
117 for (size_t i = 0; i < scovs.size(); i++) {
118 entropy_map[scovs[i]] = entropies[i];
119 }
120 }
121 }
122}
123
124 CoverageDependentSurfPhase::CoverageDependentSurfPhase(const string& infile,
125 const string& id_):
126 m_theta_ref(1.0),
127 m_stateNumlast(-2)
128{
129 setNDim(2);
130 initThermoFile(infile, id_);
131}
132
133 void CoverageDependentSurfPhase::addInterpolativeDependency(
134 const InterpolativeDependency& int_deps)
135{
136 if (int_deps.enthalpy_map.begin()->first != 0.0) {
137 throw CanteraError("CoverageDependentSurfPhase::addInterpolativeDependency",
138 "The first element of enthalpy-coverages array must be 0.0.");
139 }
140 if (int_deps.enthalpy_map.rbegin()->first != 1.0) {
141 throw CanteraError("CoverageDependentSurfPhase::addInterpolativeDependency",
142 "The last element of enthalpy-coverages array must be 1.0.");
143 }
144
145 if (int_deps.entropy_map.begin()->first != 0.0) {
146 throw CanteraError("CoverageDependentSurfPhase::addInterpolativeDependency",
147 "The first element of entropy-coverages array must be 0.0.");
148 }
149 if (int_deps.entropy_map.rbegin()->first != 1.0) {
150 throw CanteraError("CoverageDependentSurfPhase::addInterpolativeDependency",
151 "The last element of entropy-coverages array must be 1.0.");
152 }
153
154 m_InterpolativeDependency.push_back(int_deps);
155}
156
157 void CoverageDependentSurfPhase::initThermo()
158{
159 SurfPhase::initThermo();
160 if (m_input.hasKey("reference-state-coverage")) {
161 m_theta_ref = m_input["reference-state-coverage"].as<double>();
162 if (m_theta_ref <= 0.0 || m_theta_ref > 1.0) {
163 throw InputFileError("CoverageDependentSurfPhase::initThermo",
164 m_input, "Reference state coverage must be greater than 0.0 and \
165 less than or equal to 1.0.");
166 }
167 }
168 for (auto& item : m_species) {
169 // Read enthalpy and entropy dependencies from species 'input' information
170 // (i.e. as specified in a YAML input file) for both self- and cross-
171 // interactions.
172 if (item.second->input.hasKey("coverage-dependencies")) {
173 auto& cov_map = item.second->input["coverage-dependencies"];
174 for (const auto& item2 : cov_map) {
175 size_t k = speciesIndex(item.first);
176 size_t j = speciesIndex(item2.first);
177 if (k == npos) {
178 throw InputFileError("CoverageDependentSurfPhase::initThermo",
179 item.second->input, "Unknown species '{}'.", item.first);
180 }
181 if (j == npos) {
182 throw InputFileError("CoverageDependentSurfPhase::initThermo",
183 item.second->input, "Unknown species '{}'.", item2.first);
184 }
185 auto& dep_map = item2.second.as<AnyMap>();
186 // For linear model and polynomial model
187 if (dep_map["model"] == "linear" || dep_map["model"] == "polynomial") {
188 PolynomialDependency poly_deps(k, j, dep_map);
189 m_PolynomialDependency.push_back(poly_deps);
190 // For piecewise-linear model and interpolative model
191 } else if (dep_map["model"] == "piecewise-linear" ||
192 dep_map["model"] == "interpolative") {
193 InterpolativeDependency int_deps(k, j, dep_map,
194 item.second->input);
195 addInterpolativeDependency(int_deps);
196 } else {
197 throw InputFileError("CoverageDependentSurfPhase::initThermo",
198 item.second->input, "Unrecognized coverage dependency model. \
199 Model must be 'linear', 'piecewise-linear', 'polynomial', \
200 or 'interpolative'.");
201 }
202 // For coverage-dependent heat capacity parameters, if present
203 if (dep_map.hasKey("heat-capacity-a")) {
204 HeatCapacityDependency cpcov_deps(k, j);
205 cpcov_deps.coeff_a = dep_map.convert("heat-capacity-a", "J/kmol/K");
206 cpcov_deps.coeff_b = dep_map.convert("heat-capacity-b", "J/kmol/K");
207
208 m_HeatCapacityDependency.push_back(cpcov_deps);
209 }
210 }
211 }
212 }
213}
214
215 bool CoverageDependentSurfPhase::addSpecies(shared_ptr<Species> spec)
216{
217 bool added = SurfPhase::addSpecies(spec);
218 if (added) {
219 m_cov.push_back(0.0);
220 m_h_cov.push_back(0.0);
221 m_s_cov.push_back(0.0);
222 m_cp_cov.push_back(0.0);
223 m_mu_cov.push_back(0.0);
224 m_enthalpy.push_back(0.0);
225 m_entropy.push_back(0.0);
226 m_heatcapacity.push_back(0.0);
227 m_chempot.push_back(0.0);
228 }
229 return added;
230}
231
232 void CoverageDependentSurfPhase::getParameters(AnyMap& phaseNode) const
233{
234 SurfPhase::getParameters(phaseNode);
235 phaseNode["reference-state-coverage"] = m_theta_ref;
236}
237
238 void CoverageDependentSurfPhase::getSpeciesParameters(const string& name,
239 AnyMap& speciesNode) const
240{
241 SurfPhase::getSpeciesParameters(name, speciesNode);
242 size_t k = speciesIndex(name);
243 // Get linear and polynomial model parameters from PolynomialDependency vector
244 for (auto& item : m_PolynomialDependency) {
245 if (item.k == k) {
246 if (item.isLinear) {
247 auto& covdepNode =
248 speciesNode["coverage-dependencies"][speciesName(item.j)]
249 .getMapWhere("model", "linear", true);
250 covdepNode["enthalpy"].setQuantity(item.enthalpy_coeffs[1], "J/kmol");
251 covdepNode["entropy"].setQuantity(item.entropy_coeffs[1], "J/kmol/K");
252 } else {
253 auto& covdepNode =
254 speciesNode["coverage-dependencies"][speciesName(item.j)]
255 .getMapWhere("model", "polynomial", true);
256 vector<double> hvec (
257 item.enthalpy_coeffs.begin() + 1, item.enthalpy_coeffs.end());
258 covdepNode["enthalpy-coefficients"].setQuantity(hvec, "J/kmol");
259 vector<double> svec (
260 item.entropy_coeffs.begin() + 1, item.entropy_coeffs.end());
261 covdepNode["entropy-coefficients"].setQuantity(svec, "J/kmol/K");
262 }
263 }
264 }
265 // Get piecewise-linear model parameters from InterpolativeDependency vector
266 for (auto& item : m_InterpolativeDependency) {
267 if (item.k == k) {
268 if (item.isPiecewise) {
269 auto& covdepNode =
270 speciesNode["coverage-dependencies"][speciesName(item.j)]
271 .getMapWhere("model", "piecewise-linear", true);
272 vector<double> hcovs, enthalpies, scovs, entropies;
273 for (const auto& hmap : item.enthalpy_map) {
274 hcovs.push_back(hmap.first);
275 enthalpies.push_back(hmap.second);
276 }
277 for (const auto& smap : item.entropy_map) {
278 scovs.push_back(smap.first);
279 entropies.push_back(smap.second);
280 }
281 covdepNode["enthalpy-change"] = hcovs[1];
282 covdepNode["enthalpy-low"].setQuantity(
283 (enthalpies[1] - enthalpies[0]) / (hcovs[1] - hcovs[0]), "J/kmol");
284 covdepNode["enthalpy-high"].setQuantity(
285 (enthalpies[2] - enthalpies[1]) / (hcovs[2] - hcovs[1]), "J/kmol");
286 covdepNode["entropy-change"] = scovs[1];
287 covdepNode["entropy-low"].setQuantity(
288 (entropies[1] - entropies[0]) / (scovs[1] - scovs[0]), "J/kmol/K");
289 covdepNode["entropy-high"].setQuantity(
290 (entropies[2] - entropies[1]) / (scovs[2] - scovs[1]), "J/kmol/K");
291 } else {
292 auto& covdepNode =
293 speciesNode["coverage-dependencies"][speciesName(item.j)]
294 .getMapWhere("model", "interpolative", true);
295 vector<double> hcovs, enthalpies, scovs, entropies;
296 for (const auto& hmap : item.enthalpy_map) {
297 hcovs.push_back(hmap.first);
298 enthalpies.push_back(hmap.second);
299 }
300 for (const auto& smap : item.entropy_map) {
301 scovs.push_back(smap.first);
302 entropies.push_back(smap.second);
303 }
304 covdepNode["enthalpy-coverages"] = std::move(hcovs);
305 covdepNode["enthalpies"].setQuantity(enthalpies, "J/kmol");
306 covdepNode["entropy-coverages"] = std::move(scovs);
307 covdepNode["entropies"].setQuantity(entropies, "J/kmol/K");
308 }
309 }
310 }
311 // Get heat capacity model parameters from HeatCapacityDependency vector
312 for (auto& item : m_HeatCapacityDependency) {
313 if (item.k == k) {
314 auto& covdepNode =
315 speciesNode["coverage-dependencies"][speciesName(item.j)]
316 .getMapWhere("heat-capacity-a", "", true);
317 covdepNode["heat-capacity-a"].setQuantity(item.coeff_a, "J/kmol/K");
318 covdepNode["heat-capacity-b"].setQuantity(item.coeff_b, "J/kmol/K");
319 }
320 }
321}
322
323 void CoverageDependentSurfPhase::getGibbs_RT_ref(double* grt) const
324{
325 SurfPhase::_updateThermo();
326 scale(m_mu0.begin(), m_mu0.end(), grt, 1.0/RT());
327}
328
329 void CoverageDependentSurfPhase::getEnthalpy_RT_ref(double* hrt) const
330{
331 SurfPhase::_updateThermo();
332 scale(m_h0.begin(), m_h0.end(), hrt, 1.0/RT());
333}
334
335 void CoverageDependentSurfPhase::getEntropy_R_ref(double* sr) const
336{
337 SurfPhase::_updateThermo();
338 scale(m_s0.begin(), m_s0.end(), sr, 1.0/GasConstant);
339}
340
341 void CoverageDependentSurfPhase::getCp_R_ref(double* cpr) const
342{
343 SurfPhase::_updateThermo();
344 scale(m_cp0.begin(), m_cp0.end(), cpr, 1.0/GasConstant);
345}
346
347 void CoverageDependentSurfPhase::getEnthalpy_RT(double* hrt) const
348{
349 _updateTotalThermo();
350 scale(m_enthalpy.begin(), m_enthalpy.end(), hrt, 1.0/RT());
351}
352
353 void CoverageDependentSurfPhase::getEntropy_R(double* sr) const
354{
355 _updateTotalThermo();
356 scale(m_entropy.begin(), m_entropy.end(), sr, 1.0/GasConstant);
357 if (m_theta_ref != 1.0) {
358 double tmp = -log(m_theta_ref);
359 for (size_t k = 0; k < m_kk; k++) {
360 sr[k] -= tmp;
361 }
362 }
363}
364
365 void CoverageDependentSurfPhase::getCp_R(double* cpr) const
366{
367 _updateTotalThermo();
368 scale(m_heatcapacity.begin(), m_heatcapacity.end(), cpr, 1.0/GasConstant);
369}
370
371 void CoverageDependentSurfPhase::getGibbs_RT(double* grt) const
372{
373 _updateTotalThermo();
374 scale(m_chempot.begin(), m_chempot.end(), grt, 1.0/RT());
375 if (m_theta_ref != 1.0) {
376 double tmp = -log(m_theta_ref);
377 for (size_t k = 0; k < m_kk; k++) {
378 grt[k] += tmp;
379 }
380 }
381}
382
383 void CoverageDependentSurfPhase::getPureGibbs(double* g) const
384{
385 getGibbs_RT(g);
386 for (size_t k = 0; k < m_kk; k++) {
387 g[k] *= RT();
388 }
389}
390
391 void CoverageDependentSurfPhase::getStandardChemPotentials(double* mu0) const
392{
393 _updateTotalThermo();
394 copy(m_chempot.begin(), m_chempot.end(), mu0);
395 if (m_theta_ref != 1.0) {
396 double tmp = RT() * -log(m_theta_ref);
397 for (size_t k = 0; k < m_kk; k++) {
398 mu0[k] += tmp;
399 }
400 }
401}
402
403 void CoverageDependentSurfPhase::getPartialMolarEnthalpies(double* hbar) const
404{
405 _updateTotalThermo();
406 copy(m_enthalpy.begin(), m_enthalpy.end(), hbar);
407}
408
409 void CoverageDependentSurfPhase::getPartialMolarEntropies(double* sbar) const
410{
411 _updateTotalThermo();
412 copy(m_entropy.begin(), m_entropy.end(), sbar);
413 for (size_t k = 0; k < m_kk; k++) {
414 sbar[k] -= GasConstant * log(std::max(m_cov[k], SmallNumber) / m_theta_ref);
415 }
416}
417
418 void CoverageDependentSurfPhase::getPartialMolarCp(double* cpbar) const
419{
420 _updateTotalThermo();
421 copy(m_heatcapacity.begin(), m_heatcapacity.end(), cpbar);
422}
423
424 void CoverageDependentSurfPhase::getChemPotentials(double* mu) const
425{
426 _updateTotalThermo();
427 copy(m_chempot.begin(), m_chempot.end(), mu);
428 for (size_t k = 0; k < m_kk; k++) {
429 mu[k] += RT() * log(std::max(m_cov[k], SmallNumber) / m_theta_ref);
430 }
431}
432
433 double CoverageDependentSurfPhase::enthalpy_mole() const
434{
435 _updateTotalThermo();
436 return mean_X(m_enthalpy);
437}
438
439 double CoverageDependentSurfPhase::entropy_mole() const
440{
441 _updateTotalThermo();
442 double entropy = 0.0;
443 for (size_t k = 0; k < m_kk; k++) {
444 entropy += moleFraction(k) * (m_entropy[k] -
445 GasConstant * log(std::max(m_cov[k], SmallNumber) / m_theta_ref));
446 }
447 return entropy;
448}
449
450 double CoverageDependentSurfPhase::cp_mole() const
451{
452 _updateTotalThermo();
453 return mean_X(m_heatcapacity);
454}
455
456 void CoverageDependentSurfPhase::_updateCovDepThermo() const
457{
458 int stateNumnow = stateMFNumber();
459 double tnow = temperature();
460 if (m_stateNumlast != stateNumnow || m_tlast != tnow) {
461 for (size_t k = 0; k < m_kk; k++) {
462 m_h_cov[k] = 0.0;
463 m_s_cov[k] = 0.0;
464 m_cp_cov[k] = 0.0;
465 }
466 getCoverages(m_cov.data());
467
468 // For linear and polynomial model
469 for (auto& item : m_PolynomialDependency) {
470 m_h_cov[item.k] += poly4(m_cov[item.j], item.enthalpy_coeffs.data());
471 m_s_cov[item.k] += poly4(m_cov[item.j], item.entropy_coeffs.data());
472 }
473
474 // For piecewise-linear and interpolative model
475 for (auto& item : m_InterpolativeDependency) {
476 auto h_iter = item.enthalpy_map.upper_bound(m_cov[item.j]);
477 auto s_iter = item.entropy_map.upper_bound(m_cov[item.j]);
478 AssertThrowMsg(h_iter != item.enthalpy_map.end(),
479 "CoverageDependentSurfPhase::_updateCovDepThermo",
480 "Coverage out of range: {}", m_cov[item.j]);
481 AssertThrowMsg(h_iter != item.enthalpy_map.begin(),
482 "CoverageDependentSurfPhase::_updateCovDepThermo",
483 "Coverage out of range: {}", m_cov[item.j]);
484 AssertThrowMsg(s_iter != item.entropy_map.end(),
485 "CoverageDependentSurfPhase::_updateCovDepThermo",
486 "Coverage out of range: {}", m_cov[item.j]);
487 AssertThrowMsg(s_iter != item.entropy_map.begin(),
488 "CoverageDependentSurfPhase::_updateCovDepThermo",
489 "Coverage out of range: {}", m_cov[item.j]);
490
491 double highHcov = h_iter->first;
492 double highH = h_iter->second;
493 double lowHcov = (--h_iter)->first;
494 double lowH = h_iter->second;
495
496 double highScov = s_iter->first;
497 double highS = s_iter->second;
498 double lowScov = (--s_iter)->first;
499 double lowS = s_iter->second;
500
501 m_h_cov[item.k] += (highH - lowH) / (highHcov - lowHcov)
502 * (m_cov[item.j] - lowHcov) + lowH;
503
504 m_s_cov[item.k] += (highS - lowS) / (highScov - lowScov)
505 * (m_cov[item.j] - lowScov) + lowS;
506 }
507
508 // For coverage-dependent heat capacity
509 for (auto& item : m_HeatCapacityDependency) {
510 double a = item.coeff_a;
511 double b = item.coeff_b;
512 m_cp_cov[item.k] += (a * log(tnow) + b) * m_cov[item.j] * m_cov[item.j];
513 double int_cp_tnow = tnow * (a * log(tnow) - a + b);
514 double int_cp_298 = 298.15 * (a * log(298.15) - a + b);
515 m_h_cov[item.k] += (int_cp_tnow - int_cp_298) * m_cov[item.j]
516 * m_cov[item.j];
517 double int_cp_T_tnow = log(tnow) * (a * log(tnow) + 2 * b);
518 double int_cp_T_298 = log(298.15) * (a * log(298.15) + 2 * b);
519 m_s_cov[item.k] += 0.5 * (int_cp_T_tnow - int_cp_T_298) * m_cov[item.j]
520 * m_cov[item.j];
521 }
522
523 for (size_t k = 0; k < m_kk; k++) {
524 m_mu_cov[k] = m_h_cov[k] - tnow * m_s_cov[k];
525 }
526 m_stateNumlast = stateNumnow;
527 }
528}
529
530 void CoverageDependentSurfPhase::_updateTotalThermo() const
531{
532 _updateCovDepThermo();
533 SurfPhase::_updateThermo();
534
535 for (size_t k = 0; k < m_kk; k++) {
536 m_enthalpy[k] = m_h0[k] + m_h_cov[k];
537 m_entropy[k] = m_s0[k] + m_s_cov[k];
538 m_heatcapacity[k] = m_cp0[k] + m_cp_cov[k];
539 m_chempot[k] = m_mu0[k] + m_mu_cov[k];
540 }
541}
542
543}
CoverageDependentSurfPhase.h
Header for a thermodynamics model of a coverage-dependent surface phase derived from SurfPhase,...
Species.h
Declaration for class Cantera::Species.
SurfPhase.h
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
ThermoFactory.h
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Cantera::AnyBase
Base class defining common data possessed by both AnyMap and AnyValue objects.
Definition AnyMap.h:34
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::AnyMap::hasKey
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1423
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
Cantera::CoverageDependentSurfPhase::getStandardChemPotentials
void getStandardChemPotentials(double *mu0) const override
Get the standard state chemical potential vector. Units: J/kmol.
Definition CoverageDependentSurfPhase.cpp:391
Cantera::CoverageDependentSurfPhase::getPureGibbs
void getPureGibbs(double *g) const override
Get the standard state gibbs free energy vector. Units: J/kmol.
Definition CoverageDependentSurfPhase.cpp:383
Cantera::CoverageDependentSurfPhase::enthalpy_mole
double enthalpy_mole() const override
Return the solution's molar enthalpy. Units: J/kmol.
Definition CoverageDependentSurfPhase.cpp:433
Cantera::CoverageDependentSurfPhase::m_entropy
vector< double > m_entropy
Temporary storage for the sum of reference state entropies and coverage-dependent entropies.
Definition CoverageDependentSurfPhase.h:401
Cantera::CoverageDependentSurfPhase::m_InterpolativeDependency
vector< InterpolativeDependency > m_InterpolativeDependency
Array of enthalpy and entropy coverage dependency parameters used in the piecewise-linear and interpo...
Definition CoverageDependentSurfPhase.h:417
Cantera::CoverageDependentSurfPhase::getPartialMolarEnthalpies
void getPartialMolarEnthalpies(double *hbar) const override
Get the partial molar enthalpy vector. Units: J/kmol.
Definition CoverageDependentSurfPhase.cpp:403
Cantera::CoverageDependentSurfPhase::getChemPotentials
void getChemPotentials(double *mu) const override
Get the chemical potential vector. Units: J/kmol.
Definition CoverageDependentSurfPhase.cpp:424
Cantera::CoverageDependentSurfPhase::getSpeciesParameters
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...
Definition CoverageDependentSurfPhase.cpp:238
Cantera::CoverageDependentSurfPhase::getEntropy_R
void getEntropy_R(double *sr) const override
Get the nondimensionalized standard state entropy vector.
Definition CoverageDependentSurfPhase.cpp:353
Cantera::CoverageDependentSurfPhase::CoverageDependentSurfPhase
CoverageDependentSurfPhase(const string &infile="", const string &id="")
Construct and initialize a CoverageDependentSurfPhase ThermoPhase object directly from an ASCII input...
Definition CoverageDependentSurfPhase.cpp:124
Cantera::CoverageDependentSurfPhase::m_enthalpy
vector< double > m_enthalpy
Temporary storage for the sum of reference state enthalpies and coverage-dependent enthalpies.
Definition CoverageDependentSurfPhase.h:397
Cantera::CoverageDependentSurfPhase::m_HeatCapacityDependency
vector< HeatCapacityDependency > m_HeatCapacityDependency
Array of heat capacity coverage dependency parameters.
Definition CoverageDependentSurfPhase.h:420
Cantera::CoverageDependentSurfPhase::getCp_R_ref
void getCp_R_ref(double *cpr) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition CoverageDependentSurfPhase.cpp:341
Cantera::CoverageDependentSurfPhase::getCp_R
void getCp_R(double *cpr) const override
Get the nondimensionalized standard state heat capacity vector.
Definition CoverageDependentSurfPhase.cpp:365
Cantera::CoverageDependentSurfPhase::getParameters
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition CoverageDependentSurfPhase.cpp:232
Cantera::CoverageDependentSurfPhase::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition CoverageDependentSurfPhase.cpp:157
Cantera::CoverageDependentSurfPhase::m_h_cov
vector< double > m_h_cov
Temporary storage for the coverage-dependent enthalpies.
Definition CoverageDependentSurfPhase.h:384
Cantera::CoverageDependentSurfPhase::getEntropy_R_ref
void getEntropy_R_ref(double *sr) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition CoverageDependentSurfPhase.cpp:335
Cantera::CoverageDependentSurfPhase::m_stateNumlast
int m_stateNumlast
Last value of the state number processed.
Definition CoverageDependentSurfPhase.h:428
Cantera::CoverageDependentSurfPhase::m_chempot
vector< double > m_chempot
Temporary storage for the sum of reference state chemical potentials and coverage-dependent chemical ...
Definition CoverageDependentSurfPhase.h:409
Cantera::CoverageDependentSurfPhase::addInterpolativeDependency
void addInterpolativeDependency(const InterpolativeDependency &int_deps)
Add interpolative coverage dependence parameters for a species.
Definition CoverageDependentSurfPhase.cpp:133
Cantera::CoverageDependentSurfPhase::m_heatcapacity
vector< double > m_heatcapacity
Temporary storage for the sum of reference state heat capacities and coverage-dependent heat capaciti...
Definition CoverageDependentSurfPhase.h:405
Cantera::CoverageDependentSurfPhase::_updateTotalThermo
void _updateTotalThermo() const
Update the total (reference state + coverage-dependent) thermodynamic functions.
Definition CoverageDependentSurfPhase.cpp:530
Cantera::CoverageDependentSurfPhase::getEnthalpy_RT
void getEnthalpy_RT(double *hrt) const override
Get the nondimensionalized standard state enthalpy vector.
Definition CoverageDependentSurfPhase.cpp:347
Cantera::CoverageDependentSurfPhase::m_theta_ref
double m_theta_ref
Storage for the user-defined reference state coverage which has to be greater than 0....
Definition CoverageDependentSurfPhase.h:425
Cantera::CoverageDependentSurfPhase::_updateCovDepThermo
void _updateCovDepThermo() const
Update the species coverage-dependent thermodynamic functions.
Definition CoverageDependentSurfPhase.cpp:456
Cantera::CoverageDependentSurfPhase::getGibbs_RT
void getGibbs_RT(double *grt) const override
Get the nondimensionalized standard state gibbs free energy vector.
Definition CoverageDependentSurfPhase.cpp:371
Cantera::CoverageDependentSurfPhase::entropy_mole
double entropy_mole() const override
Return the solution's molar entropy. Units: J/kmol/K.
Definition CoverageDependentSurfPhase.cpp:439
Cantera::CoverageDependentSurfPhase::m_mu_cov
vector< double > m_mu_cov
Temporary storage for the coverage-dependent chemical potentials.
Definition CoverageDependentSurfPhase.h:393
Cantera::CoverageDependentSurfPhase::m_s_cov
vector< double > m_s_cov
Temporary storage for the coverage-dependent entropies.
Definition CoverageDependentSurfPhase.h:387
Cantera::CoverageDependentSurfPhase::cp_mole
double cp_mole() const override
Return the solution's molar heat capacity. Units: J/kmol/K.
Definition CoverageDependentSurfPhase.cpp:450
Cantera::CoverageDependentSurfPhase::m_cov
vector< double > m_cov
Temporary storage for the coverages.
Definition CoverageDependentSurfPhase.h:381
Cantera::CoverageDependentSurfPhase::getPartialMolarCp
void getPartialMolarCp(double *cpbar) const override
Get the partial molar heat capacity vector. Units: J/kmol/K.
Definition CoverageDependentSurfPhase.cpp:418
Cantera::CoverageDependentSurfPhase::addSpecies
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition CoverageDependentSurfPhase.cpp:215
Cantera::CoverageDependentSurfPhase::getGibbs_RT_ref
void getGibbs_RT_ref(double *grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition CoverageDependentSurfPhase.cpp:323
Cantera::CoverageDependentSurfPhase::m_PolynomialDependency
vector< PolynomialDependency > m_PolynomialDependency
Array of enthalpy and entropy coverage dependency parameters used in the linear and polynomial depend...
Definition CoverageDependentSurfPhase.h:413
Cantera::CoverageDependentSurfPhase::m_cp_cov
vector< double > m_cp_cov
Temporary storage for the coverage-dependent heat capacities.
Definition CoverageDependentSurfPhase.h:390
Cantera::CoverageDependentSurfPhase::getPartialMolarEntropies
void getPartialMolarEntropies(double *sbar) const override
Get the partial molar entropy vector. Units: J/kmol/K.
Definition CoverageDependentSurfPhase.cpp:409
Cantera::CoverageDependentSurfPhase::getEnthalpy_RT_ref
void getEnthalpy_RT_ref(double *hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition CoverageDependentSurfPhase.cpp:329
Cantera::InputFileError
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:738
Cantera::Phase::setNDim
void setNDim(size_t ndim)
Set the number of spatial dimensions (1, 2, or 3).
Definition Phase.h:653
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition Phase.h:947
Cantera::Phase::temperature
double temperature() const
Temperature (K).
Definition Phase.h:662
Cantera::Phase::speciesName
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:151
Cantera::Phase::speciesIndex
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:138
Cantera::Phase::moleFraction
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:545
Cantera::Phase::stateMFNumber
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition Phase.h:866
Cantera::Phase::mean_X
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:737
Cantera::Phase::name
string name() const
Return the name of the phase.
Definition Phase.cpp:20
Cantera::SurfPhase::getParameters
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition SurfPhase.cpp:336
Cantera::SurfPhase::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition SurfPhase.cpp:327
Cantera::SurfPhase::m_h0
vector< double > m_h0
Temporary storage for the reference state enthalpies.
Definition SurfPhase.h:328
Cantera::SurfPhase::m_s0
vector< double > m_s0
Temporary storage for the reference state entropies.
Definition SurfPhase.h:331
Cantera::SurfPhase::m_cp0
vector< double > m_cp0
Temporary storage for the reference state heat capacities.
Definition SurfPhase.h:334
Cantera::SurfPhase::_updateThermo
void _updateThermo(bool force=false) const
Update the species reference state thermodynamic functions.
Definition SurfPhase.cpp:311
Cantera::SurfPhase::getCoverages
void getCoverages(double *theta) const
Return a vector of surface coverages.
Definition SurfPhase.cpp:257
Cantera::SurfPhase::m_mu0
vector< double > m_mu0
Temporary storage for the reference state Gibbs energies.
Definition SurfPhase.h:337
Cantera::SurfPhase::addSpecies
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition SurfPhase.cpp:185
Cantera::ThermoPhase::RT
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1077
Cantera::ThermoPhase::m_tlast
double m_tlast
last value of the temperature processed by reference state
Definition ThermoPhase.h:2149
Cantera::ThermoPhase::initThermoFile
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
Definition ThermoPhase.cpp:1072
Cantera::ThermoPhase::getSpeciesParameters
virtual void getSpeciesParameters(const string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
Definition ThermoPhase.h:1979
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition ThermoPhase.h:2130
AssertThrowMsg
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
Definition ctexceptions.h:278
Cantera::poly4
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
Definition utilities.h:153
Cantera::scale
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:104
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:195
Cantera::SmallNumber
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:158
stringUtils.h
Contains declarations for string manipulation functions within Cantera.
Cantera::CoverageDependentSurfPhase::HeatCapacityDependency
A struct to store sets of parameters used in coverage-dependent heat capacity calculations by a log-q...
Definition CoverageDependentSurfPhase.h:192
Cantera::CoverageDependentSurfPhase::HeatCapacityDependency::coeff_a
double coeff_a
coefficient [J/kmol/K] in the coverage-dependent heat capacity model
Definition CoverageDependentSurfPhase.h:207
Cantera::CoverageDependentSurfPhase::HeatCapacityDependency::coeff_b
double coeff_b
coefficient [J/kmol/K] in the coverage-dependent heat capacity model
Definition CoverageDependentSurfPhase.h:210
Cantera::CoverageDependentSurfPhase::InterpolativeDependency
A struct to store sets of parameters used in coverage-dependent enthalpy and entropy calculations by ...
Definition CoverageDependentSurfPhase.h:165
Cantera::CoverageDependentSurfPhase::InterpolativeDependency::enthalpy_map
map< double, double > enthalpy_map
map of <coverage[dimensionless], enthalpy[J/kmol]> pairs
Definition CoverageDependentSurfPhase.h:182
Cantera::CoverageDependentSurfPhase::InterpolativeDependency::entropy_map
map< double, double > entropy_map
map of <coverage[dimensionless], entropy[J/kmol/K]> pairs
Definition CoverageDependentSurfPhase.h:184
Cantera::CoverageDependentSurfPhase::InterpolativeDependency::InterpolativeDependency
InterpolativeDependency(size_t k, size_t j, const AnyMap &dep_map, const AnyBase &node)
Definition CoverageDependentSurfPhase.cpp:58
Cantera::CoverageDependentSurfPhase::PolynomialDependency
A struct to store sets of parameters used in coverage-dependent enthalpy and entropy calculations by ...
Definition CoverageDependentSurfPhase.h:133
Cantera::CoverageDependentSurfPhase::PolynomialDependency::PolynomialDependency
PolynomialDependency(size_t k, size_t j, const AnyMap &dep_map)
Definition CoverageDependentSurfPhase.cpp:25
utilities.h
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...