40 #include "libmesh/getpot.h"
42 template<
typename ChemicalMixture>
43 int test( ChemicalMixture& chem_mixture )
45 const unsigned int N_index = chem_mixture.species_index(
"N");
46 const unsigned int C_index = chem_mixture.species_index(
"C");
47 const unsigned int CN_index = chem_mixture.species_index(
"CN");
49 const double gamma = 0.03;
55 const double w_s = 0.2;
57 const double rho = 1.0e-3;
58 const double rho_s = rho*w_s;
60 const double T = 620.1;
61 const double R_N = chem_mixture.R( chem_mixture.species_index(
"N") );
63 const double R = 30.1;
67 const double drho_dws = -rho*rho_s/R;
68 const double domega_dot_dws_exact = drho_dws*w_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) )
69 + rho*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
71 const double mdot_C_exact = -omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"C") )/chem_mixture.M( chem_mixture.species_index(
"N") );
73 const double mdot_CN_exact = omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"CN") )/chem_mixture.M( chem_mixture.species_index(
"N") );
77 const double omega_dot_N = wall.
omega_dot( rho_s, T );
79 const double domega_dot_dT_N = wall.
domega_dot_dT( rho_s, T );
81 const double domega_dot_dws_N = wall.
domega_dot_dws( rho_s, w_s, T, R );
89 const double tol = 1.0e-15;
93 double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
97 std::cerr << std::setprecision(16) << std::scientific
98 <<
"Mismatch in omega_dot_N!" << std::endl
99 <<
"omega_dot_N = " << omega_dot_N << std::endl
100 <<
"omega_dot_exact = " << omega_dot_exact << std::endl
101 <<
"rel error = " << rel_error << std::endl;
109 double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
111 if( rel_error > tol )
113 std::cerr << std::setprecision(16) << std::scientific
114 <<
"Mismatch in domega_dot_dT_N!" << std::endl
115 <<
"domega_dot_dT_N = " << domega_dot_dT_N << std::endl
116 <<
"domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
117 <<
"rel error = " << rel_error << std::endl;
125 double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
127 if( rel_error > tol )
129 std::cerr << std::setprecision(16) << std::scientific
130 <<
"Mismatch in domega_dot_dws_N!" << std::endl
131 <<
"domega_dot_dws_N = " << domega_dot_dws_N << std::endl
132 <<
"domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
133 <<
"rel error = " << rel_error << std::endl;
141 double rel_error = std::fabs( (mdot_N-(-omega_dot_exact))/(-omega_dot_exact) );
143 if( rel_error > tol )
145 std::cerr << std::setprecision(16) << std::scientific
146 <<
"Mismatch in mdot_N!" << std::endl
147 <<
"mdot_N = " << mdot_N << std::endl
148 <<
"mdot_N_exact = " << -omega_dot_exact << std::endl
149 <<
"rel error = " << rel_error << std::endl;
157 double rel_error = std::fabs( (mdot_C - mdot_C_exact)/mdot_C_exact );
159 if( rel_error > tol )
161 std::cerr << std::setprecision(16) << std::scientific
162 <<
"Mismatch in mdot_C!" << std::endl
163 <<
"mdot_C = " << mdot_C << std::endl
164 <<
"mdot_C_exact = " << mdot_C_exact << std::endl
165 <<
"rel error = " << rel_error << std::endl;
173 double rel_error = std::fabs( (mdot_CN - mdot_CN_exact)/mdot_CN_exact );
175 if( rel_error > tol )
177 std::cerr << std::setprecision(16) << std::scientific
178 <<
"Mismatch in mdot_CN!" << std::endl
179 <<
"mdot_CN = " << mdot_CN << std::endl
180 <<
"mdot_CN_exact = " << mdot_CN_exact << std::endl
181 <<
"rel error = " << rel_error << std::endl;
191 int main(
int argc,
char* argv[])
195 std::cerr <<
"Error: must specify the test type (cantera or antioch) and the input file name"
200 std::string test_type = argv[1];
202 GetPot input( argv[2] );
208 if( test_type ==
"cantera" )
210 #ifdef GRINS_HAVE_CANTERA
211 libMesh::UniquePtr<GRINS::CanteraMixture> chem_uptr;
213 return_flag = test<GRINS::CanteraMixture>( *chem_uptr );
218 else if( test_type ==
"antioch" )
220 #ifdef GRINS_HAVE_ANTIOCH
221 libMesh::UniquePtr<GRINS::AntiochChemistry> chem_uptr;
223 return_flag = test<GRINS::AntiochChemistry>( *chem_uptr );
230 std::cerr <<
"Invalid test type " << test_type << std::endl;
libMesh::Real compute_reactant_gas_mass_flux(const libMesh::Real rho, const libMesh::Real Y_r, const libMesh::Real T)
int main(int argc, char *argv[])
int test(ChemicalMixture &chem_mixture)
libMesh::Real compute_reactant_solid_mass_consumption(const libMesh::Real rho, const libMesh::Real Y_r, const libMesh::Real T)
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
void build_chemistry(const GetPot &input, const std::string &material, libMesh::UniquePtr< ChemistryType > &chem_ptr)
const libMesh::Real two_pi
libMesh::Real compute_product_mass_flux(const libMesh::Real rho, const libMesh::Real Y_r, const libMesh::Real T)