Doxygen update for SurfPhase
Also added a Surfphase(XML_node &) constructor.
This commit is contained in:
parent
c20ccb4023
commit
6b2b1ad51a
8 changed files with 857 additions and 372 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
* @file IdealGasPhase.h
|
||||
*
|
||||
* `
|
||||
* ThermoPhase object for the ideal gas equation of state.
|
||||
*/
|
||||
|
||||
|
|
@ -59,8 +59,9 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Molar enthalpy. Units: J/kmol.
|
||||
|
||||
//! Return the Molar enthalpy. Units: J/kmol.
|
||||
/*!
|
||||
* For an ideal gas mixture,
|
||||
* \f[
|
||||
* \hat h(T) = \sum_k X_k \hat h^0_k(T),
|
||||
|
|
@ -69,6 +70,7 @@ namespace Cantera {
|
|||
* The standard-state pure-species enthalpies
|
||||
* \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
*
|
||||
* \see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const {
|
||||
|
|
@ -335,7 +337,7 @@ namespace Cantera {
|
|||
//@{
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
|
|
@ -346,7 +348,7 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! Get the nondimensional Enthalpy functions for the species standard states
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
|
|
@ -354,8 +356,8 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! 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.
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
|
|
@ -363,7 +365,7 @@ namespace Cantera {
|
|||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state gibbs free energies
|
||||
* Length: m_kk.
|
||||
|
|
@ -504,6 +506,17 @@ namespace Cantera {
|
|||
|
||||
// @}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "SurfPhase.h"
|
||||
#include "EdgePhase.h"
|
||||
#include "utilities.h"
|
||||
#include "importCTML.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
|
@ -42,6 +43,17 @@ namespace Cantera {
|
|||
setNDim(2);
|
||||
}
|
||||
|
||||
SurfPhase::SurfPhase(XML_Node& xmlphase) {
|
||||
const XML_Node& th = xmlphase.child("thermo");
|
||||
string model = th["model"];
|
||||
if (model != "Surface") {
|
||||
throw CanteraError("SurfPhase::SurfPhase",
|
||||
"thermo model attribute must be Surface");
|
||||
}
|
||||
importPhase(xmlphase, this);
|
||||
}
|
||||
|
||||
|
||||
doublereal SurfPhase::
|
||||
enthalpy_mole() const {
|
||||
if (m_n0 <= 0.0) return 0.0;
|
||||
|
|
@ -52,9 +64,9 @@ namespace Cantera {
|
|||
SurfPhase::
|
||||
~SurfPhase() { }
|
||||
|
||||
/**
|
||||
/*
|
||||
* For a surface phase, the pressure is not a relevant
|
||||
* thermodynamic variable, and so the enthalpy is equal to the
|
||||
* thermodynamic variable, and so the Enthalpy is equal to the
|
||||
* internal energy.
|
||||
*/
|
||||
doublereal SurfPhase::
|
||||
|
|
@ -93,17 +105,21 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/// The only parameter that can be set is the site density.
|
||||
void SurfPhase::
|
||||
setParameters(int n, doublereal* c) {
|
||||
m_n0 = c[0];
|
||||
if (m_n0 <= 0.0) {
|
||||
throw CanteraError("SurfPhase::setParameters",
|
||||
"Bad value for parameter");
|
||||
}
|
||||
m_logn0 = log(m_n0);
|
||||
/// The only parameter that can be set is the site density.
|
||||
void SurfPhase::
|
||||
setParameters(int n, doublereal* c) {
|
||||
if (n != 1) {
|
||||
throw CanteraError("SurfPhase::setParameters",
|
||||
"Bad value for number of parameter");
|
||||
}
|
||||
|
||||
m_n0 = c[0];
|
||||
if (m_n0 <= 0.0) {
|
||||
throw CanteraError("SurfPhase::setParameters",
|
||||
"Bad value for parameter");
|
||||
}
|
||||
m_logn0 = log(m_n0);
|
||||
}
|
||||
|
||||
void SurfPhase::
|
||||
getEnthalpy_RT(doublereal* hrt) const {
|
||||
_updateThermo();
|
||||
|
|
@ -202,7 +218,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void SurfPhase::
|
||||
setCoveragesByName(string cov) {
|
||||
setCoveragesByName(std::string cov) {
|
||||
int kk = nSpecies();
|
||||
int k;
|
||||
compositionMap cc;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
*
|
||||
* @file SurfPhase.h
|
||||
*
|
||||
* Contains the declarations for the surface %ThermoPhase class,
|
||||
* SurfPhase.
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Author$
|
||||
|
|
@ -23,112 +26,500 @@
|
|||
namespace Cantera {
|
||||
|
||||
|
||||
/**
|
||||
* A simple model for a surface phase. The surface consists of a
|
||||
* grid of equivalent sites. Surface species may be defined that
|
||||
* occupy one or more sites. The surface species are assumed to be
|
||||
* independent, and thus the species form an ideal solution.
|
||||
* The definitions of the member functions are located in
|
||||
* InterfaceKinetics.cpp.
|
||||
|
||||
//! A simple thermoydnamics model for a surface phase, assuming an ideal solution model.
|
||||
/*!
|
||||
* The surface consists of a grid of equivalent sites. Surface species may be defined to
|
||||
* occupy one or more sites. The surface species are assumed to be
|
||||
* independent, and thus the species form an ideal solution.
|
||||
*
|
||||
* The density of surface sites is given by the variable \f$ n_0 \f$, which has MKS units
|
||||
* of kmol m-2.
|
||||
|
||||
*
|
||||
* The activity of species defined in the phase is given by
|
||||
* \f[
|
||||
* a_k = \theta_k
|
||||
* \f]
|
||||
*
|
||||
* The activity concentration,\f$ C^a_k \f$, used by the kinetics manager, is equal to
|
||||
* the actual concentration, \f$ C^s_k \f$, and is given by the following
|
||||
* expression.
|
||||
* \f[
|
||||
* C^a_k = C^s_k = \frac{\theta_k n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is:
|
||||
* \f[
|
||||
* C^0_k = \frac{n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* Pressure is defined as an independent variable in this phase. However, it has
|
||||
* no effect on any quantities, as the molar concentration is a constant.
|
||||
*
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T) + R T \log(\theta_k)
|
||||
* \f]
|
||||
*
|
||||
* The internal energy for species k is equal to the enthalpy for species <I>k</I>
|
||||
* \f[
|
||||
* u_k = h_k
|
||||
* \f]
|
||||
*
|
||||
* The entropy for the phase is given by the following relation, which is
|
||||
* independent of the pressure:
|
||||
*
|
||||
* \f[
|
||||
* s_k(T,P) = s^o_k(T) - R \log(\theta_k)
|
||||
* \f]
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for Cantera. A new SurfPhase may be created by the following code snippet:
|
||||
*
|
||||
* @code
|
||||
* XML_Node * const xs = xc->findNameID("phase", "diamond_100");
|
||||
* ThermoPhase *diamond100TP_tp = newPhase(*xs);
|
||||
* SurfPhase *diamond100TP = dynamic_cast <SurfPhase *>(diamond100TP_tp);
|
||||
* @endcode
|
||||
*
|
||||
* or by the following constructor:
|
||||
*
|
||||
* @code
|
||||
* XML_Node * const xs = xc->findNameID("phase", "diamond_100");
|
||||
* SurfPhase *diamond100TP = new SurfPhase(*xs);
|
||||
* @endcode
|
||||
*
|
||||
* An example of an XML Element named phase setting up a SurfPhase object named diamond_100
|
||||
* is given below.
|
||||
*
|
||||
* @code
|
||||
* <phase dim="2" id="diamond_100">
|
||||
* <elementArray datasrc="elements.xml">H C</elementArray>
|
||||
* <speciesArray datasrc="#species_data">c6HH c6H* c6*H c6** c6HM c6HM* c6*M c6B </speciesArray>
|
||||
* <reactionArray datasrc="#reaction_data"/>
|
||||
* <state>
|
||||
* <temperature units="K">1200.0</temperature>
|
||||
* <coverages>c6H*:0.1, c6HH:0.9</coverages>
|
||||
* </state>
|
||||
* <thermo model="Surface">
|
||||
* <site_density units="mol/cm2">3e-09</site_density>
|
||||
* </thermo>
|
||||
* <kinetics model="Interface"/>
|
||||
* <transport model="None"/>
|
||||
* <phaseArray>
|
||||
* gas_phase diamond_bulk
|
||||
* </phaseArray>
|
||||
* </phase>
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* The model attribute, "Surface", on the thermo element identifies the phase as being
|
||||
* a SurfPhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
class SurfPhase : public ThermoPhase {
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
/*!
|
||||
* @param n0 Site Density of the Surface Phase
|
||||
* Units: kmol m-2.
|
||||
*/
|
||||
class SurfPhase : public ThermoPhase {
|
||||
SurfPhase(doublereal n0 = 0.0);
|
||||
|
||||
public:
|
||||
//! Constructor.
|
||||
/*!
|
||||
* @param xmlphase XML node pointing to a SurfPhase description
|
||||
*/
|
||||
SurfPhase(XML_Node& xmlphase);
|
||||
|
||||
|
||||
/// Constructor.
|
||||
SurfPhase(doublereal n0 = 0.0);
|
||||
//! Destructor.
|
||||
virtual ~SurfPhase();
|
||||
|
||||
/// Destructor.
|
||||
virtual ~SurfPhase();
|
||||
//----- reimplimented methods of class ThermoPhase ------
|
||||
|
||||
//----- reimplimented methods of class ThermoPhase ------
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
* Redefine this to return cSurf, listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const { return cSurf; }
|
||||
|
||||
virtual int eosType() const { return cSurf; }
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
virtual doublereal standardConcentration(int k = 0) const;
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual void setParameters(int n, doublereal* c);
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
virtual void initThermo();
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
doublereal siteDensity(){ return m_n0; }
|
||||
void setPotentialEnergy(int k, doublereal pe);
|
||||
doublereal potentialEnergy(int k) {return m_pe[k];}
|
||||
void setSiteDensity(doublereal n0);
|
||||
//! Return the Molar Enthalpy. Units: J/kmol.
|
||||
/*!
|
||||
* For an ideal solution,
|
||||
* \f[
|
||||
* \hat h(T,P) = \sum_k X_k \hat h^0_k(T),
|
||||
* \f]
|
||||
* and is a function only of temperature.
|
||||
* The standard-state pure-species Enthalpies
|
||||
* \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
*
|
||||
* \see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
void getEnthalpy_RT(doublereal* hrt) const;
|
||||
void getEntropy_R(doublereal* sr) const;
|
||||
//! Return the Molar Internal Energy. Units: J/kmol
|
||||
/**
|
||||
* For a surface phase, the pressure is not a relevant
|
||||
* thermodynamic variable, and so the Enthalpy is equal to the
|
||||
* Internal Energy.
|
||||
*/
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
virtual doublereal pressure() const {
|
||||
return m_press;
|
||||
}
|
||||
//! Get the array of chemical potentials at unit activity for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
|
||||
virtual void setPressure(doublereal p) {
|
||||
m_press = p;
|
||||
}
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Return a vector of activity concentrations for each species
|
||||
/*!
|
||||
* For this phase the activity concentrations,\f$ C^a_k \f$, are defined to be
|
||||
* equal to the actual concentrations, \f$ C^s_k \f$.
|
||||
* Activity concentrations are
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k = \frac{\theta_k n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* where \f$ \theta_k \f$ is the surface site fraction for species k,
|
||||
* \f$ n_0 \f$ is the surface site density for the phase, and
|
||||
* \f$ s_k \f$ is the surface size of species k.
|
||||
*
|
||||
* \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in
|
||||
* the thermodynamic functions. These activity concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
*
|
||||
* @param c vector of activity concentration (kmol m-2).
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration.
|
||||
* For this phase, the standard concentration is species-
|
||||
* specific
|
||||
*
|
||||
* \f[
|
||||
* C^0_k = \frac{n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* This definition implies that the activity is equal to \f$ \theta_k \f$.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k = 0) const;
|
||||
|
||||
//! Return the log of the standard concentration for the kth species
|
||||
/*!
|
||||
* @param k species index (default 0)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
|
||||
//! Set the equation of state parameters from the argument list
|
||||
/*!
|
||||
* @internal
|
||||
* Set equation of state parameters.
|
||||
*
|
||||
* @param n number of parameters. Must be one
|
||||
* @param c array of \a n coefficients
|
||||
* c[0] = The site density (kmol m-2)
|
||||
*/
|
||||
virtual void setParameters(int n, doublereal* c);
|
||||
|
||||
//! Set the Equation-of-State parameters by reading an XML Node Input
|
||||
/*!
|
||||
*
|
||||
* The Equation-of-State data consists of one item, the site density.
|
||||
*
|
||||
* @param thermoData Reference to an XML_Node named thermo
|
||||
* containing the equation-of-state data. The
|
||||
* XML_Node is within the phase XML_Node describing
|
||||
* the %SurfPhase object.
|
||||
*
|
||||
* An example of the contents of the thermoData XML_Node is provided
|
||||
* below. The units attribute is used to supply the units of the
|
||||
* site density in any convenient form. Internally it is changed
|
||||
* into MKS form.
|
||||
*
|
||||
* @code
|
||||
* <thermo model="Surface">
|
||||
* <site_density units="mol/cm2"> 3e-09 </site_density>
|
||||
* </thermo>
|
||||
* @endcode
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& thermoData);
|
||||
|
||||
|
||||
//! Initialize the SurfPhase object after all species have been set up
|
||||
/*!
|
||||
* @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
|
||||
* description, this method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from function importPhase().
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
//------- new methods defined in this class ----------
|
||||
//! Set the initial state of the Surface Phase from an XML_Node
|
||||
/*!
|
||||
* State variables that can be set by this routine are
|
||||
* the temperature and the surface site coverages.
|
||||
*
|
||||
* @param state XML_Node containing the state information
|
||||
*
|
||||
* An example of the XML code block is given below.
|
||||
*
|
||||
* @code
|
||||
* <state>
|
||||
* <temperature units="K">1200.0</temperature>
|
||||
* <coverages>c6H*:0.1, c6HH:0.9</coverages>
|
||||
* </state>
|
||||
* @endcode
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
/**
|
||||
* Set the surface site fractions to a specified
|
||||
* state. This routine converts to concentrations
|
||||
* in kmol/m2, using m_n0, the surface site density,
|
||||
* and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule.
|
||||
* It then calls State::setConcentrations to set the
|
||||
* internal concentration in the object.
|
||||
*
|
||||
* @param theta[k] This is the surface site fraction
|
||||
* for the kth species in the surface phase.
|
||||
* This is a dimensionless quantity.
|
||||
*/
|
||||
void setCoverages(const doublereal* theta);
|
||||
//! Returns the site density
|
||||
/*!
|
||||
* Site density kmol m-2
|
||||
*/
|
||||
doublereal siteDensity(){ return m_n0; }
|
||||
|
||||
/**
|
||||
* Set the coverages without normalizing them to sum to 1.0.
|
||||
* This may be used when the normalization condition is part
|
||||
* of the system of equations being solved.
|
||||
*/
|
||||
void setCoveragesNoNorm(const doublereal* theta);
|
||||
//! Sets the potential energy of species k.
|
||||
/*!
|
||||
*
|
||||
* @param k Species index
|
||||
* @param pe Value of the potential energy (J kmol-1)
|
||||
*/
|
||||
void setPotentialEnergy(int k, doublereal pe);
|
||||
|
||||
/**
|
||||
* Set the coverages from a string of colon-separated
|
||||
* name:value pairs.
|
||||
*/
|
||||
void setCoveragesByName(std::string cov);
|
||||
//! Return the potential energy of species k.
|
||||
/*!
|
||||
* Returns the potential energy of species, k,
|
||||
* J kmol-1
|
||||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
doublereal potentialEnergy(int k) {return m_pe[k];}
|
||||
|
||||
/**
|
||||
* Get the coverages. Array theta must be at least as long as
|
||||
* the number of species.
|
||||
*/
|
||||
void getCoverages(doublereal* theta) const;
|
||||
//! Set the site density of the surface phase (kmol m-2)
|
||||
/*!
|
||||
* @param n0 Site density of the surface phase (kmol m-2)
|
||||
*/
|
||||
void setSiteDensity(doublereal n0);
|
||||
|
||||
protected:
|
||||
//! Get the nondimensional Enthalpy functions for the species standard states
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
doublereal m_n0;
|
||||
doublereal m_logn0;
|
||||
doublereal m_tmin, m_tmax;
|
||||
doublereal m_press;
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
mutable doublereal m_tlast;
|
||||
mutable array_fp m_h0;
|
||||
mutable array_fp m_s0;
|
||||
mutable array_fp m_cp0;
|
||||
mutable array_fp m_mu0;
|
||||
mutable array_fp m_work;
|
||||
mutable array_fp m_pe;
|
||||
mutable array_fp m_logsize;
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
/*!
|
||||
* This method must be overloaded 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 m_press;
|
||||
}
|
||||
|
||||
private:
|
||||
//! Set the internally storred pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
/*!
|
||||
* This method must be reimplemented in derived classes, where it
|
||||
* may involve the solution of a nonlinear equation. Within %Cantera,
|
||||
* the independent variable is the density. Therefore, this function
|
||||
* solves for the density that will yield the desired input pressure.
|
||||
* The temperature and composition iare held constant during this process.
|
||||
*
|
||||
* This base class function will print an error, if not overwritten.
|
||||
*
|
||||
* @param p input Pressure (Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p) {
|
||||
m_press = p;
|
||||
}
|
||||
|
||||
void _updateThermo(bool force=false) const;
|
||||
|
||||
};
|
||||
//------- new methods defined in this class ----------
|
||||
|
||||
//! Set the surface site fractions to a specified state.
|
||||
/*!
|
||||
* This routine converts to concentrations
|
||||
* in kmol/m2, using m_n0, the surface site density,
|
||||
* and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule.
|
||||
* It then calls State::setConcentrations to set the
|
||||
* internal concentration in the object.
|
||||
*
|
||||
* @param theta This is the surface site fraction
|
||||
* for the kth species in the surface phase.
|
||||
* This is a dimensionless quantity.
|
||||
*
|
||||
* This routine normalizes the theta's to 1, before application
|
||||
*/
|
||||
void setCoverages(const doublereal* theta);
|
||||
|
||||
//! Set the surface site fractions to a specified state.
|
||||
/*!
|
||||
* This routine converts to concentrations
|
||||
* in kmol/m2, using m_n0, the surface site density,
|
||||
* and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule.
|
||||
* It then calls State::setConcentrations to set the
|
||||
* internal concentration in the object.
|
||||
*
|
||||
* @param theta This is the surface site fraction
|
||||
* for the kth species in the surface phase.
|
||||
* This is a dimensionless quantity.
|
||||
*/
|
||||
void setCoveragesNoNorm(const doublereal* theta);
|
||||
|
||||
|
||||
//! Set the coverages from a string of colon-separated name:value pairs.
|
||||
/*!
|
||||
* @param cov String containing colon-separated name:value pairs
|
||||
*/
|
||||
void setCoveragesByName(std::string cov);
|
||||
|
||||
//! Return a vector of surface coverages
|
||||
/*!
|
||||
* Get the coverages.
|
||||
*
|
||||
* @param theta Array theta must be at least as long as
|
||||
* the number of species.
|
||||
*/
|
||||
void getCoverages(doublereal* theta) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Surface site density (kmol m-2)
|
||||
doublereal m_n0;
|
||||
|
||||
//! log of the surface site density
|
||||
doublereal m_logn0;
|
||||
|
||||
//! Minimum temperature for valid species standard state thermo props
|
||||
/*!
|
||||
* This is the minimum temperature at which all species have valid standard
|
||||
* state thermo props defined.
|
||||
*/
|
||||
doublereal m_tmin;
|
||||
|
||||
//! Maximum temperature for valid species standard state thermo props
|
||||
/*!
|
||||
* This is the maximum temperature at which all species have valid standard
|
||||
* state thermo props defined.
|
||||
*/
|
||||
doublereal m_tmax;
|
||||
|
||||
//! Current value of the pressure (Pa)
|
||||
doublereal m_press;
|
||||
|
||||
//! Current value of the temperature (Kelvin)
|
||||
mutable doublereal m_tlast;
|
||||
|
||||
//! Temporary storage for the reference state enthalpies
|
||||
mutable array_fp m_h0;
|
||||
|
||||
//! Temporary storage for the reference state entropies
|
||||
mutable array_fp m_s0;
|
||||
|
||||
//! Temporary storage for the reference state heat capacities
|
||||
mutable array_fp m_cp0;
|
||||
|
||||
//! Temporary storage for the reference state gibbs energies
|
||||
mutable array_fp m_mu0;
|
||||
|
||||
//! Temporary work array
|
||||
mutable array_fp m_work;
|
||||
|
||||
//! Potential energy of each species in the surface phase
|
||||
/*!
|
||||
* @todo Fix potential energy
|
||||
* Note, the potential energy terms seem to be orphaned at the moment.
|
||||
* They are not connected to the Gibbs free energy calculation in
|
||||
* this object
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
mutable array_fp m_pe;
|
||||
|
||||
//! vector storring the log of the size of each species.
|
||||
/*!
|
||||
* The size of each species is defined as the number of surface
|
||||
* sites each species occupies.
|
||||
*/
|
||||
mutable array_fp m_logsize;
|
||||
|
||||
private:
|
||||
|
||||
//! Update the species standard state thermodynamic functions
|
||||
/*!
|
||||
* The polynomials for the standard state functions are only
|
||||
* reevalulated if the temperature has changed.
|
||||
*
|
||||
* @param force Boolean, which if true, forces a reevalulation
|
||||
* of the thermo polynomials.
|
||||
* default = false.
|
||||
*/
|
||||
void _updateThermo(bool force=false) const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* @file ThermoPhase.h
|
||||
*
|
||||
* Header file for class ThermoPhase.
|
||||
*
|
||||
* Also contains the text for the Module thermoprops.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -43,85 +43,137 @@ namespace Cantera {
|
|||
* is a large class that describes the interface within Cantera to Thermodynamic
|
||||
* functions for a phase.
|
||||
*
|
||||
*
|
||||
* The calculation of thermodynamic functions within %ThermoPhase is
|
||||
* broken down roughly into two or more steps. First, the standard state properties
|
||||
* of all of the species are calculated at the current temperature and at either
|
||||
* the current pressure or at a reference pressure. If the calculation is
|
||||
* carried out at a refereence pressure instead of at the current pressure
|
||||
* the calculation is called a "reference state properties" calculation,
|
||||
* just to make the distinction (even though it may be considered to be
|
||||
* a fixed-pressure standard-state calculation). The next step is to
|
||||
* adjust the reference state calculation to the current pressure. The thermodynamic
|
||||
* functions then are considered to be at the standard state of each species.
|
||||
* Lastly the mixing contributions are added to arrive at the thermodynamic
|
||||
* functions for the solution.
|
||||
*
|
||||
* The %ThermoPhase class provides interfaces to thermodynamic properties calculated for
|
||||
* the reference state of each species, the standard state values for
|
||||
* each species, the thermodynamic functions for solution values, both
|
||||
* on a per mole of solution basis (i.e., enthalpy_mole()), on a per kg of
|
||||
* solution basis, and on a
|
||||
* partial molar basis for each species (i.e.,
|
||||
* getPartialMolarEnthalpies(double *hbar)).
|
||||
* At each level, functions for the enthalpy, entropy, Gibbs free energy,
|
||||
* internal energy, and volume are provided. So, 5 levels (reference state,
|
||||
* standard state, partial molar, per mole of solution, and per mass of solution)
|
||||
* and 5 functions multiplied together makes 25 possible functions. That's
|
||||
* why %ThermoPhase is such a large class.
|
||||
*
|
||||
*
|
||||
* Mechanical properties
|
||||
*
|
||||
* Standard state properties
|
||||
* Treatment of the electrochemical potential
|
||||
*
|
||||
* Treatment of other potential energy contributions.
|
||||
*
|
||||
* Setting the State of the phase
|
||||
*
|
||||
* Instantiation of ThermoPhase properties occurs via the following path.
|
||||
*
|
||||
* Molar Basis vs. Molality Basis
|
||||
*
|
||||
* The following Objects inherit from ThermoPhase. These are known to the
|
||||
* internal factory methods
|
||||
*
|
||||
* - IdealGasPhase in IdealGasPhase.h
|
||||
* - StoichSubstance in StoichSubstance.h
|
||||
* - SurfPhase in SurfPhase.h
|
||||
* - LatticePhase in LatticePhase.h
|
||||
* - LatticeSolidPhase in LatticeSolidPhase.h
|
||||
* - ConstDensityThermo in ConstDensityThermo.h
|
||||
* - PureFluidPhase in PureFluidPhase.h
|
||||
* .
|
||||
*
|
||||
* The following additional objects inherit from ThermoPhase. Most of these
|
||||
* The following additional objects inherit from %ThermoPhase. Most of these
|
||||
* are associated with an electrochemistry capability that is under construction.
|
||||
*
|
||||
* - DebyeHuckel in thermo/DebyeHuckel.h
|
||||
* - SingleSpeciesTP in thermo/SingleSpeciesTP.h
|
||||
* - StoichSubstanceSSTP in thermo/StoichSubstanceSSTP.h
|
||||
* - VPStandardStateTP in thermo/VPStandardStateTP.h
|
||||
* - IdealMolalSoln in thermo/IdealMolalSoln.h
|
||||
* - IdealSolidSolnPhase in thermo/IdealSolidSolnPhase.h
|
||||
* - IdealGasPDSS in thermo/IdealGasPDSS.h
|
||||
* - MolalityVPSSTP in thermo/MolalityVPSSTP.h
|
||||
* - HMWSoln in thermo/HMWSoln.h
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @see newPhase(std::string file, std::string id) Description for how to read ThermoPhases from XML files.
|
||||
* @see newPhase(XML_Node &phase) How to call the Factory routine to create and initialize ThermoPhase objects.
|
||||
* @see newPhase(std::string file, std::string id) Description for how to
|
||||
* read ThermoPhases from XML files.
|
||||
* @see newPhase(XML_Node &phase) How to call the Factory routine to create
|
||||
* and initialize ThermoPhase objects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A phase with thermodynamic properties.
|
||||
* Class %ThermoPhase is the base class for the family of classes
|
||||
* that represent phases of matter of any type. It defines a
|
||||
* common public interface, and implements a few methods. Most of
|
||||
* the methods, however, are declared virtual and are meant to be
|
||||
* overloaded in derived classes. The standard way used
|
||||
* throughout Cantera to compute properties of phases of matter is
|
||||
* through pointers of type ThermoPhase* that point to objects of
|
||||
* subclasses of ThermoPhase.
|
||||
*
|
||||
* Class %ThermoPhase
|
||||
* extends class Phase by adding methods to compute thermodynamic
|
||||
* properties in addition to the ones (temperature, density,
|
||||
* composition) that class Phase provides. The distinction is that
|
||||
* the methods declared in ThermoPhase require knowing the
|
||||
* particular equation of state of the phase of interest, while
|
||||
* those of class Phase do not, since they only involve data values
|
||||
* stored within the object.
|
||||
*
|
||||
* Instances of subclasses of %ThermoPhase should be created using
|
||||
* the factory class ThermoFactory, not by calling the constructor
|
||||
* directly. This allows new classes to be used with the various
|
||||
* Cantera language interfaces.
|
||||
*
|
||||
* To implement a new equation of state, derive a class from
|
||||
* ThermoPhase and overload the virtual methods in
|
||||
* ThermoPhase. Methods that are not needed can be left
|
||||
* unimplimented, which will cause an exception to be thrown if it
|
||||
* is called.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
* @ingroup phases
|
||||
*/
|
||||
class ThermoPhase : public Phase {
|
||||
|
||||
//! Base class for a phase with thermodynamic properties.
|
||||
/*!
|
||||
* Class %ThermoPhase is the base class for the family of classes
|
||||
* that represent phases of matter of any type. It defines a
|
||||
* common public interface, and implements a few methods. Most of
|
||||
* the methods, however, are declared virtual and are meant to be
|
||||
* overloaded in derived classes. The standard way used
|
||||
* throughout Cantera to compute properties of phases of matter is
|
||||
* through pointers of type ThermoPhase* that point to objects of
|
||||
* subclasses of ThermoPhase.
|
||||
*
|
||||
* Class %ThermoPhase extends class Phase by adding methods to compute
|
||||
* thermodynamic
|
||||
* properties in addition to the ones (temperature, density,
|
||||
* composition) that class Phase provides. The distinction is that
|
||||
* the methods declared in ThermoPhase require knowing the
|
||||
* particular equation of state of the phase of interest, while
|
||||
* those of class Phase do not, since they only involve data values
|
||||
* stored within the object.
|
||||
*
|
||||
* Instances of subclasses of %ThermoPhase should be created using
|
||||
* the factory class ThermoFactory, not by calling the constructor
|
||||
* directly. This allows new classes to be used with the various
|
||||
* Cantera language interfaces.
|
||||
*
|
||||
* To implement a new equation of state, derive a class from
|
||||
* ThermoPhase and overload the virtual methods in
|
||||
* ThermoPhase. Methods that are not needed can be left
|
||||
* unimplimented, which will cause an exception to be thrown if it
|
||||
* is called.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
* @ingroup phases
|
||||
*/
|
||||
class ThermoPhase : public Phase {
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor. Note that ThermoPhase is meant to be used as
|
||||
/// a base class, so this constructor should not be called
|
||||
/// explicitly.
|
||||
ThermoPhase() : Phase(), m_spthermo(0), m_speciesData(0),
|
||||
m_index(-1), m_phi(0.0), m_hasElementPotentials(false) {}
|
||||
//! Constructor. Note that ThermoPhase is meant to be used as
|
||||
//! a base class, so this constructor should not be called
|
||||
//! explicitly.
|
||||
ThermoPhase() : Phase(), m_spthermo(0), m_speciesData(0),
|
||||
m_index(-1), m_phi(0.0), m_hasElementPotentials(false) {}
|
||||
|
||||
//! Destructor. Deletes the species thermo manager.
|
||||
virtual ~ThermoPhase() {
|
||||
delete m_spthermo;
|
||||
}
|
||||
|
||||
/// Destructor. Deletes the species thermo manager.
|
||||
virtual ~ThermoPhase() {
|
||||
delete m_spthermo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor for the %ThermoPhase object.
|
||||
*
|
||||
* Currently, this is not fully implemented. If called it will
|
||||
* throw an exception.
|
||||
*/
|
||||
ThermoPhase(const ThermoPhase &);
|
||||
|
||||
|
||||
//!Copy Constructor for the %ThermoPhase object.
|
||||
/*!
|
||||
* Currently, this is not fully implemented. If called it will
|
||||
* throw an exception.
|
||||
*/
|
||||
ThermoPhase(const ThermoPhase &);
|
||||
|
||||
//! Assignment operator
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* This is NOT a virtual function.
|
||||
*
|
||||
|
|
@ -130,34 +182,34 @@ namespace Cantera {
|
|||
*/
|
||||
ThermoPhase& operator=(const ThermoPhase &right);
|
||||
|
||||
/**
|
||||
* Duplication routine for objects which inherit from
|
||||
* ThermoPhase.
|
||||
*
|
||||
* This virtual routine can be used to duplicate thermophase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*
|
||||
* Currently, this is not fully implemented. If called, an
|
||||
* exception will be called.
|
||||
*/
|
||||
virtual ThermoPhase *duplMyselfAsThermoPhase();
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Information Methods
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const { return 0; }
|
||||
|
||||
|
||||
/**
|
||||
* Duplication routine for objects which inherit from
|
||||
* ThermoPhase.
|
||||
*
|
||||
* This virtual routine can be used to duplicate thermophase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*
|
||||
* Currently, this is not fully implemented. If called, an
|
||||
* exception will be called.
|
||||
*/
|
||||
virtual ThermoPhase *duplMyselfAsThermoPhase();
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Information Methods
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
* The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const { return 0; }
|
||||
|
||||
/**
|
||||
* Returns the reference pressure in Pa. This function is a wrapper
|
||||
* that calls the species thermo refPressure function.
|
||||
|
|
@ -182,76 +234,76 @@ namespace Cantera {
|
|||
return m_spthermo->minTemp(k);
|
||||
}
|
||||
|
||||
//! Maximum temperature for which the thermodynamic data for the species are valid.
|
||||
/*!
|
||||
* If no argument is supplied, the
|
||||
* value returned will be the highest temperature at which the
|
||||
* data for \e all species are valid. Otherwise, the value
|
||||
* will be only for species \a k. This function is a wrapper
|
||||
* that calls the species thermo maxTemp function.
|
||||
*
|
||||
* @param k index of the species. Default is -1, which will return the min of the max value
|
||||
* over all species.
|
||||
*/
|
||||
doublereal maxTemp(int k = -1) {
|
||||
return m_spthermo->maxTemp(k);
|
||||
}
|
||||
//! Maximum temperature for which the thermodynamic data for the species
|
||||
//! are valid.
|
||||
/*!
|
||||
* If no argument is supplied, the
|
||||
* value returned will be the highest temperature at which the
|
||||
* data for \e all species are valid. Otherwise, the value
|
||||
* will be only for species \a k. This function is a wrapper
|
||||
* that calls the species thermo maxTemp function.
|
||||
*
|
||||
* @param k index of the species. Default is -1, which will return the min of the max value
|
||||
* over all species.
|
||||
*/
|
||||
doublereal maxTemp(int k = -1) {
|
||||
return m_spthermo->maxTemp(k);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const {
|
||||
return err("enthalpy_mole");
|
||||
}
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const {
|
||||
return err("enthalpy_mole");
|
||||
}
|
||||
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
virtual doublereal intEnergy_mole() const {
|
||||
return err("intEnergy_mole");
|
||||
}
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
virtual doublereal intEnergy_mole() const {
|
||||
return err("intEnergy_mole");
|
||||
}
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const {
|
||||
return err("entropy_mole");
|
||||
}
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const {
|
||||
return err("entropy_mole");
|
||||
}
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
virtual doublereal gibbs_mole() const {
|
||||
return err("gibbs_mole");
|
||||
}
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
virtual doublereal gibbs_mole() const {
|
||||
return err("gibbs_mole");
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const {
|
||||
return err("cp_mole");
|
||||
}
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const {
|
||||
return err("cp_mole");
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const {
|
||||
return err("cv_mole");
|
||||
}
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const {
|
||||
return err("cv_mole");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pressure. Return the thermodynamic pressure (Pa). This
|
||||
* method must be overloaded 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");
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
/*!
|
||||
* This method must be overloaded 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 internally storred pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
|
|
@ -363,55 +415,57 @@ namespace Cantera {
|
|||
virtual int activityConvention() const;
|
||||
|
||||
|
||||
//! 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. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output 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");
|
||||
}
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output 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.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const {
|
||||
err("standardConcentration");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., 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.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const {
|
||||
err("standardConcentration");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const {
|
||||
err("logStandardConc");
|
||||
return -1.0;
|
||||
}
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const {
|
||||
err("logStandardConc");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
|
|
@ -491,19 +545,19 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const {
|
||||
err("getChemPotentials");
|
||||
}
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const {
|
||||
err("getChemPotentials");
|
||||
}
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities. This method adds a term \f$ Fz_k
|
||||
|
|
@ -594,7 +648,7 @@ namespace Cantera {
|
|||
err("getEnthalpy_RT");
|
||||
}
|
||||
|
||||
//! Get the array of nondimensional Enthalpy functions for the
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
|
|
@ -1152,60 +1206,67 @@ namespace Cantera {
|
|||
virtual void initThermoFile(std::string inputFile, std::string id);
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Import and initialize a ThermoPhase object
|
||||
* using an XML tree.
|
||||
* Here we read extra information about the XML description
|
||||
* of a phase. Regular information about elements and species
|
||||
* and their reference state thermodynamic information
|
||||
* have already been read at this point.
|
||||
* For example, we do not need to call this function for
|
||||
* ideal gas equations of state.
|
||||
* 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
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
//!Import and initialize a ThermoPhase object using an XML tree.
|
||||
/*!
|
||||
* @internal
|
||||
*
|
||||
* Here we read extra information about the XML description
|
||||
* of a phase. Regular information about elements and species
|
||||
* and their reference state thermodynamic information
|
||||
* have already been read at this point.
|
||||
* For example, we do not need to call this function for
|
||||
* ideal gas equations of state. This function is called from importPhase()
|
||||
* after the elements and the species are initialized with
|
||||
* default ideal solution level data.
|
||||
*
|
||||
* The default implementation in ThermoPhase calls the
|
||||
* virtual function initThermo() and then sets the "state" of the
|
||||
* phase by looking for an XML element named "state", and then
|
||||
* interpreting its contents by calling the virtual function
|
||||
* setStateFromXML().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @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
|
||||
* description, this method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from function importPhase().
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
// The following methods are used by the clib interface
|
||||
// library, and should not be used by application programs.
|
||||
|
||||
/**
|
||||
* @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
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
// The following methods are used by the clib interface
|
||||
// library, and should not be used by application programs.
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Index number. This method can be used to identify the
|
||||
* location of a phase object in a list, and is used by the
|
||||
* interface library (clib) routines for this purpose.
|
||||
*/
|
||||
int index() { return m_index; }
|
||||
/*!
|
||||
* @internal
|
||||
* Index number. This method can be used to identify the
|
||||
* location of a phase object in a list, and is used by the
|
||||
* interface library (clib) routines for this purpose.
|
||||
*/
|
||||
int index() { return m_index; }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -738,7 +738,7 @@ namespace Cantera {
|
|||
* species in a phase.
|
||||
* We import information about the species, including their
|
||||
* reference state thermodynamic polynomials. We then freeze
|
||||
* the state of the species, and finally call initThermo()
|
||||
* the state of the species, and finally call initThermoXML(phase, id)
|
||||
* a member function of the ThermoPhase object to "finish"
|
||||
* the description.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ depends:
|
|||
test:
|
||||
ifeq ($(os_is_win), 1)
|
||||
else
|
||||
@MAKE@ $(PROGRAM)
|
||||
@ @MAKE@ -s $(PROGRAM)
|
||||
endif
|
||||
./runtest
|
||||
@ ./runtest
|
||||
|
||||
# clean target -> clean up
|
||||
clean:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ static void printUsage()
|
|||
#include "importCTML.h"
|
||||
#include "ThermoPhase.h"
|
||||
#include "InterfaceKinetics.h"
|
||||
#include "SurfPhase.h"
|
||||
#else
|
||||
#include "Cantera.h"
|
||||
#include "kernel/ct_defs.h"
|
||||
|
|
@ -46,6 +47,7 @@ static void printUsage()
|
|||
#include "kernel/importCTML.h"
|
||||
#include "kernel/ThermoPhase.h"
|
||||
#include "kernel/InterfaceKinetics.h"
|
||||
#include "kernel/SurfPhase.h"
|
||||
#endif
|
||||
|
||||
using namespace Cantera;
|
||||
|
|
@ -80,6 +82,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
XML_Node * const xs = xc->findNameID("phase", "diamond_100");
|
||||
ThermoPhase *diamond100TP = newPhase(*xs);
|
||||
//SurfPhase *diamond100TP = new SurfPhase(*xs);
|
||||
int nsp_d100 = diamond100TP->nSpecies();
|
||||
cout << "Number of species in diamond_100 = " << nsp_d100 << endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ FILE_PATTERNS = Kinetics.h Kinetics.cpp \
|
|||
importCTML.cpp importCTML.h \
|
||||
ThermoFactory.h ThermoFactory.cpp \
|
||||
IdealGasPhase.h IdealGasPhase.cpp \
|
||||
SurfPhase.h SurfPhase.cpp \
|
||||
SpeciesThermoFactory.h SpeciesThermoFactory.cpp \
|
||||
speciesThermoTypes.h SpeciesThermoMgr.h SpeciesThermo.h SpeciesThermoInterpTypes.h \
|
||||
NasaThermo.h NasaPoly1.h NasaPoly2.h \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue