Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Copyright 2006 Sandia Corporation. Under the terms of Contract
9  * DE-AC04-94AL85000, with Sandia Corporation, the U.S. Government
10  * retains certain rights in this software.
11  */
12 
16 #include "cantera/base/ctml.h"
18 
19 using namespace std;
20 
21 namespace Cantera
22 {
23 
24 IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) :
25  m_formGC(formGC),
26  m_Pref(OneAtm),
27  m_Pcurrent(OneAtm)
28 {
29  if (formGC < 0 || formGC > 2) {
30  throw CanteraError(" IdealSolidSolnPhase Constructor",
31  " Illegal value of formGC");
32  }
33 }
34 
35 IdealSolidSolnPhase::IdealSolidSolnPhase(const std::string& inputFile,
36  const std::string& id_, int formGC) :
37  m_formGC(formGC),
38  m_Pref(OneAtm),
39  m_Pcurrent(OneAtm)
40 {
41  if (formGC < 0 || formGC > 2) {
42  throw CanteraError(" IdealSolidSolnPhase Constructor",
43  " Illegal value of formGC");
44  }
45  initThermoFile(inputFile, id_);
46 }
47 
48 IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id_,
49  int formGC) :
50  m_formGC(formGC),
51  m_Pref(OneAtm),
52  m_Pcurrent(OneAtm)
53 {
54  if (formGC < 0 || formGC > 2) {
55  throw CanteraError(" IdealSolidSolnPhase Constructor",
56  " Illegal value of formGC");
57  }
58  importPhase(*findXMLPhase(&root, id_), this);
59 }
60 
62 {
63  *this = b;
64 }
65 
67 {
68  if (this != &b) {
70 
71  m_formGC = b.m_formGC;
72  m_Pref = b.m_Pref;
75  m_h0_RT = b.m_h0_RT;
76  m_cp0_R = b.m_cp0_R;
77  m_g0_RT = b.m_g0_RT;
78  m_s0_R = b.m_s0_R;
80  m_pe = b.m_pe;
81  m_pp = b.m_pp;
82  }
83  return *this;
84 }
85 
87 {
88  return new IdealSolidSolnPhase(*this);
89 }
90 
92 {
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 /********************************************************************
112  * Molar Thermodynamic Properties of the Solution
113  ********************************************************************/
114 
116 {
117  doublereal htp = GasConstant * temperature() * mean_X(enthalpy_RT_ref());
118  return htp + (pressure() - m_Pref)/molarDensity();
119 }
120 
122 {
123  return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx());
124 }
125 
127 {
128  return GasConstant * temperature() * (mean_X(gibbs_RT_ref()) + sum_xlogx());
129 }
130 
132 {
133  return GasConstant * mean_X(cp_R_ref());
134 }
135 
136 /********************************************************************
137  * Mechanical Equation of State
138  ********************************************************************/
139 
141 {
142  /*
143  * Calculate the molarVolume of the solution (m**3 kmol-1)
144  */
145  const doublereal* const dtmp = moleFractdivMMW();
146  double invDens = dot(m_speciesMolarVolume.begin(),
147  m_speciesMolarVolume.end(), dtmp);
148  /*
149  * Set the density in the parent State object directly,
150  * by calling the Phase::setDensity() function.
151  */
152  Phase::setDensity(1.0/invDens);
153 }
154 
155 void IdealSolidSolnPhase::setDensity(const doublereal rho)
156 {
157  /*
158  * Unless the input density is exactly equal to the density
159  * calculated and stored in the State object, we throw an
160  * exception. This is because the density is NOT an
161  * independent variable.
162  */
163  if (rho != density()) {
164  throw CanteraError("IdealSolidSolnPhase::setDensity",
165  "Density is not an independent variable");
166  }
167 }
168 
170 {
171  m_Pcurrent = p;
172  calcDensity();
173 }
174 
175 void IdealSolidSolnPhase::setMolarDensity(const doublereal n)
176 {
177  throw CanteraError("IdealSolidSolnPhase::setMolarDensity",
178  "Density is not an independent variable");
179 }
180 
181 void IdealSolidSolnPhase::setMoleFractions(const doublereal* const x)
182 {
184  calcDensity();
185 }
186 
187 void IdealSolidSolnPhase::setMoleFractions_NoNorm(const doublereal* const x)
188 {
190  calcDensity();
191 }
192 
193 void IdealSolidSolnPhase::setMassFractions(const doublereal* const y)
194 {
196  calcDensity();
197 }
198 
199 void IdealSolidSolnPhase::setMassFractions_NoNorm(const doublereal* const y)
200 {
202  calcDensity();
203 }
204 
205 void IdealSolidSolnPhase::setConcentrations(const doublereal* const c)
206 {
208  calcDensity();
209 }
210 
211 /********************************************************************
212  * Chemical Potentials and Activities
213  ********************************************************************/
214 
216 {
217  const doublereal* const dtmp = moleFractdivMMW();
218  const double mmw = meanMolecularWeight();
219  switch (m_formGC) {
220  case 0:
221  for (size_t k = 0; k < m_kk; k++) {
222  c[k] = dtmp[k] * mmw;
223  }
224  break;
225  case 1:
226  for (size_t k = 0; k < m_kk; k++) {
227  c[k] = dtmp[k] * mmw / m_speciesMolarVolume[k];
228  }
229  break;
230  case 2:
231  double atmp = mmw / m_speciesMolarVolume[m_kk-1];
232  for (size_t k = 0; k < m_kk; k++) {
233  c[k] = dtmp[k] * atmp;
234  }
235  break;
236  }
237 }
238 
240 {
241  switch (m_formGC) {
242  case 0:
243  return 1.0;
244  case 1:
245  return 1.0 / m_speciesMolarVolume[k];
246  case 2:
247  return 1.0/m_speciesMolarVolume[m_kk-1];
248  }
249  return 0.0;
250 }
252 {
253  switch (m_formGC) {
254  case 0:
255  return 1.0;
256  case 1:
257  return 1.0 / m_speciesMolarVolume[k];
258  case 2:
259  return 1.0 / m_speciesMolarVolume[m_kk-1];
260  }
261  return 0.0;
262 }
263 
264 doublereal IdealSolidSolnPhase::logStandardConc(size_t k) const
265 {
266  _updateThermo();
267  double res;
268  switch (m_formGC) {
269  case 0:
270  res = 0.0;
271  break;
272  case 1:
273  res = log(1.0/m_speciesMolarVolume[k]);
274  break;
275  case 2:
276  res = log(1.0/m_speciesMolarVolume[m_kk-1]);
277  break;
278  default:
279  throw CanteraError("eosType", "Unknown type");
280  break;
281  }
282  return res;
283 }
284 
285 void IdealSolidSolnPhase::getUnitsStandardConc(double* uA, int, int sizeUA) const
286 {
287  warn_deprecated("IdealSolidSolnPhase::getUnitsStandardConc",
288  "To be removed after Cantera 2.2.");
289  int eos = eosType();
290  if (eos == cIdealSolidSolnPhase0) {
291  for (int i = 0; i < sizeUA; i++) {
292  uA[i] = 0.0;
293  }
294  } else {
295  for (int i = 0; i < sizeUA; i++) {
296  if (i == 0) {
297  uA[0] = 1.0;
298  }
299  if (i == 1) {
300  uA[1] = -int(nDim());
301  }
302  if (i == 2) {
303  uA[2] = 0.0;
304  }
305  if (i == 3) {
306  uA[3] = 0.0;
307  }
308  if (i == 4) {
309  uA[4] = 0.0;
310  }
311  if (i == 5) {
312  uA[5] = 0.0;
313  }
314  }
315  }
316 }
317 
319 {
320  for (size_t k = 0; k < m_kk; k++) {
321  ac[k] = 1.0;
322  }
323 }
324 
325 void IdealSolidSolnPhase::getChemPotentials(doublereal* mu) const
326 {
327  doublereal delta_p = m_Pcurrent - m_Pref;
328  doublereal RT = temperature() * GasConstant;
329  const vector_fp& g_RT = gibbs_RT_ref();
330  for (size_t k = 0; k < m_kk; k++) {
331  double xx = std::max(SmallNumber, moleFraction(k));
332  mu[k] = RT * (g_RT[k] + log(xx))
333  + delta_p * m_speciesMolarVolume[k];
334  }
335 }
336 
338 {
339  doublereal delta_pdRT = (m_Pcurrent - m_Pref) / (temperature() * GasConstant);
340  const vector_fp& g_RT = gibbs_RT_ref();
341  for (size_t k = 0; k < m_kk; k++) {
342  double xx = std::max(SmallNumber, moleFraction(k));
343  mu[k] = (g_RT[k] + log(xx))
344  + delta_pdRT * m_speciesMolarVolume[k];
345  }
346 }
347 
348 /********************************************************************
349  * Partial Molar Properties
350  ********************************************************************/
351 
353 {
354  const vector_fp& _h = enthalpy_RT_ref();
355  scale(_h.begin(), _h.end(), hbar, GasConstant * temperature());
356 }
357 
359 {
360  const vector_fp& _s = entropy_R_ref();
361  for (size_t k = 0; k < m_kk; k++) {
362  double xx = std::max(SmallNumber, moleFraction(k));
363  sbar[k] = GasConstant * (_s[k] - log(xx));
364  }
365 }
366 
367 void IdealSolidSolnPhase::getPartialMolarCp(doublereal* cpbar) const
368 {
369  getCp_R(cpbar);
370  for (size_t k = 0; k < m_kk; k++) {
371  cpbar[k] *= GasConstant;
372  }
373 }
374 
376 {
377  getStandardVolumes(vbar);
378 }
379 
380 /*****************************************************************
381  * Properties of the Standard State of the Species in the Solution
382  *****************************************************************/
383 
384 void IdealSolidSolnPhase::getPureGibbs(doublereal* gpure) const
385 {
386  const vector_fp& gibbsrt = gibbs_RT_ref();
387  doublereal RT = _RT();
388  const doublereal* const gk = DATA_PTR(gibbsrt);
389  doublereal delta_p = (m_Pcurrent - m_Pref);
390  for (size_t k = 0; k < m_kk; k++) {
391  gpure[k] = RT * gk[k] + delta_p * m_speciesMolarVolume[k];
392  }
393 }
394 
395 void IdealSolidSolnPhase::getGibbs_RT(doublereal* grt) const
396 {
397  const vector_fp& gibbsrt = gibbs_RT_ref();
398  doublereal RT = _RT();
399  const doublereal* const gk = DATA_PTR(gibbsrt);
400  doublereal delta_prt = (m_Pcurrent - m_Pref)/ RT;
401  for (size_t k = 0; k < m_kk; k++) {
402  grt[k] = gk[k] + delta_prt * m_speciesMolarVolume[k];
403  }
404 }
405 
406 void IdealSolidSolnPhase::getEnthalpy_RT(doublereal* hrt) const
407 {
408  const vector_fp& _h = enthalpy_RT_ref();
409  doublereal delta_prt = ((m_Pcurrent - m_Pref) /
410  (GasConstant * temperature()));
411  for (size_t k = 0; k < m_kk; k++) {
412  hrt[k] = _h[k] + delta_prt * m_speciesMolarVolume[k];
413  }
414 }
415 
416 void IdealSolidSolnPhase::getEntropy_R(doublereal* sr) const
417 {
418  const vector_fp& _s = entropy_R_ref();
419  copy(_s.begin(), _s.end(), sr);
420 }
421 
422 void IdealSolidSolnPhase::getIntEnergy_RT(doublereal* urt) const
423 {
424  const vector_fp& _h = enthalpy_RT_ref();
425  doublereal prefrt = m_Pref / (GasConstant * temperature());
426  for (size_t k = 0; k < m_kk; k++) {
427  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
428  }
429 }
430 
431 void IdealSolidSolnPhase::getCp_R(doublereal* cpr) const
432 {
433  const vector_fp& _cpr = cp_R_ref();
434  copy(_cpr.begin(), _cpr.end(), cpr);
435 }
436 
437 void IdealSolidSolnPhase::getStandardVolumes(doublereal* vol) const
438 {
439  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), vol);
440 }
441 
442 /*********************************************************************
443  * Thermodynamic Values for the Species Reference States
444  *********************************************************************/
445 
446 void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal* hrt) const
447 {
448  _updateThermo();
449  for (size_t k = 0; k != m_kk; k++) {
450  hrt[k] = m_h0_RT[k];
451  }
452 }
453 
454 void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const
455 {
456  _updateThermo();
457  for (size_t k = 0; k != m_kk; k++) {
458  grt[k] = m_g0_RT[k];
459  }
460 }
461 
462 void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const
463 {
464  _updateThermo();
465  double tmp = GasConstant * temperature();
466  for (size_t k = 0; k != m_kk; k++) {
467  g[k] = tmp * m_g0_RT[k];
468  }
469 }
470 
471 void IdealSolidSolnPhase::getIntEnergy_RT_ref(doublereal* urt) const
472 {
473  const vector_fp& _h = enthalpy_RT_ref();
474  doublereal prefrt = m_Pref / (GasConstant * temperature());
475  for (size_t k = 0; k < m_kk; k++) {
476  urt[k] = _h[k] - prefrt * m_speciesMolarVolume[k];
477  }
478 }
479 
480 void IdealSolidSolnPhase::getEntropy_R_ref(doublereal* er) const
481 {
482  _updateThermo();
483  for (size_t k = 0; k != m_kk; k++) {
484  er[k] = m_s0_R[k];
485  }
486 }
487 
488 void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const
489 {
490  _updateThermo();
491  for (size_t k = 0; k != m_kk; k++) {
492  cpr[k] = m_cp0_R[k];
493  }
494 }
495 
497 {
498  _updateThermo();
499  return m_h0_RT;
500 }
501 
503 {
504  _updateThermo();
505  return m_s0_R;
506 }
507 
508 /*********************************************************************
509  * Utility Functions
510  *********************************************************************/
511 
512 void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
513 {
514  if (id_.size() > 0) {
515  if (phaseNode.id() != id_) {
516  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
517  "phasenode and Id are incompatible");
518  }
519  }
520 
521  /*
522  * Check on the thermo field. Must have:
523  * <thermo model="IdealSolidSolution" />
524  */
525  if (phaseNode.hasChild("thermo")) {
526  XML_Node& thNode = phaseNode.child("thermo");
527  string mString = thNode.attrib("model");
528  if (lowercase(mString) != "idealsolidsolution") {
529  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
530  "Unknown thermo model: " + mString);
531  }
532  } else {
533  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
534  "Unspecified thermo model");
535  }
536 
537  /*
538  * Form of the standard concentrations. Must have one of:
539  *
540  * <standardConc model="unity" />
541  * <standardConc model="molar_volume" />
542  * <standardConc model="solvent_volume" />
543  */
544  if (phaseNode.hasChild("standardConc")) {
545  XML_Node& scNode = phaseNode.child("standardConc");
546  string formStringa = scNode.attrib("model");
547  string formString = lowercase(formStringa);
548  if (formString == "unity") {
549  m_formGC = 0;
550  } else if (formString == "molar_volume") {
551  m_formGC = 1;
552  } else if (formString == "solvent_volume") {
553  m_formGC = 2;
554  } else {
555  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
556  "Unknown standardConc model: " + formStringa);
557  }
558  } else {
559  throw CanteraError("IdealSolidSolnPhase::initThermoXML",
560  "Unspecified standardConc model");
561  }
562 
563  /*
564  * Initialize all of the lengths now that we know how many species
565  * there are in the phase.
566  */
567  initLengths();
568  /*
569  * Now go get the molar volumes
570  */
571  XML_Node& speciesList = phaseNode.child("speciesArray");
572  XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
573  &phaseNode.root());
574 
575  for (size_t k = 0; k < m_kk; k++) {
576  XML_Node* s = speciesDB->findByAttr("name", speciesName(k));
577  XML_Node* ss = s->findByName("standardState");
578  m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI");
579  }
580 
581  /*
582  * Call the base initThermo, which handles setting the initial
583  * state.
584  */
585  ThermoPhase::initThermoXML(phaseNode, id_);
586 }
587 
589 {
590  /*
591  * Obtain the reference pressure by calling the ThermoPhase
592  * function refPressure, which in turn calls the
593  * species thermo reference pressure function of the
594  * same name.
595  */
596  m_Pref = refPressure();
597 
598  m_h0_RT.resize(m_kk);
599  m_g0_RT.resize(m_kk);
600  m_expg0_RT.resize(m_kk);
601  m_cp0_R.resize(m_kk);
602  m_s0_R.resize(m_kk);
603  m_pe.resize(m_kk, 0.0);
604  m_pp.resize(m_kk);
605  m_speciesMolarVolume.resize(m_kk);
606 }
607 
608 void IdealSolidSolnPhase::setToEquilState(const doublereal* lambda_RT)
609 {
610  const vector_fp& grt = gibbs_RT_ref();
611 
612  // set the pressure and composition to be consistent with
613  // the temperature,
614  doublereal pres = 0.0;
615  for (size_t k = 0; k < m_kk; k++) {
616  m_pp[k] = -grt[k];
617  for (size_t m = 0; m < nElements(); m++) {
618  m_pp[k] += nAtoms(k,m)*lambda_RT[m];
619  }
620  m_pp[k] = m_Pref * exp(m_pp[k]);
621  pres += m_pp[k];
622  }
623  setState_PX(pres, &m_pp[0]);
624 }
625 
627 {
628  return m_speciesMolarVolume[k];
629 }
630 
632 {
633  copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
634 }
635 
637 {
638  doublereal tnow = temperature();
639  if (m_tlast != tnow) {
640  /*
641  * Update the thermodynamic functions of the reference state.
642  */
644  DATA_PTR(m_s0_R));
645  m_tlast = tnow;
646  doublereal rrt = 1.0 / (GasConstant * tnow);
647  for (size_t k = 0; k < m_kk; k++) {
648  double deltaE = rrt * m_pe[k];
649  m_h0_RT[k] += deltaE;
650  m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
651  }
652  m_tlast = tnow;
653  }
654 }
655 
656 } // end namespace Cantera
void _updateThermo() const
This function gets called for every call to functions in this class.
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
Definition: Phase.cpp:243
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
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:704
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:608
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
Definition: xml.cpp:1108
size_t nElements() const
Number of elements.
Definition: Phase.cpp:167
const doublereal OneAtm
One atmosphere [Pa].
Definition: ct_defs.h:69
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P ...
vector_fp m_pp
Temporary array used in equilibrium calculations.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:527
void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
doublereal _RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:936
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
Definition: ThermoPhase.cpp:60
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions, but don't normalize them to one.
virtual doublereal referenceConcentration(int k) const
The reference (ie standard) concentration used to normalize the generalized concentration.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
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:100
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:78
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:663
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
Definition: stringUtils.cpp:73
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions, and normalize them to one.
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:1656
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definition: xml.cpp:573
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:687
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:742
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty ThermoPhase object.
int m_formGC
Format for the generalized concentrations.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual int eosType() const
Equation of state flag.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
doublereal sum_xlogx() const
Evaluate .
Definition: Phase.cpp:703
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
doublereal m_Pref
Value of the reference pressure for all species in this phase.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
virtual void setConcentrations(const doublereal *const conc)
Set the concentrations to the specified values within the phase.
Definition: Phase.cpp:614
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
Definition: Phase.cpp:331
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:563
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 setToEquilState(const doublereal *lambda_RT)
Set mixture to an equilibrium state consistent with specified element potentials and the temperature...
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Definition: utilities.h:135
virtual doublereal logStandardConc(size_t k) const
Returns the log of the standard concentration of the kth species.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:150
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
Definition: Phase.cpp:404
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
Definition: Phase.cpp:561
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual void setMolarDensity(const doublereal rho)
Overwritten setMolarDensity() function is necessary because the density is not an independent variabl...
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
Definition: Phase.h:586
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 void setConcentrations(const doublereal *const c)
Set the concentration,.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
std::string id() const
Return the id attribute, if present.
Definition: xml.cpp:448
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
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...
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
void initLengths()
This internal function adjusts the lengths of arrays.
Templates for operations on vector-like objects.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:158
virtual void setDensity(const doublereal rho)
Overwritten setDensity() function is necessary because the density is not an independent variable...
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:669
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:194
virtual doublereal pressure() const
Pressure.
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...
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
Definition: ct_defs.h:36
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
Definition: Phase.cpp:390
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
size_t m_kk
Number of species in the phase.
Definition: Phase.h:843
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const =0
Compute the reference-state properties for all species.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
vector_fp m_pe
Vector of potential energies for the species.
XML_Node & root() const
Return the root of the current XML_Node tree.
Definition: xml.cpp:1095
IdealSolidSolnPhase & operator=(const IdealSolidSolnPhase &)
Assignment operator.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and general concentrations Note they have the same units...
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions, but don't normalize them to one.
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1607
virtual ThermoPhase * duplMyselfAsThermoPhase() const
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:272
const doublereal * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
Definition: Phase.cpp:577
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
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
Definition: Phase.h:623
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure 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.