Cantera  4.0.0a1
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
19
20using namespace std;
21
22namespace Cantera
23{
24
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
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
125 const string& id_):
126 m_theta_ref(1.0),
128{
129 setNDim(2);
130 initThermoFile(infile, id_);
131}
132
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
158{
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, false);
176 size_t j = speciesIndex(item2.first, false);
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);
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
215bool 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
233{
234 SurfPhase::getParameters(phaseNode);
235 phaseNode["reference-state-coverage"] = m_theta_ref;
236}
237
239 AnyMap& speciesNode) const
240{
242 size_t k = speciesIndex(name, true);
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
324{
325 checkArraySize("CoverageDependentSurfPhase::getGibbs_RT_ref", grt.size(), m_kk);
327 scale(m_mu0.begin(), m_mu0.end(), grt.begin(), 1.0/RT());
328}
329
331{
332 checkArraySize("CoverageDependentSurfPhase::getEnthalpy_RT_ref", hrt.size(), m_kk);
334 scale(m_h0.begin(), m_h0.end(), hrt.begin(), 1.0/RT());
335}
336
338{
339 checkArraySize("CoverageDependentSurfPhase::getEntropy_R_ref", sr.size(), m_kk);
341 scale(m_s0.begin(), m_s0.end(), sr.begin(), 1.0/GasConstant);
342}
343
344void CoverageDependentSurfPhase::getCp_R_ref(span<double> cpr) const
345{
346 checkArraySize("CoverageDependentSurfPhase::getCp_R_ref", cpr.size(), m_kk);
348 scale(m_cp0.begin(), m_cp0.end(), cpr.begin(), 1.0/GasConstant);
349}
350
352{
353 checkArraySize("CoverageDependentSurfPhase::getEnthalpy_RT", hrt.size(), m_kk);
355 scale(m_enthalpy.begin(), m_enthalpy.end(), hrt.begin(), 1.0/RT());
356}
357
359{
360 checkArraySize("CoverageDependentSurfPhase::getEntropy_R", sr.size(), m_kk);
362 scale(m_entropy.begin(), m_entropy.end(), sr.begin(), 1.0/GasConstant);
363 if (m_theta_ref != 1.0) {
364 double tmp = -log(m_theta_ref);
365 for (size_t k = 0; k < m_kk; k++) {
366 sr[k] -= tmp;
367 }
368 }
369}
370
371void CoverageDependentSurfPhase::getCp_R(span<double> cpr) const
372{
373 checkArraySize("CoverageDependentSurfPhase::getCp_R", cpr.size(), m_kk);
375 scale(m_heatcapacity.begin(), m_heatcapacity.end(), cpr.begin(), 1.0/GasConstant);
376}
377
378void CoverageDependentSurfPhase::getGibbs_RT(span<double> grt) const
379{
380 checkArraySize("CoverageDependentSurfPhase::getGibbs_RT", grt.size(), m_kk);
382 scale(m_chempot.begin(), m_chempot.end(), grt.begin(), 1.0/RT());
383 if (m_theta_ref != 1.0) {
384 double tmp = -log(m_theta_ref);
385 for (size_t k = 0; k < m_kk; k++) {
386 grt[k] += tmp;
387 }
388 }
389}
390
392{
393 checkArraySize("CoverageDependentSurfPhase::getStandardChemPotentials",
394 mu0.size(), m_kk);
396 copy(m_chempot.begin(), m_chempot.end(), mu0.begin());
397 if (m_theta_ref != 1.0) {
398 double tmp = RT() * -log(m_theta_ref);
399 for (size_t k = 0; k < m_kk; k++) {
400 mu0[k] += tmp;
401 }
402 }
403}
404
406{
407 checkArraySize("CoverageDependentSurfPhase::getPartialMolarEnthalpies",
408 hbar.size(), m_kk);
410 copy(m_enthalpy.begin(), m_enthalpy.end(), hbar.begin());
411}
412
414{
415 checkArraySize("CoverageDependentSurfPhase::getPartialMolarEntropies",
416 sbar.size(), m_kk);
418 copy(m_entropy.begin(), m_entropy.end(), sbar.begin());
419 for (size_t k = 0; k < m_kk; k++) {
420 sbar[k] -= GasConstant * log(std::max(m_cov[k], SmallNumber) / m_theta_ref);
421 }
422}
423
425{
426 checkArraySize("CoverageDependentSurfPhase::getPartialMolarCp", cpbar.size(), m_kk);
428 copy(m_heatcapacity.begin(), m_heatcapacity.end(), cpbar.begin());
429}
430
432{
433 checkArraySize("CoverageDependentSurfPhase::getChemPotentials", mu.size(), m_kk);
435 copy(m_chempot.begin(), m_chempot.end(), mu.begin());
436 for (size_t k = 0; k < m_kk; k++) {
437 mu[k] += RT() * log(std::max(m_cov[k], SmallNumber) / m_theta_ref);
438 }
439}
440
442{
444 return mean_X(m_enthalpy);
445}
446
448{
450 double entropy = 0.0;
451 for (size_t k = 0; k < m_kk; k++) {
452 entropy += moleFraction(k) * (m_entropy[k] -
453 GasConstant * log(std::max(m_cov[k], SmallNumber) / m_theta_ref));
454 }
455 return entropy;
456}
457
459{
461 return mean_X(m_heatcapacity);
462}
463
465{
466 int stateNumnow = stateMFNumber();
467 double tnow = temperature();
468 if (m_stateNumlast != stateNumnow || m_tlast != tnow) {
469 for (size_t k = 0; k < m_kk; k++) {
470 m_h_cov[k] = 0.0;
471 m_s_cov[k] = 0.0;
472 m_cp_cov[k] = 0.0;
473 }
475
476 // For linear and polynomial model
477 for (auto& item : m_PolynomialDependency) {
478 m_h_cov[item.k] += poly4(m_cov[item.j], item.enthalpy_coeffs);
479 m_s_cov[item.k] += poly4(m_cov[item.j], item.entropy_coeffs);
480 }
481
482 // For piecewise-linear and interpolative model
483 for (auto& item : m_InterpolativeDependency) {
484 auto h_iter = item.enthalpy_map.upper_bound(m_cov[item.j]);
485 auto s_iter = item.entropy_map.upper_bound(m_cov[item.j]);
486 AssertThrowMsg(h_iter != item.enthalpy_map.end(),
487 "CoverageDependentSurfPhase::_updateCovDepThermo",
488 "Coverage out of range: {}", m_cov[item.j]);
489 AssertThrowMsg(h_iter != item.enthalpy_map.begin(),
490 "CoverageDependentSurfPhase::_updateCovDepThermo",
491 "Coverage out of range: {}", m_cov[item.j]);
492 AssertThrowMsg(s_iter != item.entropy_map.end(),
493 "CoverageDependentSurfPhase::_updateCovDepThermo",
494 "Coverage out of range: {}", m_cov[item.j]);
495 AssertThrowMsg(s_iter != item.entropy_map.begin(),
496 "CoverageDependentSurfPhase::_updateCovDepThermo",
497 "Coverage out of range: {}", m_cov[item.j]);
498
499 double highHcov = h_iter->first;
500 double highH = h_iter->second;
501 double lowHcov = (--h_iter)->first;
502 double lowH = h_iter->second;
503
504 double highScov = s_iter->first;
505 double highS = s_iter->second;
506 double lowScov = (--s_iter)->first;
507 double lowS = s_iter->second;
508
509 m_h_cov[item.k] += (highH - lowH) / (highHcov - lowHcov)
510 * (m_cov[item.j] - lowHcov) + lowH;
511
512 m_s_cov[item.k] += (highS - lowS) / (highScov - lowScov)
513 * (m_cov[item.j] - lowScov) + lowS;
514 }
515
516 // For coverage-dependent heat capacity
517 for (auto& item : m_HeatCapacityDependency) {
518 double a = item.coeff_a;
519 double b = item.coeff_b;
520 m_cp_cov[item.k] += (a * log(tnow) + b) * m_cov[item.j] * m_cov[item.j];
521 double int_cp_tnow = tnow * (a * log(tnow) - a + b);
522 double int_cp_298 = 298.15 * (a * log(298.15) - a + b);
523 m_h_cov[item.k] += (int_cp_tnow - int_cp_298) * m_cov[item.j]
524 * m_cov[item.j];
525 double int_cp_T_tnow = log(tnow) * (a * log(tnow) + 2 * b);
526 double int_cp_T_298 = log(298.15) * (a * log(298.15) + 2 * b);
527 m_s_cov[item.k] += 0.5 * (int_cp_T_tnow - int_cp_T_298) * m_cov[item.j]
528 * m_cov[item.j];
529 }
530
531 for (size_t k = 0; k < m_kk; k++) {
532 m_mu_cov[k] = m_h_cov[k] - tnow * m_s_cov[k];
533 }
534 m_stateNumlast = stateNumnow;
535 }
536}
537
539{
542
543 for (size_t k = 0; k < m_kk; k++) {
544 m_enthalpy[k] = m_h0[k] + m_h_cov[k];
545 m_entropy[k] = m_s0[k] + m_s_cov[k];
546 m_heatcapacity[k] = m_cp0[k] + m_cp_cov[k];
547 m_chempot[k] = m_mu0[k] + m_mu_cov[k];
548 }
549}
550
551}
Header for a thermodynamics model of a coverage-dependent surface phase derived from SurfPhase,...
Declaration for class Cantera::Species.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
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
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1477
Base class for exceptions thrown by Cantera classes.
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.
void getCp_R(span< double > cpr) const override
Get the nondimensionalized standard state heat capacity vector.
vector< InterpolativeDependency > m_InterpolativeDependency
Array of enthalpy and entropy coverage dependency parameters used in the piecewise-linear and interpo...
void getStandardChemPotentials(span< double > mu0) const override
Get the standard state chemical potential vector. Units: J/kmol.
void getPartialMolarEnthalpies(span< double > hbar) const override
Get the partial molar enthalpy 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 getCp_R_ref(span< double > cpr) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
void getPartialMolarCp(span< double > cpbar) const override
Get the partial molar heat capacity vector. Units: J/kmol/K.
CoverageDependentSurfPhase(const string &infile="", const string &id="")
Construct and initialize a CoverageDependentSurfPhase ThermoPhase object directly from an ASCII input...
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 getGibbs_RT(span< double > grt) const override
Get the nondimensionalized standard state gibbs free energy vector.
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
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.
int m_stateNumlast
Last value of the state number processed.
void getEnthalpy_RT_ref(span< double > hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
vector< double > m_chempot
Temporary storage for the sum of reference state chemical potentials and coverage-dependent chemical ...
void getEnthalpy_RT(span< double > hrt) const override
Get the nondimensionalized standard state enthalpy vector.
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 getEntropy_R(span< double > sr) const override
Get the nondimensionalized standard state entropy 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.
double entropy_mole() const override
Return the solution's molar entropy. Units: J/kmol/K.
void getEntropy_R_ref(span< double > sr) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
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.
void getGibbs_RT_ref(span< double > grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
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 getPartialMolarEntropies(span< double > sbar) const override
Get the partial molar entropy vector. Units: J/kmol/K.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void getChemPotentials(span< double > mu) const override
Get the chemical potential vector. Units: J/kmol.
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.
Error thrown for problems processing information contained in an AnyMap or AnyValue.
Definition AnyMap.h:749
void setNDim(size_t ndim)
Set the number of spatial dimensions (1, 2, or 3).
Definition Phase.h:576
size_t m_kk
Number of species in the phase.
Definition Phase.h:875
size_t speciesIndex(const string &name, bool raise=true) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:127
double temperature() const
Temperature (K).
Definition Phase.h:585
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:143
map< string, shared_ptr< Species > > m_species
Map of Species objects.
Definition Phase.h:888
double mean_X(span< const double > Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:627
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:447
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition Phase.h:794
string name() const
Return the name of the phase.
Definition Phase.cpp:20
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
vector< double > m_h0
Temporary storage for the reference state enthalpies.
Definition SurfPhase.h:341
vector< double > m_s0
Temporary storage for the reference state entropies.
Definition SurfPhase.h:344
vector< double > m_cp0
Temporary storage for the reference state heat capacities.
Definition SurfPhase.h:347
void _updateThermo(bool force=false) const
Update the species reference state thermodynamic functions.
void getCoverages(span< double > theta) const
Return a vector of surface coverages.
vector< double > m_mu0
Temporary storage for the reference state Gibbs energies.
Definition SurfPhase.h:350
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
double RT() const
Return the Gas Constant multiplied by the current temperature.
double m_tlast
last value of the temperature processed by reference state
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
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...
AnyMap m_input
Data supplied via setParameters.
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
auto poly4(D x, const C &c)
Evaluates a polynomial of order 4.
Definition utilities.h:179
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:118
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:123
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:183
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:161
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
Contains declarations for string manipulation functions within Cantera.
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
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
map< double, double > entropy_map
map of <coverage[dimensionless], entropy[J/kmol/K]> pairs
InterpolativeDependency(size_t k, size_t j, const AnyMap &dep_map, const AnyBase &node)
A struct to store sets of parameters used in coverage-dependent enthalpy and entropy calculations by ...
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...