21 IdealSolidSolnPhase::IdealSolidSolnPhase(
int formGC) :
28 if (formGC < 0 || formGC > 2) {
30 " Illegal value of formGC");
35 const std::string& id_,
int formGC) :
42 if (formGC < 0 || formGC > 2) {
44 " Illegal value of formGC");
57 if (formGC < 0 || formGC > 2) {
59 " Illegal value of formGC");
101 res = cIdealSolidSolnPhase0;
104 res = cIdealSolidSolnPhase1;
107 res = cIdealSolidSolnPhase2;
145 doublereal g =
mean_X(dptr);
171 double dens = 1.0/invDens;
187 "Density is not an independent variable");
199 throw CanteraError(
"IdealSolidSolnPhase::setMolarDensity",
200 "Density is not an independent variable");
244 for (
size_t k = 0; k <
m_kk; k++) {
245 c[k] = dtmp[k] * mmw;
249 for (
size_t k = 0; k <
m_kk; k++) {
255 for (
size_t k = 0; k <
m_kk; k++) {
256 c[k] = dtmp[k] * atmp;
315 if (eos == cIdealSolidSolnPhase0) {
316 for (
int i = 0; i < sizeUA; i++) {
320 for (
int i = 0; i < sizeUA; i++) {
325 uA[1] = -int(
nDim());
346 for (
size_t k = 0; k <
m_kk; k++) {
358 for (
size_t k = 0; k <
m_kk; k++) {
360 mu[k] = RT * (g_RT[k] + log(xx))
372 for (
size_t k = 0; k <
m_kk; k++) {
374 mu[k] = (g_RT[k] + log(xx))
387 scale(_h.begin(), _h.end(), hbar, rt);
396 for (
size_t k = 0; k <
m_kk; k++) {
398 sbar[k] = r * (_s[k] - log(xx));
406 for (
size_t k = 0; k <
m_kk; k++) {
425 doublereal RT =
_RT();
426 const doublereal*
const gk =
DATA_PTR(gibbsrt);
428 for (
size_t k = 0; k <
m_kk; k++) {
437 doublereal RT =
_RT();
438 const doublereal*
const gk =
DATA_PTR(gibbsrt);
440 for (
size_t k = 0; k <
m_kk; k++) {
451 for (
size_t k = 0; k <
m_kk; k++) {
459 copy(_s.begin(), _s.end(), sr);
466 for (
size_t k = 0; k <
m_kk; k++) {
474 copy(_cpr.begin(), _cpr.end(), cpr);
489 for (
size_t k = 0; k !=
m_kk; k++) {
497 for (
size_t k = 0; k !=
m_kk; k++) {
506 for (
size_t k = 0; k !=
m_kk; k++) {
515 for (
size_t k = 0; k <
m_kk; k++) {
523 for (
size_t k = 0; k !=
m_kk; k++) {
531 for (
size_t k = 0; k !=
m_kk; k++) {
558 string subname =
"IdealSolidSolnPhase::initThermoXML";
559 if (id_.size() > 0) {
560 string idp = phaseNode.
id();
563 "phasenode and Id are incompatible");
573 string mStringa = thNode.
attrib(
"model");
575 if (mString !=
"idealsolidsolution") {
577 "Unknown thermo model: " + mStringa);
581 "Unspecified thermo model");
591 if (phaseNode.
hasChild(
"standardConc")) {
593 string formStringa = scNode.
attrib(
"model");
594 string formString =
lowercase(formStringa);
595 if (formString ==
"unity") {
597 }
else if (formString ==
"molar_volume") {
599 }
else if (formString ==
"solvent_volume") {
603 "Unknown standardConc model: " + formStringa);
607 "Unspecified standardConc model");
623 for (
size_t k = 0; k <
m_kk; k++) {
664 doublereal pres = 0.0;
665 for (
size_t k = 0; k <
m_kk; k++) {
667 for (
size_t m = 0; m <
nElements(); m++) {
702 for (
size_t k = 0; k <
m_kk; k++) {
703 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)
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.
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.
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
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.
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
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.
virtual void initThermo()
Initialization of an IdealSolidSolnPhase phase: Note this function is pretty much useless because it ...
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.
doublereal m_tlast
Value of the temperature at which the thermodynamics functions for the reference state of the species...
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.
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
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.
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.
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...
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.