Merged with the trunk.
This commit is contained in:
commit
7abb1dc33a
31 changed files with 989 additions and 827 deletions
|
|
@ -29,7 +29,7 @@
|
|||
//! Unary operator to multiply the argument by a constant.
|
||||
/*!
|
||||
* The form of this operator is designed for use by std::transform.
|
||||
* @see @ref scale.
|
||||
* @see @ref scale().
|
||||
*/
|
||||
template<class T> struct timesConstant : public std::unary_function<T, double>
|
||||
{
|
||||
|
|
@ -574,9 +574,9 @@ namespace Cantera {
|
|||
return sum;
|
||||
}
|
||||
|
||||
//! scale a templated vector by a constant factor.
|
||||
//! Scale a templated vector by a constant factor.
|
||||
/*!
|
||||
* The template arguments are: template<class OutputIter>
|
||||
* The template arguments are: template<class OutputIter>
|
||||
*
|
||||
* This function is essentially a wrapper around the stl
|
||||
* function %scale(). The function is has one template
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Searches a string for the first occurrence of a valid
|
||||
* quoted string. Quotes can start with either a single
|
||||
* quote or a double quote, but must also end with the same
|
||||
|
|
@ -289,7 +289,7 @@ namespace Cantera {
|
|||
return static_cast<int>(iloc1)+1;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* parseTag parses XML tags, i.e., the XML elements that are
|
||||
* inbetween angle brackets.
|
||||
*/
|
||||
|
|
@ -679,9 +679,9 @@ namespace Cantera {
|
|||
return child(cname).value();
|
||||
}
|
||||
|
||||
//! Overloaded parenthesis operator with one augment
|
||||
//! returns the value of an XML child node as a string
|
||||
/*!
|
||||
// Overloaded parenthesis operator with one augment
|
||||
// returns the value of an XML child node as a string
|
||||
/*
|
||||
* @param cname Name of the child node to the current
|
||||
* node, for which you want the value
|
||||
*/
|
||||
|
|
@ -716,7 +716,7 @@ namespace Cantera {
|
|||
m_attribs[attrib] = fp2str(value, fmt);
|
||||
}
|
||||
|
||||
// The operator[] is overloaded to provide a lookup capability
|
||||
// The operator[] is overloaded to provide a lookup capability
|
||||
// on attributes for the current XML element.
|
||||
/*
|
||||
* For example
|
||||
|
|
@ -754,7 +754,7 @@ namespace Cantera {
|
|||
return "";
|
||||
}
|
||||
|
||||
// Returns a changeable value of the attributes map for the current node
|
||||
// Returns a changeable value of the attributes map for the current node
|
||||
/*
|
||||
* Note this is a simple accessor routine. And, it is a private function.
|
||||
* It's used in some internal copy and assignment routines
|
||||
|
|
@ -861,9 +861,9 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
//! This routine carries out a search for an XML node based
|
||||
//! on both the xml element name and the attribute ID.
|
||||
/*!
|
||||
// This routine carries out a search for an XML node based
|
||||
// on both the xml element name and the attribute ID.
|
||||
/*
|
||||
* If exact matches are found for both fields, the pointer
|
||||
* to the matching XML Node is returned.
|
||||
*
|
||||
|
|
@ -946,8 +946,8 @@ namespace Cantera {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// This routine carries out a recursive search for an XML node based
|
||||
// on an attribute of each XML node
|
||||
// This routine carries out a recursive search for an XML node based
|
||||
// on an attribute of each XML node
|
||||
/*
|
||||
* If exact match is found with respect to the attribute name and
|
||||
* value of the attribute, the pointer
|
||||
|
|
@ -1236,7 +1236,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Write an XML subtree to an output stream. This is the
|
||||
* main recursive routine. It doesn't put a final endl
|
||||
* on. This is fixed up in the public method.
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ namespace Cantera {
|
|||
*/
|
||||
std::string value(const std::string &cname) const;
|
||||
|
||||
//! Overloaded parenthesis operator with one augment
|
||||
//! The Overloaded parenthesis operator with one augment
|
||||
//! returns the value of an XML child node as a string
|
||||
/*!
|
||||
* @param cname Name of the child node to the current
|
||||
|
|
|
|||
|
|
@ -39,136 +39,135 @@ using namespace std;
|
|||
namespace Cantera {
|
||||
|
||||
|
||||
/* awData structure */
|
||||
/**
|
||||
* Database for atomic molecular weights
|
||||
*
|
||||
* Values are taken from the 1989 Standard Atomic Weights, CRC
|
||||
*
|
||||
* awTable[] is a static function with scope limited to this file.
|
||||
* It can only be referenced via the static Elements class function,
|
||||
* LookupWtElements().
|
||||
*
|
||||
* units = kg / kg-mol (or equivalently gm / gm-mol)
|
||||
*
|
||||
* (note: this structure was picked because it's simple, compact,
|
||||
* and extensible).
|
||||
*
|
||||
*/
|
||||
struct awData {
|
||||
char name[4]; ///< Null Terminated name, First letter capitalized
|
||||
double atomicWeight; ///< atomic weight in kg / kg-mol
|
||||
};
|
||||
/* awData structure */
|
||||
/**
|
||||
* Database for atomic molecular weights
|
||||
*
|
||||
* Values are taken from the 1989 Standard Atomic Weights, CRC
|
||||
*
|
||||
* awTable[] is a static function with scope limited to this file.
|
||||
* It can only be referenced via the static Elements class function,
|
||||
* LookupWtElements().
|
||||
*
|
||||
* units = kg / kg-mol (or equivalently gm / gm-mol)
|
||||
*
|
||||
* (note: this structure was picked because it's simple, compact,
|
||||
* and extensible).
|
||||
*
|
||||
*/
|
||||
struct awData {
|
||||
char name[4]; ///< Null Terminated name, First letter capitalized
|
||||
double atomicWeight; ///< atomic weight in kg / kg-mol
|
||||
};
|
||||
|
||||
/*!
|
||||
* @var static struct awData aWTable[]
|
||||
* \brief aWTable is a vector containing the atomic weights database.
|
||||
*
|
||||
* The size of the table is given by the initial instantiation.
|
||||
*/
|
||||
static struct awData aWTable[] = {
|
||||
{"H", 1.00794},
|
||||
{"D", 2.0 },
|
||||
{"Tr", 3.0 },
|
||||
{"He", 4.002602},
|
||||
{"Li", 6.941 },
|
||||
{"Be", 9.012182},
|
||||
{"B", 10.811 },
|
||||
{"C", 12.011 },
|
||||
{"N", 14.00674},
|
||||
{"O", 15.9994 },
|
||||
{"F", 18.9984032},
|
||||
{"Ne", 20.1797 },
|
||||
{"Na", 22.98977},
|
||||
{"Mg", 24.3050 },
|
||||
{"Al", 26.98154},
|
||||
{"Si", 28.0855 },
|
||||
{"P", 30.97376},
|
||||
{"S", 32.066 },
|
||||
{"Cl", 35.4527 },
|
||||
{"Ar", 39.948 },
|
||||
{"K", 39.0983 },
|
||||
{"Ca", 40.078 },
|
||||
{"Sc", 44.95591},
|
||||
{"Ti", 47.88 },
|
||||
{"V", 50.9415 },
|
||||
{"Cr", 51.9961 },
|
||||
{"Mn", 54.9381 },
|
||||
{"Fe", 55.847 },
|
||||
{"Co", 58.9332 },
|
||||
{"Ni", 58.69 },
|
||||
{"Cu", 63.546 },
|
||||
{"Zn", 65.39 },
|
||||
{"Ga", 69.723 },
|
||||
{"Ge", 72.61 },
|
||||
{"As", 74.92159},
|
||||
{"Se", 78.96 },
|
||||
{"Br", 79.904 },
|
||||
{"Kr", 83.80 },
|
||||
{"Rb", 85.4678 },
|
||||
{"Sr", 87.62 },
|
||||
{"Y", 88.90585},
|
||||
{"Zr", 91.224 },
|
||||
{"Nb", 92.90638},
|
||||
{"Mo", 95.94 },
|
||||
{"Tc", 97.9072 },
|
||||
{"Ru", 101.07 },
|
||||
{"Rh", 102.9055 },
|
||||
{"Pd", 106.42 },
|
||||
{"Ag", 107.8682 },
|
||||
{"Cd", 112.411 },
|
||||
{"In", 114.82 },
|
||||
{"Sn", 118.710 },
|
||||
{"Sb", 121.75 },
|
||||
{"Te", 127.6 },
|
||||
{"I", 126.90447},
|
||||
{"Xe", 131.29 },
|
||||
{"Cs", 132.90543},
|
||||
{"Ba", 137.327 },
|
||||
{"La", 138.9055 },
|
||||
{"Ce", 140.115 },
|
||||
{"Pr", 140.90765},
|
||||
{"Nd", 144.24 },
|
||||
{"Pm", 144.9127 },
|
||||
{"Sm", 150.36 },
|
||||
{"Eu", 151.965 },
|
||||
{"Gd", 157.25 },
|
||||
{"Tb", 158.92534},
|
||||
{"Dy", 162.50 },
|
||||
{"Ho", 164.93032},
|
||||
{"Er", 167.26 },
|
||||
{"Tm", 168.93421},
|
||||
{"Yb", 173.04 },
|
||||
{"Lu", 174.967 },
|
||||
{"Hf", 178.49 },
|
||||
{"Ta", 180.9479 },
|
||||
{"W", 183.85 },
|
||||
{"Re", 186.207 },
|
||||
{"Os", 190.2 },
|
||||
{"Ir", 192.22 },
|
||||
{"Pt", 195.08 },
|
||||
{"Au", 196.96654},
|
||||
{"Hg", 200.59 },
|
||||
{"Ti", 204.3833 },
|
||||
{"Pb", 207.2 },
|
||||
{"Bi", 208.98037},
|
||||
{"Po", 208.9824 },
|
||||
{"At", 209.9871 },
|
||||
{"Rn", 222.0176 },
|
||||
{"Fr", 223.0197 },
|
||||
{"Ra", 226.0254 },
|
||||
{"Ac", 227.0279 },
|
||||
{"Th", 232.0381 },
|
||||
{"Pa", 231.03588},
|
||||
{"U", 238.0508 },
|
||||
{"Np", 237.0482 },
|
||||
{"Pu", 244.0482 }
|
||||
};
|
||||
/*!
|
||||
* @var static struct awData aWTable[]
|
||||
* \brief aWTable is a vector containing the atomic weights database.
|
||||
*
|
||||
* The size of the table is given by the initial instantiation.
|
||||
*/
|
||||
static struct awData aWTable[] = {
|
||||
{"H", 1.00794},
|
||||
{"D", 2.0 },
|
||||
{"Tr", 3.0 },
|
||||
{"He", 4.002602},
|
||||
{"Li", 6.941 },
|
||||
{"Be", 9.012182},
|
||||
{"B", 10.811 },
|
||||
{"C", 12.011 },
|
||||
{"N", 14.00674},
|
||||
{"O", 15.9994 },
|
||||
{"F", 18.9984032},
|
||||
{"Ne", 20.1797 },
|
||||
{"Na", 22.98977},
|
||||
{"Mg", 24.3050 },
|
||||
{"Al", 26.98154},
|
||||
{"Si", 28.0855 },
|
||||
{"P", 30.97376},
|
||||
{"S", 32.066 },
|
||||
{"Cl", 35.4527 },
|
||||
{"Ar", 39.948 },
|
||||
{"K", 39.0983 },
|
||||
{"Ca", 40.078 },
|
||||
{"Sc", 44.95591},
|
||||
{"Ti", 47.88 },
|
||||
{"V", 50.9415 },
|
||||
{"Cr", 51.9961 },
|
||||
{"Mn", 54.9381 },
|
||||
{"Fe", 55.847 },
|
||||
{"Co", 58.9332 },
|
||||
{"Ni", 58.69 },
|
||||
{"Cu", 63.546 },
|
||||
{"Zn", 65.39 },
|
||||
{"Ga", 69.723 },
|
||||
{"Ge", 72.61 },
|
||||
{"As", 74.92159},
|
||||
{"Se", 78.96 },
|
||||
{"Br", 79.904 },
|
||||
{"Kr", 83.80 },
|
||||
{"Rb", 85.4678 },
|
||||
{"Sr", 87.62 },
|
||||
{"Y", 88.90585},
|
||||
{"Zr", 91.224 },
|
||||
{"Nb", 92.90638},
|
||||
{"Mo", 95.94 },
|
||||
{"Tc", 97.9072 },
|
||||
{"Ru", 101.07 },
|
||||
{"Rh", 102.9055 },
|
||||
{"Pd", 106.42 },
|
||||
{"Ag", 107.8682 },
|
||||
{"Cd", 112.411 },
|
||||
{"In", 114.82 },
|
||||
{"Sn", 118.710 },
|
||||
{"Sb", 121.75 },
|
||||
{"Te", 127.6 },
|
||||
{"I", 126.90447},
|
||||
{"Xe", 131.29 },
|
||||
{"Cs", 132.90543},
|
||||
{"Ba", 137.327 },
|
||||
{"La", 138.9055 },
|
||||
{"Ce", 140.115 },
|
||||
{"Pr", 140.90765},
|
||||
{"Nd", 144.24 },
|
||||
{"Pm", 144.9127 },
|
||||
{"Sm", 150.36 },
|
||||
{"Eu", 151.965 },
|
||||
{"Gd", 157.25 },
|
||||
{"Tb", 158.92534},
|
||||
{"Dy", 162.50 },
|
||||
{"Ho", 164.93032},
|
||||
{"Er", 167.26 },
|
||||
{"Tm", 168.93421},
|
||||
{"Yb", 173.04 },
|
||||
{"Lu", 174.967 },
|
||||
{"Hf", 178.49 },
|
||||
{"Ta", 180.9479 },
|
||||
{"W", 183.85 },
|
||||
{"Re", 186.207 },
|
||||
{"Os", 190.2 },
|
||||
{"Ir", 192.22 },
|
||||
{"Pt", 195.08 },
|
||||
{"Au", 196.96654},
|
||||
{"Hg", 200.59 },
|
||||
{"Ti", 204.3833 },
|
||||
{"Pb", 207.2 },
|
||||
{"Bi", 208.98037},
|
||||
{"Po", 208.9824 },
|
||||
{"At", 209.9871 },
|
||||
{"Rn", 222.0176 },
|
||||
{"Fr", 223.0197 },
|
||||
{"Ra", 226.0254 },
|
||||
{"Ac", 227.0279 },
|
||||
{"Th", 232.0381 },
|
||||
{"Pa", 231.03588},
|
||||
{"U", 238.0508 },
|
||||
{"Np", 237.0482 },
|
||||
{"Pu", 244.0482 }
|
||||
};
|
||||
|
||||
|
||||
//! Static function to look up an atomic weight
|
||||
/*!
|
||||
*
|
||||
// Static function to look up an atomic weight
|
||||
/*
|
||||
* This static function looks up the argument string in the
|
||||
* database above and returns the associated molecular weight.
|
||||
* The data are from the periodic table.
|
||||
|
|
@ -177,8 +176,7 @@ namespace Cantera {
|
|||
* source for the element atomic weights. This helps to
|
||||
* ensure that mass is conserved.
|
||||
*
|
||||
* @param
|
||||
* ElemName String. Only the first 3 characters are significant
|
||||
* @param s String, Only the first 3 characters are significant
|
||||
*
|
||||
* @return
|
||||
* Return value contains the atomic weight of the element
|
||||
|
|
@ -188,11 +186,10 @@ namespace Cantera {
|
|||
* @exception CanteraError
|
||||
* If a match is not found, a CanteraError is thrown as well
|
||||
*/
|
||||
doublereal Elements::LookupWtElements(const std::string& s) {
|
||||
doublereal Elements::LookupWtElements(const std::string& ename) {
|
||||
int num = sizeof(aWTable) / sizeof(struct awData);
|
||||
string s3 = s.substr(0,3);
|
||||
string s3 = ename.substr(0,3);
|
||||
for (int i = 0; i < num; i++) {
|
||||
//if (!std::strncmp(s.c_str(), aWTable[i].name, 3)) {
|
||||
if (s3 == aWTable[i].name) {
|
||||
return (aWTable[i].atomicWeight);
|
||||
}
|
||||
|
|
@ -267,68 +264,68 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* freezeElements():
|
||||
*
|
||||
* Set the freeze flag. This is a prerequesite to other
|
||||
* activivities, i.e., this is done before species are defined.
|
||||
*/
|
||||
void Elements::freezeElements() {
|
||||
m_elementsFrozen = true;
|
||||
}
|
||||
/*
|
||||
* freezeElements():
|
||||
*
|
||||
* Set the freeze flag. This is a prerequesite to other
|
||||
* activivities, i.e., this is done before species are defined.
|
||||
*/
|
||||
void Elements::freezeElements() {
|
||||
m_elementsFrozen = true;
|
||||
}
|
||||
|
||||
#ifdef INCL_DEPRECATED_METHODS
|
||||
/*
|
||||
*
|
||||
* Returns an ElementData struct that contains the parameters
|
||||
* for element index m.
|
||||
*/
|
||||
ElementData Elements::element(int m) const {
|
||||
ElementData e;
|
||||
e.name = m_elementNames[m];
|
||||
e.atomicWeight = m_atomicWeights[m];
|
||||
return e;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* Returns an ElementData struct that contains the parameters
|
||||
* for element index m.
|
||||
*/
|
||||
ElementData Elements::element(int m) const {
|
||||
ElementData e;
|
||||
e.name = m_elementNames[m];
|
||||
e.atomicWeight = m_atomicWeights[m];
|
||||
return e;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* elementIndex():
|
||||
*
|
||||
* Index of element named \c name. The index is an integer
|
||||
* assigned to each element in the order it was added,
|
||||
* beginning with 0 for the first element. If \c name is not
|
||||
* the name of an element in the set, then the value -1 is
|
||||
* returned.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* elementIndex():
|
||||
*
|
||||
* Index of element named \c name. The index is an integer
|
||||
* assigned to each element in the order it was added,
|
||||
* beginning with 0 for the first element. If \c name is not
|
||||
* the name of an element in the set, then the value -1 is
|
||||
* returned.
|
||||
*
|
||||
*/
|
||||
#ifdef USE_DGG_CODE
|
||||
int Elements::elementIndex(std::string name) const{
|
||||
map<string, int>::const_iterator it;
|
||||
it = m_definedElements.find(name);
|
||||
if (it != m_definedElements.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return -1;
|
||||
int Elements::elementIndex(std::string name) const{
|
||||
map<string, int>::const_iterator it;
|
||||
it = m_definedElements.find(name);
|
||||
if (it != m_definedElements.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int Elements::elementIndex(std::string name) const {
|
||||
for (int i = 0; i < m_mm; i++) {
|
||||
if (m_elementNames[i] == name) return i;
|
||||
}
|
||||
return -1;
|
||||
int Elements::elementIndex(std::string name) const {
|
||||
for (int i = 0; i < m_mm; i++) {
|
||||
if (m_elementNames[i] == name) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* Name of the element with index \c m. @param m Element
|
||||
* index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
string Elements::elementName(int m) const {
|
||||
if (m >= 0 && m < nElements())
|
||||
return m_elementNames[m];
|
||||
else
|
||||
throw ElementRangeError("Elements::elementName", m, nElements());
|
||||
}
|
||||
/*
|
||||
*
|
||||
* Name of the element with index \c m. @param m Element
|
||||
* index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
string Elements::elementName(int m) const {
|
||||
if (m >= 0 && m < nElements())
|
||||
return m_elementNames[m];
|
||||
else
|
||||
throw ElementRangeError("Elements::elementName", m, nElements());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -340,46 +337,46 @@ namespace Cantera {
|
|||
return (m_entropy298[m]);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Add an element to the current set of elements in the current object.
|
||||
* @param symbol symbol string
|
||||
* @param weight atomic weight in kg/kmol.
|
||||
*
|
||||
* The default weight is a special value, which will cause the
|
||||
* routine to look up the actual weight via a string lookup.
|
||||
*
|
||||
* There are two interfaces to this routine. The XML interface
|
||||
* looks up the required parameters for the regular interface
|
||||
* and then calls the base routine.
|
||||
*/
|
||||
void Elements::
|
||||
addElement(const std::string& symbol, doublereal weight)
|
||||
{
|
||||
if (weight == -12345.0) {
|
||||
weight = LookupWtElements(symbol);
|
||||
if (weight < 0.0) {
|
||||
throw ElementsFrozen("addElement");
|
||||
}
|
||||
}
|
||||
if (m_elementsFrozen) {
|
||||
throw ElementsFrozen("addElement");
|
||||
return;
|
||||
}
|
||||
m_atomicWeights.push_back(weight);
|
||||
m_elementNames.push_back(symbol);
|
||||
/*
|
||||
*
|
||||
* Add an element to the current set of elements in the current object.
|
||||
* @param symbol symbol string
|
||||
* @param weight atomic weight in kg/kmol.
|
||||
*
|
||||
* The default weight is a special value, which will cause the
|
||||
* routine to look up the actual weight via a string lookup.
|
||||
*
|
||||
* There are two interfaces to this routine. The XML interface
|
||||
* looks up the required parameters for the regular interface
|
||||
* and then calls the base routine.
|
||||
*/
|
||||
void Elements::
|
||||
addElement(const std::string& symbol, doublereal weight)
|
||||
{
|
||||
if (weight == -12345.0) {
|
||||
weight = LookupWtElements(symbol);
|
||||
if (weight < 0.0) {
|
||||
throw ElementsFrozen("addElement");
|
||||
}
|
||||
}
|
||||
if (m_elementsFrozen) {
|
||||
throw ElementsFrozen("addElement");
|
||||
return;
|
||||
}
|
||||
m_atomicWeights.push_back(weight);
|
||||
m_elementNames.push_back(symbol);
|
||||
#ifdef USE_DGG_CODE
|
||||
m_definedElements[symbol] = nElements() + 1;
|
||||
m_definedElements[symbol] = nElements() + 1;
|
||||
#endif
|
||||
m_mm++;
|
||||
}
|
||||
m_mm++;
|
||||
}
|
||||
|
||||
void Elements::
|
||||
addElement(const XML_Node& e) {
|
||||
doublereal weight = atof(e["atomicWt"].c_str());
|
||||
string symbol = e["name"];
|
||||
addElement(symbol, weight);
|
||||
}
|
||||
void Elements::
|
||||
addElement(const XML_Node& e) {
|
||||
doublereal weight = atof(e["atomicWt"].c_str());
|
||||
string symbol = e["name"];
|
||||
addElement(symbol, weight);
|
||||
}
|
||||
|
||||
/*
|
||||
* addUniqueElement():
|
||||
|
|
@ -572,31 +569,31 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* subscribe(), unsubscribe(), and reportSubscriptions():
|
||||
*
|
||||
* Handles setting and reporting the number of subscriptions to this
|
||||
* object.
|
||||
*/
|
||||
void Elements::subscribe() {
|
||||
++numSubscribers;
|
||||
}
|
||||
int Elements::unsubscribe() {
|
||||
--numSubscribers;
|
||||
return numSubscribers;
|
||||
}
|
||||
int Elements::reportSubscriptions() const {
|
||||
return numSubscribers;
|
||||
}
|
||||
/*
|
||||
* subscribe(), unsubscribe(), and reportSubscriptions():
|
||||
*
|
||||
* Handles setting and reporting the number of subscriptions to this
|
||||
* object.
|
||||
*/
|
||||
void Elements::subscribe() {
|
||||
++numSubscribers;
|
||||
}
|
||||
int Elements::unsubscribe() {
|
||||
--numSubscribers;
|
||||
return numSubscribers;
|
||||
}
|
||||
int Elements::reportSubscriptions() const {
|
||||
return numSubscribers;
|
||||
}
|
||||
|
||||
/********************* GLOBAL STATIC SECTION **************************/
|
||||
/*
|
||||
* We keep track of a vector of pointers to element objects.
|
||||
* Initially there are no Elements objects. Whenever one is created,
|
||||
* the pointer to that object is added onto this list.
|
||||
*/
|
||||
vector<Elements *> Elements::Global_Elements_List;
|
||||
/***********************************************************************/
|
||||
/********************* GLOBAL STATIC SECTION **************************/
|
||||
/*
|
||||
* We keep track of a vector of pointers to element objects.
|
||||
* Initially there are no Elements objects. Whenever one is created,
|
||||
* the pointer to that object is added onto this list.
|
||||
*/
|
||||
vector<Elements *> Elements::Global_Elements_List;
|
||||
/***********************************************************************/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace Cantera {
|
||||
|
||||
class XML_Node;
|
||||
class ElementRangeError;
|
||||
class XML_Node;
|
||||
class ElementRangeError;
|
||||
|
||||
//! Positive number indicating we don't know the gibbs free energy
|
||||
//! of the element in its most stable state at 298.15 K and 1 bar.
|
||||
|
|
@ -45,249 +45,266 @@ namespace Cantera {
|
|||
*
|
||||
* @ingroup phases
|
||||
*/
|
||||
class Elements {
|
||||
class Elements {
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/// Default constructor for the elements class
|
||||
Elements();
|
||||
//! Default constructor for the elements class
|
||||
Elements();
|
||||
|
||||
//! Default destructor for the elements class
|
||||
~Elements();
|
||||
//! Default destructor for the elements class
|
||||
~Elements();
|
||||
|
||||
|
||||
//! copy constructor
|
||||
/*!
|
||||
* This copy constructor just calls the assignment operator for this
|
||||
* class. It sets the number of subscribers to zer0.
|
||||
*
|
||||
* @param right Reference to the object to be copied.
|
||||
*/
|
||||
Elements(const Elements& right);
|
||||
//! copy constructor
|
||||
/*!
|
||||
* This copy constructor just calls the assignment operator for this
|
||||
* class. It sets the number of subscribers to zer0.
|
||||
*
|
||||
* @param right Reference to the object to be copied.
|
||||
*/
|
||||
Elements(const Elements& right);
|
||||
|
||||
//! Assigntment operator
|
||||
/*!
|
||||
* This is the assignment operator for the Elements class.
|
||||
* Right now we pretty much do a straight uncomplicated
|
||||
* assignment. However, subscribers are not mucked with, as they
|
||||
* have to do with the address of the object to be subscribed to
|
||||
*
|
||||
* @param right Reference to the object to be copied.
|
||||
*/
|
||||
Elements& operator=(const Elements& right);
|
||||
//! Assigntment operator
|
||||
/*!
|
||||
* This is the assignment operator for the Elements class.
|
||||
* Right now we pretty much do a straight uncomplicated
|
||||
* assignment. However, subscribers are not mucked with, as they
|
||||
* have to do with the address of the object to be subscribed to
|
||||
*
|
||||
* @param right Reference to the object to be copied.
|
||||
*/
|
||||
Elements& operator=(const Elements& right);
|
||||
|
||||
//! Function to lookup the atomic weight of an element
|
||||
/*!
|
||||
* @param ename Element symbol name.
|
||||
*/
|
||||
static double LookupWtElements(const std::string &ename);
|
||||
|
||||
/// Atomic weight of element m.
|
||||
/*!
|
||||
* @param m element index
|
||||
*/
|
||||
doublereal atomicWeight(int m) const { return m_atomicWeights[m]; }
|
||||
//! Static function to look up an atomic weight
|
||||
/*!
|
||||
* This static function looks up the argument string in the
|
||||
* database above and returns the associated molecular weight.
|
||||
* The data are from the periodic table.
|
||||
*
|
||||
* Note: The idea behind this function is to provide a unified
|
||||
* source for the element atomic weights. This helps to
|
||||
* ensure that mass is conserved.
|
||||
*
|
||||
* @param ename String, Only the first 3 characters are significant
|
||||
*
|
||||
* @return
|
||||
* Return value contains the atomic weight of the element
|
||||
* If a match for the string is not found, a value of -1.0 is
|
||||
* returned.
|
||||
*
|
||||
* @exception CanteraError
|
||||
* If a match is not found, a CanteraError is thrown as well
|
||||
*/
|
||||
static double LookupWtElements(const std::string &ename);
|
||||
|
||||
/// Atomic number of element m.
|
||||
/*!
|
||||
* @param m element index
|
||||
*/
|
||||
int atomicNumber(int m) const { return m_atomicNumbers[m]; }
|
||||
/// Atomic weight of element m.
|
||||
/*!
|
||||
* @param m element index
|
||||
*/
|
||||
doublereal atomicWeight(int m) const { return m_atomicWeights[m]; }
|
||||
|
||||
//! Entropy at 298.15 K and 1 bar of stable state
|
||||
//! of the element
|
||||
/*!
|
||||
* units J kmol-1 K-1
|
||||
*
|
||||
* @param m Element index
|
||||
*/
|
||||
doublereal entropyElement298(int m) const;
|
||||
/// Atomic number of element m.
|
||||
/*!
|
||||
* @param m element index
|
||||
*/
|
||||
int atomicNumber(int m) const { return m_atomicNumbers[m]; }
|
||||
|
||||
/// vector of element atomic weights
|
||||
const vector_fp& atomicWeights() const { return m_atomicWeights; }
|
||||
//! Entropy at 298.15 K and 1 bar of stable state
|
||||
//! of the element
|
||||
/*!
|
||||
* units J kmol-1 K-1
|
||||
*
|
||||
* @param m Element index
|
||||
*/
|
||||
doublereal entropyElement298(int m) const;
|
||||
|
||||
/**
|
||||
* Inline function that returns the number of elements in the object.
|
||||
*
|
||||
* @return
|
||||
* \c int: The number of elements in the object.
|
||||
*/
|
||||
int nElements() const { return m_mm; }
|
||||
/// vector of element atomic weights
|
||||
const vector_fp& atomicWeights() const { return m_atomicWeights; }
|
||||
|
||||
//! Function that returns the index of an element.
|
||||
/*!
|
||||
* Index of element named \c name. The index is an integer
|
||||
* assigned to each element in the order it was added,
|
||||
* beginning with 0 for the first element. If \c name is not
|
||||
* the name of an element in the set, then the value -1 is
|
||||
* returned.
|
||||
*
|
||||
* @param name String containing the index.
|
||||
*/
|
||||
int elementIndex(std::string name) const;
|
||||
/**
|
||||
* Inline function that returns the number of elements in the object.
|
||||
*
|
||||
* @return
|
||||
* \c int: The number of elements in the object.
|
||||
*/
|
||||
int nElements() const { return m_mm; }
|
||||
|
||||
//! Function that returns the index of an element.
|
||||
/*!
|
||||
* Index of element named \c name. The index is an integer
|
||||
* assigned to each element in the order it was added,
|
||||
* beginning with 0 for the first element. If \c name is not
|
||||
* the name of an element in the set, then the value -1 is
|
||||
* returned.
|
||||
*
|
||||
* @param name String containing the index.
|
||||
*/
|
||||
int elementIndex(std::string name) const;
|
||||
|
||||
//! Name of the element with index \c m.
|
||||
/*!
|
||||
* @param m Element index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
std::string elementName(int m) const;
|
||||
//! Name of the element with index \c m.
|
||||
/*!
|
||||
* @param m Element index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
std::string elementName(int m) const;
|
||||
|
||||
//! Returns a string vector containing the element names
|
||||
/*!
|
||||
* Returns a read-only reference to the vector of element names.
|
||||
* @return <tt> const vector<string>& </tt>: The vector contains
|
||||
* the element names in their indexed order.
|
||||
*/
|
||||
const std::vector<std::string>& elementNames() const {
|
||||
return m_elementNames;
|
||||
}
|
||||
//! Returns a string vector containing the element names
|
||||
/*!
|
||||
* Returns a read-only reference to the vector of element names.
|
||||
* @return <tt> const vector<string>& </tt>: The vector contains
|
||||
* the element names in their indexed order.
|
||||
*/
|
||||
const std::vector<std::string>& elementNames() const {
|
||||
return m_elementNames;
|
||||
}
|
||||
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* The default weight is a special value, which will cause the
|
||||
* routine to look up the actual weight via a string lookup.
|
||||
*
|
||||
* There are two interfaces to this routine. The XML interface
|
||||
* looks up the required parameters for the regular interface
|
||||
* and then calls the base routine.
|
||||
*
|
||||
* @param symbol string symbol for the element.
|
||||
* @param weight Atomic weight of the element. If no argument
|
||||
* is provided, a lookup is attempted.
|
||||
*/
|
||||
void addElement(const std::string& symbol,
|
||||
doublereal weight = -12345.0);
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* The default weight is a special value, which will cause the
|
||||
* routine to look up the actual weight via a string lookup.
|
||||
*
|
||||
* There are two interfaces to this routine. The XML interface
|
||||
* looks up the required parameters for the regular interface
|
||||
* and then calls the base routine.
|
||||
*
|
||||
* @param symbol string symbol for the element.
|
||||
* @param weight Atomic weight of the element. If no argument
|
||||
* is provided, a lookup is attempted.
|
||||
*/
|
||||
void addElement(const std::string& symbol,
|
||||
doublereal weight = -12345.0);
|
||||
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* @param e Reference to the XML_Node containing the element information
|
||||
* The node name is the element symbol and the atomWt attribute
|
||||
* is used as the atomic weight.
|
||||
*/
|
||||
void addElement(const XML_Node& e);
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* @param e Reference to the XML_Node containing the element information
|
||||
* The node name is the element symbol and the atomWt attribute
|
||||
* is used as the atomic weight.
|
||||
*/
|
||||
void addElement(const XML_Node& e);
|
||||
|
||||
//! Add an element only if the element hasn't been added before.
|
||||
/*!
|
||||
* This is accomplished via a string match on symbol.
|
||||
*
|
||||
* @param symbol string symbol for the element.
|
||||
* @param weight Atomic weight of the element. If no argument
|
||||
* is provided, a lookup is attempted.
|
||||
* @param atomicNumber defaults to 0
|
||||
* @param entropy298 Value of the entropy at 298 and 1 bar of the
|
||||
* element in its most stable form.
|
||||
* The default is to specify an ENTROPY298_UNKNOWN value,
|
||||
* which will cause a throw error if its ever
|
||||
* needed.
|
||||
*/
|
||||
void addUniqueElement(const std::string& symbol,
|
||||
doublereal weight = -12345.0, int atomicNumber = 0,
|
||||
doublereal entropy298 = ENTROPY298_UNKNOWN);
|
||||
//! Add an element only if the element hasn't been added before.
|
||||
/*!
|
||||
* This is accomplished via a string match on symbol.
|
||||
*
|
||||
* @param symbol string symbol for the element.
|
||||
* @param weight Atomic weight of the element. If no argument
|
||||
* is provided, a lookup is attempted.
|
||||
* @param atomicNumber defaults to 0
|
||||
* @param entropy298 Value of the entropy at 298 and 1 bar of the
|
||||
* element in its most stable form.
|
||||
* The default is to specify an ENTROPY298_UNKNOWN value,
|
||||
* which will cause a throw error if its ever
|
||||
* needed.
|
||||
*/
|
||||
void addUniqueElement(const std::string& symbol,
|
||||
doublereal weight = -12345.0, int atomicNumber = 0,
|
||||
doublereal entropy298 = ENTROPY298_UNKNOWN);
|
||||
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* @param e Reference to the XML_Node containing the element information
|
||||
* The node name is the element symbol and the atomWt attribute
|
||||
* is used as the atomic weight.
|
||||
*/
|
||||
void addUniqueElement(const XML_Node& e);
|
||||
//! Add an element to the current set of elements in the current object.
|
||||
/*!
|
||||
* @param e Reference to the XML_Node containing the element information
|
||||
* The node name is the element symbol and the atomWt attribute
|
||||
* is used as the atomic weight.
|
||||
*/
|
||||
void addUniqueElement(const XML_Node& e);
|
||||
|
||||
//! Add multiple elements from a XML_Node phase description
|
||||
/*!
|
||||
* @param phase XML_Node reference to a phase
|
||||
*/
|
||||
void addElementsFromXML(const XML_Node& phase);
|
||||
//! Add multiple elements from a XML_Node phase description
|
||||
/*!
|
||||
* @param phase XML_Node reference to a phase
|
||||
*/
|
||||
void addElementsFromXML(const XML_Node& phase);
|
||||
|
||||
//! Prohibit addition of more elements, and prepare to add species.
|
||||
void freezeElements();
|
||||
//! Prohibit addition of more elements, and prepare to add species.
|
||||
void freezeElements();
|
||||
|
||||
/// True if freezeElements has been called.
|
||||
bool elementsFrozen() { return m_elementsFrozen; }
|
||||
/// True if freezeElements has been called.
|
||||
bool elementsFrozen() { return m_elementsFrozen; }
|
||||
|
||||
/// Remove all elements
|
||||
void clear();
|
||||
/// Remove all elements
|
||||
void clear();
|
||||
|
||||
/// True if both elements and species have been frozen
|
||||
bool ready() const;
|
||||
/// True if both elements and species have been frozen
|
||||
bool ready() const;
|
||||
|
||||
|
||||
//! subscribe to this object
|
||||
/*!
|
||||
* Increment by one the number of subscriptions to this object.
|
||||
*/
|
||||
void subscribe();
|
||||
//! subscribe to this object
|
||||
/*!
|
||||
* Increment by one the number of subscriptions to this object.
|
||||
*/
|
||||
void subscribe();
|
||||
|
||||
//! unsubscribe to this object
|
||||
/*!
|
||||
* decrement by one the number of subscriptions to this object.
|
||||
*/
|
||||
int unsubscribe();
|
||||
//! unsubscribe to this object
|
||||
/*!
|
||||
* decrement by one the number of subscriptions to this object.
|
||||
*/
|
||||
int unsubscribe();
|
||||
|
||||
//! report the number of subscriptions
|
||||
int reportSubscriptions() const;
|
||||
//! report the number of subscriptions
|
||||
int reportSubscriptions() const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
/******************************************************************/
|
||||
/* Description of DATA in the Object */
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
/* Description of DATA in the Object */
|
||||
/******************************************************************/
|
||||
|
||||
//! Number of elements.
|
||||
int m_mm;
|
||||
//! Number of elements.
|
||||
int m_mm;
|
||||
|
||||
/* m_elementsFrozen: */
|
||||
/** boolean indicating completion of object
|
||||
*
|
||||
* If this is true, then no elements may be added to the
|
||||
* object.
|
||||
*/
|
||||
bool m_elementsFrozen;
|
||||
/* m_elementsFrozen: */
|
||||
/** boolean indicating completion of object
|
||||
*
|
||||
* If this is true, then no elements may be added to the
|
||||
* object.
|
||||
*/
|
||||
bool m_elementsFrozen;
|
||||
|
||||
/**
|
||||
* Vector of element atomic weights:
|
||||
*
|
||||
* units = kg / kmol
|
||||
*/
|
||||
vector_fp m_atomicWeights;
|
||||
/**
|
||||
* Vector of element atomic weights:
|
||||
*
|
||||
* units = kg / kmol
|
||||
*/
|
||||
vector_fp m_atomicWeights;
|
||||
|
||||
/**
|
||||
* Vector of element atomic numbers:
|
||||
*
|
||||
*/
|
||||
vector_int m_atomicNumbers;
|
||||
/**
|
||||
* Vector of element atomic numbers:
|
||||
*
|
||||
*/
|
||||
vector_int m_atomicNumbers;
|
||||
|
||||
/** Vector of strings containing the names of the elements
|
||||
*
|
||||
* Note, a string search is the primary way to identify elements.
|
||||
*/
|
||||
std::vector<std::string> m_elementNames;
|
||||
/** Vector of strings containing the names of the elements
|
||||
*
|
||||
* Note, a string search is the primary way to identify elements.
|
||||
*/
|
||||
std::vector<std::string> m_elementNames;
|
||||
|
||||
//! Entropy at 298.15 K and 1 bar of stable state
|
||||
/*!
|
||||
* units J kmol-1
|
||||
*/
|
||||
vector_fp m_entropy298;
|
||||
//! Entropy at 298.15 K and 1 bar of stable state
|
||||
/*!
|
||||
* units J kmol-1
|
||||
*/
|
||||
vector_fp m_entropy298;
|
||||
|
||||
/**
|
||||
* Number of Constituents Objects that use this object
|
||||
*
|
||||
* Number of Constituents Objects that require this Elements object
|
||||
* to complete its definition.
|
||||
* The destructor checks to see that this is equal to zero.
|
||||
* when the element object is released.
|
||||
*/
|
||||
int numSubscribers;
|
||||
/**
|
||||
* Number of Constituents Objects that use this object
|
||||
*
|
||||
* Number of Constituents Objects that require this Elements object
|
||||
* to complete its definition.
|
||||
* The destructor checks to see that this is equal to zero.
|
||||
* when the element object is released.
|
||||
*/
|
||||
int numSubscribers;
|
||||
|
||||
/********* GLOBAL STATIC SECTION *************/
|
||||
/********* GLOBAL STATIC SECTION *************/
|
||||
|
||||
public:
|
||||
/** Vector of pointers to Elements Objects
|
||||
*
|
||||
*/
|
||||
static std::vector<Elements *> Global_Elements_List;
|
||||
public:
|
||||
/** Vector of pointers to Elements Objects
|
||||
*
|
||||
*/
|
||||
static std::vector<Elements *> Global_Elements_List;
|
||||
|
||||
friend class Constituents;
|
||||
};
|
||||
friend class Constituents;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ namespace Cantera {
|
|||
constructPhaseXML(phaseRoot, id);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
|
|
@ -254,7 +254,7 @@ namespace Cantera {
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
|
|
@ -578,7 +578,7 @@ namespace Cantera {
|
|||
printCoeffs();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* ~HMWSoln(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
|
|
@ -589,7 +589,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* duplMyselfAsThermoPhase():
|
||||
*
|
||||
* This routine operates at the ThermoPhase level to
|
||||
|
|
@ -601,7 +601,7 @@ namespace Cantera {
|
|||
return (ThermoPhase *) mtp;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 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
|
||||
|
|
@ -628,7 +628,7 @@ namespace Cantera {
|
|||
//
|
||||
// -------- Molar Thermodynamic Properties of the Solution ---------------
|
||||
//
|
||||
/**
|
||||
/*
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
*/
|
||||
doublereal HMWSoln::enthalpy_mole() const {
|
||||
|
|
@ -695,7 +695,7 @@ namespace Cantera {
|
|||
return L;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Molar internal energy of the solution. Units: J/kmol.
|
||||
*
|
||||
* This is calculated from the soln enthalpy and then
|
||||
|
|
@ -709,7 +709,7 @@ namespace Cantera {
|
|||
return uu;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Molar soln entropy at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* This is calculated from the partial molar entropies.
|
||||
|
|
@ -725,7 +725,7 @@ namespace Cantera {
|
|||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/** Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
/* Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* Returns the solution heat capacition at constant pressure.
|
||||
* This is calculated from the partial molar heat capacities.
|
||||
|
|
@ -736,7 +736,7 @@ namespace Cantera {
|
|||
return val;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal HMWSoln::cv_mole() const {
|
||||
//getPartialMolarCv(m_tmpV.begin());
|
||||
//return mean_X(m_tmpV.begin());
|
||||
|
|
@ -757,7 +757,7 @@ namespace Cantera {
|
|||
return m_Pcurrent;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
|
|
@ -779,7 +779,7 @@ namespace Cantera {
|
|||
State::setDensity(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* The isothermal compressibility. Units: 1/Pa.
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
|
|
@ -795,7 +795,7 @@ namespace Cantera {
|
|||
//return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* The thermal expansion coefficient. Units: 1/K.
|
||||
* The thermal expansion coefficient is defined as
|
||||
*
|
||||
|
|
@ -817,7 +817,7 @@ namespace Cantera {
|
|||
return State::density();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Overwritten setDensity() function is necessary because the
|
||||
* density is not an indendent variable.
|
||||
*
|
||||
|
|
@ -846,7 +846,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an indendent variable.
|
||||
*
|
||||
|
|
@ -1057,7 +1057,7 @@ namespace Cantera {
|
|||
//
|
||||
// ------ Partial Molar Properties of the Solution -----------------
|
||||
//
|
||||
/**
|
||||
/*
|
||||
* Get the species chemical potentials. Units: J/kmol.
|
||||
*
|
||||
* This function returns a vector of chemical potentials of the
|
||||
|
|
@ -1333,12 +1333,12 @@ namespace Cantera {
|
|||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* @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 <I>n</I> coefficients
|
||||
*
|
||||
*/
|
||||
void HMWSoln::setParameters(int n, doublereal* const c) {
|
||||
|
|
@ -1346,7 +1346,7 @@ namespace Cantera {
|
|||
|
||||
void HMWSoln::getParameters(int &n, doublereal * const c) const {
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* 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
|
||||
|
|
@ -1382,7 +1382,7 @@ namespace Cantera {
|
|||
return pres;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Report the molar volume of species k
|
||||
*
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
|
|
@ -1442,7 +1442,7 @@ namespace Cantera {
|
|||
return A;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* dA_DebyedT_TP() (virtual)
|
||||
*
|
||||
* Returns the derivative of the A_Debye parameter with
|
||||
|
|
@ -1477,7 +1477,7 @@ namespace Cantera {
|
|||
return dAdT;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* dA_DebyedP_TP() (virtual)
|
||||
*
|
||||
* Returns the derivative of the A_Debye parameter with
|
||||
|
|
@ -1512,7 +1512,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the DH Parameter used for the Enthalpy calcalations
|
||||
*
|
||||
* ADebye_L = 4 R T**2 d(Aphi) / dT
|
||||
|
|
@ -1533,7 +1533,7 @@ namespace Cantera {
|
|||
return retn;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the DH Parameter used for the Volume calcalations
|
||||
*
|
||||
* ADebye_V = - 4 R T d(Aphi) / dP
|
||||
|
|
@ -1554,7 +1554,7 @@ namespace Cantera {
|
|||
return retn;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Return Pitzer's definition of A_J. This is basically the
|
||||
* temperature derivative of A_L, and the second derivative
|
||||
* of Aphi
|
||||
|
|
@ -1584,7 +1584,7 @@ namespace Cantera {
|
|||
return retn;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* d2A_DebyedT2_TP() (virtual)
|
||||
*
|
||||
* Returns the 2nd derivative of the A_Debye parameter with
|
||||
|
|
@ -1645,7 +1645,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* initLengths():
|
||||
*
|
||||
* This internal function adjusts the lengths of arrays based on
|
||||
|
|
@ -1922,8 +1922,8 @@ namespace Cantera {
|
|||
/*
|
||||
* Find the counterIJ for the symmetric binary interaction
|
||||
*/
|
||||
//n = m_kk*i + j;
|
||||
//counterIJ = m_CounterIJ[n];
|
||||
// n = m_kk*i + j;
|
||||
// counterIJ = m_CounterIJ[n];
|
||||
/*
|
||||
* Only loop over oppositely charge species
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -672,7 +672,7 @@ namespace Cantera {
|
|||
* @code
|
||||
<binarySaltParameters cation="Na+" anion="OH-">
|
||||
<beta0> q0, q1, q2, q3, q4 </beta0>
|
||||
<\binarySaltParameters>
|
||||
</binarySaltParameters>
|
||||
@endcode
|
||||
*
|
||||
* The parameters for \f$ \beta^{(0)}\f$ fit the following equation:
|
||||
|
|
@ -686,9 +686,9 @@ namespace Cantera {
|
|||
*
|
||||
* This same COMPLEX1 </TT> temperature
|
||||
* dependence given above is used for the following parameters:
|
||||
* \f$\beta^{(0)}_{MX} \f$, \f$\beta^{(1)}_{MX} \f$,
|
||||
* \f$\beta^{(2)}_{MX} \f$, \f$ \Theta_{cc'} \f$, \f$\Theta_{aa'} \f$,
|
||||
* \f$ \Psi_{c{c'}a}\f$ and \f$ \Psi_{ca{a'}} \f$.
|
||||
* \f$ \beta^{(0)}_{MX} \f$, \f$ \beta^{(1)}_{MX} \f$,
|
||||
* \f$ \beta^{(2)}_{MX} \f$, \f$ \Theta_{cc'} \f$, \f$\Theta_{aa'} \f$,
|
||||
* \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$.
|
||||
*
|
||||
*
|
||||
* <H3> Like-Charged Binary Ion Parameters and the Mixing Parameters </H3>
|
||||
|
|
@ -813,8 +813,7 @@ namespace Cantera {
|
|||
<lambdaNeutral species1="CO2" species2="CH4">
|
||||
<lambda> 0.05 </lambda>
|
||||
</lambdaNeutral>
|
||||
@endcode
|
||||
|
||||
@endcode
|
||||
*
|
||||
* <H3> Example of the Specification of Parameters for the Activity
|
||||
* Coefficients </H3>
|
||||
|
|
@ -824,7 +823,7 @@ namespace Cantera {
|
|||
* An example <TT> activityCoefficients </TT> XML block for this
|
||||
* formulation is supplied below
|
||||
*
|
||||
* @code
|
||||
* @verbatim
|
||||
<activityCoefficients model="Pitzer" TempModel="complex1">
|
||||
<!-- Pitzer Coefficients
|
||||
These coefficients are from Pitzer's main
|
||||
|
|
@ -880,7 +879,7 @@ namespace Cantera {
|
|||
</psiCommonAnion>
|
||||
|
||||
</activityCoefficients>
|
||||
* @endcode
|
||||
@endverbatim
|
||||
*
|
||||
*
|
||||
* <H3> Specification of the Debye-Huckel Constant </H3>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ using namespace std;
|
|||
|
||||
namespace Cantera {
|
||||
|
||||
/**
|
||||
/*
|
||||
* Constructor for IdealSolidSolnPhase class:
|
||||
* The default form for the generalized concentrations is 0
|
||||
* i.e., unity.
|
||||
|
|
@ -313,7 +313,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setPressure(double) (virtual from ThermoPhase)
|
||||
*
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
|
|
@ -331,7 +331,7 @@ namespace Cantera {
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setMolarDensity() (virtual from State)
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an indendent variable.
|
||||
|
|
@ -346,7 +346,7 @@ namespace Cantera {
|
|||
"Density is not an independent variable");
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setMoleFractions() (virtual from State)
|
||||
*
|
||||
* Sets the mole fractions and adjusts the internal density.
|
||||
|
|
@ -366,7 +366,7 @@ namespace Cantera {
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setMassFractions() (virtual from State)
|
||||
*
|
||||
* Sets the mass fractions and adjusts the internal density.
|
||||
|
|
@ -376,7 +376,7 @@ namespace Cantera {
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setMassFractions_NoNorm() (virtual from State)
|
||||
*
|
||||
* Sets the mass fractions and adjusts the internal density.
|
||||
|
|
@ -386,7 +386,7 @@ namespace Cantera {
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* setConcentrations (virtual from State)
|
||||
*
|
||||
* Sets the concentrations and adjusts the internal density
|
||||
|
|
@ -596,7 +596,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
/*
|
||||
* getActivityCoefficients():
|
||||
*
|
||||
*/
|
||||
|
|
@ -606,8 +606,8 @@ namespace Cantera {
|
|||
ac[k] = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
//================================================================================================
|
||||
/*
|
||||
*
|
||||
* getChemPotentials():
|
||||
*
|
||||
|
|
@ -635,8 +635,8 @@ namespace Cantera {
|
|||
+ delta_p * m_speciesMolarVolume[k];
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
//================================================================================================
|
||||
/*
|
||||
*
|
||||
* getChemPotentials_RT()
|
||||
*
|
||||
|
|
@ -789,9 +789,9 @@ namespace Cantera {
|
|||
* \f[
|
||||
* \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k<\I>.
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
|
||||
* species <I>k<\I> at the reference pressure, \f$P_{ref}\f$.
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param grt Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
|
|
@ -920,7 +920,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the vector of non-dimensional Gibbs function
|
||||
* of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
|
|
@ -933,7 +933,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the vector of Gibbs function
|
||||
* of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
|
|
@ -947,7 +947,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the vector of nondimensional
|
||||
* internal Energies of the standard state at the current temperature
|
||||
* of the solution and current pressure for each species.
|
||||
|
|
@ -961,7 +961,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the vector of non-dimensional Entropy function
|
||||
* of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
|
|
@ -974,7 +974,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the vector of non-dimensional Entropy function
|
||||
* of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
|
|
@ -987,7 +987,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
|
|
@ -999,7 +999,7 @@ namespace Cantera {
|
|||
return m_h0_RT;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
|
|
@ -1013,7 +1013,7 @@ namespace Cantera {
|
|||
return m_expg0_RT;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
|
|
@ -1028,7 +1028,7 @@ namespace Cantera {
|
|||
/*********************************************************************
|
||||
* Utility Functions
|
||||
*********************************************************************/
|
||||
/**
|
||||
/*
|
||||
* initThermo() function initializes the object for use.
|
||||
*
|
||||
* Before its invokation, the class isn't ready for calculation.
|
||||
|
|
@ -1036,7 +1036,7 @@ namespace Cantera {
|
|||
void IdealSolidSolnPhase::initThermo() {
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Import and initialize an IdealSolidSolnPhase phase
|
||||
* specification in an XML tree into the current object.
|
||||
* Here we read an XML description of the phase.
|
||||
|
|
@ -1121,7 +1121,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Initialization of an IdealSolidSolnPhase phase using an
|
||||
* xml file
|
||||
*
|
||||
|
|
@ -1166,7 +1166,7 @@ namespace Cantera {
|
|||
delete fxml;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* @internal
|
||||
* Import and initialize a ThermoPhase object
|
||||
* using an XML tree.
|
||||
|
|
@ -1263,7 +1263,7 @@ namespace Cantera {
|
|||
ThermoPhase::initThermoXML(phaseNode, id);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This internal function adjusts the lengths of arrays
|
||||
*/
|
||||
void IdealSolidSolnPhase::
|
||||
|
|
@ -1299,7 +1299,7 @@ namespace Cantera {
|
|||
m_speciesMolarVolume.resize(leng);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set mixture to an equilibrium state consistent with specified
|
||||
* element potentials and temperature.
|
||||
*
|
||||
|
|
@ -1326,8 +1326,8 @@ namespace Cantera {
|
|||
doublereal *dptr = DATA_PTR(m_pp);
|
||||
setState_PX(pres, dptr);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
//================================================================================================
|
||||
/*
|
||||
*
|
||||
* speciesMolarVolume()
|
||||
*
|
||||
|
|
@ -1341,7 +1341,7 @@ namespace Cantera {
|
|||
return m_speciesMolarVolume[k];
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* getSpeciesMolarVolumes():
|
||||
*
|
||||
|
|
@ -1353,8 +1353,8 @@ namespace Cantera {
|
|||
{
|
||||
copy(m_speciesMolarVolume.begin(), m_speciesMolarVolume.end(), smv);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
//================================================================================================
|
||||
/*
|
||||
*
|
||||
* _updateThermo()
|
||||
*
|
||||
|
|
@ -1386,4 +1386,6 @@ namespace Cantera {
|
|||
m_tlast = tnow;
|
||||
}
|
||||
}
|
||||
}
|
||||
//================================================================================================
|
||||
} // end namespace Cantera
|
||||
//==================================================================================================
|
||||
|
|
|
|||
|
|
@ -634,6 +634,14 @@ namespace Cantera {
|
|||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_tlast += 0.0001234;
|
||||
|
|
|
|||
|
|
@ -131,6 +131,14 @@ namespace Cantera {
|
|||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param HF298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_tlast += 0.0001234;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace Cantera {
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Destructor:
|
||||
*/
|
||||
Mu0Poly::~Mu0Poly(){
|
||||
|
|
@ -111,7 +111,7 @@ namespace Cantera {
|
|||
doublereal Mu0Poly::maxTemp() const { return m_highT;}
|
||||
doublereal Mu0Poly::refPressure() const { return m_Pref; }
|
||||
|
||||
/**
|
||||
/*
|
||||
* updateProperties is the main workhorse program.
|
||||
* Given a temperature (*tt), it calculates the thermodynamic
|
||||
* functions H/RT, S_R, and cp_R, and returns the answer.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Cantera {
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assignment operator
|
||||
*/
|
||||
PDSS_ConstVol& PDSS_ConstVol::operator=(const PDSS_ConstVol&b) {
|
||||
|
|
@ -75,13 +75,13 @@ namespace Cantera {
|
|||
PDSS_ConstVol::~PDSS_ConstVol() {
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
// Duplicator
|
||||
PDSS* PDSS_ConstVol::duplMyselfAsPDSS() const {
|
||||
PDSS_ConstVol * idg = new PDSS_ConstVol(*this);
|
||||
return (PDSS *) idg;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* constructPDSSXML:
|
||||
*
|
||||
* Initialization of a PDSS_ConstVol object using an
|
||||
|
|
@ -126,7 +126,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* constructPDSSFile():
|
||||
*
|
||||
* Initialization of a PDSS_ConstVol object using an
|
||||
|
|
@ -230,7 +230,7 @@ namespace Cantera {
|
|||
return (val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the Gibbs free energy in mks units of
|
||||
* J kmol-1 K-1.
|
||||
*/
|
||||
|
|
@ -305,19 +305,19 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
/// critical temperature
|
||||
// critical temperature
|
||||
doublereal PDSS_ConstVol::critTemperature() const {
|
||||
throw CanteraError("PDSS_ConstVol::critTemperature()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical pressure
|
||||
// critical pressure
|
||||
doublereal PDSS_ConstVol::critPressure() const {
|
||||
throw CanteraError("PDSS_ConstVol::critPressure()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical density
|
||||
// critical density
|
||||
doublereal PDSS_ConstVol::critDensity() const {
|
||||
throw CanteraError("PDSS_ConstVol::critDensity()", "unimplemented");
|
||||
return (0.0);
|
||||
|
|
@ -361,7 +361,7 @@ namespace Cantera {
|
|||
setTemperature(temp);
|
||||
}
|
||||
|
||||
/// saturation pressure
|
||||
// saturation pressure
|
||||
doublereal PDSS_ConstVol::satPressure(doublereal t){
|
||||
return (1.0E-200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Cantera {
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assignment operator
|
||||
*/
|
||||
PDSS_HKFT& PDSS_HKFT::operator=(const PDSS_HKFT& b) {
|
||||
|
|
@ -199,14 +199,14 @@ namespace Cantera {
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Destructor for the PDSS_HKFT class
|
||||
*/
|
||||
PDSS_HKFT::~PDSS_HKFT() {
|
||||
delete m_waterProps;
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
// Duplicator
|
||||
PDSS* PDSS_HKFT::duplMyselfAsPDSS() const {
|
||||
PDSS_HKFT * idg = new PDSS_HKFT(*this);
|
||||
return (PDSS *) idg;
|
||||
|
|
@ -490,7 +490,7 @@ namespace Cantera {
|
|||
return ee;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the pressure (Pascals), given the temperature and density
|
||||
* Temperature: kelvin
|
||||
* rho: density in kg m-3
|
||||
|
|
@ -518,20 +518,20 @@ namespace Cantera {
|
|||
setPressure(pres);
|
||||
}
|
||||
|
||||
/// critical temperature
|
||||
// critical temperature
|
||||
doublereal
|
||||
PDSS_HKFT::critTemperature() const {
|
||||
throw CanteraError("PDSS_HKFT::critTemperature()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical pressure
|
||||
// critical pressure
|
||||
doublereal PDSS_HKFT::critPressure() const {
|
||||
throw CanteraError("PDSS_HKFT::critPressure()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical density
|
||||
// critical density
|
||||
doublereal PDSS_HKFT::critDensity() const {
|
||||
throw CanteraError("PDSS_HKFT::critDensity()", "unimplemented");
|
||||
return (0.0);
|
||||
|
|
@ -1117,7 +1117,7 @@ namespace Cantera {
|
|||
#ifdef OLDWAY
|
||||
|
||||
/* awData structure */
|
||||
/**
|
||||
/*!
|
||||
* Database for atomic molecular weights
|
||||
*
|
||||
* Values are taken from the 1989 Standard Atomic Weights, CRC
|
||||
|
|
@ -1161,9 +1161,8 @@ namespace Cantera {
|
|||
*
|
||||
* This static function looks up the argument string in the
|
||||
* database above and returns the associated Gibbs Free energies.
|
||||
|
||||
*
|
||||
* @param ElemName String. Only the first 3 characters are significant
|
||||
* @param elemName String. Only the first 3 characters are significant
|
||||
*
|
||||
* @return
|
||||
* Return value contains the Gibbs free energy for that element
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace Cantera {
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assignment operator
|
||||
*/
|
||||
PDSS_IdealGas& PDSS_IdealGas::operator=(const PDSS_IdealGas&b) {
|
||||
|
|
@ -84,7 +84,7 @@ namespace Cantera {
|
|||
PDSS_IdealGas::~PDSS_IdealGas() {
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
// Duplicator
|
||||
PDSS* PDSS_IdealGas::duplMyselfAsPDSS() const {
|
||||
PDSS_IdealGas * idg = new PDSS_IdealGas(*this);
|
||||
return (PDSS *) idg;
|
||||
|
|
@ -92,7 +92,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* constructPDSSXML:
|
||||
*
|
||||
* Initialization of a PDSS_IdealGas object using an
|
||||
|
|
@ -157,7 +157,7 @@ namespace Cantera {
|
|||
m_maxTemp = m_spthermo->maxTemp(m_spindex);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Return the molar enthalpy in units of J kmol-1
|
||||
*/
|
||||
doublereal
|
||||
|
|
@ -174,7 +174,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the internal energy in mks units of
|
||||
* J kmol-1
|
||||
*/
|
||||
|
|
@ -185,7 +185,7 @@ namespace Cantera {
|
|||
return (val * RT);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the entropy in mks units of
|
||||
* J kmol-1 K-1
|
||||
*/
|
||||
|
|
@ -201,7 +201,7 @@ namespace Cantera {
|
|||
return (val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the Gibbs free energy in mks units of
|
||||
* J kmol-1 K-1.
|
||||
*/
|
||||
|
|
@ -218,7 +218,7 @@ namespace Cantera {
|
|||
return (val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the constant pressure heat capacity
|
||||
* in mks units of J kmol-1 K-1
|
||||
*/
|
||||
|
|
@ -245,7 +245,7 @@ namespace Cantera {
|
|||
return (m_pres * m_mw / (GasConstant * m_temp));
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the constant volume heat capacity
|
||||
* in mks units of J kmol-1 K-1
|
||||
*/
|
||||
|
|
@ -279,7 +279,7 @@ namespace Cantera {
|
|||
return (GasConstant * m_temp / m_p0);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Calculate the pressure (Pascals), given the temperature and density
|
||||
* Temperature: kelvin
|
||||
* rho: density in kg m-3
|
||||
|
|
@ -296,26 +296,26 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/// critical temperature
|
||||
// critical temperature
|
||||
doublereal PDSS_IdealGas::critTemperature() const {
|
||||
throw CanteraError("PDSS_IdealGas::critTemperature()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical pressure
|
||||
// critical pressure
|
||||
doublereal PDSS_IdealGas::critPressure() const {
|
||||
throw CanteraError("PDSS_IdealGas::critPressure()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
/// critical density
|
||||
// critical density
|
||||
doublereal PDSS_IdealGas::critDensity() const {
|
||||
throw CanteraError("PDSS_IdealGas::critDensity()", "unimplemented");
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* Return the temperature
|
||||
*
|
||||
* Obtain the temperature from the owning VPStandardStateTP object
|
||||
|
|
@ -351,7 +351,7 @@ namespace Cantera {
|
|||
setTemperature(temp);
|
||||
}
|
||||
|
||||
/// saturation pressure
|
||||
// saturation pressure
|
||||
doublereal PDSS_IdealGas::satPressure(doublereal t){
|
||||
throw CanteraError("PDSS_IdealGas::satPressure()", "unimplemented");
|
||||
/*NOTREACHED*/
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
PDSS_Water::PDSS_Water(VPStandardStateTP *tp, int spindex,
|
||||
std::string inputFile, std::string id) :
|
||||
std::string inputFile, std::string id) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
|
|
@ -174,7 +174,7 @@ namespace Cantera {
|
|||
return (PDSS *) kPDSS;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* constructPDSSXML:
|
||||
*
|
||||
* Initialization of a Debye-Huckel phase using an
|
||||
|
|
@ -191,11 +191,11 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_Water::constructPDSSXML(VPStandardStateTP *tp, int spindex,
|
||||
const XML_Node& phaseNode, std::string id) {
|
||||
const XML_Node& phaseNode, std::string id) {
|
||||
constructSet();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* constructPDSSFile():
|
||||
*
|
||||
* Initialization of a Debye-Huckel phase using an
|
||||
|
|
@ -212,7 +212,7 @@ namespace Cantera {
|
|||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_Water::constructPDSSFile(VPStandardStateTP *tp, int spindex,
|
||||
std::string inputFile, std::string id) {
|
||||
std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
throw CanteraError("PDSS_Water::constructPDSSFile",
|
||||
|
|
|
|||
|
|
@ -416,7 +416,6 @@ namespace Cantera {
|
|||
//! Initialization of a PDSS object using an
|
||||
//! input XML file.
|
||||
/*!
|
||||
*
|
||||
* This routine is a precursor to constructPDSSXML(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -290,8 +290,17 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param h298 If this is nonnull, the current value of the Heat of Formation at 298K and 1 bar for
|
||||
* species m_index is returned in h298[m_index].
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar for
|
||||
* species m_index.
|
||||
*/
|
||||
virtual doublereal reportHf298(doublereal* const h298 = 0) const {
|
||||
|
||||
double tPoly[4];
|
||||
|
|
@ -317,7 +326,14 @@ namespace Cantera {
|
|||
return hh;
|
||||
}
|
||||
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
|
||||
doublereal hnow = reportHf298();
|
||||
doublereal delH = Hf298New - hnow;
|
||||
|
|
|
|||
|
|
@ -401,6 +401,14 @@ namespace Cantera {
|
|||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_tlast += 0.0001234;
|
||||
|
|
|
|||
|
|
@ -369,12 +369,27 @@ namespace Cantera {
|
|||
virtual void modifyParams(int index, doublereal *c) = 0;
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k species index
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual doublereal reportOneHf298(int k) const = 0;
|
||||
|
||||
virtual doublereal reportOneHf298(int k) const = 0;
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of the standard state of
|
||||
//! one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Index of the species
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar.
|
||||
* units = J/kmol.
|
||||
*/
|
||||
virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
|
||||
|
||||
|
||||
#endif
|
||||
};
|
||||
//@}
|
||||
|
|
|
|||
|
|
@ -745,29 +745,32 @@ namespace Cantera {
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Install a species thermodynamic property parameterization
|
||||
* for one species into a species thermo manager.
|
||||
* @param k species number
|
||||
* @param s XML node specifying species
|
||||
* @param spthermo species thermo manager
|
||||
* @param phaseNode_ptr Optional Pointer to the XML phase
|
||||
//================================================================================================
|
||||
// Install a species thermodynamic property parameterization
|
||||
// for the reference state for one species into a species thermo manager.
|
||||
/*
|
||||
* @param k Species number
|
||||
* @param speciesNode Reference to the XML node specifying the species standard
|
||||
* state information
|
||||
* @param th_ptr Pointer to the %ThermoPhase object for the species
|
||||
* @param spthermo Species reference state thermo manager
|
||||
* @param phaseNode_ptr Optional pointer to the XML phase
|
||||
* information for the phase in which the species
|
||||
* resides
|
||||
*/
|
||||
void SpeciesThermoFactory::
|
||||
installThermoForSpecies(int k, const XML_Node& s, ThermoPhase *th_ptr,
|
||||
installThermoForSpecies(int k, const XML_Node& speciesNode, ThermoPhase *th_ptr,
|
||||
SpeciesThermo& spthermo,
|
||||
const XML_Node *phaseNode_ptr) const {
|
||||
/*
|
||||
* Check to see that the species block has a thermo block
|
||||
* before processing. Throw an error if not there.
|
||||
*/
|
||||
if (!(s.hasChild("thermo"))) {
|
||||
if (!(speciesNode.hasChild("thermo"))) {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies",
|
||||
s["name"], "<nonexistent>");
|
||||
speciesNode["name"], "<nonexistent>");
|
||||
}
|
||||
const XML_Node& thermo = s.child("thermo");
|
||||
const XML_Node& thermo = speciesNode.child("thermo");
|
||||
const std::vector<XML_Node*>& tp = thermo.children();
|
||||
int nc = static_cast<int>(tp.size());
|
||||
string mname = thermo["model"];
|
||||
|
|
@ -778,71 +781,69 @@ namespace Cantera {
|
|||
throw CanteraError("SpeciesThermoFactory::installThermoForSpecies",
|
||||
"confused: expedted MinEQ3");
|
||||
}
|
||||
installMinEQ3asShomateThermoFromXML(s["name"], th_ptr, spthermo, k, f);
|
||||
installMinEQ3asShomateThermoFromXML(speciesNode["name"], th_ptr, spthermo, k, f);
|
||||
} else {
|
||||
if (nc == 1) {
|
||||
const XML_Node* f = tp[0];
|
||||
if (f->name() == "Shomate") {
|
||||
installShomateThermoFromXML(s["name"], spthermo, k, f, 0);
|
||||
installShomateThermoFromXML(speciesNode["name"], spthermo, k, f, 0);
|
||||
}
|
||||
else if (f->name() == "const_cp") {
|
||||
installSimpleThermoFromXML(s["name"], spthermo, k, *f);
|
||||
installSimpleThermoFromXML(speciesNode["name"], spthermo, k, *f);
|
||||
}
|
||||
else if (f->name() == "NASA") {
|
||||
installNasaThermoFromXML(s["name"], spthermo, k, f, 0);
|
||||
installNasaThermoFromXML(speciesNode["name"], spthermo, k, f, 0);
|
||||
}
|
||||
else if (f->name() == "Mu0") {
|
||||
installMu0ThermoFromXML(s["name"], spthermo, k, f);
|
||||
installMu0ThermoFromXML(speciesNode["name"], spthermo, k, f);
|
||||
}
|
||||
else if (f->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(s["name"], spthermo, k, tp);
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
// else if (f->name() == "HKFT") {
|
||||
// installHKFTThermoFromXML(s["name"], spthermo, k, tp);
|
||||
//}
|
||||
#ifdef WITH_ADSORBATE
|
||||
else if (f->name() == "adsorbate") {
|
||||
installAdsorbateThermoFromXML(s["name"], spthermo, k, *f);
|
||||
installAdsorbateThermoFromXML(speciesNode["name"], spthermo, k, *f);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies",
|
||||
s["name"], f->name());
|
||||
speciesNode["name"], f->name());
|
||||
}
|
||||
}
|
||||
else if (nc == 2) {
|
||||
const XML_Node* f0 = tp[0];
|
||||
const XML_Node* f1 = tp[1];
|
||||
if (f0->name() == "NASA" && f1->name() == "NASA") {
|
||||
installNasaThermoFromXML(s["name"], spthermo, k, f0, f1);
|
||||
installNasaThermoFromXML(speciesNode["name"], spthermo, k, f0, f1);
|
||||
}
|
||||
else if (f0->name() == "Shomate" && f1->name() == "Shomate") {
|
||||
installShomateThermoFromXML(s["name"], spthermo, k, f0, f1);
|
||||
installShomateThermoFromXML(speciesNode["name"], spthermo, k, f0, f1);
|
||||
}
|
||||
else if (f0->name() == "NASA9" && f1->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(s["name"], spthermo, k, tp);
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", s["name"],
|
||||
f0->name() + " and "
|
||||
+ f1->name());
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
f0->name() + " and " + f1->name());
|
||||
}
|
||||
}
|
||||
else if (nc >= 2) {
|
||||
const XML_Node* f0 = tp[0];
|
||||
if (f0->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(s["name"], spthermo, k, tp);
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", s["name"],
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
}
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", s["name"],
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//================================================================================================
|
||||
// Install a species thermodynamic property parameterization
|
||||
// for the standard state for one species into a species thermo manager, VPSSMgr
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -266,8 +266,26 @@ namespace Cantera {
|
|||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param h298 If this is nonnull, the current value of the Heat of Formation at 298K and 1 bar for
|
||||
* species m_speciesIndex is returned in h298[m_speciesIndex].
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar for
|
||||
* species m_speciesIndex.
|
||||
*/
|
||||
virtual doublereal reportHf298(doublereal* const h298 = 0) const;
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298(const int k, const doublereal Hf298New);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
/**
|
||||
* @file SpeciesThermoMgr.h
|
||||
* This file contains descriptions of templated subclasses of
|
||||
* the virtual base class, SpeciesThermo, which
|
||||
* include SpeciesThermoDuo and SpeciesThermo1
|
||||
* the virtual base class, SpeciesThermo, which include SpeciesThermoDuo and SpeciesThermo1
|
||||
* (see \ref mgrsrefcalc and classes
|
||||
* \link Cantera::SpeciesThermoDuo SpeciesThermoDuo\endlink and
|
||||
* \link Cantera::SpeciesThermo1 SpeciesThermo1\endlink)
|
||||
*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
|
|
@ -52,8 +50,9 @@ namespace Cantera {
|
|||
vector_fp& h_RT,
|
||||
vector_fp& s_R)
|
||||
{
|
||||
for (; begin != end; ++begin)
|
||||
for (; begin != end; ++begin) {
|
||||
begin->updateProperties(T, cp_R, h_RT, s_R);
|
||||
}
|
||||
}
|
||||
|
||||
//! Iterates through a list of objects which implement a method
|
||||
|
|
@ -479,16 +478,31 @@ namespace Cantera {
|
|||
virtual void modifyParams(int index, doublereal *c);
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k species index
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual doublereal reportOneHf298(int k) const {
|
||||
throw CanteraError("reportHF298", "unimplemented");
|
||||
}
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
|
||||
throw CanteraError("reportHF298", "unimplemented");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
//! Vector of SPM objects. There are m_kk of them
|
||||
std::vector<SPM> m_thermo;
|
||||
|
|
|
|||
|
|
@ -545,6 +545,14 @@ namespace Cantera {
|
|||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_tlast += 0.0001234;
|
||||
|
|
|
|||
|
|
@ -778,18 +778,53 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k species index
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
doublereal Hf298SS(const int k) const {
|
||||
return (m_spthermo->reportOneHf298(k));
|
||||
return (m_spthermo->reportOneHf298(k));
|
||||
}
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
//! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
|
||||
/*!
|
||||
* The 298K Heat of Formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k species index
|
||||
* @return Returns the current value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
doublereal Hf298SS(const int k) const {
|
||||
return err("Hf298SS - H298MODIFY_CAPABILITY not compiled in");
|
||||
}
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
(void) err("Hf298SS - H298MODIFY_CAPABILITY not compiled in");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,6 +220,22 @@ namespace Cantera {
|
|||
m_VPSS_ptr->getEnthalpy_RT(hrt);
|
||||
}
|
||||
|
||||
//================================================================================================
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
// Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
void VPStandardStateTP::modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_Tlast_ss += 0.0001234;
|
||||
}
|
||||
#endif
|
||||
//================================================================================================
|
||||
void VPStandardStateTP::getEntropy_R(doublereal* srt) const {
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getEntropy_R(srt);
|
||||
|
|
|
|||
|
|
@ -421,16 +421,23 @@ protected:
|
|||
virtual void getEnthalpy_RT_ref(doublereal *hrt) const;
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
void modifyOneHf298SS(const int k, const doublereal Hf298New) {
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
m_Tlast_ss += 0.0001234;
|
||||
}
|
||||
#endif
|
||||
//! Modify the value of the 298 K Heat of Formation of the standard state of
|
||||
//! one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Index of the species
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar.
|
||||
* units = J/kmol.
|
||||
*/
|
||||
void modifyOneHf298SS(const int k, const doublereal Hf298New);
|
||||
#endif
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs free energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* Gibbs free energies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param grt Output vector contains the nondimensional Gibbs free energies
|
||||
* of the reference state of the species
|
||||
|
|
|
|||
|
|
@ -130,41 +130,41 @@ namespace Cantera {
|
|||
*
|
||||
* units = returns density in kg m-3.
|
||||
*/
|
||||
double WaterProps::density_T(double T, double P, int ifunc) {
|
||||
double Tc = T - 273.15;
|
||||
const double U1 = 288.9414;
|
||||
const double U2 = 508929.2;
|
||||
const double U3 = 68.12963;
|
||||
const double U4 = -3.9863;
|
||||
doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc) {
|
||||
doublereal Tc = T - 273.15;
|
||||
const doublereal U1 = 288.9414;
|
||||
const doublereal U2 = 508929.2;
|
||||
const doublereal U3 = 68.12963;
|
||||
const doublereal U4 = -3.9863;
|
||||
|
||||
double tmp1 = Tc + U1;
|
||||
double tmp4 = Tc + U4;
|
||||
double t4t4 = tmp4 * tmp4;
|
||||
double tmp3 = Tc + U3;
|
||||
double rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3));
|
||||
doublereal tmp1 = Tc + U1;
|
||||
doublereal tmp4 = Tc + U4;
|
||||
doublereal t4t4 = tmp4 * tmp4;
|
||||
doublereal tmp3 = Tc + U3;
|
||||
doublereal rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3));
|
||||
|
||||
/*
|
||||
* Impose an ideal gas lower bound on rho. We need this
|
||||
* to ensure positivity of rho, even though it is
|
||||
* grossly unrepresentative.
|
||||
*/
|
||||
double rhomin = P / (GasConstant * T);
|
||||
doublereal rhomin = P / (GasConstant * T);
|
||||
if (rho < rhomin) {
|
||||
rho = rhomin;
|
||||
if (ifunc == 1) {
|
||||
double drhodT = - rhomin / T;
|
||||
doublereal drhodT = - rhomin / T;
|
||||
return drhodT;
|
||||
} else if (ifunc == 3) {
|
||||
double drhodP = rhomin / P;
|
||||
doublereal drhodP = rhomin / P;
|
||||
return drhodP;
|
||||
} else if (ifunc == 2) {
|
||||
double d2rhodT2 = 2.0 * rhomin / (T * T);
|
||||
doublereal d2rhodT2 = 2.0 * rhomin / (T * T);
|
||||
return d2rhodT2;
|
||||
}
|
||||
}
|
||||
|
||||
if (ifunc == 1) {
|
||||
double drhodT = 1000./U2 * (
|
||||
doublereal drhodT = 1000./U2 * (
|
||||
- tmp4 * tmp4 / (tmp3)
|
||||
- tmp1 * 2 * tmp4 / (tmp3)
|
||||
+ tmp1 * t4t4 / (tmp3*tmp3)
|
||||
|
|
@ -173,8 +173,8 @@ namespace Cantera {
|
|||
} else if (ifunc == 3) {
|
||||
return 0.0;
|
||||
} else if (ifunc == 2) {
|
||||
double t3t3 = tmp3 * tmp3;
|
||||
double d2rhodT2 = 1000./U2 *
|
||||
doublereal t3t3 = tmp3 * tmp3;
|
||||
doublereal d2rhodT2 = 1000./U2 *
|
||||
((-4.0*tmp4-2.0*tmp1)/tmp3 +
|
||||
(2.0*t4t4 + 4.0*tmp1*tmp4)/t3t3
|
||||
- 2.0*tmp1 * t4t4/(t3t3*tmp3));
|
||||
|
|
@ -215,67 +215,67 @@ namespace Cantera {
|
|||
* value at 25C, relEps = 78.38
|
||||
*
|
||||
*/
|
||||
double WaterProps::relEpsilon(double T, double P_pascal,
|
||||
doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal,
|
||||
int ifunc) {
|
||||
const double U1 = 3.4279E2;
|
||||
const double U2 = -5.0866E-3;
|
||||
const double U3 = 9.4690E-7;
|
||||
const double U4 = -2.0525;
|
||||
const double U5 = 3.1159E3;
|
||||
const double U6 = -1.8289E2;
|
||||
const double U7 = -8.0325E3;
|
||||
const double U8 = 4.2142E6;
|
||||
const double U9 = 2.1417;
|
||||
double T2 = T * T;
|
||||
const doublereal U1 = 3.4279E2;
|
||||
const doublereal U2 = -5.0866E-3;
|
||||
const doublereal U3 = 9.4690E-7;
|
||||
const doublereal U4 = -2.0525;
|
||||
const doublereal U5 = 3.1159E3;
|
||||
const doublereal U6 = -1.8289E2;
|
||||
const doublereal U7 = -8.0325E3;
|
||||
const doublereal U8 = 4.2142E6;
|
||||
const doublereal U9 = 2.1417;
|
||||
doublereal T2 = T * T;
|
||||
|
||||
double eps1000 = U1 * exp(U2 * T + U3 * T2);
|
||||
double C = U4 + U5/(U6 + T);
|
||||
double B = U7 + U8/T + U9 * T;
|
||||
doublereal eps1000 = U1 * exp(U2 * T + U3 * T2);
|
||||
doublereal C = U4 + U5/(U6 + T);
|
||||
doublereal B = U7 + U8/T + U9 * T;
|
||||
|
||||
double Pbar = P_pascal * 1.0E-5;
|
||||
double tmpBpar = B + Pbar;
|
||||
double tmpB1000 = B + 1000.0;
|
||||
double ltmp = log(tmpBpar/tmpB1000);
|
||||
double epsRel = eps1000 + C * ltmp;
|
||||
doublereal Pbar = P_pascal * 1.0E-5;
|
||||
doublereal tmpBpar = B + Pbar;
|
||||
doublereal tmpB1000 = B + 1000.0;
|
||||
doublereal ltmp = log(tmpBpar/tmpB1000);
|
||||
doublereal epsRel = eps1000 + C * ltmp;
|
||||
|
||||
if (ifunc == 1 || ifunc == 2) {
|
||||
double tmpC = U6 + T;
|
||||
double dCdT = - U5/(tmpC * tmpC);
|
||||
doublereal tmpC = U6 + T;
|
||||
doublereal dCdT = - U5/(tmpC * tmpC);
|
||||
|
||||
double dBdT = - U8/(T * T) + U9;
|
||||
doublereal dBdT = - U8/(T * T) + U9;
|
||||
|
||||
double deps1000dT = eps1000 * (U2 + 2.0 * U3 * T);
|
||||
doublereal deps1000dT = eps1000 * (U2 + 2.0 * U3 * T);
|
||||
|
||||
double dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
|
||||
doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
|
||||
if (ifunc == 1) {
|
||||
double depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT;
|
||||
doublereal depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT;
|
||||
return depsReldT;
|
||||
}
|
||||
double T3 = T2 * T;
|
||||
double d2CdT2 = - 2.0 * dCdT / tmpC;
|
||||
double d2BdT2 = 2.0 * U8 / (T3);
|
||||
doublereal T3 = T2 * T;
|
||||
doublereal d2CdT2 = - 2.0 * dCdT / tmpC;
|
||||
doublereal d2BdT2 = 2.0 * U8 / (T3);
|
||||
|
||||
double d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) +
|
||||
doublereal d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) +
|
||||
dBdT*dBdT*(1.0/(tmpB1000*tmpB1000) - 1.0/(tmpBpar*tmpBpar)));
|
||||
|
||||
double d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3));
|
||||
doublereal d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3));
|
||||
|
||||
if (ifunc == 2) {
|
||||
double d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT
|
||||
doublereal d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT
|
||||
+ C * d2ltmpdT2);
|
||||
return d2epsReldT2;
|
||||
}
|
||||
}
|
||||
if (ifunc == 3) {
|
||||
double dltmpdP = 1.0E-5 / tmpBpar;
|
||||
double depsReldP = C * dltmpdP;
|
||||
doublereal dltmpdP = 1.0E-5 / tmpBpar;
|
||||
doublereal depsReldP = C * dltmpdP;
|
||||
return depsReldP;
|
||||
}
|
||||
|
||||
return epsRel;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* ADebye calculates the value of A_Debye as a function
|
||||
* of temperature and pressure according to relations
|
||||
* that take into account the temperature and pressure
|
||||
|
|
@ -318,12 +318,12 @@ namespace Cantera {
|
|||
*
|
||||
* (statically defined within the object)
|
||||
*/
|
||||
double WaterProps::ADebye(double T, double P_input, int ifunc) {
|
||||
const double e = 1.60217653E-19;
|
||||
const double epsilon0 = 8.854187817E-12;
|
||||
const double R = 8.314472E3;
|
||||
double psat = satPressure(T);
|
||||
double P;
|
||||
doublereal WaterProps::ADebye(doublereal T, doublereal P_input, int ifunc) {
|
||||
const doublereal e = 1.60217653E-19;
|
||||
const doublereal epsilon0 = 8.854187817E-12;
|
||||
const doublereal R = 8.314472E3;
|
||||
doublereal psat = satPressure(T);
|
||||
doublereal P;
|
||||
if (psat > P_input) {
|
||||
//printf("ADebye WARNING: p_input < psat: %g %g\n",
|
||||
// P_input, psat);
|
||||
|
|
@ -331,17 +331,17 @@ namespace Cantera {
|
|||
} else {
|
||||
P = P_input;
|
||||
}
|
||||
double epsRelWater = relEpsilon(T, P, 0);
|
||||
doublereal epsRelWater = relEpsilon(T, P, 0);
|
||||
//printf("releps calc = %g, compare to 78.38\n", epsRelWater);
|
||||
//double B_Debye = 3.28640E9;
|
||||
const double Na = 6.0221415E26;
|
||||
//doublereal B_Debye = 3.28640E9;
|
||||
const doublereal Na = 6.0221415E26;
|
||||
|
||||
double epsilon = epsilon0 * epsRelWater;
|
||||
double dw = density_IAPWS(T, P);
|
||||
double tmp = sqrt( 2.0 * Na * dw / 1000.);
|
||||
double tmp2 = e * e * Na / (epsilon * R * T);
|
||||
double tmp3 = tmp2 * sqrt(tmp2);
|
||||
double A_Debye = tmp * tmp3 / (8.0 * Pi);
|
||||
doublereal epsilon = epsilon0 * epsRelWater;
|
||||
doublereal dw = density_IAPWS(T, P);
|
||||
doublereal tmp = sqrt( 2.0 * Na * dw / 1000.);
|
||||
doublereal tmp2 = e * e * Na / (epsilon * R * T);
|
||||
doublereal tmp3 = tmp2 * sqrt(tmp2);
|
||||
doublereal A_Debye = tmp * tmp3 / (8.0 * Pi);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -350,20 +350,20 @@ namespace Cantera {
|
|||
* dAdT = - 3/2 Ad/T - 1/2 Ad/Vw d(Vw)/dT - 3/2 Ad/eps d(eps)/dT
|
||||
*/
|
||||
if (ifunc == 1 || ifunc == 2) {
|
||||
double dAdT = - 1.5 * A_Debye / T;
|
||||
doublereal dAdT = - 1.5 * A_Debye / T;
|
||||
|
||||
double depsRelWaterdT = relEpsilon(T, P, 1);
|
||||
doublereal depsRelWaterdT = relEpsilon(T, P, 1);
|
||||
dAdT -= A_Debye * (1.5 * depsRelWaterdT / epsRelWater);
|
||||
|
||||
//int methodD = 1;
|
||||
//double ddwdT = density_T_new(T, P, 1);
|
||||
// double contrib1 = A_Debye * (0.5 * ddwdT / dw);
|
||||
//doublereal ddwdT = density_T_new(T, P, 1);
|
||||
// doublereal contrib1 = A_Debye * (0.5 * ddwdT / dw);
|
||||
|
||||
/*
|
||||
* calculate d(lnV)/dT _constantP, i.e., the cte
|
||||
*/
|
||||
double cte = coeffThermalExp_IAPWS(T, P);
|
||||
double contrib2 = - A_Debye * (0.5 * cte);
|
||||
doublereal cte = coeffThermalExp_IAPWS(T, P);
|
||||
doublereal contrib2 = - A_Debye * (0.5 * cte);
|
||||
|
||||
//dAdT += A_Debye * (0.5 * ddwdT / dw);
|
||||
dAdT += contrib2;
|
||||
|
|
@ -383,14 +383,14 @@ namespace Cantera {
|
|||
* -> we will take each of the terms in dAdT and differentiate
|
||||
* it again.
|
||||
*/
|
||||
double d2AdT2 = 1.5 / T * (A_Debye/T - dAdT);
|
||||
doublereal d2AdT2 = 1.5 / T * (A_Debye/T - dAdT);
|
||||
|
||||
double d2epsRelWaterdT2 = relEpsilon(T, P, 2);
|
||||
doublereal d2epsRelWaterdT2 = relEpsilon(T, P, 2);
|
||||
|
||||
//double dT = -0.01;
|
||||
//double TT = T + dT;
|
||||
//double depsRelWaterdTdel = relEpsilon(TT, P, 1);
|
||||
//double d2alt = (depsRelWaterdTdel- depsRelWaterdT ) / dT;
|
||||
//doublereal dT = -0.01;
|
||||
//doublereal TT = T + dT;
|
||||
//doublereal depsRelWaterdTdel = relEpsilon(TT, P, 1);
|
||||
//doublereal d2alt = (depsRelWaterdTdel- depsRelWaterdT ) / dT;
|
||||
//printf("diff %g %g\n",d2epsRelWaterdT2, d2alt);
|
||||
// HKM -> checks out, i.e., they are the same.
|
||||
|
||||
|
|
@ -398,15 +398,15 @@ namespace Cantera {
|
|||
- A_Debye / epsRelWater *
|
||||
(d2epsRelWaterdT2 - depsRelWaterdT * depsRelWaterdT / epsRelWater));
|
||||
|
||||
double deltaT = -0.1;
|
||||
double Tdel = T + deltaT;
|
||||
double cte_del = coeffThermalExp_IAPWS(Tdel, P);
|
||||
double dctedT = (cte_del - cte) / Tdel;
|
||||
doublereal deltaT = -0.1;
|
||||
doublereal Tdel = T + deltaT;
|
||||
doublereal cte_del = coeffThermalExp_IAPWS(Tdel, P);
|
||||
doublereal dctedT = (cte_del - cte) / Tdel;
|
||||
|
||||
|
||||
//double d2dwdT2 = density_T_new(T, P, 2);
|
||||
//doublereal d2dwdT2 = density_T_new(T, P, 2);
|
||||
|
||||
double contrib3 = 0.5 * ( -(dAdT * cte) -(A_Debye * dctedT));
|
||||
doublereal contrib3 = 0.5 * ( -(dAdT * cte) -(A_Debye * dctedT));
|
||||
d2AdT2 += contrib3;
|
||||
|
||||
return d2AdT2;
|
||||
|
|
@ -426,14 +426,14 @@ namespace Cantera {
|
|||
*/
|
||||
if (ifunc == 3) {
|
||||
|
||||
double dAdP = 0.0;
|
||||
doublereal dAdP = 0.0;
|
||||
|
||||
double depsRelWaterdP = relEpsilon(T, P, 3);
|
||||
doublereal depsRelWaterdP = relEpsilon(T, P, 3);
|
||||
dAdP -= A_Debye * (1.5 * depsRelWaterdP / epsRelWater);
|
||||
|
||||
double kappa = isothermalCompressibility_IAPWS(T,P);
|
||||
doublereal kappa = isothermalCompressibility_IAPWS(T,P);
|
||||
|
||||
//double ddwdP = density_T_new(T, P, 3);
|
||||
//doublereal ddwdP = density_T_new(T, P, 3);
|
||||
dAdP += A_Debye * (0.5 * kappa);
|
||||
|
||||
return dAdP;
|
||||
|
|
@ -442,8 +442,8 @@ namespace Cantera {
|
|||
return A_Debye;
|
||||
}
|
||||
|
||||
double WaterProps::satPressure(double T) {
|
||||
double pres = m_waterIAPWS->psat(T);
|
||||
doublereal WaterProps::satPressure(doublereal T) {
|
||||
doublereal pres = m_waterIAPWS->psat(T);
|
||||
return pres;
|
||||
}
|
||||
|
||||
|
|
@ -455,8 +455,8 @@ namespace Cantera {
|
|||
* @param T Temperature (kelvin)
|
||||
* @param P pressure (pascal)
|
||||
*/
|
||||
double WaterProps::density_IAPWS(double temp, double press) {
|
||||
double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press) {
|
||||
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
return dens;
|
||||
}
|
||||
|
||||
|
|
@ -465,28 +465,28 @@ namespace Cantera {
|
|||
* This function uses the internal state of the
|
||||
* underlying water object
|
||||
*/
|
||||
double WaterProps::density_IAPWS() const {
|
||||
double dens = m_waterIAPWS->density();
|
||||
doublereal WaterProps::density_IAPWS() const {
|
||||
doublereal dens = m_waterIAPWS->density();
|
||||
return dens;
|
||||
}
|
||||
|
||||
double WaterProps::coeffThermalExp_IAPWS(double temp, double press) {
|
||||
double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press) {
|
||||
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
if (dens < 0.0) {
|
||||
throw CanteraError("WaterProps::coeffThermalExp_IAPWS",
|
||||
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
|
||||
}
|
||||
double cte = m_waterIAPWS->coeffThermExp();
|
||||
doublereal cte = m_waterIAPWS->coeffThermExp();
|
||||
return cte;
|
||||
}
|
||||
|
||||
double WaterProps::isothermalCompressibility_IAPWS(double temp, double press) {
|
||||
double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublereal press) {
|
||||
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||
if (dens < 0.0) {
|
||||
throw CanteraError("WaterProps::isothermalCompressibility_IAPWS",
|
||||
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
|
||||
}
|
||||
double kappa = m_waterIAPWS->isothermalCompressibility();
|
||||
doublereal kappa = m_waterIAPWS->isothermalCompressibility();
|
||||
return kappa;
|
||||
}
|
||||
|
||||
|
|
@ -497,12 +497,12 @@ namespace Cantera {
|
|||
// Parameters for the viscosityWater() function
|
||||
|
||||
//@{
|
||||
const double H[4] = {1.,
|
||||
const doublereal H[4] = {1.,
|
||||
0.978197,
|
||||
0.579829,
|
||||
-0.202354};
|
||||
|
||||
const double Hij[6][7] =
|
||||
const doublereal Hij[6][7] =
|
||||
{
|
||||
{ 0.5132047, 0.2151778, -0.2818107, 0.1778064, -0.04176610, 0., 0.},
|
||||
{ 0.3205656, 0.7317883, -1.070786 , 0.4605040, 0., -0.01578386, 0.},
|
||||
|
|
@ -511,10 +511,10 @@ namespace Cantera {
|
|||
{-0.7782567, 0.0 , 0., 0. , 0., 0., 0.},
|
||||
{ 0.1885447, 0.0 , 0., 0. , 0., 0., 0.},
|
||||
};
|
||||
const double TStar = 647.27; // Kelvin
|
||||
const double rhoStar = 317.763; // kg / m3
|
||||
const double presStar = 22.115E6; // Pa
|
||||
const double muStar = 55.071E-6; //Pa s
|
||||
const doublereal TStar = 647.27; // Kelvin
|
||||
const doublereal rhoStar = 317.763; // kg / m3
|
||||
const doublereal presStar = 22.115E6; // Pa
|
||||
const doublereal muStar = 55.071E-6; //Pa s
|
||||
//@}
|
||||
|
||||
// Returns the viscosity of water at the current conditions
|
||||
|
|
@ -533,66 +533,66 @@ namespace Cantera {
|
|||
* for steam and for water, even near the critical point.
|
||||
* Pressures above 500 MPa and temperature above 900 C are suspect.
|
||||
*/
|
||||
double WaterProps::viscosityWater() const {
|
||||
doublereal WaterProps::viscosityWater() const {
|
||||
|
||||
double temp = m_waterIAPWS->temperature();
|
||||
double dens = m_waterIAPWS->density();
|
||||
doublereal temp = m_waterIAPWS->temperature();
|
||||
doublereal dens = m_waterIAPWS->density();
|
||||
|
||||
//WaterPropsIAPWS *waterP = new WaterPropsIAPWS();
|
||||
//m_waterIAPWS->setState_TR(temp, dens);
|
||||
//double pressure = m_waterIAPWS->pressure();
|
||||
//doublereal pressure = m_waterIAPWS->pressure();
|
||||
//printf("pressure = %g\n", pressure);
|
||||
//dens = 18.02 * pressure / (GasConstant * temp);
|
||||
//printf ("mod dens = %g\n", dens);
|
||||
|
||||
double rhobar = dens/rhoStar;
|
||||
double tbar = temp / TStar;
|
||||
// double pbar = pressure / presStar;
|
||||
doublereal rhobar = dens/rhoStar;
|
||||
doublereal tbar = temp / TStar;
|
||||
// doublereal pbar = pressure / presStar;
|
||||
|
||||
double tbar2 = tbar * tbar;
|
||||
double tbar3 = tbar2 * tbar;
|
||||
doublereal tbar2 = tbar * tbar;
|
||||
doublereal tbar3 = tbar2 * tbar;
|
||||
|
||||
double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
|
||||
doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
|
||||
|
||||
//printf("mu0bar = %g\n", mu0bar);
|
||||
//printf("mu0 = %g\n", mu0bar * muStar);
|
||||
|
||||
double tfac1 = 1.0 / tbar - 1.0;
|
||||
double tfac2 = tfac1 * tfac1;
|
||||
double tfac3 = tfac2 * tfac1;
|
||||
double tfac4 = tfac3 * tfac1;
|
||||
double tfac5 = tfac4 * tfac1;
|
||||
doublereal tfac1 = 1.0 / tbar - 1.0;
|
||||
doublereal tfac2 = tfac1 * tfac1;
|
||||
doublereal tfac3 = tfac2 * tfac1;
|
||||
doublereal tfac4 = tfac3 * tfac1;
|
||||
doublereal tfac5 = tfac4 * tfac1;
|
||||
|
||||
double rfac1 = rhobar - 1.0;
|
||||
double rfac2 = rfac1 * rfac1;
|
||||
double rfac3 = rfac2 * rfac1;
|
||||
double rfac4 = rfac3 * rfac1;
|
||||
double rfac5 = rfac4 * rfac1;
|
||||
double rfac6 = rfac5 * rfac1;
|
||||
doublereal rfac1 = rhobar - 1.0;
|
||||
doublereal rfac2 = rfac1 * rfac1;
|
||||
doublereal rfac3 = rfac2 * rfac1;
|
||||
doublereal rfac4 = rfac3 * rfac1;
|
||||
doublereal rfac5 = rfac4 * rfac1;
|
||||
doublereal rfac6 = rfac5 * rfac1;
|
||||
|
||||
double sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
|
||||
doublereal sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
|
||||
Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
|
||||
Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 +
|
||||
Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 +
|
||||
Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
|
||||
Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6
|
||||
);
|
||||
double mu1bar = std::exp(rhobar * sum);
|
||||
doublereal mu1bar = std::exp(rhobar * sum);
|
||||
|
||||
// Apply the near-critical point corrections if necessary
|
||||
double mu2bar = 1.0;
|
||||
doublereal mu2bar = 1.0;
|
||||
if ((tbar >= 0.9970) && tbar <= 1.0082) {
|
||||
if ((rhobar >= 0.755) && (rhobar <= 1.290)) {
|
||||
double drhodp = 1.0 / m_waterIAPWS->dpdrho();
|
||||
doublereal drhodp = 1.0 / m_waterIAPWS->dpdrho();
|
||||
drhodp *= presStar / rhoStar;
|
||||
double xsi = rhobar * drhodp;
|
||||
doublereal xsi = rhobar * drhodp;
|
||||
if (xsi >= 21.93) {
|
||||
mu2bar = 0.922 * std::pow(xsi, 0.0263);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double mubar = mu0bar * mu1bar * mu2bar;
|
||||
doublereal mubar = mu0bar * mu1bar * mu2bar;
|
||||
|
||||
return mubar * muStar;
|
||||
}
|
||||
|
|
@ -612,19 +612,19 @@ namespace Cantera {
|
|||
* for steam and for water, even near the critical point.
|
||||
* Pressures above 500 MPa and temperature above 900 C are suspect.
|
||||
*/
|
||||
double WaterProps::thermalConductivityWater() const {
|
||||
static const double Tstar = 647.27;
|
||||
static const double rhostar = 317.763;
|
||||
static const double lambdastar = 0.4945;
|
||||
static const double presstar = 22.115E6;
|
||||
static const double L[4] =
|
||||
doublereal WaterProps::thermalConductivityWater() const {
|
||||
static const doublereal Tstar = 647.27;
|
||||
static const doublereal rhostar = 317.763;
|
||||
static const doublereal lambdastar = 0.4945;
|
||||
static const doublereal presstar = 22.115E6;
|
||||
static const doublereal L[4] =
|
||||
{
|
||||
1.0000,
|
||||
6.978267,
|
||||
2.599096,
|
||||
-0.998254
|
||||
};
|
||||
static const double Lji[6][5] =
|
||||
static const doublereal Lji[6][5] =
|
||||
{
|
||||
{ 1.3293046, 1.7018363, 5.2246158, 8.7127675, -1.8525999},
|
||||
{-0.40452437, -2.2156845, -10.124111, -9.5000611, 0.93404690},
|
||||
|
|
@ -634,41 +634,41 @@ namespace Cantera {
|
|||
{ 0.044809953, -0.11203160, 0.13333849, 0.0, 0.0},
|
||||
};
|
||||
|
||||
double temp = m_waterIAPWS->temperature();
|
||||
double dens = m_waterIAPWS->density();
|
||||
doublereal temp = m_waterIAPWS->temperature();
|
||||
doublereal dens = m_waterIAPWS->density();
|
||||
|
||||
double rhobar = dens/rhostar;
|
||||
double tbar = temp / Tstar;
|
||||
double tbar2 = tbar * tbar;
|
||||
double tbar3 = tbar2 * tbar;
|
||||
double lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3);
|
||||
doublereal rhobar = dens/rhostar;
|
||||
doublereal tbar = temp / Tstar;
|
||||
doublereal tbar2 = tbar * tbar;
|
||||
doublereal tbar3 = tbar2 * tbar;
|
||||
doublereal lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3);
|
||||
|
||||
//double lambdagas = lambda0bar * lambdastar * 1.0E3;
|
||||
//doublereal lambdagas = lambda0bar * lambdastar * 1.0E3;
|
||||
|
||||
double tfac1 = 1.0 / tbar - 1.0;
|
||||
double tfac2 = tfac1 * tfac1;
|
||||
double tfac3 = tfac2 * tfac1;
|
||||
double tfac4 = tfac3 * tfac1;
|
||||
doublereal tfac1 = 1.0 / tbar - 1.0;
|
||||
doublereal tfac2 = tfac1 * tfac1;
|
||||
doublereal tfac3 = tfac2 * tfac1;
|
||||
doublereal tfac4 = tfac3 * tfac1;
|
||||
|
||||
double rfac1 = rhobar - 1.0;
|
||||
double rfac2 = rfac1 * rfac1;
|
||||
double rfac3 = rfac2 * rfac1;
|
||||
double rfac4 = rfac3 * rfac1;
|
||||
double rfac5 = rfac4 * rfac1;
|
||||
doublereal rfac1 = rhobar - 1.0;
|
||||
doublereal rfac2 = rfac1 * rfac1;
|
||||
doublereal rfac3 = rfac2 * rfac1;
|
||||
doublereal rfac4 = rfac3 * rfac1;
|
||||
doublereal rfac5 = rfac4 * rfac1;
|
||||
|
||||
double sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 +
|
||||
doublereal sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 +
|
||||
Lji[1][0]*rfac1 + Lji[1][1]*tfac1*rfac1 + Lji[1][2]*tfac2*rfac1 + Lji[1][3]*tfac3*rfac1 + Lji[1][4]*tfac4*rfac1 +
|
||||
Lji[2][0]*rfac2 + Lji[2][1]*tfac1*rfac2 + Lji[2][2]*tfac2*rfac2 + Lji[2][3]*tfac3*rfac2 +
|
||||
Lji[3][0]*rfac3 + Lji[3][1]*tfac1*rfac3 + Lji[3][2]*tfac2*rfac3 + Lji[3][3]*tfac3*rfac3 +
|
||||
Lji[4][0]*rfac4 + Lji[4][1]*tfac1*rfac4 + Lji[4][2]*tfac2*rfac4 +
|
||||
Lji[5][0]*rfac5 + Lji[5][1]*tfac1*rfac5 + Lji[5][2]*tfac2*rfac5
|
||||
);
|
||||
double lambda1bar = exp(rhobar * sum);
|
||||
doublereal lambda1bar = exp(rhobar * sum);
|
||||
|
||||
double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
|
||||
doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
|
||||
|
||||
double tfac5 = tfac4 * tfac1;
|
||||
double rfac6 = rfac5 * rfac1;
|
||||
doublereal tfac5 = tfac4 * tfac1;
|
||||
doublereal rfac6 = rfac5 * rfac1;
|
||||
|
||||
sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
|
||||
Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
|
||||
|
|
@ -677,17 +677,17 @@ namespace Cantera {
|
|||
Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
|
||||
Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6
|
||||
);
|
||||
double mu1bar = std::exp(rhobar * sum);
|
||||
doublereal mu1bar = std::exp(rhobar * sum);
|
||||
|
||||
double t2r2 = tbar * tbar / (rhobar * rhobar);
|
||||
double drhodp = 1.0 / m_waterIAPWS->dpdrho();
|
||||
doublereal t2r2 = tbar * tbar / (rhobar * rhobar);
|
||||
doublereal drhodp = 1.0 / m_waterIAPWS->dpdrho();
|
||||
drhodp *= presStar / rhoStar;
|
||||
double xsi = rhobar * drhodp;
|
||||
double xsipow = std::pow(xsi, 0.4678);
|
||||
double rho1 = rhobar - 1.;
|
||||
double rho2 = rho1 * rho1;
|
||||
double rho4 = rho2 * rho2;
|
||||
double temp2 = (tbar - 1.0) * (tbar - 1.0);
|
||||
doublereal xsi = rhobar * drhodp;
|
||||
doublereal xsipow = std::pow(xsi, 0.4678);
|
||||
doublereal rho1 = rhobar - 1.;
|
||||
doublereal rho2 = rho1 * rho1;
|
||||
doublereal rho4 = rho2 * rho2;
|
||||
doublereal temp2 = (tbar - 1.0) * (tbar - 1.0);
|
||||
|
||||
/*
|
||||
* beta = M / (rho * Rgas) (d (pressure) / dT) at constant rho
|
||||
|
|
@ -697,15 +697,15 @@ namespace Cantera {
|
|||
* beta = delta (phi0_d() + phiR_d())
|
||||
* - tau delta (phi0_dt() + phiR_dt())
|
||||
*/
|
||||
double beta = m_waterIAPWS->coeffPresExp();
|
||||
doublereal beta = m_waterIAPWS->coeffPresExp();
|
||||
|
||||
double dpdT_const_rho = beta * GasConstant * dens / 18.015268;
|
||||
doublereal dpdT_const_rho = beta * GasConstant * dens / 18.015268;
|
||||
dpdT_const_rho *= Tstar / presstar;
|
||||
|
||||
double lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho *
|
||||
doublereal lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho *
|
||||
xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rho4);
|
||||
|
||||
double lambda = ( lambda0bar * lambda1bar + lambda2bar) * lambdastar;
|
||||
doublereal lambda = ( lambda0bar * lambda1bar + lambda2bar) * lambdastar;
|
||||
return lambda;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ namespace Cantera {
|
|||
//! Simple calculation of water density at atmospheric pressure.
|
||||
//! Valid up to boiling point.
|
||||
/*!
|
||||
* static function.
|
||||
* This formulation has no dependence on the pressure and shouldn't
|
||||
* be used where accuracy is needed.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public:
|
|||
* @param tau Dimensionless temperature = T_c/T
|
||||
* @param delta Dimensionless density = delta = rho / Rho_c
|
||||
*/
|
||||
double phi_dd(doublereal tau, doublereal delta);
|
||||
doublereal phi_dd(doublereal tau, doublereal delta);
|
||||
|
||||
//! First derivative of phi wrt tau
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ namespace Cantera {
|
|||
m_mw(0.0),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_ready(false),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
|
|
@ -49,7 +48,6 @@ namespace Cantera {
|
|||
m_mw(0.0),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_ready(false),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
|
|
@ -64,7 +62,6 @@ namespace Cantera {
|
|||
m_mw(0.0),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_ready(false),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
|
|
@ -80,7 +77,6 @@ namespace Cantera {
|
|||
m_mw(b.m_mw),
|
||||
EW_Offset(b.EW_Offset),
|
||||
SW_Offset(b.SW_Offset),
|
||||
m_verbose(b.m_verbose),
|
||||
m_ready(false),
|
||||
m_allowGasPhase(b.m_allowGasPhase)
|
||||
{
|
||||
|
|
@ -108,7 +104,6 @@ namespace Cantera {
|
|||
|
||||
|
||||
m_mw = b.m_mw;
|
||||
m_verbose = b.m_verbose;
|
||||
m_ready = b.m_ready;
|
||||
m_allowGasPhase = b.m_allowGasPhase;
|
||||
return *this;
|
||||
|
|
|
|||
|
|
@ -551,22 +551,21 @@ namespace Cantera {
|
|||
//! Molecular weight of Water -> Cantera assumption
|
||||
doublereal m_mw;
|
||||
|
||||
/**
|
||||
* Offset constants used to obtain consistency with the NIST database.
|
||||
* This is added to all internal energy and enthalpy results.
|
||||
//! Offset constants used to obtain consistency with the NIST database.
|
||||
/*!
|
||||
* This is added to all internal energy and enthalpy results.
|
||||
* units = J kmol-1.
|
||||
*/
|
||||
double EW_Offset;
|
||||
doublereal EW_Offset;
|
||||
|
||||
/*
|
||||
* Offset constant used to obtain consistency with NIST convention.
|
||||
* This is added to all internal entropy results.
|
||||
//! Offset constant used to obtain consistency with NIST convention.
|
||||
/*!
|
||||
* This is added to all internal entropy results.
|
||||
* units = J kmol-1 K-1.
|
||||
*/
|
||||
double SW_Offset;
|
||||
|
||||
bool m_verbose;
|
||||
doublereal SW_Offset;
|
||||
|
||||
//! Boolean is true if object has been properly initialized for calculation
|
||||
bool m_ready;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue