GRINS-0.7.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
GRINSTesting::NASAThermoTestBase Class Referenceabstract

#include <nasa_thermo_test_base.h>

Inheritance diagram for GRINSTesting::NASAThermoTestBase:
Inheritance graph
[legend]
Collaboration diagram for GRINSTesting::NASAThermoTestBase:
Collaboration graph
[legend]

Public Member Functions

virtual libMesh::Real cp_exact (unsigned int species_idx, libMesh::Real T)=0
 
virtual libMesh::Real h_exact (unsigned int species_idx, libMesh::Real T)=0
 
virtual libMesh::Real s_R_exact (unsigned int species_idx, libMesh::Real T)=0
 
virtual libMesh::Real h_RT_exact (unsigned int species_idx, libMesh::Real T)=0
 
template<typename ThermoMixture , typename ThermoEvaluator >
void test_cp_common (ThermoMixture &mixture, const std::vector< libMesh::Real > &Y, libMesh::Real rel_tol)
 
template<typename ThermoMixture , typename ThermoEvaluator >
void test_h_common (ThermoMixture &mixture, libMesh::Real rel_tol)
 
- Public Member Functions inherited from GRINSTesting::SpeciesTestBase
 SpeciesTestBase ()
 
libMesh::Real molar_mass (unsigned int idx)
 
libMesh::Real R_species (unsigned int idx)
 

Protected Member Functions

const std::vector< libMesh::Real > & nasa_coeffs (unsigned int idx)
 

Protected Attributes

std::vector< libMesh::Real > _N2_200_1000_coeffs
 
std::vector< libMesh::Real > _O2_200_1000_coeffs
 
std::vector< libMesh::Real > _O_200_1000_coeffs
 
std::vector< libMesh::Real > _NO_200_1000_coeffs
 
std::vector< libMesh::Real > _N_200_1000_coeffs
 
- Protected Attributes inherited from GRINSTesting::SpeciesTestBase
unsigned int _N2_idx
 
unsigned int _O2_idx
 
unsigned int _O_idx
 
unsigned int _N_idx
 
unsigned int _NO_idx
 
std::vector< unsigned int > _active_species
 

Detailed Description

Definition at line 40 of file nasa_thermo_test_base.h.

Member Function Documentation

virtual libMesh::Real GRINSTesting::NASAThermoTestBase::cp_exact ( unsigned int  species_idx,
libMesh::Real  T 
)
pure virtual
virtual libMesh::Real GRINSTesting::NASAThermoTestBase::h_exact ( unsigned int  species_idx,
libMesh::Real  T 
)
pure virtual
virtual libMesh::Real GRINSTesting::NASAThermoTestBase::h_RT_exact ( unsigned int  species_idx,
libMesh::Real  T 
)
pure virtual
const std::vector<libMesh::Real>& GRINSTesting::NASAThermoTestBase::nasa_coeffs ( unsigned int  idx)
inlineprotected

Definition at line 121 of file nasa_thermo_test_base.h.

References _N2_200_1000_coeffs, GRINSTesting::SpeciesTestBase::_N2_idx, _N_200_1000_coeffs, GRINSTesting::SpeciesTestBase::_N_idx, _NO_200_1000_coeffs, GRINSTesting::SpeciesTestBase::_NO_idx, _O2_200_1000_coeffs, GRINSTesting::SpeciesTestBase::_O2_idx, _O_200_1000_coeffs, and GRINSTesting::SpeciesTestBase::_O_idx.

Referenced by GRINSTesting::NASA7ThermoTestBase::cp_exact(), GRINSTesting::NASA9ThermoTestBase::cp_exact(), GRINSTesting::NASA7ThermoTestBase::h_exact(), GRINSTesting::NASA9ThermoTestBase::h_exact(), GRINSTesting::NASA7ThermoTestBase::h_RT_exact(), GRINSTesting::NASA9ThermoTestBase::h_RT_exact(), GRINSTesting::NASA7ThermoTestBase::s_R_exact(), and GRINSTesting::NASA9ThermoTestBase::s_R_exact().

122  {
123  if(idx == _N2_idx)
124  return _N2_200_1000_coeffs;
125 
126  else if( idx == _O2_idx)
127  return _O2_200_1000_coeffs;
128 
129  else if( idx == _NO_idx)
130  return _NO_200_1000_coeffs;
131 
132  else if(idx == _O_idx)
133  return _O_200_1000_coeffs;
134 
135  else if(idx == _N_idx)
136  return _N_200_1000_coeffs;
137 
138  else
139  CPPUNIT_FAIL("Invalid idx for nasa_coeffs");
140 
141  // dummy to avoid warning
142  return _N2_200_1000_coeffs;
143  }
std::vector< libMesh::Real > _NO_200_1000_coeffs
std::vector< libMesh::Real > _N2_200_1000_coeffs
std::vector< libMesh::Real > _N_200_1000_coeffs
std::vector< libMesh::Real > _O2_200_1000_coeffs
std::vector< libMesh::Real > _O_200_1000_coeffs
virtual libMesh::Real GRINSTesting::NASAThermoTestBase::s_R_exact ( unsigned int  species_idx,
libMesh::Real  T 
)
pure virtual
template<typename ThermoMixture , typename ThermoEvaluator >
void GRINSTesting::NASAThermoTestBase::test_cp_common ( ThermoMixture &  mixture,
const std::vector< libMesh::Real > &  Y,
libMesh::Real  rel_tol 
)
inline

Definition at line 53 of file nasa_thermo_test_base.h.

References GRINSTesting::SpeciesTestBase::_active_species, GRINSTesting::TestingUtils::abs_tol_from_rel_tol(), GRINSTesting::ThermochemTestCommon::compute_mass_frac_mixture_prop(), and cp_exact().

54  {
55  CPPUNIT_ASSERT_EQUAL(_active_species.size(), Y.size() );
56 
57  ThermoEvaluator evaluator( mixture );
58 
59  libMesh::Real R_mix = mixture.R_mix(Y);
60  libMesh::Real rho = 1.0e-3;
61 
62  libMesh::Real T = 300;
63  while( T <= 1000 )
64  {
65  libMesh::Real P = rho*R_mix*T;
66 
67  libMesh::Real cp_mix_computed = evaluator.cp( T, P, Y );
68 
69  std::vector<libMesh::Real> species_cp(_active_species.size(),0.0);
70  for( unsigned int s = 0; s < _active_species.size(); s++ )
71  species_cp[s] = this->cp_exact(_active_species[s], T);
72 
73  libMesh::Real cp_mix_exact =
75 
76  std::stringstream ss;
77  ss << T;
78  std::string message = "T = "+ss.str();
79 
80  libMesh::Real tol = TestingUtils::abs_tol_from_rel_tol( cp_mix_exact, rel_tol );
81 
82  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( message, cp_mix_exact, cp_mix_computed, tol );
83 
84  T += 100.0;
85  }
86  }
static libMesh::Real abs_tol_from_rel_tol(libMesh::Real exact, libMesh::Real rel_tol)
Get absolute tolerance from input relative tol.
Definition: testing_utils.h:44
virtual libMesh::Real cp_exact(unsigned int species_idx, libMesh::Real T)=0
std::vector< unsigned int > _active_species
static libMesh::Real compute_mass_frac_mixture_prop(const std::vector< libMesh::Real > &properties, const std::vector< libMesh::Real > &mass_fracs)
template<typename ThermoMixture , typename ThermoEvaluator >
void GRINSTesting::NASAThermoTestBase::test_h_common ( ThermoMixture &  mixture,
libMesh::Real  rel_tol 
)
inline

Definition at line 89 of file nasa_thermo_test_base.h.

References GRINSTesting::SpeciesTestBase::_active_species, GRINSTesting::TestingUtils::abs_tol_from_rel_tol(), and h_exact().

90  {
91  ThermoEvaluator evaluator( mixture );
92 
93  libMesh::Real tol;
94 
95  libMesh::Real T = 300;
96  while( T <= 1000 )
97  {
98  std::stringstream ss;
99  ss << T;
100  std::string message = "T = "+ss.str();
101 
102  for( unsigned int s = 0; s < _active_species.size(); s++ )
103  {
104  libMesh::Real h_exact = this->h_exact(_active_species[s], T);
105 
106  libMesh::Real h_computed = evaluator.h_s( T, _active_species[s] );
107  tol = TestingUtils::abs_tol_from_rel_tol( h_exact, rel_tol );
108 
109  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( message,
110  h_exact,
111  h_computed,
112  tol );
113  }
114 
115  T += 100.0;
116  }
117  }
static libMesh::Real abs_tol_from_rel_tol(libMesh::Real exact, libMesh::Real rel_tol)
Get absolute tolerance from input relative tol.
Definition: testing_utils.h:44
virtual libMesh::Real h_exact(unsigned int species_idx, libMesh::Real T)=0
std::vector< unsigned int > _active_species

Member Data Documentation

std::vector<libMesh::Real> GRINSTesting::NASAThermoTestBase::_N2_200_1000_coeffs
protected
std::vector<libMesh::Real> GRINSTesting::NASAThermoTestBase::_N_200_1000_coeffs
protected
std::vector<libMesh::Real> GRINSTesting::NASAThermoTestBase::_NO_200_1000_coeffs
protected
std::vector<libMesh::Real> GRINSTesting::NASAThermoTestBase::_O2_200_1000_coeffs
protected
std::vector<libMesh::Real> GRINSTesting::NASAThermoTestBase::_O_200_1000_coeffs
protected

The documentation for this class was generated from the following file:

Generated on Thu Jun 2 2016 21:52:33 for GRINS-0.7.0 by  doxygen 1.8.10