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 C_index = chem_mixture.species_index(
"C");
 
   46   const unsigned int CN_index = chem_mixture.species_index(
"CN");
 
   48   const double gamma = 0.03;
 
   54   const double w_s = 0.2;
 
   56   const double rho = 1.0e-3;
 
   57   const double rho_s = rho*w_s;
 
   59   const double T = 620.1;
 
   60   const double R_N = chem_mixture.R( chem_mixture.species_index(
"N") );
 
   62   const double R = 30.1;
 
   66   const double drho_dws = -rho*rho_s/R;
 
   67   const double domega_dot_dws_exact = drho_dws*w_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) )
 
   68                                     + rho*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
 
   70   const double mdot_C_exact = -omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"C") )/chem_mixture.M( chem_mixture.species_index(
"N") );
 
   72   const double mdot_CN_exact = omega_dot_exact*chem_mixture.M( chem_mixture.species_index(
"CN") )/chem_mixture.M( chem_mixture.species_index(
"N") );
 
   76   const double omega_dot_N = wall.
omega_dot( rho_s, T );
 
   78   const double domega_dot_dT_N = wall.
domega_dot_dT( rho_s, T );
 
   80   const double domega_dot_dws_N = wall.
domega_dot_dws( rho_s, w_s, T, R );
 
   88   const double tol = 1.0e-15;
 
   92     double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
 
   96         std::cerr << std::setprecision(16) << std::scientific
 
   97                   << 
"Mismatch in omega_dot_N!" << std::endl
 
   98                   << 
"omega_dot_N = " << omega_dot_N << std::endl
 
   99                   << 
"omega_dot_exact = " << omega_dot_exact << std::endl
 
  100                   << 
"rel error = " << rel_error << std::endl;
 
  108     double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
 
  110     if( rel_error > tol )
 
  112         std::cerr << std::setprecision(16) << std::scientific
 
  113                   << 
"Mismatch in domega_dot_dT_N!" << std::endl
 
  114                   << 
"domega_dot_dT_N = " << domega_dot_dT_N << std::endl
 
  115                   << 
"domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
 
  116                   << 
"rel error = " << rel_error << std::endl;
 
  124     double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
 
  126     if( rel_error > tol )
 
  128         std::cerr << std::setprecision(16) << std::scientific
 
  129                   << 
"Mismatch in domega_dot_dws_N!" << std::endl
 
  130                   << 
"domega_dot_dws_N = " << domega_dot_dws_N << std::endl
 
  131                   << 
"domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
 
  132                   << 
"rel error = " << rel_error << std::endl;
 
  140     double rel_error = std::fabs( (mdot_N-(-omega_dot_exact))/(-omega_dot_exact) );
 
  142     if( rel_error > tol )
 
  144         std::cerr << std::setprecision(16) << std::scientific
 
  145                   << 
"Mismatch in mdot_N!" << std::endl
 
  146                   << 
"mdot_N = " << mdot_N << std::endl
 
  147                   << 
"mdot_N_exact = " << -omega_dot_exact << std::endl
 
  148                   << 
"rel error = " << rel_error << std::endl;
 
  156     double rel_error = std::fabs( (mdot_C - mdot_C_exact)/mdot_C_exact );
 
  158     if( rel_error > tol )
 
  160         std::cerr << std::setprecision(16) << std::scientific
 
  161                   << 
"Mismatch in mdot_C!" << std::endl
 
  162                   << 
"mdot_C = " << mdot_C << std::endl
 
  163                   << 
"mdot_C_exact = " << mdot_C_exact << std::endl
 
  164                   << 
"rel error = " << rel_error << std::endl;
 
  172     double rel_error = std::fabs( (mdot_CN - mdot_CN_exact)/mdot_CN_exact );
 
  174     if( rel_error > tol )
 
  176         std::cerr << std::setprecision(16) << std::scientific
 
  177                   << 
"Mismatch in mdot_CN!" << std::endl
 
  178                   << 
"mdot_CN = " << mdot_CN << std::endl
 
  179                   << 
"mdot_CN_exact = " << mdot_CN_exact << std::endl
 
  180                   << 
"rel error = " << rel_error << std::endl;
 
  190 int main(
int argc, 
char* argv[])
 
  194       std::cerr << 
"Error: must specify the test type (cantera or antioch) and the input file name" 
  199   std::string test_type = argv[1];
 
  201   GetPot input( argv[2] );
 
  205   if( test_type == 
"cantera" )
 
  207 #ifdef GRINS_HAVE_CANTERA 
  209       return_flag = test<GRINS::CanteraMixture>( chem_mixture );
 
  214   else if( test_type == 
"antioch" )
 
  216 #ifdef GRINS_HAVE_ANTIOCH 
  218       return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
 
  225       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. 
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 
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
const libMesh::Real two_pi
libMesh::Real compute_product_mass_flux(const libMesh::Real rho, const libMesh::Real Y_r, const libMesh::Real T)