https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
NASA7PolynomialsTest.C File Reference

Go to the source code of this file.

Functions

 TEST (NASA7PolynomialsTest, canteraBelowMidpoint)
 
 TEST (NASA7PolynomialsTest, canteraAtMidpoint)
 
 TEST (NASA7PolynomialsTest, canteraAboveMidpoint)
 
 TEST (NASA7PolynomialsTest, molarMass)
 
 TEST (NASA7PolynomialsTest, consistentDerivatives)
 

Function Documentation

◆ TEST() [1/5]

TEST ( NASA7PolynomialsTest  ,
canteraAboveMidpoint   
)

Definition at line 72 of file NASA7PolynomialsTest.C.

73{
74 expectCanteraValues(1500.0,
75 {{{"H2", 3.8822959451999997, 2.9101473592241667, 21.51235276622741},
76 {"O2", 4.3989938846625, 3.2555381173887485, 31.039298778830236},
77 {"H2O", 5.687841430574999, -15.524086927924582, 30.14793701207187},
78 {"CH4", 10.874274296875003, 0.43494356952083546, 33.86860929626944},
79 {"CO", 4.234951016024999, -5.748131851494999, 29.878586100354962},
80 {"CO2", 7.023470866475001, -26.605086887146665, 35.14116319971301},
81 {"N2", 4.1861203930625, 3.079423123570834, 29.081165481314585}}});
82}

◆ TEST() [2/5]

TEST ( NASA7PolynomialsTest  ,
canteraAtMidpoint   
)

Definition at line 59 of file NASA7PolynomialsTest.C.

60{
61 // Cantera uses the low-temperature polynomial at the midpoint temperature itself
62 expectCanteraValues(1000.0,
63 {{{"H2", 3.6277926600000017, 2.4880181500000003, 19.99356155536211},
64 {"O2", 4.195457489999999, 2.7310016248333326, 29.296709192476225},
65 {"H2O", 4.9666161199999985, -25.957432841000003, 27.991587242388515},
66 {"CH4", 8.854050229999995, -4.323604100000004, 29.861079446444933},
67 {"CO", 3.9885755050000005, -10.6849246888, 28.209233158602412},
68 {"CO2", 6.533298272000001, -43.31136104626667, 32.38768755547865},
69 {"N2", 3.9403564, 2.5822312499999995, 27.43274636040696}}});
70}

◆ TEST() [3/5]

TEST ( NASA7PolynomialsTest  ,
canteraBelowMidpoint   
)

Definition at line 46 of file NASA7PolynomialsTest.C.

47{
48 // 923.15 K (650 C) is a typical operating temperature of solid oxide cells
49 expectCanteraValues(923.15,
50 {{{"H2", 3.613168165140949, 2.393557882983218, 19.70388492877914},
51 {"O2", 4.147314656442323, 2.611086604285082, 28.963169712215056},
52 {"H2O", 4.844876850286245, -28.52667487834571, 27.59941233403597},
53 {"CH4", 8.411873653444164, -5.402055033541204, 29.171138189568893},
54 {"CO", 3.9393320432028016, -11.904521875475112, 27.892178607608198},
55 {"CO2", 6.410478331025108, -47.455763652874914, 31.870172746438772},
56 {"N2", 3.883883836068483, 2.4714182404274005, 27.11985064871594}}});
57}

◆ TEST() [4/5]

TEST ( NASA7PolynomialsTest  ,
consistentDerivatives   
)

Definition at line 106 of file NASA7PolynomialsTest.C.

107{
108 // The enthalpy and entropy polynomials are integrals of the heat capacity polynomial:
109 // d(h/R)/dT = cp/R and d(s/R)/dT = cp/(R T). Check this with automatic differentiation on both
110 // sides of the midpoint temperature.
111 DNDerivativeType dTdT;
112 Moose::derivInsert(dTdT, 0, 1);
113
114 for (const std::string species :
115 {"H2", "O2", "H2O", "CH4", "CO", "CO2", "N2", "He", "Ar", "Kr", "Xe"})
116 for (const Real T_value : {600.0, 2000.0})
117 {
118 const auto & data = NASA7::speciesData(species);
119 const ADReal T(T_value, dTdT);
120
121 const Real cp_R = NASA7::cpOverR(data, T_value);
122 const ADReal h_R = T * NASA7::hOverRT(data, T);
123 const ADReal s_R = NASA7::sOverR(data, T);
124 EXPECT_NEAR(h_R.derivatives()[0], cp_R, tol * cp_R) << species << " at " << T_value;
125 EXPECT_NEAR(s_R.derivatives()[0], cp_R / T_value, tol * cp_R / T_value)
126 << species << " at " << T_value;
127 }
128}
DualNumber< Real, DNDerivativeType, true > ADReal
SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< MOOSE_AD_MAX_DOFS_PER_ELEM > > DNDerivativeType
const double tol
const double T
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
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.
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 ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ TEST() [5/5]

TEST ( NASA7PolynomialsTest  ,
molarMass   
)

Definition at line 84 of file NASA7PolynomialsTest.C.

85{
86 // Molecular weights reported by Cantera 3.2.0 for gri30.yaml and, for He, Kr, and Xe,
87 // nasa_gas.yaml [g/mol]
88 const std::array<std::pair<std::string, Real>, 11> molecular_weights = {{{"H2", 2.016},
89 {"O2", 31.998},
90 {"H2O", 18.015},
91 {"CH4", 16.043},
92 {"CO", 28.010},
93 {"CO2", 44.009},
94 {"N2", 28.014},
95 {"He", 4.002602},
96 {"Ar", 39.95},
97 {"Kr", 83.798},
98 {"Xe", 131.293}}};
99
100 // The tolerance [kg/mol] only absorbs roundoff in the conversion from g/mol; it is far below the
101 // 1e-6 kg/mol resolution of the reported values
102 for (const auto & [species, molecular_weight] : molecular_weights)
103 EXPECT_NEAR(NASA7::speciesData(species).molar_mass, 1e-3 * molecular_weight, 1e-15) << species;
104}
Standard-state thermodynamic properties of ideal-gas species from NASA 7-coefficient polynomials.