[Thermo] Allow discontinuous thermo warnings to be suppressed
Resolves #354
This commit is contained in:
parent
469cc63d99
commit
aa4d07f543
9 changed files with 49 additions and 1 deletions
|
|
@ -216,6 +216,12 @@ void suppress_deprecation_warnings();
|
|||
//! @copydoc Application::make_deprecation_warnings_fatal
|
||||
void make_deprecation_warnings_fatal();
|
||||
|
||||
//! @copydoc Application::suppress_thermo_warnings
|
||||
void suppress_thermo_warnings(bool suppress=true);
|
||||
|
||||
//! @copydoc Application::thermo_warnings_suppressed
|
||||
bool thermo_warnings_suppressed();
|
||||
|
||||
//! @copydoc Application::Messages::setLogger
|
||||
void setLogger(Logger* logwriter);
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ extern "C" {
|
|||
CANTERA_CAPI int ct_addCanteraDirectory(size_t buflen, const char* buf);
|
||||
CANTERA_CAPI int ct_getDataDirectories(int buflen, char* buf, const char* sep);
|
||||
CANTERA_CAPI int ct_getCanteraVersion(int buflen, char* buf);
|
||||
CANTERA_CAPI int ct_suppress_thermo_warnings(int suppress);
|
||||
CANTERA_CAPI int ct_clearStorage();
|
||||
|
||||
CANTERA_CAPI int ct_ck2cti(const char* in_file, const char* db_file,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ cdef extern from "cantera/base/global.h" namespace "Cantera":
|
|||
cdef XML_Node* CxxGetXmlFile "Cantera::get_XML_File" (string) except +translate_exception
|
||||
cdef XML_Node* CxxGetXmlFromString "Cantera::get_XML_from_string" (string) except +translate_exception
|
||||
cdef void Cxx_make_deprecation_warnings_fatal "Cantera::make_deprecation_warnings_fatal" ()
|
||||
cdef void Cxx_suppress_thermo_warnings "Cantera::suppress_thermo_warnings" (cbool)
|
||||
|
||||
cdef extern from "<memory>":
|
||||
cppclass shared_ptr "std::shared_ptr" [T]:
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ def appdelete():
|
|||
def make_deprecation_warnings_fatal():
|
||||
Cxx_make_deprecation_warnings_fatal()
|
||||
|
||||
def suppress_thermo_warnings(pybool suppress=True):
|
||||
Cxx_suppress_thermo_warnings(suppress)
|
||||
|
||||
cdef Composition comp_map(X) except *:
|
||||
if isinstance(X, (str, unicode, bytes)):
|
||||
return parseCompString(stringify(X))
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ void Application::ThreadMessages::removeThreadMessages()
|
|||
|
||||
Application::Application() :
|
||||
m_suppress_deprecation_warnings(false),
|
||||
m_fatal_deprecation_warnings(false)
|
||||
m_fatal_deprecation_warnings(false),
|
||||
m_suppress_thermo_warnings(false)
|
||||
{
|
||||
// install a default logwriter that writes to standard
|
||||
// output / standard error
|
||||
|
|
|
|||
|
|
@ -344,6 +344,17 @@ public:
|
|||
m_fatal_deprecation_warnings = true;
|
||||
}
|
||||
|
||||
//! Globally disable printing of warnings about problematic thermo data,
|
||||
//! e.g. NASA polynomials with discontinuities at the midpoint temperature.
|
||||
void suppress_thermo_warnings(bool suppress=true) {
|
||||
m_suppress_thermo_warnings = suppress;
|
||||
}
|
||||
|
||||
//! Returns `true` if thermo warnings should be suppressed.
|
||||
bool thermo_warnings_suppressed() {
|
||||
return m_suppress_thermo_warnings;
|
||||
}
|
||||
|
||||
//! @copydoc Messages::setLogger
|
||||
void setLogger(Logger* logwriter) {
|
||||
pMessenger->setLogger(logwriter);
|
||||
|
|
@ -400,6 +411,7 @@ protected:
|
|||
|
||||
bool m_suppress_deprecation_warnings;
|
||||
bool m_fatal_deprecation_warnings;
|
||||
bool m_suppress_thermo_warnings;
|
||||
|
||||
ThreadMessages pMessenger;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@ void make_deprecation_warnings_fatal()
|
|||
app()->make_deprecation_warnings_fatal();
|
||||
}
|
||||
|
||||
void suppress_thermo_warnings(bool suppress)
|
||||
{
|
||||
app()->suppress_thermo_warnings(suppress);
|
||||
}
|
||||
|
||||
bool thermo_warnings_suppressed()
|
||||
{
|
||||
return app()->thermo_warnings_suppressed();
|
||||
}
|
||||
|
||||
// **************** Global Data ****************
|
||||
|
||||
Unit* Unit::s_u = 0;
|
||||
|
|
|
|||
|
|
@ -1428,6 +1428,16 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
int ct_suppress_thermo_warnings(int suppress)
|
||||
{
|
||||
try {
|
||||
suppress_thermo_warnings(static_cast<bool>(suppress));
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int ct_setLogWriter(void* logger)
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ namespace Cantera {
|
|||
|
||||
void NasaPoly2::validate(const std::string& name)
|
||||
{
|
||||
if (thermo_warnings_suppressed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
double cp_low, h_low, s_low;
|
||||
double cp_high, h_high, s_high;
|
||||
mnp_low.updatePropertiesTemp(m_midT, &cp_low, &h_low, &s_low);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue