Cantera  2.2.1
NasaPoly2.cpp
2 #include "cantera/base/global.h"
4
5 namespace Cantera {
6
7 void NasaPoly2::validate(const std::string& name)
8 {
9  size_t offset = mnp_low.speciesIndex();
10  double cp_low, h_low, s_low;
11  double cp_high, h_high, s_high;
12  mnp_low.updatePropertiesTemp(m_midT, &cp_low - offset,
13  &h_low - offset, &s_low - offset);
14  mnp_high.updatePropertiesTemp(m_midT, &cp_high - offset,
15  &h_high - offset, &s_high - offset);
16
17  double delta = cp_low - cp_high;
18  if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.001) {
19  writelog("\n\n**** WARNING ****\nFor species "+name+
20  ", discontinuity in cp/R detected at Tmid = "
21  +fp2str(m_midT)+"\n");
22  writelog("\tValue computed using low-temperature polynomial: "
23  +fp2str(cp_low)+".\n");
24  writelog("\tValue computed using high-temperature polynomial: "
25  +fp2str(cp_high)+".\n");
26  }
27
28  // enthalpy
29  delta = h_low - h_high;
30  if (fabs(delta/(fabs(h_low)+cp_low*m_midT)) > 0.001) {
31  writelog("\n\n**** WARNING ****\nFor species "+name+
32  ", discontinuity in h/RT detected at Tmid = "
33  +fp2str(m_midT)+"\n");
34  writelog("\tValue computed using low-temperature polynomial: "
35  +fp2str(h_low)+".\n");
36  writelog("\tValue computed using high-temperature polynomial: "
37  +fp2str(h_high)+".\n");
38  }
39
40  // entropy
41  delta = s_low - s_high;
42  if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
43  writelog("\n\n**** WARNING ****\nFor species "+name+
44  ", discontinuity in s/R detected at Tmid = "
45  +fp2str(m_midT)+"\n");
46  writelog("\tValue computed using low-temperature polynomial: "
47  +fp2str(s_low)+".\n");
48  writelog("\tValue computed using high-temperature polynomial: "
49  +fp2str(s_high)+".\n");
50  }
51 }
52
53 }
void validate(const std::string &name)
Check for problems with the parameterization, and generate warnings or throw and exception if any are...
Definition: NasaPoly2.cpp:7
virtual size_t speciesIndex() const
Returns an integer representing the species index.
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, (see Input File Handling, Diagnostic Output, and Writing messages to the screen).
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Definition: stringUtils.cpp:28
NasaPoly1 mnp_high
NasaPoly1 object for the high temperature region.
Definition: NasaPoly2.h:235
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
Definition: NasaPoly1.h:177
doublereal m_midT
Midrange temperature.
Definition: NasaPoly2.h:231
Contains declarations for string manipulation functions within Cantera.
void writelog(const std::string &msg)
Write a message to the screen.
Definition: global.cpp:33
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
NasaPoly1 mnp_low
NasaPoly1 object for the low temperature region.
Definition: NasaPoly2.h:233