20MaskellSolidSolnPhase::MaskellSolidSolnPhase()
22 warn_deprecated(
"class MaskellSolidSolnPhase",
"To be removed after Cantera 3.0");
28 for (
size_t sp = 0; sp <
m_kk; ++sp) {
39 const double fmval = fm(r);
45 return x * std::log(x);
52 const double fmval = fm(r);
53 const double rfm = r * fmval;
54 return s0 +
GasConstant * (xlogx(1-rfm) - xlogx(rfm) - xlogx(1-r-rfm) - xlogx((1-fmval)*r) - xlogx(1-r) - xlogx(r));
63 vector<double> moleFracs(
m_kk);
66 for (
size_t i = 0; i <
m_kk; i++) {
67 vtotal += vbar[i] * moleFracs[i];
84 cached.
value.resize(2);
87 const double pval = p(r);
88 const double rfm = r * fm(r);
89 const double A = (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval)) /
90 (std::pow(1 - r - rfm, 1 + pval) * (1 - r));
93 cached.
value[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B);
95 std::copy(cached.
value.begin(), cached.
value.end(), ac);
101 const double pval = p(r);
102 const double rfm = r * fm(r);
103 const double DgbarDr = pval *
h_mixing +
105 std::log( (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval) * r) /
106 (std::pow(1 - r - rfm, 1 + pval) * (1 - r)) );
108 mu[reactant_species_index] =
RT() *
m_g0_RT[reactant_species_index] - DgbarDr;
114 "To be removed after Cantera 3.0. Use getChemPotentials instead.");
116 for (
size_t sp=0; sp <
m_kk; ++sp) {
117 mu[sp] *= 1.0 /
RT();
145 for (
size_t sp=0; sp <
m_kk; ++sp) {
171 phaseNode[
"excess-enthalpy"].setQuantity(
h_mixing,
"J/kmol");
179 throw CanteraError(
"MaskellSolidSolnPhase::setProductSpecies",
180 "Species '{}' not found",
name);
185double MaskellSolidSolnPhase::s()
const
190double MaskellSolidSolnPhase::fm(
const double r)
const
192 return (1 - std::sqrt(1 - 4*r*(1-r)/s())) / (2*r);
195double MaskellSolidSolnPhase::p(
const double r)
const
197 const double sval = s();
198 return (1 - 2*r) / std::sqrt(sval*sval - 4 * sval * r + 4 * sval * r * r);
Header file for a solid solution model following Maskell, Shaw, and Tye.
A map of string keys to values whose type can vary at runtime.
bool empty() const
Return boolean indicating whether AnyMap is empty.
double convert(const string &key, const string &units) const
Convert the item stored by the given key to the units specified in units.
Base class for exceptions thrown by Cantera classes.
double enthalpy_mole() const override
Molar enthalpy. Units: J/kmol.
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 pressure() const override
Pressure.
double h_mixing
Value of the enthalpy change on mixing due to protons changing from type B to type A configurations.
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 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 pressure at constant temperature.
void getPartialMolarVolumes(double *vbar) const override
Return an array of partial molar volumes for the species in the mixture.
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.
int product_species_index
Index of the species whose mole fraction defines the extent of reduction r.
double entropy_mole() const override
Molar entropy. Units: J/kmol/K.
void calcDensity() override
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
void getPartialMolarCp(double *cpbar) const override
Return an array of partial molar heat capacities for the species in the mixture.
void setProductSpecies(const string &name)
Set the product Species. Must be called after species have been added.
void getChemPotentials_RT(double *mu) const override
void getActivityCoefficients(double *ac) const override
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
double m_Pcurrent
m_Pcurrent = The current pressure.
An error indicating that an unimplemented function has been called.
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
ValueCache m_cache
Cached for saved calculations within each ThermoPhase.
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)
string speciesName(size_t k) const
Name of the species with index k.
void getMoleFractions(double *const x) const
Get the species mole fraction vector.
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.
int stateMFNumber() const
Return the State Mole Fraction Number.
double mean_X(const double *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
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.
AnyMap m_input
Data supplied via setParameters.
vector< double > m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast and P = p_ref.
vector< double > m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast and P = p_ref.
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
vector< double > m_s0_R
Vector containing the species reference entropies at T = m_tlast and P = p_ref.
void getStandardVolumes(double *vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
CachedArray getArray(int id)
Get a reference to a CachedValue object representing an array (vector<double>) with the given id.
int getId()
Get a unique id for a cached value.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Contains declarations for string manipulation functions within Cantera.
A cached property value and the state at which it was evaluated.
T value
The value of the cached property.
bool validate(double state1New)
Check whether the currently cached value is valid based on a single state variable.