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);
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 }
global.h
Cantera::NasaPoly1::setParameters
void setParameters(const vector_fp &coeffs)
Set array of 7 polynomial coefficients.
Definition: NasaPoly1.h:66
Cantera::NasaPoly2::m_midT
doublereal m_midT
Midrange temperature.
Definition: NasaPoly2.h:170
Cantera::vector_fp
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
Cantera::NasaPoly2::validate
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:24
Cantera::NasaPoly2::mnp_high
NasaPoly1 mnp_high
NasaPoly1 object for the high temperature region.
Definition: NasaPoly2.h:174
Cantera::SpeciesThermoInterpType::setMaxTemp
virtual void setMaxTemp(double Tmax)
Set the maximum temperature at which the thermo parameterization is valid.
Definition: SpeciesThermoInterpType.h:144
stringUtils.h
Cantera::NasaPoly2::mnp_low
NasaPoly1 mnp_low
NasaPoly1 object for the low temperature region.
Definition: NasaPoly2.h:172
Cantera::thermo_warnings_suppressed
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
Definition: global.cpp:79
Cantera::SpeciesThermoInterpType::setMinTemp
virtual void setMinTemp(double Tmin)
Set the minimum temperature at which the thermo parameterization is valid.
Definition: SpeciesThermoInterpType.h:133
NasaPoly2.h
Cantera::warn_user
void warn_user(const std::string &method, const std::string &msg, const Args &... args)
Definition: global.h:206
Cantera::NasaPoly2::setParameters
void setParameters(double Tmid, const vector_fp &low, const vector_fp &high)
Definition: NasaPoly2.cpp:15
Cantera::NasaPoly1::updatePropertiesTemp
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:122
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:263