39 #include "libmesh/getpot.h"
41 template<
typename ChemicalMixture>
42 int test( ChemicalMixture& chem_mixture )
44 const unsigned int N_index = chem_mixture.species_index(
"N");
45 const unsigned int N2_index = chem_mixture.species_index(
"N2");
47 const double gamma = 0.03;
53 const double w_s = 0.2;
55 const double rho = 1.0e-3;
56 const double rho_s = rho*w_s;
58 const double T = 620.1;
59 const double R_N = chem_mixture.R( chem_mixture.species_index(
"N") );
61 const double R = 30.1;
65 const double drho_dws = -rho*rho_s/R;
66 const double domega_dot_dws_exact = drho_dws*w_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) )
67 + rho*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
71 const double omega_dot_N = wall_N.
omega_dot( rho_s, T );
73 const double domega_dot_dT_N = wall_N.
domega_dot_dT( rho_s, T );
75 const double domega_dot_dws_N = wall_N.
domega_dot_dws( rho_s, w_s, T, R );
77 const double tol = 1.0e-15;
81 double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
85 std::cerr << std::setprecision(16) << std::scientific
86 <<
"Mismatch in omega_dot_N!" << std::endl
87 <<
"omega_dot_N = " << omega_dot_N << std::endl
88 <<
"omega_dot_exact = " << omega_dot_exact << std::endl
89 <<
"rel error = " << rel_error << std::endl;
97 double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
101 std::cerr << std::setprecision(16) << std::scientific
102 <<
"Mismatch in domega_dot_dT_N!" << std::endl
103 <<
"domega_dot_dT_N = " << domega_dot_dT_N << std::endl
104 <<
"domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
105 <<
"rel error = " << rel_error << std::endl;
113 double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
115 if( rel_error > tol )
117 std::cerr << std::setprecision(16) << std::scientific
118 <<
"Mismatch in domega_dot_dws_N!" << std::endl
119 <<
"domega_dot_dws_N = " << domega_dot_dws_N << std::endl
120 <<
"domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
121 <<
"rel error = " << rel_error << std::endl;
131 int main(
int argc,
char* argv[])
135 std::cerr <<
"Error: must specify the test type (cantera or antioch) and the input file name"
140 std::string test_type = argv[1];
142 GetPot input( argv[2] );
146 if( test_type ==
"cantera" )
148 #ifdef GRINS_HAVE_CANTERA
150 return_flag = test<GRINS::CanteraMixture>( chem_mixture );
155 else if( test_type ==
"antioch" )
157 #ifdef GRINS_HAVE_ANTIOCH
159 return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
166 std::cerr <<
"Invalid test type " << test_type << std::endl;
Wrapper class for Antioch::ChemicalMixture.
int test(ChemicalMixture &chem_mixture)
libMesh::Real domega_dot_dT(const libMesh::Real rho_s, const libMesh::Real T) const
libMesh::Real omega_dot(const libMesh::Real rho_s, const libMesh::Real T) const
libMesh::Real domega_dot_dws(const libMesh::Real rho_s, const libMesh::Real w_s, const libMesh::Real T, const libMesh::Real R) const
int main(int argc, char *argv[])
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
const libMesh::Real two_pi