Cantera
Install
User Guide
Examples
Reference
Develop
Community
4.0.0a2
Toggle main menu visibility
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
6
#include "
cantera/thermo/NasaPoly2.h
"
7
#include "
cantera/base/global.h
"
8
#include "
cantera/base/stringUtils.h
"
9
#include "
cantera/base/AnyMap.h
"
10
11
namespace
Cantera
{
12
13
void
NasaPoly2::setParameters
(
double
Tmid, span<const double> low,
14
span<const 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
22
void
NasaPoly2::getParameters
(
AnyMap
& thermo)
const
23
{
24
thermo[
"model"
] =
"NASA7"
;
25
SpeciesThermoInterpType::getParameters
(thermo);
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
33
void
NasaPoly2::validate
(
const
string
& name)
34
{
35
if
(
thermo_warnings_suppressed
()) {
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
}
AnyMap.h
NasaPoly2.h
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition
AnyMap.h:431
Cantera::NasaPoly2::setParameters
void setParameters(double Tmid, span< const double > low, span< const double > high)
Definition
NasaPoly2.cpp:13
Cantera::NasaPoly2::getParameters
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
Cantera::NasaPoly2::validate
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
Cantera::NasaPoly2::m_midT
double m_midT
Midrange temperature.
Definition
NasaPoly2.h:162
Cantera::NasaPoly2::mnp_low
NasaPoly1 mnp_low
NasaPoly1 object for the low temperature region.
Definition
NasaPoly2.h:164
Cantera::NasaPoly2::mnp_high
NasaPoly1 mnp_high
NasaPoly1 object for the high temperature region.
Definition
NasaPoly2.h:166
Cantera::SpeciesThermoInterpType::getParameters
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition
SpeciesThermoInterpType.cpp:58
Cantera::SpeciesThermoInterpType::m_lowT
double m_lowT
lowest valid temperature
Definition
SpeciesThermoInterpType.h:277
Cantera::SpeciesThermoInterpType::m_highT
double m_highT
Highest valid temperature.
Definition
SpeciesThermoInterpType.h:279
global.h
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Cantera::thermo_warnings_suppressed
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
Definition
global.cpp:97
Cantera::warn_user
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
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
stringUtils.h
Contains declarations for string manipulation functions within Cantera.
src
thermo
NasaPoly2.cpp
Generated by
1.17.0