35 "The formGC constructor argument is deprecated and will be removed"
36 " after Cantera 2.6. Use the setStandardConcentrationModel"
40 if (formGC < 0 || formGC > 2) {
41 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
42 "Illegal value of formGC");
47 const std::string& id_,
int formGC) :
55 warn_deprecated(
"IdealSolidSolnPhase(string inputFile, string id_, int formGC)",
56 "The formGC constructor argument is deprecated and will be removed"
57 " after Cantera 2.6. Use the setStandardConcentrationModel"
61 if (formGC < 0 || formGC > 2) {
62 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
63 "Illegal value of formGC");
77 warn_deprecated(
"IdealSolidSolnPhase(XML_Node root, string id_, int formGC)",
78 "The formGC constructor argument is deprecated and will be removed"
79 " after Cantera 2.6. Use the setStandardConcentrationModel"
83 if (formGC < 0 || formGC > 2) {
84 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
85 "Illegal value of formGC");
147 return Units(1.0, 0, -
static_cast<double>(
nDim()), 0, 0, 0, 1);
157 for (
size_t k = 0; k <
m_kk; k++) {
158 c[k] = dtmp[k] * mmw;
162 for (
size_t k = 0; k <
m_kk; k++) {
168 for (
size_t k = 0; k <
m_kk; k++) {
169 c[k] = dtmp[k] * atmp;
190 for (
size_t k = 0; k <
m_kk; k++) {
199 for (
size_t k = 0; k <
m_kk; k++) {
201 mu[k] =
RT() * (g_RT[k] + log(xx))
210 for (
size_t k = 0; k <
m_kk; k++) {
212 mu[k] = (g_RT[k] + log(xx))
223 for (
size_t k = 0; k <
m_kk; k++) {
232 for (
size_t k = 0; k <
m_kk; k++) {
241 for (
size_t k = 0; k <
m_kk; k++) {
257 for (
size_t k = 0; k <
m_kk; k++) {
266 for (
size_t k = 0; k <
m_kk; k++) {
275 for (
size_t k = 0; k <
m_kk; k++) {
283 copy(_s.begin(), _s.end(), sr);
290 for (
size_t k = 0; k <
m_kk; k++) {
298 copy(_cpr.begin(), _cpr.end(), cpr);
311 for (
size_t k = 0; k !=
m_kk; k++) {
319 for (
size_t k = 0; k !=
m_kk; k++) {
328 for (
size_t k = 0; k !=
m_kk; k++) {
337 for (
size_t k = 0; k <
m_kk; k++) {
345 for (
size_t k = 0; k !=
m_kk; k++) {
353 for (
size_t k = 0; k !=
m_kk; k++) {
389 if (spec->input.hasKey(
"equation-of-state")) {
390 auto& eos = spec->input[
"equation-of-state"].getMapWhere(
"model",
"constant-volume");
392 if (eos.hasKey(
"density")) {
394 }
else if (eos.hasKey(
"molar-density")) {
395 mv = 1.0 / eos.convert(
"molar-density",
"kmol/m^3");
396 }
else if (eos.hasKey(
"molar-volume")) {
397 mv = eos.convert(
"molar-volume",
"m^3/kmol");
400 "equation-of-state entry for species '{}' is missing "
401 "'density', 'molar-volume', or 'molar-density' "
402 "specification", spec->name);
405 }
else if (spec->input.hasKey(
"molar_volume")) {
410 "Molar volume not specified for species '{}'", spec->name);
431 phaseNode[
"standard-concentration-basis"] =
"species-molar-volume";
433 phaseNode[
"standard-concentration-basis"] =
"solvent-molar-volume";
438 AnyMap& speciesNode)
const
443 auto& eosNode = speciesNode[
"equation-of-state"].getMapWhere(
444 "model",
"constant-volume",
true);
446 if (S->input.hasKey(
"equation-of-state")) {
447 auto& eosIn = S->input[
"equation-of-state"];
448 if (eosIn.hasKey(
"density")) {
449 eosNode[
"density"].setQuantity(
451 }
else if (eosIn.hasKey(
"molar-density")) {
466 if (id_.size() > 0 && phaseNode.
id() != id_) {
467 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
468 "phasenode and Id are incompatible");
476 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
477 "Unknown thermo model: " + thNode[
"model"]);
480 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
481 "Unspecified thermo model");
489 if (phaseNode.
hasChild(
"standardConc")) {
492 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
493 "Unspecified standardConc model");
509 doublereal pres = 0.0;
511 for (
size_t k = 0; k <
m_kk; k++) {
512 double tmp = -grt[k] + mu_RT[k];
515 }
else if (tmp > 500.0) {
517 double tmp2 = tmp / 500.;
519 m_pp[k] = m_p0 * exp(500.) * tmp2;
521 m_pp[k] = m_p0 * exp(tmp);
540 throw CanteraError(
"IdealSolidSolnPhase::setStandardConcentrationModel",
541 "Unknown standard concentration model '{}'", model);
563 for (
size_t k = 0; k <
m_kk; k++) {
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
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 std::string &key) const
Returns true if the map contains an item named key.
Base class for exceptions thrown by Cantera classes.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
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 species activity coefficients.
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs function for the species standard states at the current T and P of the s...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
vector_fp m_pp
Temporary array used in equilibrium calculations.
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
Vector containing the species reference entropies at T = m_tlast.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
IdealSolidSolnPhase(int formCG=-1)
Constructor for IdealSolidSolnPhase.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual doublereal pressure() const
Pressure.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
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 compositionChanged()
Apply changes to the state which are needed after the composition changes.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P .
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
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
Value of the reference pressure for all species in this phase.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
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.
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
size_t m_kk
Number of species in the phase.
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
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.
virtual bool ready() const
Returns a bool indicating whether the object is ready for use.
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 void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
AnyMap m_input
Data supplied via setParameters.
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.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
std::string id() const
Return the id attribute, if present.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
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 dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
const double OneAtm
One atmosphere [Pa].
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
void warn_deprecated(const std::string &source, const AnyBase &node, const std::string &message)
A deprecation warning for syntax in an input file.
const double 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.
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)...