24 IdealSolidSolnPhase::IdealSolidSolnPhase(
int formGC) :
29 if (formGC < 0 || formGC > 2) {
31 " Illegal value of formGC");
36 const std::string& id_,
int formGC) :
41 if (formGC < 0 || formGC > 2) {
43 " Illegal value of formGC");
54 if (formGC < 0 || formGC > 2) {
56 " Illegal value of formGC");
96 res = cIdealSolidSolnPhase0;
99 res = cIdealSolidSolnPhase1;
102 res = cIdealSolidSolnPhase2;
165 "Density is not an independent variable");
177 throw CanteraError(
"IdealSolidSolnPhase::setMolarDensity",
178 "Density is not an independent variable");
221 for (
size_t k = 0; k <
m_kk; k++) {
222 c[k] = dtmp[k] * mmw;
226 for (
size_t k = 0; k <
m_kk; k++) {
232 for (
size_t k = 0; k <
m_kk; k++) {
233 c[k] = dtmp[k] * atmp;
288 "To be removed after Cantera 2.2.");
290 if (eos == cIdealSolidSolnPhase0) {
291 for (
int i = 0; i < sizeUA; i++) {
295 for (
int i = 0; i < sizeUA; i++) {
300 uA[1] = -int(
nDim());
320 for (
size_t k = 0; k <
m_kk; k++) {
330 for (
size_t k = 0; k <
m_kk; k++) {
332 mu[k] = RT * (g_RT[k] + log(xx))
341 for (
size_t k = 0; k <
m_kk; k++) {
343 mu[k] = (g_RT[k] + log(xx))
361 for (
size_t k = 0; k <
m_kk; k++) {
370 for (
size_t k = 0; k <
m_kk; k++) {
387 doublereal RT =
_RT();
388 const doublereal*
const gk =
DATA_PTR(gibbsrt);
390 for (
size_t k = 0; k <
m_kk; k++) {
398 doublereal RT =
_RT();
399 const doublereal*
const gk =
DATA_PTR(gibbsrt);
401 for (
size_t k = 0; k <
m_kk; k++) {
411 for (
size_t k = 0; k <
m_kk; k++) {
419 copy(_s.begin(), _s.end(), sr);
426 for (
size_t k = 0; k <
m_kk; k++) {
434 copy(_cpr.begin(), _cpr.end(), cpr);
449 for (
size_t k = 0; k !=
m_kk; k++) {
457 for (
size_t k = 0; k !=
m_kk; k++) {
466 for (
size_t k = 0; k !=
m_kk; k++) {
475 for (
size_t k = 0; k <
m_kk; k++) {
483 for (
size_t k = 0; k !=
m_kk; k++) {
491 for (
size_t k = 0; k !=
m_kk; k++) {
514 if (id_.size() > 0) {
515 if (phaseNode.
id() != id_) {
516 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
517 "phasenode and Id are incompatible");
527 string mString = thNode.
attrib(
"model");
528 if (
lowercase(mString) !=
"idealsolidsolution") {
529 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
530 "Unknown thermo model: " + mString);
533 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
534 "Unspecified thermo model");
544 if (phaseNode.
hasChild(
"standardConc")) {
546 string formStringa = scNode.
attrib(
"model");
547 string formString =
lowercase(formStringa);
548 if (formString ==
"unity") {
550 }
else if (formString ==
"molar_volume") {
552 }
else if (formString ==
"solvent_volume") {
555 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
556 "Unknown standardConc model: " + formStringa);
559 throw CanteraError(
"IdealSolidSolnPhase::initThermoXML",
560 "Unspecified standardConc model");
575 for (
size_t k = 0; k <
m_kk; k++) {
614 doublereal pres = 0.0;
615 for (
size_t k = 0; k <
m_kk; k++) {
617 for (
size_t m = 0; m <
nElements(); m++) {
647 for (
size_t k = 0; k <
m_kk; k++) {
648 double deltaE = rrt *
m_pe[k];
void _updateThermo() const
This function gets called for every call to functions in this class.
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
doublereal nAtoms(size_t k, size_t m) const
Number of atoms of element m in species k.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
XML_Node * findByAttr(const std::string &attr, const std::string &val, int depth=100000) const
This routine carries out a recursive search for an XML node based on an attribute of each XML node...
virtual doublereal density() const
Density (kg/m^3).
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
size_t nElements() const
Number of elements.
const doublereal OneAtm
One atmosphere [Pa].
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P ...
vector_fp m_pp
Temporary array used in equilibrium calculations.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
doublereal _RT() const
Return the Gas Constant multiplied by the current temperature.
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions, but don't normalize them to one.
virtual doublereal referenceConcentration(int k) const
The reference (ie standard) concentration used to normalize the generalized concentration.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
doublereal molarDensity() const
Molar density (kmol/m^3).
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions, and normalize them to one.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
doublereal m_tlast
last value of the temperature processed by reference state
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
Base class for a phase with thermodynamic properties.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node...
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty ThermoPhase object.
int m_formGC
Format for the generalized concentrations.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual int eosType() const
Equation of state flag.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
doublereal sum_xlogx() const
Evaluate .
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
doublereal m_Pref
Value of the reference pressure for all species in this phase.
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 enthalpy_mole() const
Molar enthalpy of the solution.
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
Base class for exceptions thrown by Cantera classes.
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
virtual void setConcentrations(const doublereal *const conc)
Set the concentrations to the specified values within the phase.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
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 setToEquilState(const doublereal *lambda_RT)
Set mixture to an equilibrium state consistent with specified element potentials and the temperature...
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
virtual doublereal logStandardConc(size_t k) const
Returns the log of the standard concentration of the kth species.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions to the specified values without normalizing.
doublereal moleFraction(size_t k) const
Return the mole fraction of a single species.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual void setMolarDensity(const doublereal rho)
Overwritten setMolarDensity() function is necessary because the density is not an independent variabl...
doublereal temperature() const
Temperature (K).
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void setConcentrations(const doublereal *const c)
Set the concentration,.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
std::string id() const
Return the id attribute, if present.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
const doublereal SmallNumber
smallest number to compare to zero.
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...
Class IdealSolidSolnPhase represents a condensed phase ideal solution compound.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void initLengths()
This internal function adjusts the lengths of arrays.
Templates for operations on vector-like objects.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
virtual void setDensity(const doublereal rho)
Overwritten setDensity() function is necessary because the density is not an independent variable...
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Contains declarations for string manipulation functions within Cantera.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
virtual doublereal pressure() const
Pressure.
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...
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
size_t m_kk
Number of species in the phase.
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const =0
Compute the reference-state properties for all species.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
vector_fp m_pe
Vector of potential energies for the species.
XML_Node & root() const
Return the root of the current XML_Node tree.
IdealSolidSolnPhase & operator=(const IdealSolidSolnPhase &)
Assignment operator.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and general concentrations Note they have the same units...
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions, but don't normalize them to one.
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
std::string speciesName(size_t k) const
Name of the species with index k.
const doublereal * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.