28 return RT() *
mean_X(enthalpy_RT_ref()) +
77 for (
size_t k = 0; k <
m_kk; k++) {
96 for (
size_t k = 0; k <
m_kk; k++) {
98 mu[k] =
RT() * (g_RT[k] + log(xx))
105 const vector<double>& _h = enthalpy_RT_ref();
106 scale(_h.begin(), _h.end(), hbar,
RT());
112 for (
size_t k = 0; k <
m_kk; k++) {
121 for (
size_t k = 0; k <
m_kk; k++) {
134 scale(gibbsrt.begin(), gibbsrt.end(), mu0,
RT());
141 for (
size_t k = 0; k <
m_kk; k++) {
148 const vector<double>& _h = enthalpy_RT_ref();
150 for (
size_t k = 0; k <
m_kk; k++) {
158 std::copy(_s.begin(), _s.end(), sr);
165 for (
size_t k = 0; k <
m_kk; k++) {
173 for (
size_t k = 0; k <
m_kk; k++) {
180 const vector<double>& _cpr =
cp_R_ref();
181 std::copy(_cpr.begin(), _cpr.end(), cpr);
189 const vector<double>& LatticePhase::enthalpy_RT_ref()
const
204 for (
size_t k = 0; k <
m_kk; k++) {
233 if (spec->input.hasKey(
"equation-of-state")) {
234 auto& eos = spec->input[
"equation-of-state"].getMapWhere(
235 "model",
"constant-volume");
236 if (eos.hasKey(
"density")) {
238 }
else if (eos.hasKey(
"molar-density")) {
239 mv = 1.0 / eos.convert(
"molar-density",
"kmol/m^3");
240 }
else if (eos.hasKey(
"molar-volume")) {
241 mv = eos.convert(
"molar-volume",
"m^3/kmol");
252 for (
size_t k = 0; k <
m_kk; k++) {
254 auto& eos =
species(k)->input[
"equation-of-state"].getMapWhere(
255 "model",
"constant-volume");
256 if (eos.hasKey(
"molar-volume") || eos.hasKey(
"density")
257 || eos.hasKey(
"molar-density")) {
271 for (
size_t k = 0; k <
m_kk; k++) {
288 phaseNode[
"site-density"].setQuantity(
m_site_density,
"kmol/m^3");
297 if (S->input.hasKey(
"equation-of-state")) {
298 auto& eosIn = S->input[
"equation-of-state"].getMapWhere(
299 "model",
"constant-volume");
300 auto& eosOut = speciesNode[
"equation-of-state"].getMapWhere(
301 "model",
"constant-volume",
true);
303 if (eosIn.hasKey(
"density")) {
304 eosOut[
"model"] =
"constant-volume";
305 eosOut[
"density"].setQuantity(
307 }
else if (eosIn.hasKey(
"molar-density")) {
308 eosOut[
"model"] =
"constant-volume";
311 }
else if (eosIn.hasKey(
"molar-volume")) {
312 eosOut[
"model"] =
"constant-volume";
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.
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
double convert(const string &key, const string &units) const
Convert the item stored by the given key to the units specified in units.
const vector< double > & entropy_R_ref() const
Returns a reference to the dimensionless reference state Entropy vector.
double enthalpy_mole() const override
Return the Molar Enthalpy. Units: J/kmol.
double logStandardConc(size_t k=0) const override
Natural logarithm of the standard concentration of the kth species.
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
double m_site_density
Site Density of the lattice solid.
double pressure() const override
Pressure. Units: Pa.
vector< double > m_g0_RT
Temporary storage for the reference state Gibbs energies.
void getSpeciesParameters(const string &name, AnyMap &speciesNode) const override
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the species standard states at the current T an...
vector< double > m_h0_RT
Reference state enthalpies / RT.
void getGibbs_ref(double *g) const override
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
double m_Pref
Reference state pressure.
void getStandardChemPotentials(double *mu) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
void getCp_R(double *cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
void getActivityConcentrations(double *c) const override
This method returns an array of generalized concentrations.
void setPressure(double p) override
Set the internally stored pressure (Pa) at constant temperature and composition.
const vector< double > & gibbs_RT_ref() const
Returns a reference to the dimensionless reference state Gibbs free energy vector.
void getPartialMolarVolumes(double *vbar) const override
Return an array of partial molar volumes for the species in the mixture.
double cv_mole() const override
Molar heat capacity at constant volume of the solution.
void getPureGibbs(double *gpure) const override
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species standard states at their standard states at...
vector< double > m_s0_R
Temporary storage for the reference state entropies at the current temperature.
void getGibbs_RT(double *grt) const override
Get the nondimensional Gibbs functions for the species standard states at the current T and P of the ...
double entropy_mole() const override
Molar entropy of the solution. Units: J/kmol/K.
void setSiteDensity(double sitedens)
Set the density of lattice sites [kmol/m^3].
vector< double > m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
void getStandardVolumes(double *vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
double cp_mole() const override
Molar heat capacity at constant pressure of the solution.
Units standardConcentrationUnits() const override
Returns the units of the "standard concentration" for this phase.
void getPartialMolarCp(double *cpbar) const override
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
void compositionChanged() override
Apply changes to the state which are needed after the composition changes.
double standardConcentration(size_t k=0) const override
Return the standard concentration for the kth species.
vector< double > m_cp0_R
Temporary storage for the reference state heat capacities.
double calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void _updateThermo() const
Update the species reference state thermodynamic functions.
void getGibbs_RT_ref(double *grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
void getActivityCoefficients(double *ac) const override
Get the array of non-dimensional activity coefficients at the current solution temperature,...
LatticePhase(const string &inputFile="", const string &id="")
Full constructor for a lattice phase.
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
const vector< double > & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
double m_Pcurrent
The current pressure.
virtual void update(double T, double *cp_R, double *h_RT, double *s_R) const
Compute the reference-state properties for all species.
virtual 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.
size_t m_kk
Number of species in the phase.
double temperature() const
Temperature (K).
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
void getMoleFractions(double *const x) const
Get the species mole fraction vector.
double sum_xlogx() const
Evaluate .
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
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.
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
double molecularWeight(size_t k) const
Molecular weight of species k.
shared_ptr< Species > species(const string &name) const
Return the Species object for the named species.
string name() const
Return the name of the phase.
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
double RT() const
Return the Gas Constant multiplied by the current temperature.
double m_tlast
last value of the temperature processed by reference state
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
virtual void getSpeciesParameters(const string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual double refPressure() const
Returns the reference pressure in Pa.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
AnyMap m_input
Data supplied via setParameters.
const AnyMap & input() const
Access input data associated with the phase description.
A representation of the units associated with a dimensional quantity.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
const double SmallNumber
smallest number to compare to zero.
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...