37 return RT() *
mean_X(enthalpy_RT_ref()) +
86 for (
size_t k = 0; k <
m_kk; k++) {
105 for (
size_t k = 0; k <
m_kk; k++) {
107 mu[k] =
RT() * (g_RT[k] + log(xx))
115 scale(_h.begin(), _h.end(), hbar,
RT());
121 for (
size_t k = 0; k <
m_kk; k++) {
130 for (
size_t k = 0; k <
m_kk; k++) {
143 scale(gibbsrt.begin(), gibbsrt.end(), mu0,
RT());
150 for (
size_t k = 0; k <
m_kk; k++) {
159 for (
size_t k = 0; k <
m_kk; k++) {
167 std::copy(_s.begin(), _s.end(), sr);
174 for (
size_t k = 0; k <
m_kk; k++) {
182 for (
size_t k = 0; k <
m_kk; k++) {
190 std::copy(_cpr.begin(), _cpr.end(), cpr);
198const vector_fp& LatticePhase::enthalpy_RT_ref()
const
213 for (
size_t k = 0; k <
m_kk; k++) {
242 if (spec->input.hasKey(
"equation-of-state")) {
243 auto& eos = spec->input[
"equation-of-state"].getMapWhere(
244 "model",
"constant-volume");
245 if (eos.hasKey(
"density")) {
247 }
else if (eos.hasKey(
"molar-density")) {
248 mv = 1.0 / eos.convert(
"molar-density",
"kmol/m^3");
249 }
else if (eos.hasKey(
"molar-volume")) {
250 mv = eos.convert(
"molar-volume",
"m^3/kmol");
252 }
else if (spec->input.hasKey(
"molar_volume")) {
254 mv = spec->input[
"molar_volume"].asDouble();
264 for (
size_t k = 0; k <
m_kk; k++) {
269 auto& eos =
species(k)->input[
"equation-of-state"].getMapWhere(
270 "model",
"constant-volume");
271 if (eos.hasKey(
"molar-volume") || eos.hasKey(
"density")
272 || eos.hasKey(
"molar-density")) {
286 for (
size_t k = 0; k <
m_kk; k++) {
303 phaseNode[
"site-density"].setQuantity(
m_site_density,
"kmol/m^3");
307 AnyMap& speciesNode)
const
313 if (S->input.hasKey(
"equation-of-state")) {
314 auto& eosIn = S->input[
"equation-of-state"].getMapWhere(
315 "model",
"constant-volume");
316 auto& eosOut = speciesNode[
"equation-of-state"].getMapWhere(
317 "model",
"constant-volume",
true);
319 if (eosIn.hasKey(
"density")) {
320 eosOut[
"model"] =
"constant-volume";
321 eosOut[
"density"].setQuantity(
323 }
else if (eosIn.hasKey(
"molar-density")) {
324 eosOut[
"model"] =
"constant-volume";
327 }
else if (eosIn.hasKey(
"molar-volume")) {
328 eosOut[
"model"] =
"constant-volume";
332 }
else if (S->input.hasKey(
"molar_volume")) {
334 auto& eosOut = speciesNode[
"equation-of-state"].getMapWhere(
335 "model",
"constant-volume",
true);
336 eosOut[
"model"] =
"constant-volume";
345 eosdata.
_require(
"model",
"Lattice");
Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase,...
Declaration for class Cantera::Species.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
A map of string keys to values whose type can vary at runtime.
double convert(const std::string &key, const std::string &units) const
Convert the item stored by the given key to the units specified in units.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
vector_fp m_g0_RT
Temporary storage for the reference state Gibbs energies.
vector_fp m_cp0_R
Temporary storage for the reference state heat capacities.
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution 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 ...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
vector_fp m_h0_RT
Reference state enthalpies / RT.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual doublereal enthalpy_mole() const
Return the Molar Enthalpy. Units: J/kmol.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
doublereal calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
vector_fp m_s0_R
Temporary storage for the reference state entropies at the current temperature.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume of the solution.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
const vector_fp & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
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 getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the species standard states at the current T an...
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
virtual doublereal entropy_mole() const
Molar entropy of the solution. Units: J/kmol/K.
const vector_fp & entropy_R_ref() const
Returns a reference to the dimensionless reference state Entropy vector.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the dimensionless reference state Gibbs free energy vector.
void setSiteDensity(double sitedens)
Set the density of lattice sites [kmol/m^3].
doublereal m_Pcurrent
The current pressure.
virtual doublereal pressure() const
Pressure. Units: Pa.
virtual Units standardConcentrationUnits() const
The activity of a species in solution is related to the chemical potential by.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
LatticePhase(const std::string &inputFile="", const std::string &id="")
Full constructor for a lattice phase.
void _updateThermo() const
Update the species reference state thermodynamic functions.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
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...
doublereal m_Pref
Reference state pressure.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species standard states at their standard states at...
doublereal m_site_density
Site Density of the lattice solid.
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.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
double molarDensity() const
Molar density (kmol/m^3).
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
std::string name() const
Return the name of the phase.
size_t m_kk
Number of species in the phase.
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
void getMoleFractions(double *const x) const
Get the species mole fraction vector.
double moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
doublereal temperature() const
Temperature (K).
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
shared_ptr< Species > species(const std::string &name) const
Return the Species object for the named species.
doublereal sum_xlogx() const
Evaluate .
virtual bool addSpecies(shared_ptr< Species > spec)
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
doublereal m_tlast
last value of the temperature processed by reference state
void initThermoFile(const std::string &inputFile, const std::string &id)
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
AnyMap m_input
Data supplied via setParameters.
const AnyMap & input() const
Access input data associated with the phase description.
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
A representation of the units associated with a dimensional quantity.
Class XML_Node is a tree-based representation of the contents of an XML file.
void _require(const std::string &a, const std::string &v) const
Require that the current XML node has an attribute named by the first argument, a,...
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type="")
Get a floating-point value from a child element.
const double OneAtm
One atmosphere [Pa].
const double SmallNumber
smallest number to compare to zero.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...