https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NASA7Polynomials.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "MooseTypes.h"
13#include "metaphysicl/raw_type.h"
14
15#include <array>
16#include <cmath>
17#include <string>
18
25namespace NASA7
26{
28using Coefficients = std::array<Real, 7>;
29
32{
34 std::string name;
38 Real T_min;
40 Real T_mid;
42 Real T_max;
47};
48
50constexpr Real reference_pressure = 101325.0;
51
57const SpeciesData & speciesData(const std::string & name);
58
60std::string speciesNames();
61
67template <typename CppType>
68const Coefficients &
69coefficients(const SpeciesData & data, const CppType & T)
70{
71 return MetaPhysicL::raw_value(T) <= data.T_mid ? data.low : data.high;
72}
73
75template <typename CppType>
76CppType
77cpOverR(const SpeciesData & data, const CppType & T)
78{
79 const auto & a = coefficients(data, T);
80 return a[0] + T * (a[1] + T * (a[2] + T * (a[3] + T * a[4])));
81}
82
84template <typename CppType>
85CppType
86hOverRT(const SpeciesData & data, const CppType & T)
87{
88 const auto & a = coefficients(data, T);
89 return a[0] + T * (a[1] / 2 + T * (a[2] / 3 + T * (a[3] / 4 + T * a[4] / 5))) + a[5] / T;
90}
91
96template <typename CppType>
97CppType
98sOverR(const SpeciesData & data, const CppType & T)
99{
100 using std::log;
101 const auto & a = coefficients(data, T);
102 return a[0] * log(T) + T * (a[1] + T * (a[2] / 2 + T * (a[3] / 3 + T * a[4] / 4))) + a[6];
103}
104}
const double T
const std::string name
Definition Setup.h:21
auto raw_value(const Eigen::Map< T > &in)
Standard-state thermodynamic properties of ideal-gas species from NASA 7-coefficient polynomials.
CppType hOverRT(const SpeciesData &data, const CppType &T)
Standard-state molar enthalpy divided by the gas constant and temperature, h/(RT)
const SpeciesData & speciesData(const std::string &name)
Data of a built-in species.
CppType cpOverR(const SpeciesData &data, const CppType &T)
Standard-state molar isobaric heat capacity divided by the gas constant, cp/R.
const Coefficients & coefficients(const SpeciesData &data, const CppType &T)
Coefficients of the polynomial that applies at a temperature.
CppType sOverR(const SpeciesData &data, const CppType &T)
Standard-state molar entropy divided by the gas constant, s/R, at the reference pressure of the data ...
constexpr Real reference_pressure
Pressure at which the standard-state entropy of the built-in species applies [Pa].
std::array< Real, 7 > Coefficients
Coefficients a_0, ..., a_6 of the polynomial for one temperature interval.
std::string speciesNames()
Names of the built-in species, separated by spaces.
NASA 7-coefficient data of one species.
Real T_max
Upper end of the temperature range of the fit [K].
Real T_mid
Temperature where the low- and high-temperature polynomials meet [K].
std::string name
Species name, e.g. "H2O".
Real T_min
Lower end of the temperature range of the fit [K].
Coefficients low
Coefficients for T <= T_mid.
Real molar_mass
Molar mass [kg/mol].
Coefficients high
Coefficients for T > T_mid.