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
15#include "cantera/base/ctml.h"
17
18using namespace std;
19
20namespace Cantera
21{
22
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
46IdealSolidSolnPhase::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
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
93{
94 doublereal htp = RT() * mean_X(enthalpy_RT_ref());
95 return htp + (pressure() - m_Pref)/molarDensity();
96}
97
99{
100 return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx());
101}
102
104{
105 return RT() * (mean_X(gibbs_RT_ref()) + sum_xlogx());
106}
107
109{
110 return GasConstant * mean_X(cp_R_ref());
111}
112
113// Mechanical Equation of State
114
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
128{
129 m_Pcurrent = p;
130 calcDensity();
131}
132
134{
136 calcDensity();
137}
138
139// Chemical Potentials and Activities
140
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
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
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
189{
190 for (size_t k = 0; k < m_kk; k++) {
191 ac[k] = 1.0;
192 }
193}
194
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
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
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
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
238void 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
247{
248 getStandardVolumes(vbar);
249}
250
251// Properties of the Standard State of the Species in the Solution
252
253void 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
262void 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
271void 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
280void IdealSolidSolnPhase::getEntropy_R(doublereal* sr) const
281{
282 const vector_fp& _s = entropy_R_ref();
283 copy(_s.begin(), _s.end(), sr);
284}
285
286void 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
295void IdealSolidSolnPhase::getCp_R(doublereal* cpr) const
296{
297 const vector_fp& _cpr = cp_R_ref();
298 copy(_cpr.begin(), _cpr.end(), cpr);
299}
300
302{
303 copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), vol);
304}
305
306// Thermodynamic Values for the Species Reference States
307
309{
311 for (size_t k = 0; k != m_kk; k++) {
312 hrt[k] = m_h0_RT[k];
313 }
314}
315
316void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const
317{
319 for (size_t k = 0; k != m_kk; k++) {
320 grt[k] = m_g0_RT[k];
321 }
322}
323
324void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const
325{
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
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
343{
345 for (size_t k = 0; k != m_kk; k++) {
346 er[k] = m_s0_R[k];
347 }
348}
349
350void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const
351{
353 for (size_t k = 0; k != m_kk; k++) {
354 cpr[k] = m_cp0_R[k];
355 }
356}
357
359{
361 return m_h0_RT;
362}
363
365{
367 return m_s0_R;
368}
369
370// Utility Functions
371
372bool 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.
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
420{
421 if (m_input.hasKey("standard-concentration-basis")) {
422 setStandardConcentrationModel(m_input["standard-concentration-basis"].asString());
423 }
425}
426
428{
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
437void IdealSolidSolnPhase::getSpeciesParameters(const std::string &name,
438 AnyMap& speciesNode) const
439{
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
464void 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
500void 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
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
546{
547 return m_speciesMolarVolume[k];
548}
549
551{
552 copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
553}
554
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
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
Declaration for class Cantera::Species.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:1406
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
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...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
vector_fp m_pp
Temporary array used in equilibrium calculations.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
IdealSolidSolnPhase(int formCG=-1)
Constructor for IdealSolidSolnPhase.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
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...
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual doublereal pressure() const
Pressure.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
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...
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P .
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
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...
doublereal m_Pref
Value of the reference pressure for all species in this phase.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
double molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:671
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:698
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:717
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:70
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:564
size_t m_kk
Number of species in the phase.
Definition: Phase.h:943
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition: Phase.h:638
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:492
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:751
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:548
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: Phase.cpp:999
doublereal temperature() const
Temperature (K).
Definition: Phase.h:654
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
Definition: Phase.cpp:187
virtual bool ready() const
Returns a bool indicating whether the object is ready for use.
Definition: Phase.cpp:979
shared_ptr< Species > species(const std::string &name) const
Return the Species object for the named species.
Definition: Phase.cpp:950
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:727
virtual bool addSpecies(shared_ptr< Species > spec)
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:782
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1928
void initThermoFile(const std::string &inputFile, const std::string &id)
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:150
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1894
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1898
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
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:529
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:539
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 ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:77
const double OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:81
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
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
const double SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:153
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
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...