Cantera  3.1.0
Loading...
Searching...
No Matches
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
8
9namespace Cantera {
10
11void NasaPoly2::setParameters(double Tmid, const vector<double>& low,
12 const vector<double>& high) {
13 m_midT = Tmid;
14 mnp_low.setMaxTemp(Tmid);
15 mnp_high.setMinTemp(Tmid);
18}
19
21{
22 thermo["model"] = "NASA7";
24 vector<double> Tranges {m_lowT, m_midT, m_highT};
25 thermo["temperature-ranges"].setQuantity(Tranges, "K");
26 thermo["data"] = vector<vector<double>>();
27 mnp_low.getParameters(thermo);
28 mnp_high.getParameters(thermo);
29}
30
31void NasaPoly2::validate(const string& name)
32{
34 return;
35 }
36
37 double cp_low, h_low, s_low;
38 double cp_high, h_high, s_high;
39 mnp_low.updatePropertiesTemp(m_midT, &cp_low, &h_low, &s_low);
40 mnp_high.updatePropertiesTemp(m_midT, &cp_high, &h_high, &s_high);
41
42 double delta = cp_low - cp_high;
43 if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.01) {
44 warn_user("NasaPoly2::validate",
45 "\nFor species {}, discontinuity in cp/R detected at Tmid = {}\n"
46 "\tValue computed using low-temperature polynomial: {}\n"
47 "\tValue computed using high-temperature polynomial: {}\n",
48 name, m_midT, cp_low, cp_high);
49 }
50
51 // enthalpy
52 delta = h_low - h_high;
53 if (fabs(delta/cp_low) > 0.001) {
54 warn_user("NasaPoly2::validate",
55 "\nFor species {}, discontinuity in h/RT detected at Tmid = {}\n"
56 "\tValue computed using low-temperature polynomial: {}\n"
57 "\tValue computed using high-temperature polynomial: {}\n",
58 name, m_midT, h_low, h_high);
59 }
60
61 // entropy
62 delta = s_low - s_high;
63 if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
64 warn_user("NasaPoly2::validate",
65 "\nFor species {}, discontinuity in s/R detected at Tmid = {}\n"
66 "\tValue computed using low-temperature polynomial: {}\n"
67 "\tValue computed using high-temperature polynomial: {}\n",
68 name, m_midT, s_low, s_high);
69 }
70}
71
72}
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
void setParameters(const vector< double > &coeffs)
Set array of 7 polynomial coefficients.
Definition NasaPoly1.h:68
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition NasaPoly1.h:141
void updatePropertiesTemp(const double temp, double *cp_R, double *h_RT, double *s_R) const override
Compute the reference-state property of one species.
Definition NasaPoly1.h:124
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition NasaPoly2.cpp:20
void validate(const string &name) override
Check for problems with the parameterization, and generate warnings or throw and exception if any are...
Definition NasaPoly2.cpp:31
void setParameters(double Tmid, const vector< double > &low, const vector< double > &high)
Definition NasaPoly2.cpp:11
double m_midT
Midrange temperature.
Definition NasaPoly2.h:167
NasaPoly1 mnp_low
NasaPoly1 object for the low temperature region.
Definition NasaPoly2.h:169
NasaPoly1 mnp_high
NasaPoly1 object for the high temperature region.
Definition NasaPoly2.h:171
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
double m_lowT
lowest valid temperature
virtual void setMinTemp(double Tmin)
Set the minimum temperature at which the thermo parameterization is valid.
double m_highT
Highest valid temperature.
virtual void setMaxTemp(double Tmax)
Set the maximum temperature at which the thermo parameterization is valid.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
Definition global.cpp:97
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition global.h:263
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Contains declarations for string manipulation functions within Cantera.