Cantera  3.2.0
Loading...
Searching...
No Matches
NasaPoly2.cpp
Go to the documentation of this file.
1//! @file NasaPoly2.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
10
11namespace Cantera {
12
13void NasaPoly2::setParameters(double Tmid, const vector<double>& low,
14 const vector<double>& high) {
15 m_midT = Tmid;
16 mnp_low.setMaxTemp(Tmid);
17 mnp_high.setMinTemp(Tmid);
18 mnp_low.setParameters(low);
19 mnp_high.setParameters(high);
20}
21
23{
24 thermo["model"] = "NASA7";
26 vector<double> Tranges {m_lowT, m_midT, m_highT};
27 thermo["temperature-ranges"].setQuantity(Tranges, "K");
28 thermo["data"] = vector<vector<double>>();
29 mnp_low.getParameters(thermo);
30 mnp_high.getParameters(thermo);
31}
32
33void NasaPoly2::validate(const string& name)
34{
36 return;
37 }
38
39 double cp_low, h_low, s_low;
40 double cp_high, h_high, s_high;
41 mnp_low.updatePropertiesTemp(m_midT, &cp_low, &h_low, &s_low);
42 mnp_high.updatePropertiesTemp(m_midT, &cp_high, &h_high, &s_high);
43
44 double delta = cp_low - cp_high;
45 if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.01) {
46 warn_user("NasaPoly2::validate",
47 "\nFor species {}, discontinuity in cp/R detected at Tmid = {}\n"
48 "\tValue computed using low-temperature polynomial: {}\n"
49 "\tValue computed using high-temperature polynomial: {}\n",
50 name, m_midT, cp_low, cp_high);
51 }
52
53 // enthalpy
54 delta = h_low - h_high;
55 if (fabs(delta/cp_low) > 0.001) {
56 warn_user("NasaPoly2::validate",
57 "\nFor species {}, discontinuity in h/RT detected at Tmid = {}\n"
58 "\tValue computed using low-temperature polynomial: {}\n"
59 "\tValue computed using high-temperature polynomial: {}\n",
60 name, m_midT, h_low, h_high);
61 }
62
63 // entropy
64 delta = s_low - s_high;
65 if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
66 warn_user("NasaPoly2::validate",
67 "\nFor species {}, discontinuity in s/R detected at Tmid = {}\n"
68 "\tValue computed using low-temperature polynomial: {}\n"
69 "\tValue computed using high-temperature polynomial: {}\n",
70 name, m_midT, s_low, s_high);
71 }
72}
73
74}
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 getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition NasaPoly2.cpp:22
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:33
void setParameters(double Tmid, const vector< double > &low, const vector< double > &high)
Definition NasaPoly2.cpp:13
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
double m_highT
Highest valid temperature.
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:106
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition global.h:268
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Contains declarations for string manipulation functions within Cantera.