General cleanup of class ThermoPhase
This commit is contained in:
parent
14b1bf093b
commit
fb2f52b2ec
2 changed files with 26 additions and 87 deletions
|
|
@ -90,19 +90,15 @@ class XML_Node;
|
||||||
* activity concentrations. The dimensions depend on the number
|
* activity concentrations. The dimensions depend on the number
|
||||||
* of products and reactants.
|
* of products and reactants.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* The kinetics manager requires the calculation of K_c for the
|
* The kinetics manager requires the calculation of K_c for the
|
||||||
* calculation of the reverse rate constant
|
* calculation of the reverse rate constant
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @ingroup thermoprops
|
* @ingroup thermoprops
|
||||||
* @ingroup phases
|
* @ingroup phases
|
||||||
*/
|
*/
|
||||||
class ThermoPhase : public Phase
|
class ThermoPhase : public Phase
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor. Note that ThermoPhase is meant to be used as
|
//! Constructor. Note that ThermoPhase is meant to be used as
|
||||||
//! a base class, so this constructor should not be called
|
//! a base class, so this constructor should not be called
|
||||||
//! explicitly.
|
//! explicitly.
|
||||||
|
|
@ -119,15 +115,12 @@ public:
|
||||||
|
|
||||||
//! Assignment operator
|
//! Assignment operator
|
||||||
/*!
|
/*!
|
||||||
* This is NOT a virtual function.
|
|
||||||
*
|
|
||||||
* @param right Reference to %ThermoPhase object to be copied into the
|
* @param right Reference to %ThermoPhase object to be copied into the
|
||||||
* current one.
|
* current one.
|
||||||
*/
|
*/
|
||||||
ThermoPhase& operator=(const ThermoPhase& right);
|
ThermoPhase& operator=(const ThermoPhase& right);
|
||||||
|
|
||||||
//! Duplication routine for objects which inherit from
|
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||||
//! ThermoPhase.
|
|
||||||
/*!
|
/*!
|
||||||
* This virtual routine can be used to duplicate %ThermoPhase objects
|
* This virtual routine can be used to duplicate %ThermoPhase objects
|
||||||
* inherited from %ThermoPhase even if the application only has
|
* inherited from %ThermoPhase even if the application only has
|
||||||
|
|
@ -335,9 +328,8 @@ public:
|
||||||
* @}
|
* @}
|
||||||
* @name Electric Potential
|
* @name Electric Potential
|
||||||
*
|
*
|
||||||
* The phase may be at some non-zero electrical
|
* The phase may be at some non-zero electrical potential. These methods
|
||||||
* potential. These methods set or get the value of the
|
* set or get the value of the electric potential.
|
||||||
* electric potential.
|
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|
@ -372,8 +364,7 @@ public:
|
||||||
* \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
* \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||||
* the standard chemical potential at unit activity,
|
* the standard chemical potential at unit activity,
|
||||||
* which depends on temperature and pressure,
|
* which depends on temperature and pressure,
|
||||||
* but not on composition. The
|
* but not on composition. The activity is dimensionless.
|
||||||
* activity is dimensionless.
|
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -951,8 +942,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @name Setting the State
|
* @name Setting the State
|
||||||
*
|
*
|
||||||
* These methods set all or part of the thermodynamic
|
* These methods set all or part of the thermodynamic state.
|
||||||
* state.
|
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -1084,7 +1074,6 @@ public:
|
||||||
virtual void setState_UV(doublereal u, doublereal v, doublereal tol = 1.e-4);
|
virtual void setState_UV(doublereal u, doublereal v, doublereal tol = 1.e-4);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Carry out work in HP and UV calculations.
|
//! Carry out work in HP and UV calculations.
|
||||||
/*!
|
/*!
|
||||||
* @param h Specific enthalpy or internal energy (J/kg)
|
* @param h Specific enthalpy or internal energy (J/kg)
|
||||||
|
|
@ -1098,7 +1087,6 @@ private:
|
||||||
doublereal tol = 1.e-4, bool doUV = false);
|
doublereal tol = 1.e-4, bool doUV = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Set the specific entropy (J/kg/K) and pressure (Pa).
|
//! Set the specific entropy (J/kg/K) and pressure (Pa).
|
||||||
/*!
|
/*!
|
||||||
* This function fixes the internal state of the phase so that
|
* This function fixes the internal state of the phase so that
|
||||||
|
|
@ -1152,7 +1140,6 @@ public:
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//!This method is used by the ChemEquil equilibrium solver.
|
//!This method is used by the ChemEquil equilibrium solver.
|
||||||
/*!
|
/*!
|
||||||
* It sets the state such that the chemical potentials satisfy
|
* It sets the state such that the chemical potentials satisfy
|
||||||
|
|
@ -1182,7 +1169,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void setElementPotentials(const vector_fp& lambda);
|
void setElementPotentials(const vector_fp& lambda);
|
||||||
|
|
||||||
|
|
||||||
//! Returns the element potentials stored in the ThermoPhase object
|
//! Returns the element potentials stored in the ThermoPhase object
|
||||||
/*!
|
/*!
|
||||||
* Returns the stored element potentials.
|
* Returns the stored element potentials.
|
||||||
|
|
@ -1209,20 +1195,17 @@ public:
|
||||||
|
|
||||||
/// Critical temperature (K).
|
/// Critical temperature (K).
|
||||||
virtual doublereal critTemperature() const {
|
virtual doublereal critTemperature() const {
|
||||||
err("critTemperature");
|
return err("critTemperature");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Critical pressure (Pa).
|
/// Critical pressure (Pa).
|
||||||
virtual doublereal critPressure() const {
|
virtual doublereal critPressure() const {
|
||||||
err("critPressure");
|
return err("critPressure");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Critical density (kg/m3).
|
/// Critical density (kg/m3).
|
||||||
virtual doublereal critDensity() const {
|
virtual doublereal critDensity() const {
|
||||||
err("critDensity");
|
return err("critDensity");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
@ -1240,8 +1223,7 @@ public:
|
||||||
* @param p Pressure (Pa)
|
* @param p Pressure (Pa)
|
||||||
*/
|
*/
|
||||||
virtual doublereal satTemperature(doublereal p) const {
|
virtual doublereal satTemperature(doublereal p) const {
|
||||||
err("satTemperature");
|
return err("satTemperature");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return the saturation pressure given the temperature
|
//! Return the saturation pressure given the temperature
|
||||||
|
|
@ -1249,14 +1231,12 @@ public:
|
||||||
* @param t Temperature (Kelvin)
|
* @param t Temperature (Kelvin)
|
||||||
*/
|
*/
|
||||||
virtual doublereal satPressure(doublereal t) {
|
virtual doublereal satPressure(doublereal t) {
|
||||||
err("satPressure");
|
return err("satPressure");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return the fraction of vapor at the current conditions
|
//! Return the fraction of vapor at the current conditions
|
||||||
virtual doublereal vaporFraction() const {
|
virtual doublereal vaporFraction() const {
|
||||||
err("vaprFraction");
|
return err("vaprFraction");
|
||||||
return -1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Set the state to a saturated system at a particular temperature
|
//! Set the state to a saturated system at a particular temperature
|
||||||
|
|
@ -1334,8 +1314,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* Initialization of a ThermoPhase object using an
|
* Initialization of a ThermoPhase object using an ctml file.
|
||||||
* ctml file.
|
|
||||||
*
|
*
|
||||||
* This routine is a precursor to initThermoXML(XML_Node*)
|
* This routine is a precursor to initThermoXML(XML_Node*)
|
||||||
* routine, which does most of the work.
|
* routine, which does most of the work.
|
||||||
|
|
@ -1426,7 +1405,6 @@ public:
|
||||||
virtual void setParameters(int n, doublereal* const c) {
|
virtual void setParameters(int n, doublereal* const c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Get the equation of state parameters in a vector
|
//! Get the equation of state parameters in a vector
|
||||||
/*!
|
/*!
|
||||||
* @internal
|
* @internal
|
||||||
|
|
@ -1438,10 +1416,8 @@ public:
|
||||||
virtual void getParameters(int& n, doublereal* const c) const {
|
virtual void getParameters(int& n, doublereal* const c) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Set equation of state parameter values from XML entries.
|
//! Set equation of state parameter values from XML entries.
|
||||||
/*!
|
/*!
|
||||||
*
|
|
||||||
* This method is called by function importPhase() in
|
* This method is called by function importPhase() in
|
||||||
* file importCTML.cpp when processing a phase definition in
|
* file importCTML.cpp when processing a phase definition in
|
||||||
* an input file. It should be overloaded in subclasses to set
|
* an input file. It should be overloaded in subclasses to set
|
||||||
|
|
@ -1454,7 +1430,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
||||||
|
|
||||||
|
|
||||||
//! Set the initial state of the phase to the conditions
|
//! Set the initial state of the phase to the conditions
|
||||||
//! specified in the state XML element.
|
//! specified in the state XML element.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -1576,7 +1551,6 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Fills `names` and `data` with the column names and species thermo
|
//! Fills `names` and `data` with the column names and species thermo
|
||||||
//! properties to be included in the output of the reportCSV method.
|
//! properties to be included in the output of the reportCSV method.
|
||||||
virtual void getCsvReportData(std::vector<std::string>& names,
|
virtual void getCsvReportData(std::vector<std::string>& names,
|
||||||
|
|
@ -1637,13 +1611,11 @@ protected:
|
||||||
std::vector<doublereal> xMol_Ref;
|
std::vector<doublereal> xMol_Ref;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Error function that gets called for unhandled cases
|
//! Error function that gets called for unhandled cases
|
||||||
/*!
|
/*!
|
||||||
* @param msg String containing the message.
|
* @param msg String containing the message.
|
||||||
*/
|
*/
|
||||||
doublereal err(const std::string& msg) const;
|
doublereal err(const std::string& msg) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! typedef for the ThermoPhase class
|
//! typedef for the ThermoPhase class
|
||||||
|
|
@ -1652,4 +1624,3 @@ typedef ThermoPhase thermo_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ namespace Cantera
|
||||||
{
|
{
|
||||||
|
|
||||||
ThermoPhase::ThermoPhase() :
|
ThermoPhase::ThermoPhase() :
|
||||||
Phase(),
|
|
||||||
m_spthermo(0), m_speciesData(0),
|
m_spthermo(0), m_speciesData(0),
|
||||||
m_phi(0.0),
|
m_phi(0.0),
|
||||||
m_hasElementPotentials(false),
|
m_hasElementPotentials(false),
|
||||||
|
|
@ -39,7 +38,6 @@ ThermoPhase::~ThermoPhase()
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermoPhase::ThermoPhase(const ThermoPhase& right) :
|
ThermoPhase::ThermoPhase(const ThermoPhase& right) :
|
||||||
Phase(),
|
|
||||||
m_spthermo(0),
|
m_spthermo(0),
|
||||||
m_speciesData(0),
|
m_speciesData(0),
|
||||||
m_phi(0.0),
|
m_phi(0.0),
|
||||||
|
|
@ -53,8 +51,7 @@ ThermoPhase::ThermoPhase(const ThermoPhase& right) :
|
||||||
*this = operator=(right);
|
*this = operator=(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermoPhase& ThermoPhase::
|
ThermoPhase& ThermoPhase::operator=(const ThermoPhase& right)
|
||||||
operator=(const ThermoPhase& right)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Check for self assignment.
|
* Check for self assignment.
|
||||||
|
|
@ -153,22 +150,19 @@ void ThermoPhase::setState_TPX(doublereal t, doublereal p, const std::string& x)
|
||||||
setState_TP(t,p);
|
setState_TP(t,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
|
void ThermoPhase::setState_TPY(doublereal t, doublereal p, const doublereal* y)
|
||||||
const doublereal* y)
|
|
||||||
{
|
{
|
||||||
setMassFractions(y);
|
setMassFractions(y);
|
||||||
setState_TP(t,p);
|
setState_TP(t,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
|
void ThermoPhase::setState_TPY(doublereal t, doublereal p, compositionMap& y)
|
||||||
compositionMap& y)
|
|
||||||
{
|
{
|
||||||
setMassFractionsByName(y);
|
setMassFractionsByName(y);
|
||||||
setState_TP(t,p);
|
setState_TP(t,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
|
void ThermoPhase::setState_TPY(doublereal t, doublereal p, const std::string& y)
|
||||||
const std::string& y)
|
|
||||||
{
|
{
|
||||||
compositionMap yy = parseCompString(y, speciesNames());
|
compositionMap yy = parseCompString(y, speciesNames());
|
||||||
setMassFractionsByName(yy);
|
setMassFractionsByName(yy);
|
||||||
|
|
@ -199,8 +193,7 @@ void ThermoPhase::setState_HP(doublereal Htarget, doublereal p,
|
||||||
setState_HPorUV(Htarget, p, dTtol, false);
|
setState_HPorUV(Htarget, p, dTtol, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::setState_UV(doublereal u, doublereal v,
|
void ThermoPhase::setState_UV(doublereal u, doublereal v, doublereal dTtol)
|
||||||
doublereal dTtol)
|
|
||||||
{
|
{
|
||||||
setState_HPorUV(u, v, dTtol, true);
|
setState_HPorUV(u, v, dTtol, true);
|
||||||
}
|
}
|
||||||
|
|
@ -217,12 +210,11 @@ void ThermoPhase::setState_HPorUV(doublereal Htarget, doublereal p,
|
||||||
doublereal dTtol, bool doUV)
|
doublereal dTtol, bool doUV)
|
||||||
{
|
{
|
||||||
doublereal dt;
|
doublereal dt;
|
||||||
doublereal Hmax = 0.0, Hmin = 0.0;
|
|
||||||
doublereal v = 0.0;
|
doublereal v = 0.0;
|
||||||
|
|
||||||
// Assign the specific volume or pressure and make sure it's positive
|
// Assign the specific volume or pressure and make sure it's positive
|
||||||
if (doUV) {
|
if (doUV) {
|
||||||
v = p;
|
doublereal v = p;
|
||||||
if (v < 1.0E-300) {
|
if (v < 1.0E-300) {
|
||||||
throw CanteraError("setState_HPorUV (UV)",
|
throw CanteraError("setState_HPorUV (UV)",
|
||||||
"Input specific volume is too small or negative. v = " + fp2str(v));
|
"Input specific volume is too small or negative. v = " + fp2str(v));
|
||||||
|
|
@ -301,7 +293,7 @@ void ThermoPhase::setState_HPorUV(doublereal Htarget, doublereal p,
|
||||||
// Check Max and Min values
|
// Check Max and Min values
|
||||||
if (Tnew > Tmax && !ignoreBounds) {
|
if (Tnew > Tmax && !ignoreBounds) {
|
||||||
setState_conditional_TP(Tmax, p, !doUV);
|
setState_conditional_TP(Tmax, p, !doUV);
|
||||||
Hmax = (doUV) ? intEnergy_mass() : enthalpy_mass();
|
double Hmax = (doUV) ? intEnergy_mass() : enthalpy_mass();
|
||||||
if (Hmax >= Htarget) {
|
if (Hmax >= Htarget) {
|
||||||
if (Htop < Htarget) {
|
if (Htop < Htarget) {
|
||||||
Ttop = Tmax;
|
Ttop = Tmax;
|
||||||
|
|
@ -314,7 +306,7 @@ void ThermoPhase::setState_HPorUV(doublereal Htarget, doublereal p,
|
||||||
}
|
}
|
||||||
if (Tnew < Tmin && !ignoreBounds) {
|
if (Tnew < Tmin && !ignoreBounds) {
|
||||||
setState_conditional_TP(Tmin, p, !doUV);
|
setState_conditional_TP(Tmin, p, !doUV);
|
||||||
Hmin = (doUV) ? intEnergy_mass() : enthalpy_mass();
|
double Hmin = (doUV) ? intEnergy_mass() : enthalpy_mass();
|
||||||
if (Hmin <= Htarget) {
|
if (Hmin <= Htarget) {
|
||||||
if (Hbot > Htarget) {
|
if (Hbot > Htarget) {
|
||||||
Tbot = Tmin;
|
Tbot = Tmin;
|
||||||
|
|
@ -644,7 +636,6 @@ SpeciesThermo& ThermoPhase::speciesThermo(int k)
|
||||||
void ThermoPhase::initThermoFile(const std::string& inputFile,
|
void ThermoPhase::initThermoFile(const std::string& inputFile,
|
||||||
const std::string& id)
|
const std::string& id)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (inputFile.size() == 0) {
|
if (inputFile.size() == 0) {
|
||||||
throw CanteraError("ThermoPhase::initThermoFile",
|
throw CanteraError("ThermoPhase::initThermoFile",
|
||||||
"input file is null");
|
"input file is null");
|
||||||
|
|
@ -659,7 +650,6 @@ void ThermoPhase::initThermoFile(const std::string& inputFile,
|
||||||
* The phase object automatically constructs an XML object.
|
* The phase object automatically constructs an XML object.
|
||||||
* Use this object to store information.
|
* Use this object to store information.
|
||||||
*/
|
*/
|
||||||
//XML_Node& phaseNode_XML = xml();
|
|
||||||
XML_Node* fxml = new XML_Node();
|
XML_Node* fxml = new XML_Node();
|
||||||
fxml->build(fin);
|
fxml->build(fin);
|
||||||
XML_Node* fxml_phase = findXMLPhase(fxml, id);
|
XML_Node* fxml_phase = findXMLPhase(fxml, id);
|
||||||
|
|
@ -668,8 +658,6 @@ void ThermoPhase::initThermoFile(const std::string& inputFile,
|
||||||
"ERROR: Can not find phase named " +
|
"ERROR: Can not find phase named " +
|
||||||
id + " in file named " + inputFile);
|
id + " in file named " + inputFile);
|
||||||
}
|
}
|
||||||
//fxml_phase->copy(&phaseNode_XML);
|
|
||||||
//initThermoXML(*fxml_phase, id);
|
|
||||||
bool m_ok = importPhase(*fxml_phase, this);
|
bool m_ok = importPhase(*fxml_phase, this);
|
||||||
if (!m_ok) {
|
if (!m_ok) {
|
||||||
throw CanteraError("ThermoPhase::initThermoFile","importPhase failed ");
|
throw CanteraError("ThermoPhase::initThermoFile","importPhase failed ");
|
||||||
|
|
@ -679,10 +667,6 @@ void ThermoPhase::initThermoFile(const std::string& inputFile,
|
||||||
|
|
||||||
void ThermoPhase::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
void ThermoPhase::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* and sets the state
|
|
||||||
*/
|
|
||||||
if (phaseNode.hasChild("state")) {
|
if (phaseNode.hasChild("state")) {
|
||||||
XML_Node& stateNode = phaseNode.child("state");
|
XML_Node& stateNode = phaseNode.child("state");
|
||||||
setStateFromXML(stateNode);
|
setStateFromXML(stateNode);
|
||||||
|
|
@ -694,28 +678,20 @@ void ThermoPhase::setReferenceComposition(const doublereal* const x)
|
||||||
{
|
{
|
||||||
xMol_Ref.resize(m_kk);
|
xMol_Ref.resize(m_kk);
|
||||||
if (x) {
|
if (x) {
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
copy(x, x + m_kk, xMol_Ref.begin());
|
||||||
xMol_Ref[k] = x[k];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
getMoleFractions(DATA_PTR(xMol_Ref));
|
getMoleFractions(&xMol_Ref[0]);
|
||||||
}
|
|
||||||
double sum = -1.0;
|
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
|
||||||
sum += xMol_Ref[k];
|
|
||||||
}
|
}
|
||||||
|
double sum = accumulate(xMol_Ref.begin(), xMol_Ref.end(), -1.0);
|
||||||
if (fabs(sum) > 1.0E-11) {
|
if (fabs(sum) > 1.0E-11) {
|
||||||
throw CanteraError("ThermoPhase::setReferenceComposition",
|
throw CanteraError("ThermoPhase::setReferenceComposition",
|
||||||
"input mole fractions don't sum to 1.0");
|
"input mole fractions don't sum to 1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::getReferenceComposition(doublereal* const x) const
|
void ThermoPhase::getReferenceComposition(doublereal* const x) const
|
||||||
{
|
{
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
copy(xMol_Ref.begin(), xMol_Ref.end(), x);
|
||||||
x[k] = xMol_Ref[k];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermoPhase::initThermo()
|
void ThermoPhase::initThermo()
|
||||||
|
|
@ -775,7 +751,6 @@ void ThermoPhase::setStateFromXML(const XML_Node& state)
|
||||||
|
|
||||||
void ThermoPhase::setElementPotentials(const vector_fp& lambda)
|
void ThermoPhase::setElementPotentials(const vector_fp& lambda)
|
||||||
{
|
{
|
||||||
doublereal rrt = 1.0/(GasConstant* temperature());
|
|
||||||
size_t mm = nElements();
|
size_t mm = nElements();
|
||||||
if (lambda.size() < mm) {
|
if (lambda.size() < mm) {
|
||||||
throw CanteraError("setElementPotentials", "lambda too small");
|
throw CanteraError("setElementPotentials", "lambda too small");
|
||||||
|
|
@ -783,19 +758,14 @@ void ThermoPhase::setElementPotentials(const vector_fp& lambda)
|
||||||
if (!m_hasElementPotentials) {
|
if (!m_hasElementPotentials) {
|
||||||
m_lambdaRRT.resize(mm);
|
m_lambdaRRT.resize(mm);
|
||||||
}
|
}
|
||||||
for (size_t m = 0; m < mm; m++) {
|
scale(m_lambdaRRT, 1.0/(GasConstant* temperature()));
|
||||||
m_lambdaRRT[m] = lambda[m] * rrt;
|
|
||||||
}
|
|
||||||
m_hasElementPotentials = true;
|
m_hasElementPotentials = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThermoPhase::getElementPotentials(doublereal* lambda) const
|
bool ThermoPhase::getElementPotentials(doublereal* lambda) const
|
||||||
{
|
{
|
||||||
doublereal rt = GasConstant* temperature();
|
|
||||||
if (m_hasElementPotentials) {
|
if (m_hasElementPotentials) {
|
||||||
for (size_t m = 0; m < nElements(); m++) {
|
scale(lambda, lambda + nElements(), lambda, GasConstant* temperature());
|
||||||
lambda[m] = m_lambdaRRT[m] * rt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return m_hasElementPotentials;
|
return m_hasElementPotentials;
|
||||||
}
|
}
|
||||||
|
|
@ -946,7 +916,6 @@ std::string ThermoPhase::report(bool show_thermo) const
|
||||||
getMassFractions(&y[0]);
|
getMassFractions(&y[0]);
|
||||||
getChemPotentials(&mu[0]);
|
getChemPotentials(&mu[0]);
|
||||||
doublereal rt = GasConstant * temperature();
|
doublereal rt = GasConstant * temperature();
|
||||||
//if (th.nSpecies() > 1) {
|
|
||||||
|
|
||||||
if (show_thermo) {
|
if (show_thermo) {
|
||||||
sprintf(p, " \n X "
|
sprintf(p, " \n X "
|
||||||
|
|
@ -979,7 +948,6 @@ std::string ThermoPhase::report(bool show_thermo) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
catch (CanteraError& err) {
|
catch (CanteraError& err) {
|
||||||
err.save();
|
err.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue