Finalize cleanup of warning messages

This commit is contained in:
Ingmar Schoegl 2019-11-09 18:22:59 -06:00 committed by Ray Speth
parent 334a496267
commit 5bc81bf397
6 changed files with 44 additions and 34 deletions

View file

@ -194,14 +194,18 @@ void _warn_user(const std::string& method, const std::string& extra);
* Print a user warning raised from *method*.
*
* @param method method name
* @param msg C format string for the following arguments
* @param args arguments used to interpolate the format string
* @param msg Python-style format string with the following arguments
* @param args arguments for the format string
*/
template <typename... Args>
void warn_user(const std::string& method, const std::string& msg,
const Args&... args) {
if (sizeof...(args) == 0) {
_warn_user(method, msg);
} else {
_warn_user(method, fmt::format(msg, args...));
}
}
//! @copydoc Application::make_deprecation_warnings_fatal
void make_deprecation_warnings_fatal();

View file

@ -170,14 +170,14 @@ void Application::warn_deprecated(const std::string& method,
return;
}
warnings.insert(method);
writelog("DeprecationWarning: '" + method + "': " + extra);
writelog(fmt::format("DeprecationWarning: {}: {}", method, extra));
writelogendl();
}
void Application::warn_user(const std::string& method,
const std::string& extra)
{
writelog("UserWarning: '" + method + "': " + extra);
writelog(fmt::format("CanteraWarning: {}: {}", method, extra));
writelogendl();
}

View file

@ -45,7 +45,13 @@ void Troe::init(const vector_fp& c)
if (c.size() == 4) {
if (std::abs(c[3]) < SmallNumber) {
warn_user("Troe::init", "Zero T2 value is suppressed.");
warn_user("Troe::init",
"Unexpected parameter value T2=0. Omitting exp(T2/T) term from "
"falloff expression. To suppress this warning, remove value "
"for T2 from the input file. In the unlikely case that the "
"exp(T2/T) term should be included with T2 effectively equal "
"to 0, set T2 to a sufficiently small value "
"(i.e. T2 < 1e-16).");
}
m_t2 = c[3];
}

View file

@ -314,7 +314,7 @@ void PDSS_HKFT::initThermo()
" not consistent with G and S: {} vs {} cal gmol-1",
sname, Hcalc/toSI("cal/gmol"), m_deltaH_formation_tr_pr);
} else {
warn_user("PDSS_HKFT::initThermo()",
warn_user("PDSS_HKFT::initThermo",
"DHjmol for {} is not consistent with G and S: calculated {} "
"vs input {} cal gmol-1; continuing with consistent DHjmol = {}",
sname, Hcalc/toSI("cal/gmol"), m_deltaH_formation_tr_pr,

View file

@ -40,32 +40,32 @@ Description:
Chemical equilibrium.
Equilibrium composition and pressure for a range of temperatures at constant density.
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI2H6, discontinuity in h/RT detected at Tmid = 1000
Value computed using low-temperature polynomial: 19.8328
Value computed using high-temperature polynomial: 19.9055
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI2H6, discontinuity in s/R detected at Tmid = 1000
Value computed using low-temperature polynomial: 49.5493
Value computed using high-temperature polynomial: 49.7214
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI3H8, discontinuity in h/RT detected at Tmid = 1000
Value computed using low-temperature polynomial: 29.3028
Value computed using high-temperature polynomial: 29.4297
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI3H8, discontinuity in s/R detected at Tmid = 1000
Value computed using low-temperature polynomial: 65.9731
Value computed using high-temperature polynomial: 66.2781
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI2, discontinuity in h/RT detected at Tmid = 1000
Value computed using low-temperature polynomial: 74.0115
Value computed using high-temperature polynomial: 74.0387
UserWarning: 'NasaPoly2::validate':
CanteraWarning: NasaPoly2::validate:
For species SI2, discontinuity in s/R detected at Tmid = 1000
Value computed using low-temperature polynomial: 32.8813
Value computed using high-temperature polynomial: 32.9489