Go to the documentation of this file.
22 IdealSolidSolnPhase::IdealSolidSolnPhase(
int formGC) :
27 if (formGC < 0 || formGC > 2) {
28 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
29 "Illegal value of formGC");
34 const std::string& id_,
int formGC) :
39 if (formGC < 0 || formGC > 2) {
40 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
41 "Illegal value of formGC");
52 if (formGC < 0 || formGC > 2) {
53 throw CanteraError(
"IdealSolidSolnPhase::IdealSolidSolnPhase",
54 "Illegal value of formGC");
102 "Overloaded function to be removed after Cantera 2.5. "
103 "Error will be thrown by Phase::setDensity instead");
104 if (std::abs(rho/
density() - 1.0) > 1e-15) {
106 "Density is not an independent variable");
119 "Overloaded function to be removed after Cantera 2.5. "
120 "Error will be thrown by Phase::setMolarDensity instead");
121 throw CanteraError(
"IdealSolidSolnPhase::setMolarDensity",
122 "Density is not an independent variable");
139 return Units(1.0, 0, -
static_cast<double>(
nDim()), 0, 0, 0, 1);
149 for (
size_t k = 0; k <
m_kk; k++) {
150 c[k] = dtmp[k] * mmw;
154 for (
size_t k = 0; k <
m_kk; k++) {
160 for (
size_t k = 0; k <
m_kk; k++) {
161 c[k] = dtmp[k] * atmp;
182 for (
size_t k = 0; k <
m_kk; k++) {
191 for (
size_t k = 0; k <
m_kk; k++) {
193 mu[k] =
RT() * (g_RT[k] + log(xx))
202 for (
size_t k = 0; k <
m_kk; k++) {
204 mu[k] = (g_RT[k] + log(xx))
214 scale(_h.begin(), _h.end(), hbar,
RT());
220 for (
size_t k = 0; k <
m_kk; k++) {
229 for (
size_t k = 0; k <
m_kk; k++) {
245 for (
size_t k = 0; k <
m_kk; k++) {
254 for (
size_t k = 0; k <
m_kk; k++) {
263 for (
size_t k = 0; k <
m_kk; k++) {
271 copy(_s.begin(), _s.end(), sr);
278 for (
size_t k = 0; k <
m_kk; k++) {
286 copy(_cpr.begin(), _cpr.end(), cpr);
299 for (
size_t k = 0; k !=
m_kk; k++) {
307 for (
size_t k = 0; k !=
m_kk; k++) {
316 for (
size_t k = 0; k !=
m_kk; k++) {
325 for (
size_t k = 0; k <
m_kk; k++) {
333 for (
size_t k = 0; k !=
m_kk; k++) {
341 for (
size_t k = 0; k !=
m_kk; k++) {
376 m_pe.push_back(0.0);;
378 if (spec->input.hasKey(
"equation-of-state")) {
379 auto& eos = spec->input[
"equation-of-state"].getMapWhere(
"model",
"constant-volume");
381 if (eos.hasKey(
"density")) {
383 }
else if (eos.hasKey(
"molar-density")) {
384 mv = 1.0 / eos.convert(
"molar-density",
"kmol/m^3");
385 }
else if (eos.hasKey(
"molar-volume")) {
386 mv = eos.convert(
"molar-volume",
"m^3/kmol");
389 "equation-of-state entry for species '{}' is missing "
390 "'density', 'molar-volume', or 'molar-density' "
391 "specification", spec->name);
394 }
else if (spec->extra.hasKey(
"molar_volume")) {
399 "Molar volume not specified for species '{}'", spec->name);
416 if (id_.size() > 0 && phaseNode.
id() != id_) {
417 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
418 "phasenode and Id are incompatible");
426 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
427 "Unknown thermo model: " + thNode[
"model"]);
430 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
431 "Unspecified thermo model");
439 if (phaseNode.
hasChild(
"standardConc")) {
442 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
443 "Unspecified standardConc model");
454 doublereal pres = 0.0;
456 for (
size_t k = 0; k <
m_kk; k++) {
457 double tmp = -grt[k] + mu_RT[k];
460 }
else if (tmp > 500.0) {
462 double tmp2 = tmp / 500.;
464 m_pp[k] = m_p0 * exp(500.) * tmp2;
466 m_pp[k] = m_p0 * exp(tmp);
485 throw CanteraError(
"IdealSolidSolnPhase::setStandardConcentrationModel",
486 "Unknown standard concentration model '{}'", model);
508 doublereal rrt = 1.0 /
RT();
509 for (
size_t k = 0; k <
m_kk; k++) {
510 double deltaE = rrt *
m_pe[k];
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
virtual doublereal enthalpy_mole() const
Molar enthalpy of 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 setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
const double SmallNumber
smallest number to compare to zero.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
std::string id() const
Return the id attribute, if present.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable.
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
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 getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
double moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
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 getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
size_t m_kk
Number of species in the phase.
vector_fp m_pp
Temporary array used in equilibrium calculations.
virtual bool addSpecies(shared_ptr< Species > spec)
AnyMap m_input
Data supplied via setParameters.
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
virtual double density() const
Density (kg/m^3).
vector_fp m_pe
Vector of potential energies for the species.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P .
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual bool addSpecies(shared_ptr< Species > spec)
virtual doublereal pressure() const
Pressure.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
Class XML_Node is a tree-based representation of the contents of an XML file.
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
doublereal m_tlast
last value of the temperature processed by reference state
const double OneAtm
One atmosphere [Pa].
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
doublereal sum_xlogx() const
Evaluate .
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
doublereal temperature() const
Temperature (K).
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
A representation of the units associated with a dimensional quantity.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
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 void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
double molarDensity() const
Molar density (kmol/m^3).
const double GasConstant
Universal Gas Constant [J/kmol/K].
Base class for exceptions thrown by Cantera classes.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes 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 void setPressure(doublereal p)
Set the pressure at constant temperature.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Namespace for the Cantera kernel.
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
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.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.