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);
|
||||
|
||||
//! Destructor
|
||||
~NonlinearSolver();
|
||||
virtual ~NonlinearSolver();
|
||||
|
||||
//! Assignment operator
|
||||
NonlinearSolver& operator=(const NonlinearSolver& right);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class WaterProps;
|
|||
class PDSS_HKFT : public PDSS
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
|
||||
|
|
@ -443,6 +446,13 @@ private:
|
|||
|
||||
//! Charge of the ion
|
||||
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:
|
||||
|
||||
//! Constructor
|
||||
SpeciesThermo() : m_allow_discontinuities(false) {}
|
||||
SpeciesThermo() {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~SpeciesThermo() {}
|
||||
|
|
@ -333,7 +333,6 @@ public:
|
|||
virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
|
||||
#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 clow(c+1, c+8);
|
||||
|
||||
if (!m_allow_discontinuities) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
checkContinuity(name, tmid, &clow[0], &chigh[0]);
|
||||
|
||||
|
||||
m_high[igrp-1].push_back(NasaPoly1(index, tmid, thigh,
|
||||
ref_pressure, &chigh[0]));
|
||||
|
|
|
|||
|
|
@ -22,8 +22,18 @@
|
|||
using namespace std;
|
||||
using namespace ctml;
|
||||
|
||||
|
||||
|
||||
|
||||
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(tp, spindex),
|
||||
m_waterSS(0),
|
||||
|
|
@ -51,8 +61,9 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) :
|
|||
m_pres = OneAtm;
|
||||
m_pdssType = cPDSS_MOLAL_HKFT;
|
||||
m_presR_bar = OneAtm * 1.0E-5;
|
||||
m_presR_bar = 1.0;
|
||||
}
|
||||
|
||||
//==========================================================================================================================
|
||||
PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex,
|
||||
const std::string& inputFile, const std::string& id) :
|
||||
PDSS(tp, spindex),
|
||||
|
|
@ -74,13 +85,14 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex,
|
|||
m_omega_pr_tr(0.0),
|
||||
m_Y_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_charge_j(0.0)
|
||||
{
|
||||
m_pres = OneAtm;
|
||||
m_pdssType = cPDSS_MOLAL_HKFT;
|
||||
m_presR_bar = OneAtm * 1.0E-5;
|
||||
m_presR_bar = 1.0;
|
||||
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_pdssType = cPDSS_MOLAL_HKFT;
|
||||
m_presR_bar = OneAtm * 1.0E-5;
|
||||
m_presR_bar = 1.0;
|
||||
// We have to read the info from here
|
||||
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled);
|
||||
}
|
||||
|
|
@ -513,7 +526,7 @@ doublereal PDSS_HKFT::critDensity() const
|
|||
throw CanteraError("PDSS_HKFT::critDensity()", "unimplemented");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//=====================================================================================================================
|
||||
void PDSS_HKFT::initThermo()
|
||||
{
|
||||
PDSS::initThermo();
|
||||
|
|
@ -537,12 +550,13 @@ void PDSS_HKFT::initThermo()
|
|||
m_waterProps = new WaterProps(m_waterSS);
|
||||
|
||||
m_presR_bar = OneAtm / 1.0E5;
|
||||
m_presR_bar = 1.0;
|
||||
m_charge_j = m_tp->charge(m_spindex);
|
||||
convertDGFormation();
|
||||
|
||||
//! Ok, we have mu. Let's check it against the input value
|
||||
// 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 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
|
||||
// an error and exit.
|
||||
if (fabs(Hcalc -DHjmol) > 100.* 1.0E3 * 4.184) {
|
||||
throw CanteraError(" PDSS_HKFT::initThermo()",
|
||||
"DHjmol is not consistent with G and S: " +
|
||||
fp2str(Hcalc/(4.184E3)) + " vs "
|
||||
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
||||
std::string sname = m_tp->speciesName(m_spindex);
|
||||
if (s_InputInconsistencyErrorExit) {
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -578,7 +603,7 @@ void PDSS_HKFT::initThermo()
|
|||
+ nu * m_charge_j / (3.082 + gval) / (3.082 + gval) * dgvaldT;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
void PDSS_HKFT::initThermoXML(const XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
PDSS::initThermoXML(phaseNode, id);
|
||||
|
|
@ -592,7 +617,7 @@ void PDSS_HKFT::initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr,
|
|||
delete m_waterProps;
|
||||
m_waterProps = new WaterProps(m_waterSS);
|
||||
}
|
||||
|
||||
//===================================================================================================================
|
||||
void PDSS_HKFT::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled)
|
||||
|
|
@ -853,7 +878,7 @@ doublereal PDSS_HKFT::deltaH() const
|
|||
return deltaH_calgmol * 1.0E3 * 4.184;
|
||||
}
|
||||
#endif
|
||||
|
||||
//================================================================================================================
|
||||
doublereal PDSS_HKFT::deltaG() const
|
||||
{
|
||||
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[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
|
||||
// parameterizations found.
|
||||
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
|
||||
th->setSpeciesThermo(spth);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue