Cantera  2.5.1
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 
14 #include "cantera/base/ctml.h"
15 #include "cantera/base/utilities.h"
16 
17 using namespace std;
18 
19 namespace Cantera
20 {
21 
22 IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) :
23  m_formGC(formGC),
24  m_Pref(OneAtm),
25  m_Pcurrent(OneAtm)
26 {
27  if (formGC < 0 || formGC > 2) {
28  throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
29  "Illegal value of formGC");
30  }
31 }
32 
33 IdealSolidSolnPhase::IdealSolidSolnPhase(const std::string& inputFile,
34  const std::string& id_, int formGC) :
35  m_formGC(formGC),
36  m_Pref(OneAtm),
37  m_Pcurrent(OneAtm)
38 {
39  if (formGC < 0 || formGC > 2) {
40  throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
41  "Illegal value of formGC");
42  }
43  initThermoFile(inputFile, id_);
44 }
45 
46 IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id_,
47  int formGC) :
48  m_formGC(formGC),
49  m_Pref(OneAtm),
50  m_Pcurrent(OneAtm)
51 {
52  if (formGC < 0 || formGC > 2) {
53  throw CanteraError("IdealSolidSolnPhase::IdealSolidSolnPhase",
54  "Illegal value of formGC");
55  }
56  importPhase(root, this);
57 }
58 
59 // Molar Thermodynamic Properties of the Solution
60 
62 {
63  doublereal htp = RT() * mean_X(enthalpy_RT_ref());
64  return htp + (pressure() - m_Pref)/molarDensity();
65 }
66 
68 {
69  return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx());
70 }
71 
73 {
74  return RT() * (mean_X(gibbs_RT_ref()) + sum_xlogx());
75 }
76 
77 doublereal IdealSolidSolnPhase::cp_mole() const
78 {
79  return GasConstant * mean_X(cp_R_ref());
80 }
81 
82 // Mechanical Equation of State
83 
85 {
86  // Calculate the molarVolume of the solution (m**3 kmol-1)
87  const doublereal* const dtmp = moleFractdivMMW();
88  double invDens = dot(m_speciesMolarVolume.begin(),
89  m_speciesMolarVolume.end(), dtmp);
90 
91  // Set the density in the parent State object directly, by calling the
92  // Phase::assignDensity() function.
93  Phase::assignDensity(1.0/invDens);
94 }
95 
96 void IdealSolidSolnPhase::setDensity(const doublereal rho)
97 {
98  // Unless the input density is exactly equal to the density calculated and
99  // stored in the State object, we throw an exception. This is because the
100  // density is NOT an independent variable.
101  warn_deprecated("IdealSolidSolnPhase::setDensity",
102  "Overloaded function to be removed after Cantera 2.5. "
103  "Error will be thrown by Phase::setDensity instead");
104  if (std::abs(rho/density() - 1.0) > 1e-15) {
105  throw CanteraError("IdealSolidSolnPhase::setDensity",
106  "Density is not an independent variable");
107  }
108 }
109 
111 {
112  m_Pcurrent = p;
113  calcDensity();
114 }
115 
116 void IdealSolidSolnPhase::setMolarDensity(const doublereal n)
117 {
118  warn_deprecated("IdealSolidSolnPhase::setMolarDensity",
119  "Overloaded function to be removed after Cantera 2.5. "
120  "Error will be thrown by Phase::setMolarDensity instead");
121  throw CanteraError("IdealSolidSolnPhase::setMolarDensity",
122  "Density is not an independent variable");
123 }
124 
126 {
128  calcDensity();
129 }
130 
131 // Chemical Potentials and Activities
132 
134 {
135  if (m_formGC == 0) {
136  return Units(1.0); // dimensionless
137  } else {
138  // kmol/m^3 for bulk phases
139  return Units(1.0, 0, -static_cast<double>(nDim()), 0, 0, 0, 1);
140  }
141 }
142 
144 {
145  const doublereal* const dtmp = moleFractdivMMW();
146  const double mmw = meanMolecularWeight();
147  switch (m_formGC) {
148  case 0:
149  for (size_t k = 0; k < m_kk; k++) {
150  c[k] = dtmp[k] * mmw;
151  }
152  break;
153  case 1:
154  for (size_t k = 0; k < m_kk; k++) {
155  c[k] = dtmp[k] * mmw / m_speciesMolarVolume[k];
156  }
157  break;
158  case 2:
159  double atmp = mmw / m_speciesMolarVolume[m_kk-1];
160  for (size_t k = 0; k < m_kk; k++) {
161  c[k] = dtmp[k] * atmp;
162  }
163  break;
164  }
165 }
166 
168 {
169  switch (m_formGC) {
170  case 0:
171  return 1.0;
172  case 1:
173  return 1.0 / m_speciesMolarVolume[k];
174  case 2:
175  return 1.0/m_speciesMolarVolume[m_kk-1];
176  }
177  return 0.0;
178 }
179 
181 {
182  for (size_t k = 0; k < m_kk; k++) {
183  ac[k] = 1.0;
184  }
185 }
186 
187 void IdealSolidSolnPhase::getChemPotentials(doublereal* mu) const
188 {
189  doublereal delta_p = m_Pcurrent - m_Pref;
190  const vector_fp& g_RT = gibbs_RT_ref();
191  for (size_t k = 0; k < m_kk; k++) {
192  double xx = std::max(SmallNumber, moleFraction(k));
193  mu[k] = RT() * (g_RT[k] + log(xx))
194  + delta_p * m_speciesMolarVolume[k];
195  }
196 }
197 
199 {
200  doublereal delta_pdRT = (m_Pcurrent - m_Pref) / (temperature() * GasConstant);
201  const vector_fp& g_RT = gibbs_RT_ref();
202  for (size_t k = 0; k < m_kk; k++) {
203  double xx = std::max(SmallNumber, moleFraction(k));
204  mu[k] = (g_RT[k] + log(xx))
205  + delta_pdRT * m_speciesMolarVolume[k];
206  }
207 }
208 
209 // Partial Molar Properties
210 
212 {
213  const vector_fp& _h = enthalpy_RT_ref();
214  scale(_h.begin(), _h.end(), hbar, RT());
215 }
216 
218 {
219  const vector_fp& _s = entropy_R_ref();
220  for (size_t k = 0; k < m_kk; k++) {
221  double xx = std::max(SmallNumber, moleFraction(k));
222  sbar[k] = GasConstant * (_s[k] - log(xx));
223  }
224 }
225 
226 void IdealSolidSolnPhase::getPartialMolarCp(doublereal* cpbar) const
227 {
228  getCp_R(cpbar);
229  for (size_t k = 0; k < m_kk; k++) {
230  cpbar[k] *= GasConstant;
231  }
232 }
233 
235 {
236  getStandardVolumes(vbar);
237 }
238 
239 // Properties of the Standard State of the Species in the Solution
240 
241 void IdealSolidSolnPhase::getPureGibbs(doublereal* gpure) const
242 {
243  const vector_fp& gibbsrt = gibbs_RT_ref();
244  doublereal delta_p = (m_Pcurrent - m_Pref);
245  for (size_t k = 0; k < m_kk; k++) {
246  gpure[k] = RT() * gibbsrt[k] + delta_p * m_speciesMolarVolume[k];
247  }
248 }
249 
250 void IdealSolidSolnPhase::getGibbs_RT(doublereal* grt) const
251 {
252  const vector_fp& gibbsrt = gibbs_RT_ref();
253  doublereal delta_prt = (m_Pcurrent - m_Pref)/ RT();
254  for (size_t k = 0; k < m_kk; k++) {
255  grt[k] = gibbsrt[k] + delta_prt * m_speciesMolarVolume[k];
256  }
257 }
258 
259 void IdealSolidSolnPhase::getEnthalpy_RT(doublereal* hrt) const
260 {
261  const vector_fp& _h = enthalpy_RT_ref();
262  doublereal delta_prt = (m_Pcurrent - m_Pref) / RT();
263  for (size_t k = 0; k < m_kk; k++) {
264  hrt[k] = _h[k] + delta_prt * m_speciesMolarVolume[k];
265  }
266 }
267 
268 void IdealSolidSolnPhase::getEntropy_R(doublereal* sr) const
269 {
270  const vector_fp& _s = entropy_R_ref();
271  copy(_s.begin(), _s.end(), sr);
272 }
273 
274 void IdealSolidSolnPhase::getIntEnergy_RT(doublereal* urt) const
275 {
276  const vector_fp& _h = enthalpy_RT_ref();
277  doublereal prefrt = m_Pref / RT();
278  for (size_t k = 0; k < m_kk; k++) {
279  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
280  }
281 }
282 
283 void IdealSolidSolnPhase::getCp_R(doublereal* cpr) const
284 {
285  const vector_fp& _cpr = cp_R_ref();
286  copy(_cpr.begin(), _cpr.end(), cpr);
287 }
288 
289 void IdealSolidSolnPhase::getStandardVolumes(doublereal* vol) const
290 {
291  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), vol);
292 }
293 
294 // Thermodynamic Values for the Species Reference States
295 
296 void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal* hrt) const
297 {
298  _updateThermo();
299  for (size_t k = 0; k != m_kk; k++) {
300  hrt[k] = m_h0_RT[k];
301  }
302 }
303 
304 void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const
305 {
306  _updateThermo();
307  for (size_t k = 0; k != m_kk; k++) {
308  grt[k] = m_g0_RT[k];
309  }
310 }
311 
312 void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const
313 {
314  _updateThermo();
315  double tmp = RT();
316  for (size_t k = 0; k != m_kk; k++) {
317  g[k] = tmp * m_g0_RT[k];
318  }
319 }
320 
321 void IdealSolidSolnPhase::getIntEnergy_RT_ref(doublereal* urt) const
322 {
323  const vector_fp& _h = enthalpy_RT_ref();
324  doublereal prefrt = m_Pref / RT();
325  for (size_t k = 0; k < m_kk; k++) {
326  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
327  }
328 }
329 
330 void IdealSolidSolnPhase::getEntropy_R_ref(doublereal* er) const
331 {
332  _updateThermo();
333  for (size_t k = 0; k != m_kk; k++) {
334  er[k] = m_s0_R[k];
335  }
336 }
337 
338 void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const
339 {
340  _updateThermo();
341  for (size_t k = 0; k != m_kk; k++) {
342  cpr[k] = m_cp0_R[k];
343  }
344 }
345 
347 {
348  _updateThermo();
349  return m_h0_RT;
350 }
351 
353 {
354  _updateThermo();
355  return m_s0_R;
356 }
357 
358 // Utility Functions
359 
360 bool IdealSolidSolnPhase::addSpecies(shared_ptr<Species> spec)
361 {
362  bool added = ThermoPhase::addSpecies(spec);
363  if (added) {
364  if (m_kk == 1) {
365  // Obtain the reference pressure by calling the ThermoPhase function
366  // refPressure, which in turn calls the species thermo reference
367  // pressure function of the same name.
368  m_Pref = refPressure();
369  }
370 
371  m_h0_RT.push_back(0.0);
372  m_g0_RT.push_back(0.0);
373  m_expg0_RT.push_back(0.0);
374  m_cp0_R.push_back(0.0);
375  m_s0_R.push_back(0.0);
376  m_pe.push_back(0.0);;
377  m_pp.push_back(0.0);
378  if (spec->input.hasKey("equation-of-state")) {
379  auto& eos = spec->input["equation-of-state"].getMapWhere("model", "constant-volume");
380  double mv;
381  if (eos.hasKey("density")) {
382  mv = molecularWeight(m_kk-1) / eos.convert("density", "kg/m^3");
383  } else if (eos.hasKey("molar-density")) {
384  mv = 1.0 / eos.convert("molar-density", "kmol/m^3");
385  } else if (eos.hasKey("molar-volume")) {
386  mv = eos.convert("molar-volume", "m^3/kmol");
387  } else {
388  throw CanteraError("IdealSolidSolnPhase::addSpecies",
389  "equation-of-state entry for species '{}' is missing "
390  "'density', 'molar-volume', or 'molar-density' "
391  "specification", spec->name);
392  }
393  m_speciesMolarVolume.push_back(mv);
394  } else if (spec->extra.hasKey("molar_volume")) {
395  // From XML
396  m_speciesMolarVolume.push_back(spec->extra["molar_volume"].asDouble());
397  } else {
398  throw CanteraError("IdealSolidSolnPhase::addSpecies",
399  "Molar volume not specified for species '{}'", spec->name);
400  }
401  calcDensity();
402  }
403  return added;
404 }
405 
407 {
408  if (m_input.hasKey("standard-concentration-basis")) {
409  setStandardConcentrationModel(m_input["standard-concentration-basis"].asString());
410  }
412 }
413 
414 void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
415 {
416  if (id_.size() > 0 && phaseNode.id() != id_) {
417  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
418  "phasenode and Id are incompatible");
419  }
420 
421  // Check on the thermo field. Must have:
422  // <thermo model="IdealSolidSolution" />
423  if (phaseNode.hasChild("thermo")) {
424  XML_Node& thNode = phaseNode.child("thermo");
425  if (!caseInsensitiveEquals(thNode["model"], "idealsolidsolution")) {
426  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
427  "Unknown thermo model: " + thNode["model"]);
428  }
429  } else {
430  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
431  "Unspecified thermo model");
432  }
433 
434  // Form of the standard concentrations. Must have one of:
435  //
436  // <standardConc model="unity" />
437  // <standardConc model="molar_volume" />
438  // <standardConc model="solvent_volume" />
439  if (phaseNode.hasChild("standardConc")) {
440  setStandardConcentrationModel(phaseNode.child("standardConc")["model"]);
441  } else {
442  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
443  "Unspecified standardConc model");
444  }
445 
446  // Call the base initThermo, which handles setting the initial state.
447  ThermoPhase::initThermoXML(phaseNode, id_);
448 }
449 
450 void IdealSolidSolnPhase::setToEquilState(const doublereal* mu_RT)
451 {
452  const vector_fp& grt = gibbs_RT_ref();
453 
454  doublereal pres = 0.0;
455  double m_p0 = refPressure();
456  for (size_t k = 0; k < m_kk; k++) {
457  double tmp = -grt[k] + mu_RT[k];
458  if (tmp < -600.) {
459  m_pp[k] = 0.0;
460  } else if (tmp > 500.0) {
461  // Protect against inf results if the exponent is too high
462  double tmp2 = tmp / 500.;
463  tmp2 *= tmp2;
464  m_pp[k] = m_p0 * exp(500.) * tmp2;
465  } else {
466  m_pp[k] = m_p0 * exp(tmp);
467  }
468  pres += m_pp[k];
469  }
470  // set state
471  setState_PX(pres, m_pp.data());
472 }
473 
475 {
476  if (caseInsensitiveEquals(model, "unity")) {
477  m_formGC = 0;
478  } else if (caseInsensitiveEquals(model, "species-molar-volume")
479  || caseInsensitiveEquals(model, "molar_volume")) {
480  m_formGC = 1;
481  } else if (caseInsensitiveEquals(model, "solvent-molar-volume")
482  || caseInsensitiveEquals(model, "solvent_volume")) {
483  m_formGC = 2;
484  } else {
485  throw CanteraError("IdealSolidSolnPhase::setStandardConcentrationModel",
486  "Unknown standard concentration model '{}'", model);
487  }
488 }
489 
491 {
492  return m_speciesMolarVolume[k];
493 }
494 
496 {
497  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
498 }
499 
501 {
502  doublereal tnow = temperature();
503  if (m_tlast != tnow) {
504 
505  // Update the thermodynamic functions of the reference state.
506  m_spthermo.update(tnow, m_cp0_R.data(), m_h0_RT.data(), m_s0_R.data());
507  m_tlast = tnow;
508  doublereal rrt = 1.0 / RT();
509  for (size_t k = 0; k < m_kk; k++) {
510  double deltaE = rrt * m_pe[k];
511  m_h0_RT[k] += deltaE;
512  m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
513  }
514  m_tlast = tnow;
515  }
516 }
517 
518 } // end namespace Cantera
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:984
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 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 & gibbs_RT_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...
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.
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable.
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.
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',...
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
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 ...
vector_fp m_pe
Vector of potential energies for the species.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
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 setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
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 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 ...
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:700
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:727
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:746
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:593
size_t m_kk
Number of species in the phase.
Definition: Phase.h:942
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition: Phase.h:651
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:521
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:748
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:577
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:685
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: Phase.cpp:1028
doublereal temperature() const
Temperature (K).
Definition: Phase.h:667
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:756
virtual bool addSpecies(shared_ptr< Species > spec)
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:776
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1904
virtual 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:145
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:1870
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1874
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:104
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:528
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:538
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definition: xml.cpp:546
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
const double OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:78
const double SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:149
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:180
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:109
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:112
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:135
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...