Cantera  2.1.2
LatticeSolidPhase.cpp
Go to the documentation of this file.
1 /**
2  * @file LatticeSolidPhase.cpp
3  * Definitions for a simple thermodynamics model of a bulk solid phase
4  * derived from ThermoPhase,
5  * assuming an ideal solution model based on a lattice of solid atoms
6  * (see \ref thermoprops and class \link Cantera::LatticeSolidPhase LatticeSolidPhase\endlink).
7  */
8 
9 #include "cantera/base/ct_defs.h"
17 
18 using namespace std;
19 
20 namespace Cantera
21 {
22 LatticeSolidPhase::LatticeSolidPhase() :
23  m_tlast(0.0),
24  m_press(-1.0),
25  m_molar_density(0.0),
26  m_nlattice(0),
27  m_lattice(0),
28  m_x(0),
29  theta_(0),
30  tmpV_(0)
31 {
32 }
33 
35  m_tlast(0.0),
36  m_press(-1.0),
37  m_molar_density(0.0),
38  m_nlattice(0),
39  m_lattice(0),
40  m_x(0),
41  theta_(0),
42  tmpV_(0)
43 {
44  *this = operator=(right);
45 }
46 
49 {
50  if (&right != this) {
52  m_tlast = right.m_tlast;
53  m_press = right.m_press;
55  m_nlattice = right.m_nlattice;
56  deepStdVectorPointerCopy<LatticePhase>(right.m_lattice, m_lattice);
57  m_x = right.m_x;
58  theta_ = right.theta_;
59  tmpV_ = right.tmpV_;
60  }
61  return *this;
62 }
63 
65 {
66  // We own the sublattices. So we have to delete the sublattices
67  for (size_t n = 0; n < m_nlattice; n++) {
68  delete m_lattice[n];
69  m_lattice[n] = 0;
70  }
71 }
72 
74 {
75  return new LatticeSolidPhase(*this);
76 }
77 
78 doublereal LatticeSolidPhase::minTemp(size_t k) const
79 {
80  if (k != npos) {
81  for (size_t n = 0; n < m_nlattice; n++) {
82  if (lkstart_[n+1] < k) {
83  return (m_lattice[n])->minTemp(k-lkstart_[n]);
84  }
85  }
86  }
87  doublereal mm = 1.0E300;
88  for (size_t n = 0; n < m_nlattice; n++) {
89  double ml = (m_lattice[n])->minTemp();
90  mm = std::min(mm, ml);
91  }
92  return mm;
93 }
94 
95 doublereal LatticeSolidPhase::maxTemp(size_t k) const
96 {
97  if (k != npos) {
98  for (size_t n = 0; n < m_nlattice; n++) {
99  if (lkstart_[n+1] < k) {
100  return (m_lattice[n])->maxTemp(k - lkstart_[n]);
101  }
102  }
103  }
104  doublereal mm = -1.0E300;
105  for (size_t n = 0; n < m_nlattice; n++) {
106  double ml = (m_lattice[n])->maxTemp();
107  mm = std::max(mm, ml);
108  }
109  return mm;
110 }
111 
113 {
114  return m_lattice[0]->refPressure();
115 }
116 
118 {
119  _updateThermo();
120  doublereal sum = 0.0;
121  for (size_t n = 0; n < m_nlattice; n++) {
122  sum += theta_[n] * m_lattice[n]->enthalpy_mole();
123  }
124  return sum;
125 }
126 
128 {
129  _updateThermo();
130  doublereal sum = 0.0;
131  for (size_t n = 0; n < m_nlattice; n++) {
132  sum += theta_[n] * m_lattice[n]->intEnergy_mole();
133  }
134  return sum;
135 }
136 
138 {
139  _updateThermo();
140  doublereal sum = 0.0;
141  for (size_t n = 0; n < m_nlattice; n++) {
142  sum += theta_[n] * m_lattice[n]->entropy_mole();
143  }
144  return sum;
145 }
146 
148 {
149  _updateThermo();
150  doublereal sum = 0.0;
151  for (size_t n = 0; n < m_nlattice; n++) {
152  sum += theta_[n] * m_lattice[n]->gibbs_mole();
153  }
154  return sum;
155 }
156 
157 doublereal LatticeSolidPhase::cp_mole() const
158 {
159  _updateThermo();
160  doublereal sum = 0.0;
161  for (size_t n = 0; n < m_nlattice; n++) {
162  sum += theta_[n] * m_lattice[n]->cp_mole();
163  }
164  return sum;
165 }
166 
168 {
169  _updateThermo();
170  size_t strt = 0;
171  for (size_t n = 0; n < m_nlattice; n++) {
172  m_lattice[n]->getMoleFractions(c+strt);
173  strt += m_lattice[n]->nSpecies();
174  }
175 }
176 
178 {
179  for (size_t k = 0; k < m_kk; k++) {
180  ac[k] = 1.0;
181  }
182 }
183 
185 {
186  return 1.0;
187 }
188 
189 doublereal LatticeSolidPhase::logStandardConc(size_t k) const
190 {
191  return 0.0;
192 }
193 
195 {
196  m_press = p;
197  for (size_t n = 0; n < m_nlattice; n++) {
198  m_lattice[n]->setPressure(m_press);
199  }
200  calcDensity();
201 }
202 
204 {
205  double sum = 0.0;
206  for (size_t n = 0; n < m_nlattice; n++) {
207  sum += theta_[n] * m_lattice[n]->density();
208  }
209  Phase::setDensity(sum);
210  return sum;
211 }
212 
213 void LatticeSolidPhase::setMoleFractions(const doublereal* const x)
214 {
215  size_t nsp, strt = 0;
216  for (size_t n = 0; n < m_nlattice; n++) {
217  nsp = m_lattice[n]->nSpecies();
218  m_lattice[n]->setMoleFractions(x + strt);
219  strt += nsp;
220  }
221  for (size_t k = 0; k < strt; k++) {
222  m_x[k] = x[k] / m_nlattice;
223  }
225  calcDensity();
226 }
227 
228 void LatticeSolidPhase::getMoleFractions(doublereal* const x) const
229 {
230  size_t nsp, strt = 0;
231  // the ifdef block should be the way we calculate this.!!!!!
233  doublereal sum;
234  for (size_t n = 0; n < m_nlattice; n++) {
235  nsp = m_lattice[n]->nSpecies();
236  sum = 0.0;
237  for (size_t k = 0; k < nsp; k++) {
238  sum += (x + strt)[k];
239  }
240  for (size_t k = 0; k < nsp; k++) {
241  (x + strt)[k] /= sum;
242  }
243  /*
244  * At this point we can check against the mole fraction vector of the underlying LatticePhase objects and
245  * get the same answer.
246  */
247 #ifdef DEBUG_MODE
248  m_lattice[n]->getMoleFractions(&(m_x[strt]));
249  for (size_t k = 0; k < nsp; k++) {
250  if (fabs((x + strt)[k] - m_x[strt+k]) > 1.0E-14) {
251  throw CanteraError("LatticeSolidPhase::getMoleFractions()",
252  "internal error");
253  }
254  }
255 #endif
256  strt += nsp;
257  }
258 }
259 
260 void LatticeSolidPhase::getChemPotentials(doublereal* mu) const
261 {
262  _updateThermo();
263  size_t strt = 0;
264  for (size_t n = 0; n < m_nlattice; n++) {
265  size_t nlsp = m_lattice[n]->nSpecies();
266  m_lattice[n]->getChemPotentials(mu+strt);
267  strt += nlsp;
268  }
269 }
270 
272 {
273  _updateThermo();
274  size_t strt = 0;
275  for (size_t n = 0; n < m_nlattice; n++) {
276  size_t nlsp = m_lattice[n]->nSpecies();
277  m_lattice[n]->getPartialMolarEnthalpies(hbar + strt);
278  strt += nlsp;
279  }
280 }
281 
283 {
284  _updateThermo();
285  size_t strt = 0;
286  for (size_t n = 0; n < m_nlattice; n++) {
287  size_t nlsp = m_lattice[n]->nSpecies();
288  m_lattice[n]->getPartialMolarEntropies(sbar + strt);
289  strt += nlsp;
290  }
291 }
292 
293 void LatticeSolidPhase::getPartialMolarCp(doublereal* cpbar) const
294 {
295  _updateThermo();
296  size_t strt = 0;
297  for (size_t n = 0; n < m_nlattice; n++) {
298  size_t nlsp = m_lattice[n]->nSpecies();
299  m_lattice[n]->getPartialMolarCp(cpbar + strt);
300  strt += nlsp;
301  }
302 }
303 
304 void LatticeSolidPhase::getPartialMolarVolumes(doublereal* vbar) const
305 {
306  _updateThermo();
307  size_t strt = 0;
308  for (size_t n = 0; n < m_nlattice; n++) {
309  size_t nlsp = m_lattice[n]->nSpecies();
310  m_lattice[n]->getPartialMolarVolumes(vbar + strt);
311  strt += nlsp;
312  }
313 }
314 
316 {
317  _updateThermo();
318  size_t strt = 0;
319  for (size_t n = 0; n < m_nlattice; n++) {
320  m_lattice[n]->getStandardChemPotentials(mu0+strt);
321  strt += m_lattice[n]->nSpecies();
322  }
323 }
324 
325 void LatticeSolidPhase::getGibbs_RT_ref(doublereal* grt) const
326 {
327  _updateThermo();
328  for (size_t n = 0; n < m_nlattice; n++) {
329  m_lattice[n]->getGibbs_RT_ref(grt + lkstart_[n]);
330  }
331 }
332 
333 void LatticeSolidPhase::getGibbs_ref(doublereal* g) const
334 {
335  getGibbs_RT_ref(g);
336  for (size_t k = 0; k < m_kk; k++) {
337  g[k] *= GasConstant * temperature();
338  }
339 }
340 
342 {
343  size_t kk = 0;
344  size_t kstart = 0;
346  SpeciesThermo* spthermo_ptr = new GeneralSpeciesThermo();
347  setSpeciesThermo(spthermo_ptr);
348  m_speciesData.clear();
349 
350  XML_Node& eosdata = phaseNode->child("thermo");
351  XML_Node& la = eosdata.child("LatticeArray");
352  std::vector<XML_Node*> lattices;
353  la.getChildren("phase",lattices);
354  for (size_t n = 0; n < m_nlattice; n++) {
355  LatticePhase* lp = m_lattice[n];
356  XML_Node* phaseNode_ptr = lattices[n];
357  size_t nsp = lp->nSpecies();
358  vector<doublereal> constArr(lp->nElements());
359  const vector_fp& aws = lp->atomicWeights();
360  for (size_t es = 0; es < lp->nElements(); es++) {
361  string esName = lp->elementName(es);
362  double wt = aws[es];
363  int an = lp->atomicNumber(es);
364  int e298 = lp->entropyElement298(es); //! @todo Why is this an int instead of a double?
365  int et = lp->elementType(es);
366  addUniqueElementAfterFreeze(esName, wt, an, e298, et);
367  }
368  const std::vector<const XML_Node*> & spNode = lp->speciesData();
369  kstart = kk;
370 
371 
372  for (size_t k = 0; k < nsp; k++) {
373  std::string sname = lp->speciesName(k);
374  std::map<std::string, double> comp;
375  lp->getAtoms(k, DATA_PTR(constArr));
376  size_t nel = nElements();
377  vector_fp ecomp(nel, 0.0);
378  for (size_t m = 0; m < lp->nElements(); m++) {
379  if (constArr[m] != 0.0) {
380  std::string oldEname = lp->elementName(m);
381  size_t newIndex = elementIndex(oldEname);
382  if (newIndex == npos) {
383  throw CanteraError("LatticeSolidPhase::installSlavePhases", "confused");
384  }
385  ecomp[newIndex] = constArr[m];
386  }
387  }
388  double chrg = lp->charge(k);
389  double sz = lp->size(k);
390  addUniqueSpecies(sname, &ecomp[0], chrg, sz);
391  spFactory->installThermoForSpecies(kk, *(spNode[k]), this, *m_spthermo, phaseNode_ptr);
392 
393  m_speciesData.push_back(new XML_Node(*(spNode[k])));
394  kk++;
395  }
396  /*
397  * Add in the lattice stoichiometry constraint
398  */
399  if (n > 0) {
400  string econ = "LC_";
401  econ += int2str(n);
402  econ += "_" + id();
403  size_t m = addUniqueElementAfterFreeze(econ, 0.0, 0, 0.0, CT_ELEM_TYPE_LATTICERATIO);
404  size_t mm = nElements();
405  LatticePhase* lp0 = m_lattice[0];
406  size_t nsp0 = lp0->nSpecies();
407  for (size_t k = 0; k < nsp0; k++) {
408  m_speciesComp[k * mm + m] = -theta_[0];
409  }
410  for (size_t k = 0; k < nsp; k++) {
411  size_t ks = kstart + k;
412  m_speciesComp[ks * mm + m] = theta_[n];
413  }
414  }
415  }
416 }
417 
419 {
420  initLengths();
421  size_t nsp, loc = 0;
422  for (size_t n = 0; n < m_nlattice; n++) {
423  nsp = m_lattice[n]->nSpecies();
424  lkstart_[n] = loc;
425  for (size_t k = 0; k < nsp; k++) {
426  m_x[loc] =m_lattice[n]->moleFraction(k) / (double) m_nlattice;
427  loc++;
428  }
429  lkstart_[n+1] = loc;
430  }
433 }
434 
436 {
437  theta_.resize(m_nlattice,0);
438  lkstart_.resize(m_nlattice+1);
439  m_x.resize(m_kk, 0.0);
440  tmpV_.resize(m_kk, 0.0);
441 }
442 
444 {
445  doublereal tnow = temperature();
446  // if (fabs(molarDensity() - m_molar_density)/m_molar_density > 0.0001) {
447  // throw CanteraError("_updateThermo","molar density changed from "
448  // +fp2str(m_molar_density)+" to "+fp2str(molarDensity()));
449  //}
450  if (m_tlast != tnow) {
452  size_t strt = 0;
453  for (size_t n = 0; n < m_nlattice; n++) {
454  m_lattice[n]->setTemperature(tnow);
455  m_lattice[n]->setMoleFractions(DATA_PTR(m_x) + strt);
456  m_lattice[n]->setPressure(m_press);
457  strt += m_lattice[n]->nSpecies();
458  }
459  m_tlast = tnow;
460  }
461 }
462 
463 void LatticeSolidPhase::setLatticeMoleFractionsByName(int nn, const std::string& x)
464 {
465  m_lattice[nn]->setMoleFractionsByName(x);
466  size_t loc = 0;
467  doublereal ndens;
468  for (size_t n = 0; n < m_nlattice; n++) {
469  size_t nsp = m_lattice[n]->nSpecies();
470  ndens = m_lattice[n]->molarDensity();
471  for (size_t k = 0; k < nsp; k++) {
472  m_x[loc] = ndens * m_lattice[n]->moleFraction(k);
473  loc++;
474  }
475  }
477 }
478 
480 {
481  eosdata._require("model","LatticeSolid");
482  XML_Node& la = eosdata.child("LatticeArray");
483  std::vector<XML_Node*> lattices;
484  la.getChildren("phase",lattices);
485  size_t nl = lattices.size();
486  m_nlattice = nl;
487  for (size_t n = 0; n < nl; n++) {
488  XML_Node& i = *lattices[n];
489  m_lattice.push_back((LatticePhase*)newPhase(i));
490  }
491  std::vector<string> pnam;
492  std::vector<string> pval;
493  XML_Node& ls = eosdata.child("LatticeStoichiometry");
494  int np = ctml::getPairs(ls, pnam, pval);
495  theta_.resize(nl);
496  for (int i = 0; i < np; i++) {
497  double val = fpValueCheck(pval[i]);
498  bool found = false;
499  for (size_t j = 0; j < nl; j++) {
500  ThermoPhase& tp = *(m_lattice[j]);
501  string idj = tp.id();
502  if (idj == pnam[i]) {
503  theta_[j] = val;
504  found = true;
505  break;
506  }
507  }
508  if (!found) {
509  throw CanteraError("", "not found");
510  }
511  }
512 
513 }
514 
515 #ifdef H298MODIFY_CAPABILITY
516 void LatticeSolidPhase::modifyOneHf298SS(const size_t& k, const doublereal Hf298New)
517 {
518  for (size_t n = 0; n < m_nlattice; n++) {
519  if (lkstart_[n+1] < k) {
520  size_t kk = k-lkstart_[n];
521  SpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo();
522  l_spthermo.modifyOneHf298(kk, Hf298New);
523  }
524  }
525  m_tlast += 0.0001234;
526  _updateThermo();
527 }
528 #endif
529 
530 doublereal LatticeSolidPhase::err(const std::string& msg) const
531 {
532  throw CanteraError("LatticeSolidPhase","Unimplemented " + msg);
533  return 0.0;
534 }
535 
536 } // End namespace Cantera
Factory to build instances of classes that manage the standard-state thermodynamic properties of a se...
ThermoPhase * newPhase(XML_Node &xmlphase)
Create a new ThermoPhase object and initializes it according to the XML tree.
void _require(const std::string &a, const std::string &v) const
Require that the current xml node have an attribute named by the first argument, a, and that this attribute have the the string value listed in the second argument, v.
Definition: xml.cpp:614
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
Definition: stringUtils.cpp:40
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
std::vector< LatticePhase * > m_lattice
Vector of sublattic ThermoPhase objects.
virtual void installSlavePhases(Cantera::XML_Node *phaseNode)
Add in species from Slave phases.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
size_t nElements() const
Number of elements.
Definition: Phase.cpp:139
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
Definition: ThermoPhase.h:1635
doublereal calcDensity()
Calculate the density of the solid mixture.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:173
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
Definition: ThermoPhase.cpp:57
LatticeSolidPhase & operator=(const LatticeSolidPhase &right)
Assignment operator.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
LatticeSolidPhase()
Base empty constructor.
static SpeciesThermoFactory * factory()
Static method to return an instance of this class.
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New)
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) ...
Definition: ThermoPhase.h:227
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values, and then normalize them so that they sum to 1...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual doublereal cp_mole() const
Return the constant pressure heat capacity. Units: J/kmol/K.
doublereal size(size_t k) const
This routine returns the size of species k.
Definition: Phase.h:398
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
virtual ~LatticeSolidPhase()
Destructor.
A simple thermodynamic model for a bulk phase, assuming a lattice of solid atoms. ...
Definition: LatticePhase.h:246
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
Definition: Phase.cpp:519
void installThermoForSpecies(size_t k, const XML_Node &speciesNode, ThermoPhase *th_ptr, SpeciesThermo &spthermo, const XML_Node *phaseNode_ptr=0) const
Install a species thermodynamic property parameterization for the reference state for one species int...
Pure Virtual base class for the species thermo manager classes.
doublereal m_tlast
Last temperature at which the reference thermo was calculated.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definition: xml.cpp:584
doublereal entropyElement298(size_t m) const
Entropy of the element in its standard state at 298 K and 1 bar.
Definition: Phase.cpp:184
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
void _updateThermo() const
Update the reference thermodynamic functions.
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of standard state chemical potentials at unit activity for the species at their standar...
const vector_fp & atomicWeights() const
Return a read-only reference to the vector of atomic weights.
Definition: Phase.cpp:193
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the gibbs function of the reference state at the current temperatureof the solu...
A species thermodynamic property manager for a phase.
void getAtoms(size_t k, double *atomArray) const
Get a vector containing the atomic composition of species k.
Definition: Phase.cpp:222
Header for a simple thermodynamics model of a bulk solid phase derived from ThermoPhase, assuming an ideal solution model based on a lattice of solid atoms (see Thermodynamic Properties and class LatticeSolidPhase).
void initLengths()
Initialize vectors that depend on the number of species and sublattices.
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
doublereal m_molar_density
Current value of the molar density.
int atomicNumber(size_t m) const
Atomic number of element m.
Definition: Phase.cpp:198
vector_fp tmpV_
Temporary vector.
doublereal err(const std::string &msg) const
error routine
std::string id() const
Return the string id for the phase.
Definition: Phase.cpp:119
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:68
int getPairs(const Cantera::XML_Node &node, std::vector< std::string > &key, std::vector< std::string > &val)
This function interprets the value portion of an XML element as a series of "Pairs" separated by whit...
Definition: ctml.cpp:527
doublereal m_press
Current value of the pressure.
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:306
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual doublereal intEnergy_mole() const
Return the Molar Internal Energy. Units: J/kmol.
void setLatticeMoleFractionsByName(int n, const std::string &x)
Set the Lattice mole fractions using a string.
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:252
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
vector_fp m_x
Vector of mole fractions.
Header for factory to build instances of classes that manage the standard-state thermodynamic propert...
Headers for a completely general species thermodynamic property manager for a phase (see Managers for...
std::vector< doublereal > theta_
Lattice stoichiometric coefficients.
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:165
size_t elementIndex(const std::string &name) const
Return the index of element named 'name'.
Definition: Phase.cpp:164
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized activity concentrations.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
A phase that is comprised of a fixed additive combination of other lattice phases.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:66
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
Definition: ct_defs.h:36
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
virtual doublereal entropy_mole() const
Return the Molar Entropy. Units: J/kmol/K.
std::string elementName(size_t m) const
Name of the element with index m.
Definition: Phase.cpp:158
int elementType(size_t m) const
Return the element constraint type Possible types include:
Definition: Phase.cpp:203
vector_fp m_speciesComp
Atomic composition of the species.
Definition: Phase.h:725
#define CT_ELEM_TYPE_LATTICERATIO
Constraint associated with maintaining a fixed lattice stoichiometry in a solid.
Definition: Elements.h:54
size_t m_kk
Number of species in the phase.
Definition: Phase.h:716
size_t addUniqueElementAfterFreeze(const std::string &symbol, doublereal weight, int atomicNumber, doublereal entropy298=ENTROPY298_UNKNOWN, int elem_type=CT_ELEM_TYPE_ABSPOS)
Add an element after elements have been frozen, checking for uniqueness The uniqueness is checked by ...
Definition: Phase.cpp:806
void setSpeciesThermo(SpeciesThermo *spthermo)
Install a species thermodynamic property manager.
size_t m_nlattice
Number of sublattice phases.
virtual void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
virtual doublereal enthalpy_mole() const
Return the Molar Enthalpy. Units: J/kmol.
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.
virtual doublereal gibbs_mole() const
Return the Molar Gibbs energy. Units: J/kmol.
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1625
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:246
void addUniqueSpecies(const std::string &name, const doublereal *comp, doublereal charge=0.0, doublereal size=1.0)
Add a species to the phase, checking for uniqueness of the name This routine checks for uniqueness of...
Definition: Phase.cpp:884
Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase, assuming a lattice of solid atoms (see Thermodynamic Properties and class LatticePhase).
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
void getChildren(const std::string &name, std::vector< XML_Node * > &children) const
Get a vector of pointers to XML_Node containing all of the children of the current node which matches...
Definition: xml.cpp:916
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:549
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:504