25 #ifndef GRINS_NASA_THERMO_TEST_BASE_H
26 #define GRINS_NASA_THERMO_TEST_BASE_H
28 #include "grins_config.h"
30 #ifdef GRINS_HAVE_CPPUNIT
32 #include <cppunit/extensions/HelperMacros.h>
44 virtual libMesh::Real
cp_exact(
unsigned int species_idx, libMesh::Real T ) = 0;
46 virtual libMesh::Real
h_exact(
unsigned int species_idx, libMesh::Real T ) = 0;
48 virtual libMesh::Real
s_R_exact(
unsigned int species_idx, libMesh::Real T ) = 0;
50 virtual libMesh::Real
h_RT_exact(
unsigned int species_idx, libMesh::Real T ) = 0;
52 template<
typename ThermoMixture,
typename ThermoEvaluator>
53 void test_cp_common( ThermoMixture& mixture,
const std::vector<libMesh::Real>& Y, libMesh::Real rel_tol )
57 ThermoEvaluator evaluator( mixture );
59 libMesh::Real R_mix = mixture.R_mix(Y);
60 libMesh::Real rho = 1.0e-3;
62 libMesh::Real T = 300;
65 libMesh::Real P = rho*R_mix*T;
67 libMesh::Real cp_mix_computed = evaluator.cp( T, P, Y );
73 libMesh::Real cp_mix_exact =
78 std::string message =
"T = "+ss.str();
82 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( message, cp_mix_exact, cp_mix_computed, tol );
88 template<
typename ThermoMixture,
typename ThermoEvaluator>
91 ThermoEvaluator evaluator( mixture );
95 libMesh::Real T = 300;
100 std::string message =
"T = "+ss.str();
109 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( message,
139 CPPUNIT_FAIL(
"Invalid idx for nasa_coeffs");
166 virtual libMesh::Real
cp_exact(
unsigned int species_idx, libMesh::Real T )
168 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
177 virtual libMesh::Real
h_exact(
unsigned int species_idx, libMesh::Real T )
179 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
186 coeffs[5])*this->
R_species(species_idx)*T;
189 virtual libMesh::Real
s_R_exact(
unsigned int species_idx, libMesh::Real T )
191 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
201 virtual libMesh::Real
h_RT_exact(
unsigned int species_idx, libMesh::Real T )
203 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
295 virtual libMesh::Real
cp_exact(
unsigned int species_idx, libMesh::Real T )
297 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
308 virtual libMesh::Real
h_exact(
unsigned int species_idx, libMesh::Real T )
310 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
319 coeffs[7])*this->
R_species(species_idx)*T;
322 virtual libMesh::Real
s_R_exact(
unsigned int species_idx, libMesh::Real T )
324 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
336 virtual libMesh::Real
h_RT_exact(
unsigned int species_idx, libMesh::Real T )
338 const std::vector<libMesh::Real> coeffs = this->
nasa_coeffs(species_idx);
431 #endif // GRINS_HAVE_CPPUNIT
433 #endif // GRINS_NASA_THERMO_TEST_BASE_H
const std::vector< libMesh::Real > & nasa_coeffs(unsigned int idx)
virtual libMesh::Real s_R_exact(unsigned int species_idx, libMesh::Real T)=0
virtual libMesh::Real cp_exact(unsigned int species_idx, libMesh::Real T)
std::vector< libMesh::Real > _NO_200_1000_coeffs
virtual libMesh::Real h_RT_exact(unsigned int species_idx, libMesh::Real T)
static libMesh::Real nasa7_cp_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4)
virtual libMesh::Real h_exact(unsigned int species_idx, libMesh::Real T)
static libMesh::Real nasa9_s_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a8)
std::vector< libMesh::Real > _N2_200_1000_coeffs
virtual libMesh::Real h_exact(unsigned int species_idx, libMesh::Real T)
std::vector< libMesh::Real > _N_200_1000_coeffs
static libMesh::Real nasa9_cp_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6)
static libMesh::Real nasa7_s_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a6)
virtual libMesh::Real cp_exact(unsigned int species_idx, libMesh::Real T)
virtual libMesh::Real h_RT_exact(unsigned int species_idx, libMesh::Real T)
static libMesh::Real abs_tol_from_rel_tol(libMesh::Real exact, libMesh::Real rel_tol)
Get absolute tolerance from input relative tol.
void test_h_common(ThermoMixture &mixture, libMesh::Real rel_tol)
virtual libMesh::Real h_RT_exact(unsigned int species_idx, libMesh::Real T)=0
virtual libMesh::Real h_exact(unsigned int species_idx, libMesh::Real T)=0
std::vector< libMesh::Real > _O2_200_1000_coeffs
virtual libMesh::Real cp_exact(unsigned int species_idx, libMesh::Real T)=0
static libMesh::Real nasa7_h_RT_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5)
std::vector< unsigned int > _active_species
virtual libMesh::Real s_R_exact(unsigned int species_idx, libMesh::Real T)
static libMesh::Real compute_mass_frac_mixture_prop(const std::vector< libMesh::Real > &properties, const std::vector< libMesh::Real > &mass_fracs)
virtual libMesh::Real s_R_exact(unsigned int species_idx, libMesh::Real T)
std::vector< libMesh::Real > _O_200_1000_coeffs
static libMesh::Real nasa9_h_RT_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a7)
libMesh::Real R_species(unsigned int idx)
void test_cp_common(ThermoMixture &mixture, const std::vector< libMesh::Real > &Y, libMesh::Real rel_tol)