10 #include "cantera/base/config.h"
25 m_speciesMolarVolume(0),
34 m_speciesMolarVolume(0),
172 for (
size_t k = 0; k <
m_kk; k++) {
193 for (
size_t k = 0; k <
m_kk; k++) {
195 mu[k] = RT * (g_RT[k] + log(xx))
205 scale(_h.begin(), _h.end(), hbar, rt);
213 for (
size_t k = 0; k <
m_kk; k++) {
215 sbar[k] = r * (_s[k] - log(xx));
222 for (
size_t k = 0; k <
m_kk; k++) {
235 scale(gibbsrt.begin(), gibbsrt.end(), mu0,
_RT());
243 for (
size_t k = 0; k <
m_kk; k++) {
252 for (
size_t k = 0; k <
m_kk; k++) {
260 std::copy(_s.begin(), _s.end(), sr);
266 doublereal RT =
_RT();
268 for (
size_t k = 0; k <
m_kk; k++) {
276 for (
size_t k = 0; k <
m_kk; k++) {
284 std::copy(_cpr.begin(), _cpr.end(), cpr);
307 for (
size_t k = 0; k <
m_kk; k++) {
339 std::string idattrib = phaseNode.
id();
340 if (!id_.empty() && id_ != idattrib) {
345 std::string subname =
"LatticePhase::initThermoXML";
352 std::string mStringa = thNode.
attrib(
"model");
353 std::string mString =
lowercase(mStringa);
354 if (mString !=
"lattice") {
356 "Unknown thermo model: " + mStringa);
360 "Unspecified thermo model");
369 for (
size_t k = 0; k <
m_kk; k++) {
373 throw CanteraError(
" LatticePhase::initThermoXML",
"database problems");
396 for (
size_t k = 0; k <
m_kk; k++) {
420 eosdata.
_require(
"model",
"Lattice");
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...
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.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
doublereal m_site_density
Site Density of the lattice solid.
doublereal m_tlast
Current value of the temperature (Kelvin)
doublereal m_Pref
Reference state pressure.
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
const doublereal OneAtm
One atmosphere [Pa].
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
virtual void getActivityConcentrations(doublereal *c) const
The activity of a species in solution is related to the chemical potential by The quantity is the ...
doublereal _RT() const
Return the Gas Constant multiplied by the current temperature.
doublereal calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
vector_fp m_g0_RT
Temporary storage for the reference state gibbs energies.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
vector_fp m_s0_R
Temporary storage for the reference state entropies at the current temperature.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species standard states at the current T and P of the ...
vector_fp m_h0_RT
Reference state enthalpies / RT.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Class XML_Node is a tree-based representation of the contents of an XML file.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters from the argument list.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
A simple thermodynamic model for a bulk phase, assuming a lattice of solid atoms. ...
doublereal molarDensity() const
Molar density (kmol/m^3).
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
virtual doublereal entropy_mole() const
Molar entropy of the solution. Units: J/kmol/K.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
std::string m_vacancy
String name for the species which represents a vacancy in the lattice.
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions, but don't normalize them to one.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
LatticePhase & operator=(const LatticePhase &right)
Assignment operator.
virtual doublereal gibbs_mole() const
Molar gibbs free energy of the solution. Units: J/kmol.
Base class for a phase with thermodynamic properties.
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...
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
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...
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty thermophase object.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution...
doublereal sum_xlogx() const
Evaluate .
doublereal m_Pcurrent
The current pressure.
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions.
vector_fp m_cp0_R
Temporary storage for the reference state heat capacities.
Base class for exceptions thrown by Cantera classes.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume of the solution.
virtual doublereal pressure() const
In this equation of state implementation, the density is a function only of the mole fractions...
virtual void setConcentrations(const doublereal *const conc)
Set the concentrations to the specified values within the phase.
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...
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
void _updateThermo() const
Update the species reference state thermodynamic functions.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the dimensionless reference state Gibbs free energy vector.
virtual void setMolarDensity(const doublereal molarDensity)
Set the internally stored molar density (kmol/m^3) of the phase.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the species standard states at the current T an...
doublereal temperature() const
Temperature (K).
std::string id() const
Return the id attribute, if present.
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.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species standard states at the current ...
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
const vector_fp & enthalpy_RT_ref() const
Returns the vector of nondimensional Enthalpies of the reference state at the current temperature of ...
virtual doublereal enthalpy_mole() const
Return the Molar Enthalpy. Units: J/kmol.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Contains declarations for string manipulation functions within Cantera.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species standard states at their standard states at...
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
const vector_fp & entropy_R_ref() const
Returns a reference to the dimensionless reference state Entropy vector.
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution. Units: J/kmol.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
virtual void setConcentrations(const doublereal *const c)
Set the concentration,.
size_t m_kk
Number of species in the phase.
const vector_fp & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
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)
XML_Node & root() const
Return the root of the current XML_Node tree.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature, pressure, and solution concentration.
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
std::string getChildValue(const Cantera::XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its xml value as the return s...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
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.
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 ...
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).
LatticePhase()
Base Empty constructor.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions, and normalize them to one.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.