Fixed a big error in the calculation of Cp for the PDSS_HKFT standard

state.
Added reportParams() for the PDSS object and its children.
This commit is contained in:
Harry Moffat 2009-01-03 03:59:38 +00:00
parent 51aa98675e
commit b20c4174c0
8 changed files with 130 additions and 22 deletions

View file

@ -895,7 +895,6 @@ namespace Cantera {
}
}
/*
* Get the array of non-dimensional activities at
* the current solution temperature, pressure, and

View file

@ -2055,7 +2055,6 @@ namespace Cantera {
*/
virtual double A_Debye_TP(double temperature = -1.0,
double pressure = -1.0) const;
//! Value of the derivative of the Debye Huckel constant with
//! respect to temperature as a function of temperature
@ -2113,7 +2112,6 @@ namespace Cantera {
double ADebye_L(double temperature = -1.0,
double pressure = -1.0) const;
/**
* Return Pitzer's definition of A_J. This is basically the
* temperature derivative of A_L, and the second derivative

View file

@ -184,7 +184,14 @@ namespace Cantera {
PDSS *ip = new PDSS(*this);
return ip;
}
// Returns the type of the standard state parameterization
/*
* @return Returns the integer # of the parameterization
*/
PDSS_enumType PDSS::reportPDSSType() const {
return m_pdssType;
}
void PDSS::initThermoXML(const XML_Node& phaseNode, std::string& id) {
AssertThrow(m_tp != 0, "PDSS::initThermoXML()");
@ -476,4 +483,16 @@ namespace Cantera {
throw CanteraError("PDSS::" + msg, "unimplemented");
}
void PDSS::reportParams(int &kindex, int &type,
doublereal * const c,
doublereal &minTemp,
doublereal &maxTemp,
doublereal &refPressure) const {
kindex = m_spindex;
type = m_pdssType;
minTemp = m_minTemp;
maxTemp = m_maxTemp;
refPressure = m_p0;
}
}

View file

@ -260,7 +260,7 @@ namespace Cantera {
/*!
* @return Returns the integer # of the parameterization
*/
virtual PDSS_enumType reportPDSSType() const { return cPDSS_UNDEF; }
PDSS_enumType reportPDSSType() const;
private:
@ -594,6 +594,28 @@ namespace Cantera {
*/
virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
//! This utility function reports back the type of
//! parameterization and all of the parameters for the
//! species, index.
/*!
*
* @param index Species index
* @param type Integer type of the standard type
* @param c Vector of coefficients used to set the
* parameters for the standard state.
* @param minTemp output - Minimum temperature
* @param maxTemp output - Maximum temperature
* @param refPressure output - reference pressure (Pa).
*
*/
virtual void reportParams(int &kindex, int &type,
doublereal * const c,
doublereal &minTemp,
doublereal &maxTemp,
doublereal &refPressure) const;
private:
//! Initialize all of the internal shallow pointers that can be initialized
/*!

View file

@ -48,7 +48,6 @@ namespace Cantera {
PDSS(tp, spindex)
{
m_pdssType = cPDSS_CONSTVOL;
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled) ;
}
@ -69,9 +68,7 @@ namespace Cantera {
PDSS_ConstVol& PDSS_ConstVol::operator=(const PDSS_ConstVol&b) {
if (&b == this) return *this;
PDSS::operator=(b);
m_constMolarVolume = b.m_constMolarVolume;
return *this;
}

View file

@ -285,16 +285,22 @@ namespace Cantera {
doublereal r_e_j = r_e_j_pr_tr + fabs(m_charge_j) * gval;
doublereal dr_e_jdT = fabs(m_charge_j) * dgvaldT;
doublereal d2r_e_jdT2 = fabs(m_charge_j) * d2gvaldT2;
omega_j = nu * (m_charge_j * m_charge_j / r_e_j - m_charge_j / (3.082 + gval) );
doublereal r_e_j2 = r_e_j * r_e_j;
domega_jdT = - 2.0 * nu * (m_charge_j * m_charge_j * m_charge_j * m_charge_j / (r_e_j * r_e_j* r_e_j)
- m_charge_j / (3.082 + gval) / (3.082 + gval) / (3.082 + gval)) * dgvaldT * dgvaldT
- nu * (m_charge_j * m_charge_j * fabs(m_charge_j) / (r_e_j * r_e_j)
- m_charge_j / (3.082 + gval) / (3.082 + gval)) * d2gvaldT2;
d2omega_jdT2 = nu * (m_charge_j * m_charge_j / (r_e_j * r_e_j) * dr_e_jdT)
+ nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
doublereal charge2 = m_charge_j * m_charge_j;
doublereal r_e_H = 3.082 + gval;
doublereal r_e_H2 = r_e_H * r_e_H;
omega_j = nu * (charge2 / r_e_j - m_charge_j / r_e_H);
domega_jdT = nu * (-(charge2 / r_e_j2 * dr_e_jdT)
+(m_charge_j / r_e_H2 * dgvaldT ));
d2omega_jdT2 = nu * ( 2.0*charge2*dr_e_jdT/(r_e_j2*r_e_j) - charge2*d2r_e_jdT2/r_e_j2
-2.0 *dgvaldT /(r_e_H2*r_e_H) + charge2*d2gvaldT2 /r_e_H2);
}
doublereal relepsilon = m_waterProps->relEpsilon(m_temp, m_pres, 0);
@ -1092,6 +1098,46 @@ namespace Cantera {
//! Store the result into an internal variable.
m_Mu0_tr_pr = dg + totalSum;
}
// This utility function reports back the type of
// parameterization and all of the parameters for the
// species, index.
/*
*
* @param index Species index
* @param type Integer type of the standard type
* @param c Vector of coefficients used to set the
* parameters for the standard state.
* @param minTemp output - Minimum temperature
* @param maxTemp output - Maximum temperature
* @param refPressure output - reference pressure (Pa).
*
*/
void PDSS_HKFT::reportParams(int &kindex, int &type,
doublereal * const c,
doublereal &minTemp,
doublereal &maxTemp,
doublereal &refPressure) const {
// Fill in the first part
PDSS::reportParams(kindex, type, c, minTemp, maxTemp,
refPressure);
c[0] = m_deltaG_formation_tr_pr;
c[1] = m_deltaH_formation_tr_pr;
c[2] = m_Mu0_tr_pr;
c[3] = m_Entrop_tr_pr;
c[4] = m_a1;
c[5] = m_a2;
c[6] = m_a3;
c[7] = m_a4;
c[8] = m_c1;
c[9] = m_c2;
c[10] = m_omega_pr_tr;
}
}

View file

@ -432,6 +432,39 @@ namespace Cantera {
virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr,
SpeciesThermo* spthermo_ptr);
//! This utility function reports back the type of
//! parameterization and all of the parameters for the
//! species, index.
/*!
*
* The following parameters are reported
*
* - c[0] = m_deltaG_formation_tr_pr;
* - c[1] = m_deltaH_formation_tr_pr;
* - c[2] = m_Mu0_tr_pr;
* - c[3] = m_Entrop_tr_pr;
* - c[4] = m_a1;
* - c[5] = m_a2;
* - c[6] = m_a3;
* - c[7] = m_a4;
* - c[8] = m_c1;
* - c[9] = m_c2;
* - c[10] = m_omega_pr_tr;
* .
*
* @param index Species index
* @param type Integer type of the standard type
* @param c Vector of coefficients used to set the
* parameters for the standard state.
* @param minTemp output - Minimum temperature
* @param maxTemp output - Maximum temperature
* @param refPressure output - reference pressure (Pa).
*
*/
virtual void reportParams(int &kindex, int &type, doublereal * const c,
doublereal &minTemp, doublereal &maxTemp,
doublereal &refPressure) const;
//@}

View file

@ -140,12 +140,6 @@ namespace Cantera {
* @{
*/
//! Returns the type of the standard state parameterization
/*!
* @return Returns the integer # of the parameterization
*/
virtual PDSS_enumType reportPDSSType() const { return cPDSS_WATER; }
/**
* @}
* @name Molar Thermodynamic Properties of the Species Standard State