Doxygen update. Added SingleSpeciesTP to doxygen.

I took out overloaded functions that weren't doing anything.
This commit is contained in:
Harry Moffat
2007-02-07 21:26:47 +00:00
parent de9faa82b7
commit 6dae6c7a2c
5 changed files with 423 additions and 394 deletions

View File

@@ -252,44 +252,48 @@ namespace Cantera {
return 0;
}
/**
* Returns the units of the standard and general concentrations
* Note they have the same units, as their divisor is
* defined to be equal to the activity of the kth species
* in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* On return uA contains the powers of the units (MKS assumed)
* of the standard concentrations and generalized concentrations
* for the kth species.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void ThermoPhase::getUnitsStandardConc(double *uA, int k, int sizeUA) {
for (int i = 0; i < sizeUA; i++) {
if (i == 0) uA[0] = 1.0;
if (i == 1) uA[1] = -nDim();
if (i == 2) uA[2] = 0.0;
/*
* Returns the units of the standard and general concentrations
* Note they have the same units, as their divisor is
* defined to be equal to the activity of the kth species
* in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* On return uA contains the powers of the units (MKS assumed)
* of the standard concentrations and generalized concentrations
* for the kth species.
*
* The base %ThermoPhase class assigns thedefault quantities
* of (kmol/m3).
* Inherited classes are responsible for overriding the default
* values if necessary.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void ThermoPhase::getUnitsStandardConc(double *uA, int k, int sizeUA) {
for (int i = 0; i < sizeUA; i++) {
if (i == 0) uA[0] = 1.0;
if (i == 1) uA[1] = -nDim();
if (i == 2) uA[2] = 0.0;
if (i == 3) uA[3] = 0.0;
if (i == 4) uA[4] = 0.0;
if (i == 5) uA[5] = 0.0;
}
}
}
/*
* initThermoFile():
*
* Initialization of a Debye-Huckel phase using an
* xml file.
* Initialization of a phase using an xml file.
*
* This routine is a precursor to initThermoXML(XML_Node*)
* routine, which does most of the work.
@@ -332,8 +336,12 @@ namespace Cantera {
}
/*
* Import and initialize a ThermoPhase
* object
* Import and initialize a ThermoPhase object
*
* This function is called from importPhase()
* after the elements and the
* species are initialized with default ideal solution
* level data.
*
* @param phaseNode This object must be the phase node of a
* complete XML tree
@@ -347,19 +355,20 @@ namespace Cantera {
* with the correct id.
*/
void ThermoPhase::initThermoXML(XML_Node& phaseNode, std::string id) {
/*
* The default implementation just calls initThermo();
*/
initThermo();
/*
* and sets the state
*/
if (phaseNode.hasChild("state")) {
XML_Node& stateNode = phaseNode.child("state");
setStateFromXML(stateNode);
}
/*
* The default implementation just calls initThermo(), which
* inheriting classes may override.
*/
initThermo();
/*
* and sets the state
*/
if (phaseNode.hasChild("state")) {
XML_Node& stateNode = phaseNode.child("state");
setStateFromXML(stateNode);
}
}
/*
* Initialize.
*

View File

@@ -259,22 +259,22 @@ namespace Cantera {
err("isothermalCompressibility"); return -1.0;
}
/**
* The volumetric thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*/
virtual doublereal thermalExpansionCoeff() const {
err("thermalExpansionCoeff()"); return -1.0;
}
/**
* The volumetric thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*/
virtual doublereal thermalExpansionCoeff() const {
err("thermalExpansionCoeff()"); return -1.0;
}
/// @deprecated
virtual void updateDensity() {
deprecatedMethod("ThermoPhase","updateDensity","");
}
/// @deprecated
virtual void updateDensity() {
deprecatedMethod("ThermoPhase","updateDensity","");
}
/**
* @}
@@ -402,6 +402,11 @@ namespace Cantera {
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* The base %ThermoPhase class assigns thedefault quantities
* of (kmol/m3) for all species.
* Inherited classes are responsible for overriding the default
* values if necessary.
*
* @param uA Output vector containing the units
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
@@ -1203,31 +1208,39 @@ namespace Cantera {
void setIndex(int m) { m_index = m; }
/**
* @internal
* Set equation of state parameters. The number and meaning of
* these depends on the subclass.
* @param n number of parameters
* @param c array of \a n coefficients
*
*/
virtual void setParameters(int n, doublereal* c) {}
virtual void getParameters(int &n, doublereal * const c) {}
/**
* @internal
* Set equation of state parameters. The number and meaning of
* these depends on the subclass.
* @param n number of parameters
* @param c array of \a n coefficients
*/
virtual void setParameters(int n, doublereal* c) {}
/**
* Set equation of state parameter values from XML
* entries. This method is called by function importPhase in
* file importCTML.cpp when processing a phase definition in
* an input file. It should be overloaded in subclasses to set
* any parameters that are specific to that particular phase
* model. Note, this method is called before the phase is
* initialzed with elements and/or species.
*
* @param eosdata An XML_Node object corresponding to
* the "thermo" entry for this phase in the input file.
*/
virtual void setParametersFromXML(const XML_Node& eosdata) {}
/**
* @internal
* Get equation of state parameters. The number and meaning of
* these depends on the subclass.
* @param n number of parameters
* @param c array of \a n coefficients
*/
virtual void getParameters(int &n, doublereal * const c) {}
/**
* Set equation of state parameter values from XML entries.
*
* This method is called by function importPhase() in
* file importCTML.cpp when processing a phase definition in
* an input file. It should be overloaded in subclasses to set
* any parameters that are specific to that particular phase
* model. Note, this method is called before the phase is
* initialzed with elements and/or species.
*
* @param eosdata An XML_Node object corresponding to
* the "thermo" entry for this phase in the input file.
*/
virtual void setParametersFromXML(const XML_Node& eosdata) {}
/**
* Set the initial state of the phase to the conditions
* specified in the state XML element.

View File

@@ -778,7 +778,7 @@ namespace Cantera {
// set equation of state parameters. The parameters are
// Set equation of state parameters. The parameters are
// specific to each subclass of ThermoPhase, so this is done
// by method setParametersFromXML in each subclass.
if (phase.hasChild("thermo")) {
@@ -935,7 +935,7 @@ namespace Cantera {
th->saveSpeciesData(db);
// perform any required subclass-specific initialization.
// Perform any required subclass-specific initialization.
string id = "";
th->initThermoXML(phase, id);

View File

@@ -359,7 +359,7 @@ namespace Cantera {
}
void SingleSpeciesTP::setState_TPX(doublereal t, doublereal p,
const string& x) {
const std::string& x) {
setTemperature(t); setPressure(p);
}
@@ -374,7 +374,7 @@ namespace Cantera {
}
void SingleSpeciesTP::setState_TPY(doublereal t, doublereal p,
const string& y) {
const std::string& y) {
setTemperature(t); setPressure(p);
}
@@ -389,7 +389,7 @@ namespace Cantera {
if (y[0] != 1.0) {
err("setStatePY -> x[0] not 1.0");
}
setMassFractions(y); setPressure(p);
setPressure(p);
}
void SingleSpeciesTP::setState_HP(doublereal h, doublereal p,
@@ -458,52 +458,19 @@ namespace Cantera {
throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt));
}
/**
/*
* This private function throws a cantera exception. It's used when
* this class doesn't have an answer for the question given to it,
* because the derived class isn't overriding a function.
*/
doublereal SingleSpeciesTP::err(string msg) const {
doublereal SingleSpeciesTP::err(std::string msg) const {
throw CanteraError("SingleSpeciesTP","Base class method "
+msg+" called. Equation of state type: "
+int2str(eosType()));
return 0;
}
/**
* Returns the units of the standard and general concentrations
* Note they have the same units, as their divisor is
* defined to be equal to the activity of the kth species
* in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* On return uA contains the powers of the units (MKS assumed)
* of the standard concentrations and generalized concentrations
* for the kth species.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void SingleSpeciesTP::getUnitsStandardConc(double *uA, int k, int sizeUA) {
for (int i = 0; i < sizeUA; i++) {
if (i == 0) uA[0] = 1.0;
if (i == 1) uA[1] = -nDim();
if (i == 2) uA[2] = 0.0;
if (i == 3) uA[3] = 0.0;
if (i == 4) uA[4] = 0.0;
if (i == 5) uA[5] = 0.0;
}
}
/**
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
@@ -537,8 +504,7 @@ namespace Cantera {
ThermoPhase::initThermo();
}
/**
/*
* _updateThermo():
*
* This crucial internal routine calls the species thermo

View File

@@ -30,15 +30,47 @@ namespace Cantera {
/**
* @ingroup thermoprops
*
* The SingleSpeciesTP class is a filter class for ThermoPhase.
* What it does is to simplify the construction of ThermoPhase
* The %SingleSpeciesTP class is a filter class for %ThermoPhase.
* What it does is to simplify the construction of %ThermoPhase
* objects by assuming that the phase consists of one and
* only one type of species. In other words, it's a stoichiometric
* phase. However, no assumptions are made concerning the
* thermodynamic functions or the equation of state of the
* phase. Therefore it's an incomplete description of
* the thermodynamics. The complete description must be
* made in a derived class of SingleSpeciesTP.
* made in a derived class of %SingleSpeciesTP.
*
* Several different groups of thermodynamic functions are resolved
* at this level by this class. For example, All partial molar property
* routines call their single species standard state equivalents.
* All molar solution thermodynamic routines call the single species
* standard state equivalents.
* Activities routines are resolved at this level, as there is only
* one species.
*
* It is assumed that the reference state thermodynamics may be
* obtained by a pointer to a populated species thermodynamic property
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
* changes to the reference state thermodynamics is again left open
* to implementation.
*
* Mole fraction and Mass fraction vectors are assumed to be equal
* to x[0] = 1 y[0] = 1, respectively. Simplifications to the interface
* of setState_TPY() and setState_TPX() functions result and are made
* within the class.
*
* Note, this class can handle the thermodynamic description of one
* phase of one species. It can not handle the description of phase
* equilibrium between two phases of a stoichiometric compound
* (e.g. water liquid and water vapor, below the critical point).
* However, it may be used to describe the thermodynamics of one phase
* of such a compound even past the phase equilibrium point, up to the
* point where the phase itself ceases to be a stable phase.
*
* This class doesn't do much at the initialization level. It's SingleSpeciesTP::initThermo()
* member does check that one and only one species has been defined
* to occupy the phase.
*
* \nosubgrouping
*/
class SingleSpeciesTP : public ThermoPhase {
@@ -77,21 +109,45 @@ namespace Cantera {
*/
/// Molar enthalpy. Units: J/kmol.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal enthalpy_mole() const;
/// Molar internal energy. Units: J/kmol.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal intEnergy_mole() const;
/// Molar entropy. Units: J/kmol/K.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal entropy_mole() const;
/// Molar Gibbs function. Units: J/kmol.
/// Molar Gibbs function. Units: J/kmol.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal gibbs_mole() const;
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal cp_mole() const;
/// Molar heat capacity at constant volume. Units: J/kmol/K.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*/
doublereal cv_mole() const;
/**
@@ -100,50 +156,6 @@ namespace Cantera {
* @{
*/
/**
* Pressure. Return the thermodynamic pressure (Pa). This
* method must be reimplemented in derived classes.
* Since the mass density, temperature, and mass fractions
* are stored, this method should use these
* values to implement the mechanical equation of state
* \f$ P(T, \rho, Y_1, \dots, Y_K) \f$.
*/
virtual doublereal pressure() const {
return err("pressure");
}
/**
* Set the pressure.
* Sets the thermodynamic pressure -> must be reimplemented
* in derived classes. Units: Pa.
*/
virtual void setPressure(doublereal p) {
err("setPressure");
}
/**
* The isothermal compressibility. Units: 1/Pa.
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
*/
virtual doublereal isothermalCompressibility() const {
err("isothermalCompressibility"); return -1.0;
}
/**
* The thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*/
virtual doublereal thermalExpansionCoeff() const {
err("thermalExpansionCoeff()"); return -1.0;
}
/**
* @}
* @name Electric Potential
@@ -165,25 +177,7 @@ namespace Cantera {
* @{
*/
/**
* Set the potential energy of species k to pe.
* Units: J/kmol.
* This function must be reimplemented in inherited classes
* of ThermoPhase.
*/
virtual void setPotentialEnergy(int k, doublereal pe) {
err("setPotentialEnergy");
}
/**
* Get the potential energy of species k.
* Units: J/kmol.
* This function must be reimplemented in inherited classes
* of ThermoPhase.
*/
virtual doublereal potentialEnergy(int k) const {
return err("potentialEnergy");
}
/**
* @}
@@ -197,75 +191,14 @@ namespace Cantera {
* @{
*/
/**
* This method returns an array of generalized concentrations
* \f$ C_k\f$ that are defined such that
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
* is a standard concentration
* defined below. These generalized concentrations are used
* by kinetics manager classes to compute the forward and
* reverse rates of elementary reactions.
*
* @param c Array of generalized concentrations. The
* units depend upon the implementation of the
* reaction rate expressions within the phase.
*/
virtual void getActivityConcentrations(doublereal* c) const {
err("getActivityConcentrations");
}
/**
* The standard concentration \f$ C^0_k \f$ used to normalize
* the generalized concentration. In many cases, this quantity
* will be the same for all species in a phase - for example,
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
* reason, this method returns a single value, instead of an
* array. However, for phases in which the standard
* concentration is species-specific (e.g. surface species of
* different sizes), this method may be called with an
* optional parameter indicating the species.
*/
virtual doublereal standardConcentration(int k=0) const {
err("standardConcentration");
return -1.0;
}
/**
* Returns the natural logarithm of the standard
* concentration of the kth species
*/
virtual doublereal logStandardConc(int k=0) const {
err("logStandardConc");
return -1.0;
}
/**
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
virtual void getUnitsStandardConc(double *uA, int k = 0,
int sizeUA = 6);
/**
* Get the array of non-dimensional activities at
* the current solution temperature, pressure, and
* solution concentration.
*
* We redefine this function to just return 1.0 here.
*
* @param a Output vector of activities. Length: 1.
*/
virtual void getActivities(doublereal* a) {
a[0] = 1.0;
@@ -275,6 +208,8 @@ namespace Cantera {
* Get the array of non-dimensional activity coefficients at
* the current solution temperature, pressure, and
* solution concentration.
*
* @param ac Output vector of activity coefficients. Length: 1.
*/
virtual void getActivityCoefficients(doublereal* ac) const {
if (m_kk == 1) {
@@ -297,12 +232,18 @@ namespace Cantera {
* These functions are all resolved here to point to the
* standard state functions for species 0
*/
/**
* Get the array of non-dimensional species chemical potentials
* These are partial molar Gibbs free energies.
* \f$ \mu_k / \hat R T \f$.
* Units: unitless
*
* This function is resolved here by calling the standard state
* thermo function.
*
* @param mu Output vector of dimensionless chemical potentials.
* Length: m_kk.
*/
void getChemPotentials_RT(doublereal* mu) const;
@@ -310,6 +251,12 @@ namespace Cantera {
* Get the species chemical potentials in the solution
* These are partial molar Gibbs free energies.
* Units: J/kmol.
*
* This function is resolved here by calling the standard state
* thermo function.
*
* @param mu Output vector of species chemical
* potentials. Length: m_kk. Units: J/kmol
*/
void getChemPotentials(doublereal* mu) const;
@@ -321,26 +268,48 @@ namespace Cantera {
* This is resolved here. A single single species phase
* is not allowed to have anything other than a zero
* charge.
*
* @param mu Output vector of species electrochemical
* potentials. Length: m_kk. Units: J/kmol
*/
void getElectrochemPotentials(doublereal* mu) const;
/**
* Get the species partial molar enthalpies. Units: J/kmol.
//! Get the species partial molar enthalpies. Units: J/kmol.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*
* @param hbar Output vector of species partial molar enthalpies.
* Length: 1. units are J/kmol.
*/
void getPartialMolarEnthalpies(doublereal* hbar) const;
/**
* Get the species partial molar internal energies. Units: J/kmol.
//! Get the species partial molar enthalpies. Units: J/kmol.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*
* @param ubar Output vector of speciar partial molar internal energies.
* Length = m_kk. units are J/kmol.
*/
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
/**
* Get the species partial molar entropies. Units: J/kmol.
//! Get the species partial molar entropies. Units: J/kmol/K.
/*!
* This function is resolved here by calling the standard state
* thermo function.
*
* @param sbar Output vector of species partial molar entropies.
* Length = 1. units are J/kmol/K.
*/
void getPartialMolarEntropies(doublereal* sbar) const;
/**
* Get the species partial molar volumes. Units: m^3/kmol.
//! Get the species partial molar volumes. Units: m^3/kmol.
/*!
* This function is resolved here by calling the density function.
*
* @param vbar Output vector of speciar partial molar volumes.
* Length = 1. units are m^3/kmol.
*/
void getPartialMolarVolumes(doublereal* vbar) const;
@@ -352,66 +321,18 @@ namespace Cantera {
/// are not resolved at the SingleSpeciesTP level.
//@{
/**
* Get the array of chemical potentials at unit activity.
* These are the standard state chemical potentials.
* \f$ \mu^0_k(T,P) \f$. The values are evaluated at the current
* temperature and pressure.
*/
virtual void getStandardChemPotentials(doublereal* mu) const {
err("getStandardChemPotentials");
}
/**
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
*/
virtual void getEnthalpy_RT(doublereal* hrt) const {
err("getEnthalpy_RT");
}
/**
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
*/
virtual void getIntEnergy_RT(doublereal* urt) const {
err("getIntEnergy_RT");
}
/**
* Get the array of nondimensional Enthalpy functions for the
* standard state species
* at the current <I>T</I> and <I>P</I> of the solution.
*/
virtual void getEntropy_R(doublereal* sr) const {
err("getEntropy_R");
}
/**
* Get the nondimensional Gibbs functions for the species
* at their standard states of solution at the current T and P
* of the solution
*/
virtual void getGibbs_RT(doublereal* grt) const {
err("getGibbs_RT");
}
/**
* Get the dimensional Gibbs functions for the standard
* state of the species at the current T and P.
*
* This function is resolved here by referencing getGibbs_RT().
*
* @param gpure returns a vector of size 1, containing the Gibbs function
* Units: J/kmol.
*/
void getPureGibbs(doublereal* gpure) const;
/**
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
virtual void getCp_R(doublereal* cpr) const {
err("getCp_RT");
}
/**
* Get the molar volumes of each species in their standard
* states at the current
@@ -420,6 +341,9 @@ namespace Cantera {
*
* We resolve this function at this level, by assigning
* the molec weight divided by the phase density
*
* @param vol vector of length one, containing the standard volume
* of the phase.
*/
void getStandardVolumes(doublereal *vol) const;
@@ -429,46 +353,79 @@ namespace Cantera {
///
/// Almost all functions in this group are resolved by this
/// class. It is assumed that the m_spthermo species thermo
/// pointer is populated and yields the reference state.
/// pointer is populated and yields the reference state thermodynamics
/// The internal energy function is not given by this
/// class, since it would involve a specification of the
/// equation of state.
//@{
/**
/*!
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
* pointer is populated and yields the reference state.
*
* @param hrt Output vector containing the nondimensional reference state enthalpies
* Length: m_kk.
*/
virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
/**
/*!
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
* pointer is populated and yields the reference state.
*
* @param grt Output vector containing the nondimensional reference state
* Gibbs Free energies. Length: m_kk.
*/
virtual void getGibbs_RT_ref(doublereal *grt) const;
/**
/*!
* Returns the vector of the
* gibbs function of the reference state at the current temperature
* of the solution and the reference pressure for the species.
* units = J/kmol
*
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
* pointer is populated and yields the reference state.
*
* @param g Output vector containing the reference state
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
*/
virtual void getGibbs_ref(doublereal *g) const;
/**
/*!
* Returns the vector of nondimensional
* entropies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*/
* of the solution and the reference pressure for each species.
*
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
* pointer is populated and yields the reference state.
*
* @param er Output vector containing the nondimensional reference state
* entropies. Length: m_kk.
*/
virtual void getEntropy_R_ref(doublereal *er) const;
/**
/*!
* Returns the vector of nondimensional
* constant pressure heat capacities of the reference state
* at the current temperature of the solution
* and reference pressure for the species.
* and reference pressure for each species.
*
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
* pointer is populated and yields the reference state.
*
* @param cprt Output vector of nondimensional reference state
* heat capacities at constant pressure for the species.
* Length: m_kk
*/
virtual void getCp_R_ref(doublereal *cprt) const;
@@ -479,78 +436,158 @@ namespace Cantera {
* state.
* @{
*/
/** Set the temperature (K), pressure (Pa), and mole fractions. */
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x Vector of mole fractions.
* Length is equal to m_kk.
*/
void setState_TPX(doublereal t, doublereal p, const doublereal* x);
/** Set the temperature (K), pressure (Pa), and mole fractions. */
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x String containing a composition map of the mole fractions. Species not in
* the composition map are assumed to have zero mole fraction
*/
void setState_TPX(doublereal t, doublereal p, compositionMap& x);
/** Set the temperature (K), pressure (Pa), and mole fractions. */
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x String containing a composition map of the mole fractions. Species not in
* the composition map are assumed to have zero mole fraction
*/
void setState_TPX(doublereal t, doublereal p, const std::string& x);
/** Set the temperature (K), pressure (Pa), and mass fractions. */
//! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase.
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y Vector of mass fractions.
* Length is equal to m_kk.
*/
void setState_TPY(doublereal t, doublereal p, const doublereal* y);
/** Set the temperature (K), pressure (Pa), and mass fractions. */
//! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y Composition map of mass fractions. Species not in
* the composition map are assumed to have zero mass fraction
*/
void setState_TPY(doublereal t, doublereal p, compositionMap& y);
/** Set the temperature (K), pressure (Pa), and mass fractions. */
//! Set the internally storred temperature (K), pressure (Pa), and mass fractions of the phase
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y String containing a composition map of the mass fractions. Species not in
* the composition map are assumed to have zero mass fraction
*/
void setState_TPY(doublereal t, doublereal p, const std::string& y);
/** Set the pressure (Pa) and mole fractions. */
//! Set the pressure (Pa) and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param p Pressure (Pa)
* @param x Vector of mole fractions.
* Length is equal to m_kk.
*/
void setState_PX(doublereal p, doublereal* x);
/** Set the pressure (Pa) and mass fractions. */
//! Set the internally storred pressure (Pa) and mass fractions.
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Note, the temperature is held constant during this operation.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param p Pressure (Pa)
* @param y Vector of mass fractions.
* Length is equal to m_kk.
*/
void setState_PY(doublereal p, doublereal* y);
/** Set the specific enthalpy (J/kg) and pressure (Pa). */
//! Set the internally storred specific enthalpy (J/kg) and pressure (Pa) of the phase.
/*!
* @param h Specific enthalpy (J/kg)
* @param p Pressure (Pa)
* @param tol Optional parameter setting the tolerance of the
* calculation.
*/
virtual void setState_HP(doublereal h, doublereal p,
doublereal tol = 1.e-8);
/** Set the specific enthalpy (J/kg) and specific volume (m^3/kg). */
//! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
/*!
* This function fixes the internal state of the phase so that
* the specific internal energy and specific volume have the value of the input parameters.
*
* @param u specific internal energy (J/kg)
* @param v specific volume (m^3/kg).
* @param tol Optional parameter setting the tolerance of the
* calculation.
*/
virtual void setState_UV(doublereal u, doublereal v,
doublereal tol = 1.e-8);
/** Set the specific entropy (J/kg/K) and pressure (Pa). */
//! Set the specific entropy (J/kg/K) and pressure (Pa).
/*!
* This function fixes the internal state of the phase so that
* the specific entropy and the pressure have the value of the input parameters.
*
* @param s specific entropy (J/kg/K)
* @param p specific pressure (Pa).
* @param tol Optional parameter setting the tolerance of the
* calculation.
*/
virtual void setState_SP(doublereal s, doublereal p,
doublereal tol = 1.e-8);
/** Set the specific entropy (J/kg/K) and specific volume (m^3/kg). */
//! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
/*!
* This function fixes the internal state of the phase so that
* the specific entropy and specific volume have the value of the input parameters.
*
* @param s specific entropy (J/kg/K)
* @param v specific volume (m^3/kg).
* @param tol Optional parameter setting the tolerance of the
* calculation.
*/
virtual void setState_SV(doublereal s, doublereal v,
doublereal tol = 1.e-8);
//@}
/**
* @name Chemical Equilibrium
* Chemical equilibrium.
* @{
*/
/**
* This method is used by the ChemEquil equilibrium solver.
* It sets the state such that the chemical potentials satisfy
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
* \f$ \lambda_m \f$ is the element potential of element m. The
* temperature is unchanged. Any phase (ideal or not) that
* implements this method can be equilibrated by ChemEquil.
*/
virtual void setToEquilState(const doublereal* lambda_RT) {
err("setToEquilState");
}
//@}
/**
* @internal
* Set equation of state parameters. The number and meaning of
* these depends on the subclass.
* @param n number of parameters
* @param c array of \i n coefficients
* @param c array of n coefficients
*
*/
virtual void setParameters(int n, doublereal* c) {}
@@ -575,20 +612,7 @@ namespace Cantera {
//@{
/// Critical temperature (K).
virtual doublereal critTemperature() const {
err("critTemperature"); return -1.0;
}
/// Critical pressure (Pa).
virtual doublereal critPressure() const {
err("critPressure"); return -1.0;
}
/// Critical density (kg/m3).
virtual doublereal critDensity() const {
err("critDensity"); return -1.0;
}
//@}
@@ -620,15 +644,20 @@ namespace Cantera {
/**
* @internal Initialize. This method is provided to allow
* @internal Initialize.
*
* This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* each species. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
* from function importPhase().
*
* Inheriting objects should call this function
*
* This version sets the mole fraction vector to x[0] = 1.0, and then
* calls the ThermoPhase::initThermo() function.
*
* @see importCTML.cpp
*/
@@ -637,20 +666,32 @@ namespace Cantera {
protected:
//! Lower value of the temperature for which reference thermo is valid
doublereal m_tmin;
//! Upper value of the temperature for which reference thermo is valid
doublereal m_tmax;
//! Current value of the pressure (Pascals)
doublereal m_press;
//! Value of the reference pressure (Pascals)
doublereal m_p0;
doublereal m_tmin, m_tmax, m_press, m_p0;
/**
* Last temperature used to evaluate the thermodynamic
* polynomial.
*/
//! Last temperature used to evaluate the thermodynamic polynomial.
mutable doublereal m_tlast;
//! Dimensionless enthalpy at the (mtlast, m_p0)
mutable array_fp m_h0_RT;
//! Dimensionless heat capacity at the (mtlast, m_p0)
mutable array_fp m_cp0_R;
//! Dimensionless entropy at the (mtlast, m_p0)
mutable array_fp m_s0_R;
protected:
/**
* @internal
* This crucial internal routine calls the species thermo
* update program to calculate new species Cp0, H0, and
* S0 whenever the temperature has changed.
*/
void _updateThermo() const;
private: