All quantities here are nondimensional, so taking h+cp*T makes no sense, and caused the test to pass even for suspicously discontinuous thermo data (although the bad data would generally get flagged by the tests for cp and/or s).
41 lines
1.6 KiB
C++
41 lines
1.6 KiB
C++
#include "cantera/thermo/NasaPoly2.h"
|
|
#include "cantera/base/global.h"
|
|
#include "cantera/base/stringUtils.h"
|
|
|
|
namespace Cantera {
|
|
|
|
void NasaPoly2::validate(const std::string& name)
|
|
{
|
|
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);
|
|
mnp_high.updatePropertiesTemp(m_midT, &cp_high, &h_high, &s_high);
|
|
|
|
double delta = cp_low - cp_high;
|
|
if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.001) {
|
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
|
" in cp/R detected at Tmid = {}\n", name, m_midT);
|
|
writelog("\tValue computed using low-temperature polynomial: {}\n", cp_low);
|
|
writelog("\tValue computed using high-temperature polynomial: {}\n", cp_high);
|
|
}
|
|
|
|
// enthalpy
|
|
delta = h_low - h_high;
|
|
if (fabs(delta/cp_low) > 0.001) {
|
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
|
" in h/RT detected at Tmid = {}\n", name, m_midT);
|
|
writelog("\tValue computed using low-temperature polynomial: {}\n", h_low);
|
|
writelog("\tValue computed using high-temperature polynomial: {}\n", h_high);
|
|
}
|
|
|
|
// entropy
|
|
delta = s_low - s_high;
|
|
if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
|
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
|
" in s/R detected at Tmid = {}\n", name, m_midT);
|
|
writelog("\tValue computed using low-temperature polynomial: {}\n", s_low);
|
|
writelog("\tValue computed using high-temperature polynomial: {}\n", s_high);
|
|
}
|
|
}
|
|
|
|
}
|