Cantera  2.5.1
NasaPoly2.cpp
1 // This file is part of Cantera. See License.txt in the top-level directory or
2 // at https://cantera.org/license.txt for license and copyright information.
3 
5 #include "cantera/base/global.h"
7 
8 namespace Cantera {
9 
10 NasaPoly2::NasaPoly2()
11  : m_midT(0)
12 {
13 }
14 
15 void NasaPoly2::setParameters(double Tmid, const vector_fp& low,
16  const vector_fp& high) {
17  m_midT = Tmid;
18  mnp_low.setMaxTemp(Tmid);
19  mnp_high.setMinTemp(Tmid);
20  mnp_low.setParameters(low);
21  mnp_high.setParameters(high);
22 }
23 
24 void NasaPoly2::validate(const std::string& name)
25 {
27  return;
28  }
29 
30  double cp_low, h_low, s_low;
31  double cp_high, h_high, s_high;
32  mnp_low.updatePropertiesTemp(m_midT, &cp_low, &h_low, &s_low);
33  mnp_high.updatePropertiesTemp(m_midT, &cp_high, &h_high, &s_high);
34 
35  double delta = cp_low - cp_high;
36  if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.01) {
37  warn_user("NasaPoly2::validate",
38  "\nFor species {}, discontinuity in cp/R detected at Tmid = {}\n"
39  "\tValue computed using low-temperature polynomial: {}\n"
40  "\tValue computed using high-temperature polynomial: {}\n",
41  name, m_midT, cp_low, cp_high);
42  }
43 
44  // enthalpy
45  delta = h_low - h_high;
46  if (fabs(delta/cp_low) > 0.001) {
47  warn_user("NasaPoly2::validate",
48  "\nFor species {}, discontinuity in h/RT detected at Tmid = {}\n"
49  "\tValue computed using low-temperature polynomial: {}\n"
50  "\tValue computed using high-temperature polynomial: {}\n",
51  name, m_midT, h_low, h_high);
52  }
53 
54  // entropy
55  delta = s_low - s_high;
56  if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
57  warn_user("NasaPoly2::validate",
58  "\nFor species {}, discontinuity in s/R detected at Tmid = {}\n"
59  "\tValue computed using low-temperature polynomial: {}\n"
60  "\tValue computed using high-temperature polynomial: {}\n",
61  name, m_midT, s_low, s_high);
62  }
63 }
64 
65 }
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
This file contains definitions for utility functions and text for modules, inputfiles,...
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
Definition: global.cpp:79
void warn_user(const std::string &method, const std::string &msg, const Args &... args)
Definition: global.h:206
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
Contains declarations for string manipulation functions within Cantera.