Took out change of user NASA polynomials.
This violates basic paradigm of what the user inputs the user gets. If this is necessary, this needs to be a cpp utility program that is run before the main simulation.
This commit is contained in:
parent
f8850963a0
commit
7e88d49734
6 changed files with 51 additions and 27 deletions
|
|
@ -135,7 +135,7 @@ public:
|
||||||
NonlinearSolver(const NonlinearSolver& right);
|
NonlinearSolver(const NonlinearSolver& right);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NonlinearSolver();
|
virtual ~NonlinearSolver();
|
||||||
|
|
||||||
//! Assignment operator
|
//! Assignment operator
|
||||||
NonlinearSolver& operator=(const NonlinearSolver& right);
|
NonlinearSolver& operator=(const NonlinearSolver& right);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@ class WaterProps;
|
||||||
class PDSS_HKFT : public PDSS
|
class PDSS_HKFT : public PDSS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! @name Constructors
|
//! @name Constructors
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
@ -443,6 +446,13 @@ private:
|
||||||
|
|
||||||
//! Charge of the ion
|
//! Charge of the ion
|
||||||
doublereal m_charge_j;
|
doublereal m_charge_j;
|
||||||
|
|
||||||
|
//! Static variable determining error exiting
|
||||||
|
/*!
|
||||||
|
* If true, then will error exit if there is an inconsistency in DG0, DH0, and DS0.
|
||||||
|
* If not, then will rewrite DH0 to be consistent with the other two.
|
||||||
|
*/
|
||||||
|
static int s_InputInconsistencyErrorExit;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class SpeciesThermo
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
SpeciesThermo() : m_allow_discontinuities(false) {}
|
SpeciesThermo() {}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~SpeciesThermo() {}
|
virtual ~SpeciesThermo() {}
|
||||||
|
|
@ -333,7 +333,6 @@ public:
|
||||||
virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
|
virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool m_allow_discontinuities;
|
|
||||||
};
|
};
|
||||||
//@}
|
//@}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,14 +82,8 @@ void NasaThermo::install(const std::string& name, size_t index, int type,
|
||||||
vector_fp chigh(c+8, c+15);
|
vector_fp chigh(c+8, c+15);
|
||||||
vector_fp clow(c+1, c+8);
|
vector_fp clow(c+1, c+8);
|
||||||
|
|
||||||
if (!m_allow_discontinuities) {
|
checkContinuity(name, tmid, &clow[0], &chigh[0]);
|
||||||
doublereal maxError = checkContinuity(name, tmid, &clow[0], &chigh[0]);
|
|
||||||
if (maxError > 1e-6) {
|
|
||||||
fixDiscontinuities(tlow, tmid, thigh, &clow[0], &chigh[0]);
|
|
||||||
AssertThrowMsg(checkContinuity(name, tmid, &clow[0], &chigh[0]) < 1e-12,
|
|
||||||
"NasaThermo::install", "Polynomials still not continuous");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_high[igrp-1].push_back(NasaPoly1(index, tmid, thigh,
|
m_high[igrp-1].push_back(NasaPoly1(index, tmid, thigh,
|
||||||
ref_pressure, &chigh[0]));
|
ref_pressure, &chigh[0]));
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,18 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ctml;
|
using namespace ctml;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Cantera
|
namespace Cantera
|
||||||
{
|
{
|
||||||
|
//==================================================================================================================================
|
||||||
|
/*
|
||||||
|
* Set the default to error exit if there is an input file inconsistency
|
||||||
|
*/
|
||||||
|
int PDSS_HKFT::s_InputInconsistencyErrorExit = 1;
|
||||||
|
|
||||||
|
//==================================================================================================================================
|
||||||
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) :
|
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) :
|
||||||
PDSS(tp, spindex),
|
PDSS(tp, spindex),
|
||||||
m_waterSS(0),
|
m_waterSS(0),
|
||||||
|
|
@ -51,8 +61,9 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) :
|
||||||
m_pres = OneAtm;
|
m_pres = OneAtm;
|
||||||
m_pdssType = cPDSS_MOLAL_HKFT;
|
m_pdssType = cPDSS_MOLAL_HKFT;
|
||||||
m_presR_bar = OneAtm * 1.0E-5;
|
m_presR_bar = OneAtm * 1.0E-5;
|
||||||
|
m_presR_bar = 1.0;
|
||||||
}
|
}
|
||||||
|
//==========================================================================================================================
|
||||||
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex,
|
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex,
|
||||||
const std::string& inputFile, const std::string& id) :
|
const std::string& inputFile, const std::string& id) :
|
||||||
PDSS(tp, spindex),
|
PDSS(tp, spindex),
|
||||||
|
|
@ -74,13 +85,14 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex,
|
||||||
m_omega_pr_tr(0.0),
|
m_omega_pr_tr(0.0),
|
||||||
m_Y_pr_tr(0.0),
|
m_Y_pr_tr(0.0),
|
||||||
m_Z_pr_tr(0.0),
|
m_Z_pr_tr(0.0),
|
||||||
m_presR_bar(0.0),
|
m_presR_bar(1.0),
|
||||||
m_domega_jdT_prtr(0.0),
|
m_domega_jdT_prtr(0.0),
|
||||||
m_charge_j(0.0)
|
m_charge_j(0.0)
|
||||||
{
|
{
|
||||||
m_pres = OneAtm;
|
m_pres = OneAtm;
|
||||||
m_pdssType = cPDSS_MOLAL_HKFT;
|
m_pdssType = cPDSS_MOLAL_HKFT;
|
||||||
m_presR_bar = OneAtm * 1.0E-5;
|
m_presR_bar = OneAtm * 1.0E-5;
|
||||||
|
m_presR_bar = 1.0;
|
||||||
constructPDSSFile(tp, spindex, inputFile, id);
|
constructPDSSFile(tp, spindex, inputFile, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,6 +124,7 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex, const XML_Node& spec
|
||||||
m_pres = OneAtm;
|
m_pres = OneAtm;
|
||||||
m_pdssType = cPDSS_MOLAL_HKFT;
|
m_pdssType = cPDSS_MOLAL_HKFT;
|
||||||
m_presR_bar = OneAtm * 1.0E-5;
|
m_presR_bar = OneAtm * 1.0E-5;
|
||||||
|
m_presR_bar = 1.0;
|
||||||
// We have to read the info from here
|
// We have to read the info from here
|
||||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
||||||
}
|
}
|
||||||
|
|
@ -513,7 +526,7 @@ doublereal PDSS_HKFT::critDensity() const
|
||||||
throw CanteraError("PDSS_HKFT::critDensity()", "unimplemented");
|
throw CanteraError("PDSS_HKFT::critDensity()", "unimplemented");
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
//=====================================================================================================================
|
||||||
void PDSS_HKFT::initThermo()
|
void PDSS_HKFT::initThermo()
|
||||||
{
|
{
|
||||||
PDSS::initThermo();
|
PDSS::initThermo();
|
||||||
|
|
@ -537,12 +550,13 @@ void PDSS_HKFT::initThermo()
|
||||||
m_waterProps = new WaterProps(m_waterSS);
|
m_waterProps = new WaterProps(m_waterSS);
|
||||||
|
|
||||||
m_presR_bar = OneAtm / 1.0E5;
|
m_presR_bar = OneAtm / 1.0E5;
|
||||||
|
m_presR_bar = 1.0;
|
||||||
m_charge_j = m_tp->charge(m_spindex);
|
m_charge_j = m_tp->charge(m_spindex);
|
||||||
convertDGFormation();
|
convertDGFormation();
|
||||||
|
|
||||||
//! Ok, we have mu. Let's check it against the input value
|
//! Ok, we have mu. Let's check it against the input value
|
||||||
// of DH_F to see that we have some internal consistency
|
// of DH_F to see that we have some internal consistency
|
||||||
|
|
||||||
doublereal Hcalc = m_Mu0_tr_pr + 298.15 * (m_Entrop_tr_pr * 1.0E3 * 4.184);
|
doublereal Hcalc = m_Mu0_tr_pr + 298.15 * (m_Entrop_tr_pr * 1.0E3 * 4.184);
|
||||||
|
|
||||||
doublereal DHjmol = m_deltaH_formation_tr_pr * 1.0E3 * 4.184;
|
doublereal DHjmol = m_deltaH_formation_tr_pr * 1.0E3 * 4.184;
|
||||||
|
|
@ -550,10 +564,21 @@ void PDSS_HKFT::initThermo()
|
||||||
// If the discrepancy is greater than 100 cal gmol-1, print
|
// If the discrepancy is greater than 100 cal gmol-1, print
|
||||||
// an error and exit.
|
// an error and exit.
|
||||||
if (fabs(Hcalc -DHjmol) > 100.* 1.0E3 * 4.184) {
|
if (fabs(Hcalc -DHjmol) > 100.* 1.0E3 * 4.184) {
|
||||||
throw CanteraError(" PDSS_HKFT::initThermo()",
|
std::string sname = m_tp->speciesName(m_spindex);
|
||||||
"DHjmol is not consistent with G and S: " +
|
if (s_InputInconsistencyErrorExit) {
|
||||||
fp2str(Hcalc/(4.184E3)) + " vs "
|
|
||||||
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
throw CanteraError(" PDSS_HKFT::initThermo() for " + sname,
|
||||||
|
"DHjmol is not consistent with G and S: " +
|
||||||
|
fp2str(Hcalc/(4.184E3)) + " vs "
|
||||||
|
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
||||||
|
} else {
|
||||||
|
writelog(" PDSS_HKFT::initThermo() WARNING: "
|
||||||
|
"DHjmol for " + sname + " is not consistent with G and S: calculated " +
|
||||||
|
fp2str(Hcalc/(4.184E3)) + " vs input "
|
||||||
|
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
||||||
|
writelog(" : continuing with consistent DHjmol = " + fp2str(Hcalc/(4.184E3)));
|
||||||
|
m_deltaH_formation_tr_pr = Hcalc / (1.0E3 * 4.184);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
doublereal nu = 166027;
|
doublereal nu = 166027;
|
||||||
|
|
||||||
|
|
@ -578,7 +603,7 @@ void PDSS_HKFT::initThermo()
|
||||||
+ nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
|
+ nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//=================================================================================================================
|
||||||
void PDSS_HKFT::initThermoXML(const XML_Node& phaseNode, const std::string& id)
|
void PDSS_HKFT::initThermoXML(const XML_Node& phaseNode, const std::string& id)
|
||||||
{
|
{
|
||||||
PDSS::initThermoXML(phaseNode, id);
|
PDSS::initThermoXML(phaseNode, id);
|
||||||
|
|
@ -592,7 +617,7 @@ void PDSS_HKFT::initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr,
|
||||||
delete m_waterProps;
|
delete m_waterProps;
|
||||||
m_waterProps = new WaterProps(m_waterSS);
|
m_waterProps = new WaterProps(m_waterSS);
|
||||||
}
|
}
|
||||||
|
//===================================================================================================================
|
||||||
void PDSS_HKFT::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
void PDSS_HKFT::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||||
const XML_Node& speciesNode,
|
const XML_Node& speciesNode,
|
||||||
const XML_Node& phaseNode, bool spInstalled)
|
const XML_Node& phaseNode, bool spInstalled)
|
||||||
|
|
@ -853,7 +878,7 @@ doublereal PDSS_HKFT::deltaH() const
|
||||||
return deltaH_calgmol * 1.0E3 * 4.184;
|
return deltaH_calgmol * 1.0E3 * 4.184;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
//================================================================================================================
|
||||||
doublereal PDSS_HKFT::deltaG() const
|
doublereal PDSS_HKFT::deltaG() const
|
||||||
{
|
{
|
||||||
doublereal pbar = m_pres * 1.0E-5;
|
doublereal pbar = m_pres * 1.0E-5;
|
||||||
|
|
@ -1183,5 +1208,5 @@ void PDSS_HKFT::reportParams(size_t& kindex, int& type,
|
||||||
c[9] = m_c2;
|
c[9] = m_c2;
|
||||||
c[10] = m_omega_pr_tr;
|
c[10] = m_omega_pr_tr;
|
||||||
}
|
}
|
||||||
|
//============================================================================================================
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -561,10 +561,6 @@ bool importPhase(XML_Node& phase, ThermoPhase* th,
|
||||||
// used, and selects a class that can handle the
|
// used, and selects a class that can handle the
|
||||||
// parameterizations found.
|
// parameterizations found.
|
||||||
spth = newSpeciesThermoMgr(spDataNodeList);
|
spth = newSpeciesThermoMgr(spDataNodeList);
|
||||||
if (eos["allow_discontinuities"] == "true") {
|
|
||||||
std::cout << "ALLOWING DISCONTINUOUS THERMO!" << std::endl;
|
|
||||||
spth->m_allow_discontinuities = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// install it in the phase object
|
// install it in the phase object
|
||||||
th->setSpeciesThermo(spth);
|
th->setSpeciesThermo(spth);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue