46 for (
size_t k = 0; k <
m_kk; k++) {
67 for (
size_t k = 0; k <
m_kk; k++) {
76 for (
size_t k = 0; k <
m_kk; k++) {
85 for (
size_t k = 0; k <
m_kk; k++) {
108 for (
size_t k = 0; k <
m_kk; k++) {
160 for (
size_t k = 0; k <
m_kk; k++) {
191 m_cp0.push_back(0.0);
192 m_mu0.push_back(0.0);
197 vector<double> cov{1.0};
205 warn_deprecated(
"SurfPhase::setMolarDensity",
"To be removed after Cantera 3.0");
208 "The volume of an interface is zero");
216 "Site density must be positive. Got {}", n0);
226 for (
size_t k = 0; k <
m_kk; k++) {
227 sum += theta[k] /
size(k);
231 "Sum of Coverage fractions is zero or negative");
233 for (
size_t k = 0; k <
m_kk; k++) {
243 for (
size_t k = 0; k <
m_kk; k++) {
244 sum += theta[k] /
size(k);
249 "Sum of Coverage fractions is zero or negative");
251 for (
size_t k = 0; k <
m_kk; k++) {
252 m_work[k] = theta[k] * sum2 / (sum *
size(k));
260 double sum_X_s = 0.0;
262 for (
size_t k = 0; k <
m_kk; k++) {
264 sum_X_s += theta[k] *
size(k);
266 for (
size_t k = 0; k <
m_kk; k++) {
267 theta[k] *=
size(k) * sum_X / sum_X_s;
278 vector<double> cv(
m_kk, 0.0);
280 for (
size_t k = 0; k <
m_kk; k++) {
289 "Input coverages are all zero or negative");
295 if (state.
hasKey(
"coverages")) {
296 if (state[
"coverages"].is<string>()) {
314 if (
m_tlast != tnow || force) {
317 for (
size_t k = 0; k <
m_kk; k++) {
332 Units(1.0, 0, -
static_cast<double>(
m_ndim), 0, 0, 0, 1)));
339 phaseNode[
"site-density"].setQuantity(
Declarations for the EdgePhase ThermoPhase object, which models the interface between two surfaces (s...
Declaration for class Cantera::Species.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
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.
Base class for exceptions thrown by Cantera classes.
EdgePhase(const string &infile="", const string &id="")
Construct and initialize an EdgePhase directly from an input file.
virtual void update(double T, double *cp_R, double *h_RT, double *s_R) const
Compute the reference-state properties for all species.
virtual void getConcentrations(double *const c) const
Get the species concentrations (kmol/m^3).
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
virtual void setMoleFractions(const double *const x)
Set the mole fractions to the specified values.
void setNDim(size_t ndim)
Set the number of spatial dimensions (1, 2, or 3).
size_t m_kk
Number of species in the phase.
size_t m_ndim
Dimensionality of the phase.
double temperature() const
Temperature (K).
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double concentration(const size_t k) const
Concentration of species k.
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.
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.
const vector< string > & speciesNames() const
Return a const reference to the vector of species names.
virtual void setMoleFractions_NoNorm(const double *const x)
Set the mole fractions to the specified values without normalizing.
SurfPhase(const string &infile="", const string &id="")
Construct and initialize a SurfPhase ThermoPhase object directly from an input file.
void setMolarDensity(const double vm) override
Since interface phases have no volume, setting this to a value other than 0.0 raises an exception.
void getStandardChemPotentials(double *mu0) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
void getPureGibbs(double *g) const override
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
double enthalpy_mole() const override
Return the Molar Enthalpy. Units: J/kmol.
void setSiteDensity(double n0)
Set the site density of the surface phase (kmol m-2)
double logStandardConc(size_t k=0) const override
Natural logarithm of the standard concentration of the kth species.
void setState(const AnyMap &state) override
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
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.
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
vector< double > m_logsize
vector storing the log of the size of each species.
vector< double > m_work
Temporary work array.
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
Return a vector of activity concentrations for each species.
double m_n0
Surface site density (kmol m-2)
double size(size_t k) const
Returns the number of sites occupied by one molecule of species k.
vector< double > m_h0
Temporary storage for the reference state enthalpies.
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. Units: J/kmol/K.
vector< double > m_s0
Temporary storage for the reference state entropies.
void setCoverages(const double *theta)
Set the surface site fractions to a specified state.
vector< double > m_cp0
Temporary storage for the reference state heat capacities.
vector< double > m_speciesSize
Vector of species sizes (number of sites occupied). length m_kk.
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
void getEntropy_R_ref(double *er) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
void getGibbs_RT(double *grt) const override
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
double intEnergy_mole() const override
Return the Molar Internal Energy. Units: J/kmol.
double entropy_mole() const override
Return the Molar Entropy. Units: J/kmol-K.
void _updateThermo(bool force=false) const
Update the species reference state thermodynamic functions.
void getCp_R_ref(double *cprt) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
void getStandardVolumes(double *vol) const override
Get the molar volumes of the species standard states at the current T and P of the solution.
void setCoveragesNoNorm(const double *theta)
Set the surface site fractions to a specified state.
void getCoverages(double *theta) const
Return a vector of surface coverages.
double cp_mole() const override
Molar heat capacity at constant pressure. Units: J/kmol/K.
void getPartialMolarCp(double *cpbar) const override
Return an array of partial molar heat capacities for the species in the mixture.
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_mu0
Temporary storage for the reference state Gibbs energies.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void setCoveragesByName(const string &cov)
Set the coverages from a string of colon-separated name:value pairs.
void getGibbs_RT_ref(double *grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
double m_logn0
log of the surface site density
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
void getEnthalpy_RT_ref(double *hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
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.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
AnyMap m_input
Data supplied via setParameters.
A representation of the units associated with a dimensional quantity.
Composition parseCompString(const string &ss, const vector< string > &names)
Parse a composition string into a map consisting of individual key:composition pairs.
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.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
const U & getValue(const map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a map.
map< string, double > Composition
Map from string names to doubles.
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...