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
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:1089
Cantera::IdealSolidSolnPhase::getSpeciesMolarVolumes
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
Definition: IdealSolidSolnPhase.cpp:495
Cantera::IdealSolidSolnPhase::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
Definition: IdealSolidSolnPhase.cpp:61
Cantera::IdealSolidSolnPhase::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy of the solution.
Definition: IdealSolidSolnPhase.cpp:67
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:352
Cantera::ThermoPhase::setState_PX
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Definition: ThermoPhase.cpp:185
Cantera::IdealSolidSolnPhase::m_s0_R
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
Definition: IdealSolidSolnPhase.h:682
Cantera::IdealSolidSolnPhase::speciesMolarVolume
double speciesMolarVolume(int k) const
Report the molar volume of species k.
Definition: IdealSolidSolnPhase.cpp:490
Cantera::IdealSolidSolnPhase::compositionChanged
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: IdealSolidSolnPhase.cpp:125
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:553
Cantera::SmallNumber
const double SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:149
Cantera::ThermoPhase::refPressure
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:145
Cantera::IdealSolidSolnPhase::m_speciesMolarVolume
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
Definition: IdealSolidSolnPhase.h:669
Cantera::warn_deprecated
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
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:572
Cantera::IdealSolidSolnPhase::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
Definition: IdealSolidSolnPhase.cpp:77
Cantera::XML_Node::id
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:538
Cantera::Phase::meanMolecularWeight
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:748
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:528
Cantera::AnyMap::hasKey
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:984
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:283
Cantera::Phase::assignDensity
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:727
Cantera::IdealSolidSolnPhase::setDensity
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable.
Definition: IdealSolidSolnPhase.cpp:96
Cantera::Phase::nDim
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition: Phase.h:651
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:226
Cantera::IdealSolidSolnPhase::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
Definition: IdealSolidSolnPhase.cpp:187
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::IdealSolidSolnPhase::m_formGC
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
Definition: IdealSolidSolnPhase.h:646
ThermoFactory.h
Cantera::IdealSolidSolnPhase::setToEquilState
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
Definition: IdealSolidSolnPhase.cpp:450
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:180
Cantera::Phase::moleFraction
double moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:577
Cantera::IdealSolidSolnPhase::setMolarDensity
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
Definition: IdealSolidSolnPhase.cpp:116
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:321
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:268
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition: Phase.h:942
Cantera::IdealSolidSolnPhase::m_pp
vector_fp m_pp
Temporary array used in equilibrium calculations.
Definition: IdealSolidSolnPhase.h:693
Cantera::ThermoPhase::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: ThermoPhase.cpp:1134
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1874
Cantera::Phase::molecularWeight
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:521
Cantera::Phase::density
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:685
Cantera::IdealSolidSolnPhase::m_pe
vector_fp m_pe
Vector of potential energies for the species.
Definition: IdealSolidSolnPhase.h:690
IdealSolidSolnPhase.h
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:217
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:686
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:198
Cantera::IdealSolidSolnPhase::IdealSolidSolnPhase
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
Definition: IdealSolidSolnPhase.cpp:22
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:274
Cantera::IdealSolidSolnPhase::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: IdealSolidSolnPhase.cpp:360
Cantera::IdealSolidSolnPhase::pressure
virtual doublereal pressure() const
Pressure.
Definition: IdealSolidSolnPhase.h:183
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:663
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::caseInsensitiveEquals
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
Definition: stringUtils.cpp:268
Cantera::ThermoPhase::m_tlast
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1904
Cantera::OneAtm
const double OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:78
Cantera::ThermoPhase::RT
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:776
utilities.h
Cantera::ThermoPhase::initThermoFile
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
Definition: ThermoPhase.cpp:1064
Cantera::Phase::sum_xlogx
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:756
Cantera::IdealSolidSolnPhase::setStandardConcentrationModel
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
Definition: IdealSolidSolnPhase.cpp:474
ctml.h
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:296
stringUtils.h
Cantera::IdealSolidSolnPhase::standardConcentration
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
Definition: IdealSolidSolnPhase.cpp:167
Cantera::Phase::temperature
doublereal temperature() const
Temperature (K).
Definition: Phase.h:667
Cantera::IdealSolidSolnPhase::m_g0_RT
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
Definition: IdealSolidSolnPhase.h:679
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:289
Cantera::dot
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:112
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:676
Cantera::IdealSolidSolnPhase::calcDensity
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Definition: IdealSolidSolnPhase.cpp:84
Cantera::IdealSolidSolnPhase::standardConcentrationUnits
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: IdealSolidSolnPhase.cpp:133
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:338
Cantera::scale
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:135
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:259
Cantera::Phase::moleFractdivMMW
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:593
Cantera::ThermoPhase::m_spthermo
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1870
Cantera::IdealSolidSolnPhase::getActivityCoefficients
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
Definition: IdealSolidSolnPhase.cpp:180
Cantera::IdealSolidSolnPhase::_updateThermo
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
Definition: IdealSolidSolnPhase.cpp:500
Cantera::IdealSolidSolnPhase::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
Definition: IdealSolidSolnPhase.cpp:143
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:241
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:746
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:29
Cantera::IdealSolidSolnPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: IdealSolidSolnPhase.cpp:406
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:250
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:304
Cantera::Phase::molarDensity
double molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:700
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:109
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:60
Cantera::IdealSolidSolnPhase::m_h0_RT
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
Definition: IdealSolidSolnPhase.h:672
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:346
Cantera::importPhase
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Definition: ThermoFactory.cpp:237
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:234
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:414
Cantera::IdealSolidSolnPhase::setPressure
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
Definition: IdealSolidSolnPhase.cpp:110
Cantera::ThermoPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: ThermoPhase.cpp:1096
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:330
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:263
Cantera::Phase::compositionChanged
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: Phase.cpp:1028
Cantera::IdealSolidSolnPhase::gibbs_mole
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
Definition: IdealSolidSolnPhase.cpp:72
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:312
Cantera::IdealSolidSolnPhase::m_Pref
doublereal m_Pref
Value of the reference pressure for all species in this phase.
Definition: IdealSolidSolnPhase.h:654
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:546
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:211