Cantera  3.1.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
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);
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);
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);
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{
326 scale(m_mu0.begin(), m_mu0.end(), grt, 1.0/RT());
327}
328
330{
332 scale(m_h0.begin(), m_h0.end(), hrt, 1.0/RT());
333}
334
336{
338 scale(m_s0.begin(), m_s0.end(), sr, 1.0/GasConstant);
339}
340
342{
344 scale(m_cp0.begin(), m_cp0.end(), cpr, 1.0/GasConstant);
345}
346
348{
350 scale(m_enthalpy.begin(), m_enthalpy.end(), hrt, 1.0/RT());
351}
352
354{
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
366{
368 scale(m_heatcapacity.begin(), m_heatcapacity.end(), cpr, 1.0/GasConstant);
369}
370
372{
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
384{
385 getGibbs_RT(g);
386 for (size_t k = 0; k < m_kk; k++) {
387 g[k] *= RT();
388 }
389}
390
392{
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
404{
406 copy(m_enthalpy.begin(), m_enthalpy.end(), hbar);
407}
408
410{
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
419{
421 copy(m_heatcapacity.begin(), m_heatcapacity.end(), cpbar);
422}
423
425{
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
434{
436 return mean_X(m_enthalpy);
437}
438
440{
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
451{
453 return mean_X(m_heatcapacity);
454}
455
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
531{
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}
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.
void getStandardChemPotentials(double *mu0) const override
Get the standard state chemical potential vector. Units: J/kmol.
void getPureGibbs(double *g) const override
Get the standard state gibbs free energy 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.
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 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 ...
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 ...
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:553
size_t m_kk
Number of species in the phase.
Definition Phase.h:854
double temperature() const
Temperature (K).
Definition Phase.h:562
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:142
map< string, shared_ptr< Species > > m_species
Map of Species objects.
Definition Phase.h:867
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition Phase.cpp:129
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition Phase.cpp:439
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition Phase.h:773
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition Phase.cpp:616
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:323
vector< double > m_s0
Temporary storage for the reference state entropies.
Definition SurfPhase.h:326
vector< double > m_cp0
Temporary storage for the reference state heat capacities.
Definition SurfPhase.h:329
void _updateThermo(bool force=false) const
Update the species reference state thermodynamic functions.
void getCoverages(double *theta) const
Return a vector of surface coverages.
vector< double > m_mu0
Temporary storage for the reference state Gibbs energies.
Definition SurfPhase.h:332
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.
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
Definition utilities.h:153
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:104
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
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:180
const double SmallNumber
smallest number to compare to zero.
Definition ct_defs.h:158
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...