Cantera 2.6.0

IdealSolidSolnPhase.cpp
Go to the documentation of this file.
1/**
2 * @file IdealSolidSolnPhase.cpp Implementation file for an ideal solid
3 * solution model with incompressible thermodynamics (see \ref
4 * thermoprops and \link Cantera::IdealSolidSolnPhase
5 * IdealSolidSolnPhase\endlink).
6 */
7
8// This file is part of Cantera. See License.txt in the top-level directory or
9// at https://cantera.org/license.txt for license and copyright information.
10
11#include "cantera/thermo/IdealSolidSolnPhase.h"
12#include "cantera/thermo/ThermoFactory.h"
13#include "cantera/thermo/Species.h"
14#include "cantera/base/stringUtils.h"
15#include "cantera/base/ctml.h"
16#include "cantera/base/utilities.h"
17
18 using namespace std;
19
20 namespace Cantera
21{
22
23 IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) :
24 m_formGC(formGC),
25 m_Pref(OneAtm),
26 m_Pcurrent(OneAtm)
27{
28 // @todo: After Cantera 2.6, this constructor can be deleted and the default
29 // construction option can be provided by adding "" as the default argument
30 // to the constructor from input file name and phase id.
31 if (formGC == -1) {
32 formGC = 0;
33 } else {
34 warn_deprecated("IdealSolidSolnPhase(int formGC)",
35 "The formGC constructor argument is deprecated and will be removed"
36 " after Cantera 2.6. Use the setStandardConcentrationModel"
37 " method instead.");
38 }
39 m_formGC = formGC;
40 if (formGC < 0 || formGC > 2) {
41 throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
42 "Illegal value of formGC");
43 }
44}
45
46 IdealSolidSolnPhase::IdealSolidSolnPhase(const std::string& inputFile,
47 const std::string& id_, int formGC) :
48 m_formGC(formGC),
49 m_Pref(OneAtm),
50 m_Pcurrent(OneAtm)
51{
52 if (formGC == -1) {
53 formGC = 0;
54 } else {
55 warn_deprecated("IdealSolidSolnPhase(string inputFile, string id_, int formGC)",
56 "The formGC constructor argument is deprecated and will be removed"
57 " after Cantera 2.6. Use the setStandardConcentrationModel"
58 " method instead.");
59 }
60 m_formGC = formGC;
61 if (formGC < 0 || formGC > 2) {
62 throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
63 "Illegal value of formGC");
64 }
65 initThermoFile(inputFile, id_);
66}
67
68 IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id_,
69 int formGC) :
70 m_formGC(formGC),
71 m_Pref(OneAtm),
72 m_Pcurrent(OneAtm)
73{
74 if (formGC == -1) {
75 formGC = 0;
76 } else {
77 warn_deprecated("IdealSolidSolnPhase(XML_Node root, string id_, int formGC)",
78 "The formGC constructor argument is deprecated and will be removed"
79 " after Cantera 2.6. Use the setStandardConcentrationModel"
80 " method instead.");
81 }
82 m_formGC = formGC;
83 if (formGC < 0 || formGC > 2) {
84 throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
85 "Illegal value of formGC");
86 }
87 importPhase(root, this);
88}
89
90// Molar Thermodynamic Properties of the Solution
91
92doublereal IdealSolidSolnPhase::enthalpy_mole() const
93{
94 doublereal htp = RT() * mean_X(enthalpy_RT_ref());
95 return htp + (pressure() - m_Pref)/molarDensity();
96}
97
98doublereal IdealSolidSolnPhase::entropy_mole() const
99{
100 return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx());
101}
102
103doublereal IdealSolidSolnPhase::gibbs_mole() const
104{
105 return RT() * (mean_X(gibbs_RT_ref()) + sum_xlogx());
106}
107
108doublereal IdealSolidSolnPhase::cp_mole() const
109{
110 return GasConstant * mean_X(cp_R_ref());
111}
112
113// Mechanical Equation of State
114
115 void IdealSolidSolnPhase::calcDensity()
116{
117 // Calculate the molarVolume of the solution (m**3 kmol-1)
118 const doublereal* const dtmp = moleFractdivMMW();
119 double invDens = dot(m_speciesMolarVolume.begin(),
120 m_speciesMolarVolume.end(), dtmp);
121
122 // Set the density in the parent State object directly, by calling the
123 // Phase::assignDensity() function.
124 Phase::assignDensity(1.0/invDens);
125}
126
127 void IdealSolidSolnPhase::setPressure(doublereal p)
128{
129 m_Pcurrent = p;
130 calcDensity();
131}
132
133 void IdealSolidSolnPhase::compositionChanged()
134{
135 Phase::compositionChanged();
136 calcDensity();
137}
138
139// Chemical Potentials and Activities
140
141 Units IdealSolidSolnPhase::standardConcentrationUnits() const
142{
143 if (m_formGC == 0) {
144 return Units(1.0); // dimensionless
145 } else {
146 // kmol/m^3 for bulk phases
147 return Units(1.0, 0, -static_cast<double>(nDim()), 0, 0, 0, 1);
148 }
149}
150
151 void IdealSolidSolnPhase::getActivityConcentrations(doublereal* c) const
152{
153 const doublereal* const dtmp = moleFractdivMMW();
154 const double mmw = meanMolecularWeight();
155 switch (m_formGC) {
156 case 0:
157 for (size_t k = 0; k < m_kk; k++) {
158 c[k] = dtmp[k] * mmw;
159 }
160 break;
161 case 1:
162 for (size_t k = 0; k < m_kk; k++) {
163 c[k] = dtmp[k] * mmw / m_speciesMolarVolume[k];
164 }
165 break;
166 case 2:
167 double atmp = mmw / m_speciesMolarVolume[m_kk-1];
168 for (size_t k = 0; k < m_kk; k++) {
169 c[k] = dtmp[k] * atmp;
170 }
171 break;
172 }
173}
174
175doublereal IdealSolidSolnPhase::standardConcentration(size_t k) const
176{
177 switch (m_formGC) {
178 case 0:
179 return 1.0;
180 case 1:
181 return 1.0 / m_speciesMolarVolume[k];
182 case 2:
183 return 1.0/m_speciesMolarVolume[m_kk-1];
184 }
185 return 0.0;
186}
187
188 void IdealSolidSolnPhase::getActivityCoefficients(doublereal* ac) const
189{
190 for (size_t k = 0; k < m_kk; k++) {
191 ac[k] = 1.0;
192 }
193}
194
195 void IdealSolidSolnPhase::getChemPotentials(doublereal* mu) const
196{
197 double delta_p = m_Pcurrent - m_Pref;
198 const vector_fp& g_RT = gibbs_RT_ref();
199 for (size_t k = 0; k < m_kk; k++) {
200 double xx = std::max(SmallNumber, moleFraction(k));
201 mu[k] = RT() * (g_RT[k] + log(xx))
202 + delta_p * m_speciesMolarVolume[k];
203 }
204}
205
206 void IdealSolidSolnPhase::getChemPotentials_RT(doublereal* mu) const
207{
208 double delta_pdRT = (m_Pcurrent - m_Pref) / (temperature() * GasConstant);
209 const vector_fp& g_RT = gibbs_RT_ref();
210 for (size_t k = 0; k < m_kk; k++) {
211 double xx = std::max(SmallNumber, moleFraction(k));
212 mu[k] = (g_RT[k] + log(xx))
213 + delta_pdRT * m_speciesMolarVolume[k];
214 }
215}
216
217// Partial Molar Properties
218
219 void IdealSolidSolnPhase::getPartialMolarEnthalpies(doublereal* hbar) const
220{
221 const vector_fp& _h = enthalpy_RT_ref();
222 double delta_p = m_Pcurrent - m_Pref;
223 for (size_t k = 0; k < m_kk; k++) {
224 hbar[k] = _h[k]*RT() + delta_p * m_speciesMolarVolume[k];
225 }
226 // scale(_h.begin(), _h.end(), hbar, RT());
227}
228
229 void IdealSolidSolnPhase::getPartialMolarEntropies(doublereal* sbar) const
230{
231 const vector_fp& _s = entropy_R_ref();
232 for (size_t k = 0; k < m_kk; k++) {
233 double xx = std::max(SmallNumber, moleFraction(k));
234 sbar[k] = GasConstant * (_s[k] - log(xx));
235 }
236}
237
238 void IdealSolidSolnPhase::getPartialMolarCp(doublereal* cpbar) const
239{
240 getCp_R(cpbar);
241 for (size_t k = 0; k < m_kk; k++) {
242 cpbar[k] *= GasConstant;
243 }
244}
245
246 void IdealSolidSolnPhase::getPartialMolarVolumes(doublereal* vbar) const
247{
248 getStandardVolumes(vbar);
249}
250
251// Properties of the Standard State of the Species in the Solution
252
253 void IdealSolidSolnPhase::getPureGibbs(doublereal* gpure) const
254{
255 const vector_fp& gibbsrt = gibbs_RT_ref();
256 double delta_p = (m_Pcurrent - m_Pref);
257 for (size_t k = 0; k < m_kk; k++) {
258 gpure[k] = RT() * gibbsrt[k] + delta_p * m_speciesMolarVolume[k];
259 }
260}
261
262 void IdealSolidSolnPhase::getGibbs_RT(doublereal* grt) const
263{
264 const vector_fp& gibbsrt = gibbs_RT_ref();
265 doublereal delta_prt = (m_Pcurrent - m_Pref)/ RT();
266 for (size_t k = 0; k < m_kk; k++) {
267 grt[k] = gibbsrt[k] + delta_prt * m_speciesMolarVolume[k];
268 }
269}
270
271 void IdealSolidSolnPhase::getEnthalpy_RT(doublereal* hrt) const
272{
273 const vector_fp& _h = enthalpy_RT_ref();
274 doublereal delta_prt = (m_Pcurrent - m_Pref) / RT();
275 for (size_t k = 0; k < m_kk; k++) {
276 hrt[k] = _h[k] + delta_prt * m_speciesMolarVolume[k];
277 }
278}
279
280 void IdealSolidSolnPhase::getEntropy_R(doublereal* sr) const
281{
282 const vector_fp& _s = entropy_R_ref();
283 copy(_s.begin(), _s.end(), sr);
284}
285
286 void IdealSolidSolnPhase::getIntEnergy_RT(doublereal* urt) const
287{
288 const vector_fp& _h = enthalpy_RT_ref();
289 doublereal prefrt = m_Pref / RT();
290 for (size_t k = 0; k < m_kk; k++) {
291 urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
292 }
293}
294
295 void IdealSolidSolnPhase::getCp_R(doublereal* cpr) const
296{
297 const vector_fp& _cpr = cp_R_ref();
298 copy(_cpr.begin(), _cpr.end(), cpr);
299}
300
301 void IdealSolidSolnPhase::getStandardVolumes(doublereal* vol) const
302{
303 copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), vol);
304}
305
306// Thermodynamic Values for the Species Reference States
307
308 void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal* hrt) const
309{
310 _updateThermo();
311 for (size_t k = 0; k != m_kk; k++) {
312 hrt[k] = m_h0_RT[k];
313 }
314}
315
316 void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const
317{
318 _updateThermo();
319 for (size_t k = 0; k != m_kk; k++) {
320 grt[k] = m_g0_RT[k];
321 }
322}
323
324 void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const
325{
326 _updateThermo();
327 double tmp = RT();
328 for (size_t k = 0; k != m_kk; k++) {
329 g[k] = tmp * m_g0_RT[k];
330 }
331}
332
333 void IdealSolidSolnPhase::getIntEnergy_RT_ref(doublereal* urt) const
334{
335 const vector_fp& _h = enthalpy_RT_ref();
336 doublereal prefrt = m_Pref / RT();
337 for (size_t k = 0; k < m_kk; k++) {
338 urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
339 }
340}
341
342 void IdealSolidSolnPhase::getEntropy_R_ref(doublereal* er) const
343{
344 _updateThermo();
345 for (size_t k = 0; k != m_kk; k++) {
346 er[k] = m_s0_R[k];
347 }
348}
349
350 void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const
351{
352 _updateThermo();
353 for (size_t k = 0; k != m_kk; k++) {
354 cpr[k] = m_cp0_R[k];
355 }
356}
357
358 const vector_fp& IdealSolidSolnPhase::enthalpy_RT_ref() const
359{
360 _updateThermo();
361 return m_h0_RT;
362}
363
364 const vector_fp& IdealSolidSolnPhase::entropy_R_ref() const
365{
366 _updateThermo();
367 return m_s0_R;
368}
369
370// Utility Functions
371
372 bool IdealSolidSolnPhase::addSpecies(shared_ptr<Species> spec)
373{
374 bool added = ThermoPhase::addSpecies(spec);
375 if (added) {
376 if (m_kk == 1) {
377 // Obtain the reference pressure by calling the ThermoPhase function
378 // refPressure, which in turn calls the species thermo reference
379 // pressure function of the same name.
380 m_Pref = refPressure();
381 }
382
383 m_h0_RT.push_back(0.0);
384 m_g0_RT.push_back(0.0);
385 m_expg0_RT.push_back(0.0);
386 m_cp0_R.push_back(0.0);
387 m_s0_R.push_back(0.0);
388 m_pp.push_back(0.0);
389 if (spec->input.hasKey("equation-of-state")) {
390 auto& eos = spec->input["equation-of-state"].getMapWhere("model", "constant-volume");
391 double mv;
392 if (eos.hasKey("density")) {
393 mv = molecularWeight(m_kk-1) / eos.convert("density", "kg/m^3");
394 } else if (eos.hasKey("molar-density")) {
395 mv = 1.0 / eos.convert("molar-density", "kmol/m^3");
396 } else if (eos.hasKey("molar-volume")) {
397 mv = eos.convert("molar-volume", "m^3/kmol");
398 } else {
399 throw CanteraError("IdealSolidSolnPhase::addSpecies",
400 "equation-of-state entry for species '{}' is missing "
401 "'density', 'molar-volume', or 'molar-density' "
402 "specification", spec->name);
403 }
404 m_speciesMolarVolume.push_back(mv);
405 } else if (spec->input.hasKey("molar_volume")) {
406 // @Deprecated - remove this case for Cantera 3.0 with removal of the XML format
407 m_speciesMolarVolume.push_back(spec->input["molar_volume"].asDouble());
408 } else {
409 throw CanteraError("IdealSolidSolnPhase::addSpecies",
410 "Molar volume not specified for species '{}'", spec->name);
411 }
412 if (ready()) {
413 calcDensity();
414 }
415 }
416 return added;
417}
418
419 void IdealSolidSolnPhase::initThermo()
420{
421 if (m_input.hasKey("standard-concentration-basis")) {
422 setStandardConcentrationModel(m_input["standard-concentration-basis"].asString());
423 }
424 ThermoPhase::initThermo();
425}
426
427 void IdealSolidSolnPhase::getParameters(AnyMap& phaseNode) const
428{
429 ThermoPhase::getParameters(phaseNode);
430 if (m_formGC == 1) {
431 phaseNode["standard-concentration-basis"] = "species-molar-volume";
432 } else if (m_formGC == 2) {
433 phaseNode["standard-concentration-basis"] = "solvent-molar-volume";
434 }
435}
436
437 void IdealSolidSolnPhase::getSpeciesParameters(const std::string &name,
438 AnyMap& speciesNode) const
439{
440 ThermoPhase::getSpeciesParameters(name, speciesNode);
441 size_t k = speciesIndex(name);
442 const auto S = species(k);
443 auto& eosNode = speciesNode["equation-of-state"].getMapWhere(
444 "model", "constant-volume", true);
445 // Output volume information in a form consistent with the input
446 if (S->input.hasKey("equation-of-state")) {
447 auto& eosIn = S->input["equation-of-state"];
448 if (eosIn.hasKey("density")) {
449 eosNode["density"].setQuantity(
450 molecularWeight(k) / m_speciesMolarVolume[k], "kg/m^3");
451 } else if (eosIn.hasKey("molar-density")) {
452 eosNode["molar-density"].setQuantity(1.0 / m_speciesMolarVolume[k],
453 "kmol/m^3");
454 } else {
455 eosNode["molar-volume"].setQuantity(m_speciesMolarVolume[k],
456 "m^3/kmol");
457 }
458 } else {
459 eosNode["molar-volume"].setQuantity(m_speciesMolarVolume[k],
460 "m^3/kmol");
461 }
462}
463
464 void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
465{
466 if (id_.size() > 0 && phaseNode.id() != id_) {
467 throw CanteraError("IdealSolidSolnPhase::initThermoXML",
468 "phasenode and Id are incompatible");
469 }
470
471 // Check on the thermo field. Must have:
472 // <thermo model="IdealSolidSolution" />
473 if (phaseNode.hasChild("thermo")) {
474 XML_Node& thNode = phaseNode.child("thermo");
475 if (!caseInsensitiveEquals(thNode["model"], "idealsolidsolution")) {
476 throw CanteraError("IdealSolidSolnPhase::initThermoXML",
477 "Unknown thermo model: " + thNode["model"]);
478 }
479 } else {
480 throw CanteraError("IdealSolidSolnPhase::initThermoXML",
481 "Unspecified thermo model");
482 }
483
484 // Form of the standard concentrations. Must have one of:
485 //
486 // <standardConc model="unity" />
487 // <standardConc model="molar_volume" />
488 // <standardConc model="solvent_volume" />
489 if (phaseNode.hasChild("standardConc")) {
490 setStandardConcentrationModel(phaseNode.child("standardConc")["model"]);
491 } else {
492 throw CanteraError("IdealSolidSolnPhase::initThermoXML",
493 "Unspecified standardConc model");
494 }
495
496 // Call the base initThermo, which handles setting the initial state.
497 ThermoPhase::initThermoXML(phaseNode, id_);
498}
499
500 void IdealSolidSolnPhase::setToEquilState(const doublereal* mu_RT)
501{
502 const vector_fp& grt = gibbs_RT_ref();
503
504 // Within the method, we protect against inf results if the exponent is too
505 // high.
506 //
507 // If it is too low, we set the partial pressure to zero. This capability is
508 // needed by the elemental potential method.
509 doublereal pres = 0.0;
510 double m_p0 = refPressure();
511 for (size_t k = 0; k < m_kk; k++) {
512 double tmp = -grt[k] + mu_RT[k];
513 if (tmp < -600.) {
514 m_pp[k] = 0.0;
515 } else if (tmp > 500.0) {
516 // Protect against inf results if the exponent is too high
517 double tmp2 = tmp / 500.;
518 tmp2 *= tmp2;
519 m_pp[k] = m_p0 * exp(500.) * tmp2;
520 } else {
521 m_pp[k] = m_p0 * exp(tmp);
522 }
523 pres += m_pp[k];
524 }
525 // set state
526 setState_PX(pres, m_pp.data());
527}
528
529 void IdealSolidSolnPhase::setStandardConcentrationModel(const std::string& model)
530{
531 if (caseInsensitiveEquals(model, "unity")) {
532 m_formGC = 0;
533 } else if (caseInsensitiveEquals(model, "species-molar-volume")
534 || caseInsensitiveEquals(model, "molar_volume")) {
535 m_formGC = 1;
536 } else if (caseInsensitiveEquals(model, "solvent-molar-volume")
537 || caseInsensitiveEquals(model, "solvent_volume")) {
538 m_formGC = 2;
539 } else {
540 throw CanteraError("IdealSolidSolnPhase::setStandardConcentrationModel",
541 "Unknown standard concentration model '{}'", model);
542 }
543}
544
545 double IdealSolidSolnPhase::speciesMolarVolume(int k) const
546{
547 return m_speciesMolarVolume[k];
548}
549
550 void IdealSolidSolnPhase::getSpeciesMolarVolumes(doublereal* smv) const
551{
552 copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
553}
554
555 void IdealSolidSolnPhase::_updateThermo() const
556{
557 doublereal tnow = temperature();
558 if (m_tlast != tnow) {
559
560 // Update the thermodynamic functions of the reference state.
561 m_spthermo.update(tnow, m_cp0_R.data(), m_h0_RT.data(), m_s0_R.data());
562 m_tlast = tnow;
563 for (size_t k = 0; k < m_kk; k++) {
564 m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
565 }
566 m_tlast = tnow;
567 }
568}
569
570} // end namespace Cantera
IdealSolidSolnPhase.h
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
Species.h
Declaration for class Cantera::Species.
ThermoFactory.h
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::AnyMap::hasKey
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:1406
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Cantera::IdealSolidSolnPhase::m_g0_RT
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
Definition: IdealSolidSolnPhase.h:649
Cantera::IdealSolidSolnPhase::m_cp0_R
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
Definition: IdealSolidSolnPhase.h:646
Cantera::IdealSolidSolnPhase::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: IdealSolidSolnPhase.cpp:372
Cantera::IdealSolidSolnPhase::getGibbs_RT_ref
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition: IdealSolidSolnPhase.cpp:316
Cantera::IdealSolidSolnPhase::getParameters
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition: IdealSolidSolnPhase.cpp:427
Cantera::IdealSolidSolnPhase::getActivityCoefficients
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
Definition: IdealSolidSolnPhase.cpp:188
Cantera::IdealSolidSolnPhase::m_expg0_RT
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
Definition: IdealSolidSolnPhase.h:656
Cantera::IdealSolidSolnPhase::getGibbs_RT
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs function for the species standard states at the current T and P of the s...
Definition: IdealSolidSolnPhase.cpp:262
Cantera::IdealSolidSolnPhase::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
Definition: IdealSolidSolnPhase.cpp:108
Cantera::IdealSolidSolnPhase::m_h0_RT
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
Definition: IdealSolidSolnPhase.h:642
Cantera::IdealSolidSolnPhase::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: IdealSolidSolnPhase.cpp:219
Cantera::IdealSolidSolnPhase::speciesMolarVolume
double speciesMolarVolume(int k) const
Report the molar volume of species k.
Definition: IdealSolidSolnPhase.cpp:545
Cantera::IdealSolidSolnPhase::getPartialMolarEntropies
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: IdealSolidSolnPhase.cpp:229
Cantera::IdealSolidSolnPhase::initThermoXML
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
Definition: IdealSolidSolnPhase.cpp:464
Cantera::IdealSolidSolnPhase::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
Definition: IdealSolidSolnPhase.cpp:92
Cantera::IdealSolidSolnPhase::setToEquilState
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
Definition: IdealSolidSolnPhase.cpp:500
Cantera::IdealSolidSolnPhase::getPartialMolarVolumes
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
Definition: IdealSolidSolnPhase.cpp:246
Cantera::IdealSolidSolnPhase::m_pp
vector_fp m_pp
Temporary array used in equilibrium calculations.
Definition: IdealSolidSolnPhase.h:659
Cantera::IdealSolidSolnPhase::getStandardVolumes
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
Definition: IdealSolidSolnPhase.cpp:301
Cantera::IdealSolidSolnPhase::m_s0_R
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
Definition: IdealSolidSolnPhase.h:652
Cantera::IdealSolidSolnPhase::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
Definition: IdealSolidSolnPhase.cpp:151
Cantera::IdealSolidSolnPhase::cp_R_ref
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
Definition: IdealSolidSolnPhase.h:554
Cantera::IdealSolidSolnPhase::getCp_R
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
Definition: IdealSolidSolnPhase.cpp:295
Cantera::IdealSolidSolnPhase::IdealSolidSolnPhase
IdealSolidSolnPhase(int formCG=-1)
Constructor for IdealSolidSolnPhase.
Definition: IdealSolidSolnPhase.cpp:23
Cantera::IdealSolidSolnPhase::getPartialMolarCp
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
Definition: IdealSolidSolnPhase.cpp:238
Cantera::IdealSolidSolnPhase::getSpeciesMolarVolumes
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
Definition: IdealSolidSolnPhase.cpp:550
Cantera::IdealSolidSolnPhase::enthalpy_RT_ref
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
Definition: IdealSolidSolnPhase.cpp:358
Cantera::IdealSolidSolnPhase::getEntropy_R
virtual void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
Definition: IdealSolidSolnPhase.cpp:280
Cantera::IdealSolidSolnPhase::setPressure
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
Definition: IdealSolidSolnPhase.cpp:127
Cantera::IdealSolidSolnPhase::m_speciesMolarVolume
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
Definition: IdealSolidSolnPhase.h:639
Cantera::IdealSolidSolnPhase::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy of the solution.
Definition: IdealSolidSolnPhase.cpp:98
Cantera::IdealSolidSolnPhase::entropy_R_ref
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
Definition: IdealSolidSolnPhase.cpp:364
Cantera::IdealSolidSolnPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: IdealSolidSolnPhase.cpp:419
Cantera::IdealSolidSolnPhase::standardConcentration
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
Definition: IdealSolidSolnPhase.cpp:175
Cantera::IdealSolidSolnPhase::gibbs_RT_ref
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
Definition: IdealSolidSolnPhase.h:535
Cantera::IdealSolidSolnPhase::getEntropy_R_ref
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition: IdealSolidSolnPhase.cpp:342
Cantera::IdealSolidSolnPhase::m_formGC
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
Definition: IdealSolidSolnPhase.h:616
Cantera::IdealSolidSolnPhase::getIntEnergy_RT_ref
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
Definition: IdealSolidSolnPhase.cpp:333
Cantera::IdealSolidSolnPhase::getIntEnergy_RT
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition: IdealSolidSolnPhase.cpp:286
Cantera::IdealSolidSolnPhase::gibbs_mole
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
Definition: IdealSolidSolnPhase.cpp:103
Cantera::IdealSolidSolnPhase::m_Pcurrent
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
Definition: IdealSolidSolnPhase.h:633
Cantera::IdealSolidSolnPhase::pressure
virtual doublereal pressure() const
Pressure.
Definition: IdealSolidSolnPhase.h:193
Cantera::IdealSolidSolnPhase::getCp_R_ref
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition: IdealSolidSolnPhase.cpp:350
Cantera::IdealSolidSolnPhase::standardConcentrationUnits
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: IdealSolidSolnPhase.cpp:141
Cantera::IdealSolidSolnPhase::getSpeciesParameters
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
Definition: IdealSolidSolnPhase.cpp:437
Cantera::IdealSolidSolnPhase::compositionChanged
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: IdealSolidSolnPhase.cpp:133
Cantera::IdealSolidSolnPhase::getChemPotentials_RT
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P .
Definition: IdealSolidSolnPhase.cpp:206
Cantera::IdealSolidSolnPhase::setStandardConcentrationModel
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
Definition: IdealSolidSolnPhase.cpp:529
Cantera::IdealSolidSolnPhase::_updateThermo
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
Definition: IdealSolidSolnPhase.cpp:555
Cantera::IdealSolidSolnPhase::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
Definition: IdealSolidSolnPhase.cpp:195
Cantera::IdealSolidSolnPhase::getGibbs_ref
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
Definition: IdealSolidSolnPhase.cpp:324
Cantera::IdealSolidSolnPhase::m_Pref
doublereal m_Pref
Value of the reference pressure for all species in this phase.
Definition: IdealSolidSolnPhase.h:624
Cantera::IdealSolidSolnPhase::getEnthalpy_RT
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
Definition: IdealSolidSolnPhase.cpp:271
Cantera::IdealSolidSolnPhase::getPureGibbs
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
Definition: IdealSolidSolnPhase.cpp:253
Cantera::IdealSolidSolnPhase::getEnthalpy_RT_ref
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition: IdealSolidSolnPhase.cpp:308
Cantera::IdealSolidSolnPhase::calcDensity
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Definition: IdealSolidSolnPhase.cpp:115
Cantera::MultiSpeciesThermo::update
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
Definition: MultiSpeciesThermo.cpp:90
Cantera::Phase::molarDensity
double molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:671
Cantera::Phase::assignDensity
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:698
Cantera::Phase::mean_X
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:717
Cantera::Phase::name
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:70
Cantera::Phase::moleFractdivMMW
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:564
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition: Phase.h:943
Cantera::Phase::nDim
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition: Phase.h:638
Cantera::Phase::molecularWeight
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:492
Cantera::Phase::meanMolecularWeight
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:751
Cantera::Phase::moleFraction
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:548
Cantera::Phase::compositionChanged
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: Phase.cpp:999
Cantera::Phase::temperature
doublereal temperature() const
Temperature (K).
Definition: Phase.h:654
Cantera::Phase::speciesIndex
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition: Phase.cpp:187
Cantera::Phase::ready
virtual bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: Phase.cpp:979
Cantera::Phase::species
shared_ptr< Species > species(const std::string &name) const
Return the Species object for the named species.
Definition: Phase.cpp:950
Cantera::Phase::sum_xlogx
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:727
Cantera::ThermoPhase::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: ThermoPhase.cpp:1140
Cantera::ThermoPhase::RT
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:782
Cantera::ThermoPhase::m_tlast
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1928
Cantera::ThermoPhase::initThermoFile
void initThermoFile(const std::string &inputFile, const std::string &id)
Definition: ThermoPhase.cpp:1066
Cantera::ThermoPhase::initThermoXML
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
Definition: ThermoPhase.cpp:1095
Cantera::ThermoPhase::setState_PX
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Definition: ThermoPhase.cpp:187
Cantera::ThermoPhase::refPressure
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:150
Cantera::ThermoPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: ThermoPhase.cpp:1102
Cantera::ThermoPhase::m_spthermo
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1894
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1898
Cantera::ThermoPhase::getSpeciesParameters
virtual void getSpeciesParameters(const std::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:1726
Cantera::ThermoPhase::getParameters
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
Definition: ThermoPhase.cpp:1193
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::XML_Node::hasChild
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:529
Cantera::XML_Node::id
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:539
Cantera::XML_Node::child
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definition: xml.cpp:547
ctml.h
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Cantera::importPhase
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Definition: ThermoFactory.cpp:250
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::dot
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:77
Cantera::OneAtm
const double OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:81
Cantera::caseInsensitiveEquals
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
Definition: stringUtils.cpp:266
Cantera::warn_deprecated
void warn_deprecated(const std::string &source, const AnyBase &node, const std::string &message)
A deprecation warning for syntax in an input file.
Definition: AnyMap.cpp:1901
Cantera::SmallNumber
const double SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:153
Cantera::vector_fp
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113
stringUtils.h
Contains declarations for string manipulation functions within Cantera.
utilities.h
Various templated functions that carry out common vector operations (see Templated Utility Functions)...