Cantera  2.3.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 http://www.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 Constructor",
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 Constructor",
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 Constructor",
54  " Illegal value of formGC");
55  }
56  importPhase(root, this);
57 }
58 
60 {
61  *this = b;
62 }
63 
64 IdealSolidSolnPhase& IdealSolidSolnPhase::operator=(const IdealSolidSolnPhase& b)
65 {
66  if (this != &b) {
68 
69  m_formGC = b.m_formGC;
70  m_Pref = b.m_Pref;
71  m_Pcurrent = b.m_Pcurrent;
72  m_speciesMolarVolume = b.m_speciesMolarVolume;
73  m_h0_RT = b.m_h0_RT;
74  m_cp0_R = b.m_cp0_R;
75  m_g0_RT = b.m_g0_RT;
76  m_s0_R = b.m_s0_R;
77  m_expg0_RT = b.m_expg0_RT;
78  m_pe = b.m_pe;
79  m_pp = b.m_pp;
80  }
81  return *this;
82 }
83 
85 {
86  return new IdealSolidSolnPhase(*this);
87 }
88 
90 {
91  warn_deprecated("EdgePhase::IdealSolidSolnPhase",
92  "To be removed after Cantera 2.3.");
93  integer res;
94  switch (m_formGC) {
95  case 0:
96  res = cIdealSolidSolnPhase0;
97  break;
98  case 1:
99  res = cIdealSolidSolnPhase1;
100  break;
101  case 2:
102  res = cIdealSolidSolnPhase2;
103  break;
104  default:
105  throw CanteraError("eosType", "Unknown type");
106  break;
107  }
108  return res;
109 }
110 
111 // Molar Thermodynamic Properties of the Solution
112 
114 {
115  doublereal htp = RT() * mean_X(enthalpy_RT_ref());
116  return htp + (pressure() - m_Pref)/molarDensity();
117 }
118 
120 {
121  return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx());
122 }
123 
125 {
126  return RT() * (mean_X(gibbs_RT_ref()) + sum_xlogx());
127 }
128 
130 {
131  return GasConstant * mean_X(cp_R_ref());
132 }
133 
134 // Mechanical Equation of State
135 
137 {
138  // Calculate the molarVolume of the solution (m**3 kmol-1)
139  const doublereal* const dtmp = moleFractdivMMW();
140  double invDens = dot(m_speciesMolarVolume.begin(),
141  m_speciesMolarVolume.end(), dtmp);
142 
143  // Set the density in the parent State object directly, by calling the
144  // Phase::setDensity() function.
145  Phase::setDensity(1.0/invDens);
146 }
147 
148 void IdealSolidSolnPhase::setDensity(const doublereal rho)
149 {
150  // Unless the input density is exactly equal to the density calculated and
151  // stored in the State object, we throw an exception. This is because the
152  // density is NOT an independent variable.
153  if (rho != density()) {
154  throw CanteraError("IdealSolidSolnPhase::setDensity",
155  "Density is not an independent variable");
156  }
157 }
158 
160 {
161  m_Pcurrent = p;
162  calcDensity();
163 }
164 
165 void IdealSolidSolnPhase::setMolarDensity(const doublereal n)
166 {
167  throw CanteraError("IdealSolidSolnPhase::setMolarDensity",
168  "Density is not an independent variable");
169 }
170 
172 {
174  calcDensity();
175 }
176 
177 // Chemical Potentials and Activities
178 
180 {
181  const doublereal* const dtmp = moleFractdivMMW();
182  const double mmw = meanMolecularWeight();
183  switch (m_formGC) {
184  case 0:
185  for (size_t k = 0; k < m_kk; k++) {
186  c[k] = dtmp[k] * mmw;
187  }
188  break;
189  case 1:
190  for (size_t k = 0; k < m_kk; k++) {
191  c[k] = dtmp[k] * mmw / m_speciesMolarVolume[k];
192  }
193  break;
194  case 2:
195  double atmp = mmw / m_speciesMolarVolume[m_kk-1];
196  for (size_t k = 0; k < m_kk; k++) {
197  c[k] = dtmp[k] * atmp;
198  }
199  break;
200  }
201 }
202 
204 {
205  switch (m_formGC) {
206  case 0:
207  return 1.0;
208  case 1:
209  return 1.0 / m_speciesMolarVolume[k];
210  case 2:
211  return 1.0/m_speciesMolarVolume[m_kk-1];
212  }
213  return 0.0;
214 }
216 {
217  warn_deprecated("IdealSolidSolnPhase::referenceConcentration",
218  "Unused duplicate of standardConcentration. "
219  "To be removed after Cantera 2.3.");
220  switch (m_formGC) {
221  case 0:
222  return 1.0;
223  case 1:
224  return 1.0 / m_speciesMolarVolume[k];
225  case 2:
226  return 1.0 / m_speciesMolarVolume[m_kk-1];
227  }
228  return 0.0;
229 }
230 
232 {
233  for (size_t k = 0; k < m_kk; k++) {
234  ac[k] = 1.0;
235  }
236 }
237 
238 void IdealSolidSolnPhase::getChemPotentials(doublereal* mu) const
239 {
240  doublereal delta_p = m_Pcurrent - m_Pref;
241  const vector_fp& g_RT = gibbs_RT_ref();
242  for (size_t k = 0; k < m_kk; k++) {
243  double xx = std::max(SmallNumber, moleFraction(k));
244  mu[k] = RT() * (g_RT[k] + log(xx))
245  + delta_p * m_speciesMolarVolume[k];
246  }
247 }
248 
250 {
251  doublereal delta_pdRT = (m_Pcurrent - m_Pref) / (temperature() * GasConstant);
252  const vector_fp& g_RT = gibbs_RT_ref();
253  for (size_t k = 0; k < m_kk; k++) {
254  double xx = std::max(SmallNumber, moleFraction(k));
255  mu[k] = (g_RT[k] + log(xx))
256  + delta_pdRT * m_speciesMolarVolume[k];
257  }
258 }
259 
260 // Partial Molar Properties
261 
263 {
264  const vector_fp& _h = enthalpy_RT_ref();
265  scale(_h.begin(), _h.end(), hbar, RT());
266 }
267 
269 {
270  const vector_fp& _s = entropy_R_ref();
271  for (size_t k = 0; k < m_kk; k++) {
272  double xx = std::max(SmallNumber, moleFraction(k));
273  sbar[k] = GasConstant * (_s[k] - log(xx));
274  }
275 }
276 
277 void IdealSolidSolnPhase::getPartialMolarCp(doublereal* cpbar) const
278 {
279  getCp_R(cpbar);
280  for (size_t k = 0; k < m_kk; k++) {
281  cpbar[k] *= GasConstant;
282  }
283 }
284 
286 {
287  getStandardVolumes(vbar);
288 }
289 
290 // Properties of the Standard State of the Species in the Solution
291 
292 void IdealSolidSolnPhase::getPureGibbs(doublereal* gpure) const
293 {
294  const vector_fp& gibbsrt = gibbs_RT_ref();
295  doublereal delta_p = (m_Pcurrent - m_Pref);
296  for (size_t k = 0; k < m_kk; k++) {
297  gpure[k] = RT() * gibbsrt[k] + delta_p * m_speciesMolarVolume[k];
298  }
299 }
300 
301 void IdealSolidSolnPhase::getGibbs_RT(doublereal* grt) const
302 {
303  const vector_fp& gibbsrt = gibbs_RT_ref();
304  doublereal delta_prt = (m_Pcurrent - m_Pref)/ RT();
305  for (size_t k = 0; k < m_kk; k++) {
306  grt[k] = gibbsrt[k] + delta_prt * m_speciesMolarVolume[k];
307  }
308 }
309 
310 void IdealSolidSolnPhase::getEnthalpy_RT(doublereal* hrt) const
311 {
312  const vector_fp& _h = enthalpy_RT_ref();
313  doublereal delta_prt = (m_Pcurrent - m_Pref) / RT();
314  for (size_t k = 0; k < m_kk; k++) {
315  hrt[k] = _h[k] + delta_prt * m_speciesMolarVolume[k];
316  }
317 }
318 
319 void IdealSolidSolnPhase::getEntropy_R(doublereal* sr) const
320 {
321  const vector_fp& _s = entropy_R_ref();
322  copy(_s.begin(), _s.end(), sr);
323 }
324 
325 void IdealSolidSolnPhase::getIntEnergy_RT(doublereal* urt) const
326 {
327  const vector_fp& _h = enthalpy_RT_ref();
328  doublereal prefrt = m_Pref / RT();
329  for (size_t k = 0; k < m_kk; k++) {
330  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
331  }
332 }
333 
334 void IdealSolidSolnPhase::getCp_R(doublereal* cpr) const
335 {
336  const vector_fp& _cpr = cp_R_ref();
337  copy(_cpr.begin(), _cpr.end(), cpr);
338 }
339 
340 void IdealSolidSolnPhase::getStandardVolumes(doublereal* vol) const
341 {
342  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), vol);
343 }
344 
345 // Thermodynamic Values for the Species Reference States
346 
347 void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal* hrt) const
348 {
349  _updateThermo();
350  for (size_t k = 0; k != m_kk; k++) {
351  hrt[k] = m_h0_RT[k];
352  }
353 }
354 
355 void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const
356 {
357  _updateThermo();
358  for (size_t k = 0; k != m_kk; k++) {
359  grt[k] = m_g0_RT[k];
360  }
361 }
362 
363 void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const
364 {
365  _updateThermo();
366  double tmp = RT();
367  for (size_t k = 0; k != m_kk; k++) {
368  g[k] = tmp * m_g0_RT[k];
369  }
370 }
371 
372 void IdealSolidSolnPhase::getIntEnergy_RT_ref(doublereal* urt) const
373 {
374  const vector_fp& _h = enthalpy_RT_ref();
375  doublereal prefrt = m_Pref / RT();
376  for (size_t k = 0; k < m_kk; k++) {
377  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
378  }
379 }
380 
381 void IdealSolidSolnPhase::getEntropy_R_ref(doublereal* er) const
382 {
383  _updateThermo();
384  for (size_t k = 0; k != m_kk; k++) {
385  er[k] = m_s0_R[k];
386  }
387 }
388 
389 void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const
390 {
391  _updateThermo();
392  for (size_t k = 0; k != m_kk; k++) {
393  cpr[k] = m_cp0_R[k];
394  }
395 }
396 
398 {
399  _updateThermo();
400  return m_h0_RT;
401 }
402 
404 {
405  _updateThermo();
406  return m_s0_R;
407 }
408 
409 // Utility Functions
410 
411 bool IdealSolidSolnPhase::addSpecies(shared_ptr<Species> spec)
412 {
413  bool added = ThermoPhase::addSpecies(spec);
414  if (added) {
415  if (m_kk == 1) {
416  // Obtain the reference pressure by calling the ThermoPhase function
417  // refPressure, which in turn calls the species thermo reference
418  // pressure function of the same name.
419  m_Pref = refPressure();
420  }
421 
422  m_h0_RT.push_back(0.0);
423  m_g0_RT.push_back(0.0);
424  m_expg0_RT.push_back(0.0);
425  m_cp0_R.push_back(0.0);
426  m_s0_R.push_back(0.0);
427  m_pe.push_back(0.0);;
428  m_pp.push_back(0.0);
429  m_speciesMolarVolume.push_back(0.0);
430  }
431  return added;
432 }
433 
434 
435 void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
436 {
437  if (id_.size() > 0 && phaseNode.id() != id_) {
438  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
439  "phasenode and Id are incompatible");
440  }
441 
442  // Check on the thermo field. Must have:
443  // <thermo model="IdealSolidSolution" />
444  if (phaseNode.hasChild("thermo")) {
445  XML_Node& thNode = phaseNode.child("thermo");
446  if (!ba::iequals(thNode["model"], "idealsolidsolution")) {
447  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
448  "Unknown thermo model: " + thNode["model"]);
449  }
450  } else {
451  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
452  "Unspecified thermo model");
453  }
454 
455  // Form of the standard concentrations. Must have one of:
456  //
457  // <standardConc model="unity" />
458  // <standardConc model="molar_volume" />
459  // <standardConc model="solvent_volume" />
460  if (phaseNode.hasChild("standardConc")) {
461  XML_Node& scNode = phaseNode.child("standardConc");
462  string formString = scNode.attrib("model");
463  if (ba::iequals(formString, "unity")) {
464  m_formGC = 0;
465  } else if (ba::iequals(formString, "molar_volume")) {
466  m_formGC = 1;
467  } else if (ba::iequals(formString, "solvent_volume")) {
468  m_formGC = 2;
469  } else {
470  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
471  "Unknown standardConc model: " + formString);
472  }
473  } else {
474  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
475  "Unspecified standardConc model");
476  }
477 
478  // Now go get the molar volumes
479  XML_Node& speciesList = phaseNode.child("speciesArray");
480  XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
481  &phaseNode.root());
482 
483  for (size_t k = 0; k < m_kk; k++) {
484  XML_Node* s = speciesDB->findByAttr("name", speciesName(k));
485  XML_Node* ss = s->findByName("standardState");
486  m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI");
487  }
488 
489  // Call the base initThermo, which handles setting the initial state.
490  ThermoPhase::initThermoXML(phaseNode, id_);
491 }
492 
493 void IdealSolidSolnPhase::setToEquilState(const doublereal* lambda_RT)
494 {
495  const vector_fp& grt = gibbs_RT_ref();
496 
497  // set the pressure and composition to be consistent with the temperature
498  doublereal pres = 0.0;
499  for (size_t k = 0; k < m_kk; k++) {
500  m_pp[k] = -grt[k];
501  for (size_t m = 0; m < nElements(); m++) {
502  m_pp[k] += nAtoms(k,m)*lambda_RT[m];
503  }
504  m_pp[k] = m_Pref * exp(m_pp[k]);
505  pres += m_pp[k];
506  }
507  setState_PX(pres, &m_pp[0]);
508 }
509 
511 {
512  return m_speciesMolarVolume[k];
513 }
514 
516 {
517  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
518 }
519 
521 {
522  doublereal tnow = temperature();
523  if (m_tlast != tnow) {
524 
525  // Update the thermodynamic functions of the reference state.
526  m_spthermo->update(tnow, m_cp0_R.data(), m_h0_RT.data(), m_s0_R.data());
527  m_tlast = tnow;
528  doublereal rrt = 1.0 / RT();
529  for (size_t k = 0; k < m_kk; k++) {
530  double deltaE = rrt * m_pe[k];
531  m_h0_RT[k] += deltaE;
532  m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
533  }
534  m_tlast = tnow;
535  }
536 }
537 
538 } // end namespace Cantera
virtual doublereal referenceConcentration(int k) const
The reference (ie standard) concentration used to normalize the generalized concentration.
size_t nElements() const
Number of elements.
Definition: Phase.cpp:161
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node...
Definition: xml.cpp:695
const doublereal OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:69
vector_fp m_pp
Temporary array used in equilibrium calculations.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
virtual int eosType() const
Equation of state flag.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:547
ThermoPhase & operator=(const ThermoPhase &right)
Definition: ThermoPhase.cpp:59
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:700
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
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 setPressure(doublereal p)
Set the pressure at constant temperature.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
STL namespace.
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1737
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:690
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:809
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
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...
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.
int m_formGC
Format for the generalized concentrations.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn&#39;t a function of pressure, but only of the mol...
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:666
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 getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:267
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
Definition: Phase.cpp:899
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
doublereal m_Pref
Value of the reference pressure for all species in this phase.
const doublereal * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:563
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
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...
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:107
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
MultiSpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1693
XML_Node & child(const size_t n) const
Return a changeable reference to the n&#39;th child of the current node.
Definition: xml.cpp:546
XML_Node & root() const
Return the root of the current XML_Node tree.
Definition: xml.cpp:1025
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P ...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
const doublereal SmallNumber
smallest number to compare to zero.
Definition: ct_defs.h:126
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:500
Class IdealSolidSolnPhase represents a condensed phase ideal solution compound.
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:157
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:661
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:130
void _updateThermo() const
This function gets called for every call to functions in this class.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:149
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable...
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:428
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Contains declarations for string manipulation functions within Cantera.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
Definition: ctml.cpp:178
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...
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
size_t m_kk
Number of species in the phase.
Definition: Phase.h:784
XML_Node * findByAttr(const std::string &attr, const std::string &val, int depth=100000) const
This routine carries out a recursive search for an XML node based on an attribute of each XML node...
Definition: xml.cpp:661
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
vector_fp m_pe
Vector of potential energies for the species.
Namespace for the Cantera kernel.
Definition: application.cpp:29
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
Definition: Phase.cpp:237
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
virtual doublereal pressure() const
Pressure.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
Definition: global.cpp:252
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
Definition: Phase.h:622
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 doublereal entropy_mole() const
Molar entropy of the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.