37 #include "libmesh/getpot.h"
39 template<
typename ChemicalMixture>
40 int test( ChemicalMixture& chem_mixture )
42 const unsigned int N_index = chem_mixture.species_index(
"N");
43 const unsigned int C_index = chem_mixture.species_index(
"C");
44 const unsigned int CN_index = chem_mixture.species_index(
"CN");
46 const double gamma = 0.03;
52 const double w_s = 0.2;
54 const double rho = 1.0e-3;
55 const double rho_s = rho*w_s;
57 const double T = 620.1;
58 const double R_N = chem_mixture.R( chem_mixture.species_index(
"N") );
60 const double R = 30.1;
64 const double drho_dws = -rho*rho_s/R;
65 const double domega_dot_dws_exact = drho_dws*w_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) )
66 + rho*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
68 const double mdot_C_exact = -omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"C") )/chem_mixture.M( chem_mixture.species_index(
"N") );
70 const double mdot_CN_exact = omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"CN") )/chem_mixture.M( chem_mixture.species_index(
"N") );
74 const double omega_dot_N = wall.
omega_dot( rho_s, T );
76 const double domega_dot_dT_N = wall.
domega_dot_dT( rho_s, T );
78 const double domega_dot_dws_N = wall.
domega_dot_dws( rho_s, w_s, T, R );
86 const double tol = 1.0e-15;
90 double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
94 std::cerr << std::setprecision(16) << std::scientific
95 <<
"Mismatch in omega_dot_N!" << std::endl
96 <<
"omega_dot_N = " << omega_dot_N << std::endl
97 <<
"omega_dot_exact = " << omega_dot_exact << std::endl
98 <<
"rel error = " << rel_error << std::endl;
106 double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
108 if( rel_error > tol )
110 std::cerr << std::setprecision(16) << std::scientific
111 <<
"Mismatch in domega_dot_dT_N!" << std::endl
112 <<
"domega_dot_dT_N = " << domega_dot_dT_N << std::endl
113 <<
"domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
114 <<
"rel error = " << rel_error << std::endl;
122 double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
124 if( rel_error > tol )
126 std::cerr << std::setprecision(16) << std::scientific
127 <<
"Mismatch in domega_dot_dws_N!" << std::endl
128 <<
"domega_dot_dws_N = " << domega_dot_dws_N << std::endl
129 <<
"domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
130 <<
"rel error = " << rel_error << std::endl;
138 double rel_error = std::fabs( (mdot_N-(-omega_dot_exact))/(-omega_dot_exact) );
140 if( rel_error > tol )
142 std::cerr << std::setprecision(16) << std::scientific
143 <<
"Mismatch in mdot_N!" << std::endl
144 <<
"mdot_N = " << mdot_N << std::endl
145 <<
"mdot_N_exact = " << -omega_dot_exact << std::endl
146 <<
"rel error = " << rel_error << std::endl;
154 double rel_error = std::fabs( (mdot_C - mdot_C_exact)/mdot_C_exact );
156 if( rel_error > tol )
158 std::cerr << std::setprecision(16) << std::scientific
159 <<
"Mismatch in mdot_C!" << std::endl
160 <<
"mdot_C = " << mdot_C << std::endl
161 <<
"mdot_C_exact = " << mdot_C_exact << std::endl
162 <<
"rel error = " << rel_error << std::endl;
170 double rel_error = std::fabs( (mdot_CN - mdot_CN_exact)/mdot_CN_exact );
172 if( rel_error > tol )
174 std::cerr << std::setprecision(16) << std::scientific
175 <<
"Mismatch in mdot_CN!" << std::endl
176 <<
"mdot_CN = " << mdot_CN << std::endl
177 <<
"mdot_CN_exact = " << mdot_CN_exact << std::endl
178 <<
"rel error = " << rel_error << std::endl;
188 int main(
int argc,
char* argv[])
192 std::cerr <<
"Error: must specify the test type (cantera or antioch) and the input file name"
197 std::string test_type = argv[1];
199 GetPot input( argv[2] );
203 if( test_type ==
"cantera" )
205 #ifdef GRINS_HAVE_CANTERA
207 return_flag = test<GRINS::CanteraMixture>( chem_mixture );
212 else if( test_type ==
"antioch" )
214 #ifdef GRINS_HAVE_ANTIOCH
216 return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
223 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)
Wrapper class for Antioch::ChemicalMixture.
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
int main(int argc, char *argv[])
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
const libMesh::Real two_pi
int test(ChemicalMixture &chem_mixture)
libMesh::Real compute_product_mass_flux(const libMesh::Real rho, const libMesh::Real Y_r, const libMesh::Real T)