GRINS-0.8.0
Functions
gas_recombination_catalytic_wall.C File Reference
#include <iomanip>
#include "grins/math_constants.h"
#include "grins/gas_recombination_catalytic_wall.h"
#include "grins/constant_catalycity.h"
#include "grins/cantera_mixture.h"
#include "grins/antioch_chemistry.h"
#include "grins/materials_parsing.h"
#include "grins/physics_naming.h"
#include "grins/chemistry_builder.h"
#include "libmesh/getpot.h"
Include dependency graph for gas_recombination_catalytic_wall.C:

Go to the source code of this file.

Functions

template<typename ChemicalMixture >
int test (ChemicalMixture &chem_mixture)
 
int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 132 of file gas_recombination_catalytic_wall.C.

References GRINS::ChemistryBuilder::build_chemistry().

133 {
134  if( argc != 3 )
135  {
136  std::cerr << "Error: must specify the test type (cantera or antioch) and the input file name"
137  << std::endl;
138  exit(1);
139  }
140 
141  std::string test_type = argv[1];
142 
143  GetPot input( argv[2] );
144 
145  int return_flag = 0;
146 
147  GRINS::ChemistryBuilder chem_builder;
148 
149  if( test_type == "cantera" )
150  {
151 #ifdef GRINS_HAVE_CANTERA
152  libMesh::UniquePtr<GRINS::CanteraMixture> chem_uptr;
153  chem_builder.build_chemistry(input,"TestMaterial",chem_uptr);
154  return_flag = test<GRINS::CanteraMixture>( *chem_uptr );
155 #else
156  return_flag = 77;
157 #endif
158  }
159  else if( test_type == "antioch" )
160  {
161 #ifdef GRINS_HAVE_ANTIOCH
162  libMesh::UniquePtr<GRINS::AntiochChemistry> chem_uptr;
163  chem_builder.build_chemistry(input,"TestMaterial",chem_uptr);
164  return_flag = test<GRINS::AntiochChemistry>( *chem_uptr );
165 #else
166  return_flag = 77;
167 #endif
168  }
169  else
170  {
171  std::cerr << "Invalid test type " << test_type << std::endl;
172  return_flag = 1;
173  }
174 
175  return return_flag;
176 }
void build_chemistry(const GetPot &input, const std::string &material, libMesh::UniquePtr< ChemistryType > &chem_ptr)
template<typename ChemicalMixture >
int test ( ChemicalMixture &  chem_mixture)

Definition at line 43 of file gas_recombination_catalytic_wall.C.

References GRINS::CatalyticWallBase< Chemistry >::domega_dot_dT(), GRINS::CatalyticWallBase< Chemistry >::domega_dot_dws(), GRINS::CatalyticWallBase< Chemistry >::omega_dot(), and GRINS::Constants::two_pi.

44 {
45  const unsigned int N_index = chem_mixture.species_index("N");
46  const unsigned int N2_index = chem_mixture.species_index("N2");
47 
48  const double gamma = 0.03;
49 
50  GRINS::ConstantCatalycity gamma_r( gamma );
51 
52  GRINS::GasRecombinationCatalyticWall<ChemicalMixture> wall_N( chem_mixture, gamma_r, N_index, N2_index );
53 
54  const double w_s = 0.2;
55 
56  const double rho = 1.0e-3;
57  const double rho_s = rho*w_s;
58 
59  const double T = 620.1;
60  const double R_N = chem_mixture.R( chem_mixture.species_index("N") );
61 
62  const double R = 30.1;
63 
64  const double omega_dot_exact = rho_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
65  const double domega_dot_dT_exact = 0.5*rho_s*gamma*std::sqrt( R_N/(T*GRINS::Constants::two_pi) );
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) );
69 
70  int return_flag = 0;
71 
72  const double omega_dot_N = wall_N.omega_dot( rho_s, T );
73 
74  const double domega_dot_dT_N = wall_N.domega_dot_dT( rho_s, T );
75 
76  const double domega_dot_dws_N = wall_N.domega_dot_dws( rho_s, w_s, T, R );
77 
78  const double tol = 1.0e-15;
79 
80  /* omega_dot tests */
81  {
82  double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
83 
84  if( rel_error > tol )
85  {
86  std::cerr << std::setprecision(16) << std::scientific
87  << "Mismatch in omega_dot_N!" << std::endl
88  << "omega_dot_N = " << omega_dot_N << std::endl
89  << "omega_dot_exact = " << omega_dot_exact << std::endl
90  << "rel error = " << rel_error << std::endl;
91 
92  return_flag = 1;
93  }
94  }
95 
96  /* domega_dot_dT tests */
97  {
98  double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
99 
100  if( rel_error > tol )
101  {
102  std::cerr << std::setprecision(16) << std::scientific
103  << "Mismatch in domega_dot_dT_N!" << std::endl
104  << "domega_dot_dT_N = " << domega_dot_dT_N << std::endl
105  << "domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
106  << "rel error = " << rel_error << std::endl;
107 
108  return_flag = 1;
109  }
110  }
111 
112  /* domega_dot_dws tests */
113  {
114  double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
115 
116  if( rel_error > tol )
117  {
118  std::cerr << std::setprecision(16) << std::scientific
119  << "Mismatch in domega_dot_dws_N!" << std::endl
120  << "domega_dot_dws_N = " << domega_dot_dws_N << std::endl
121  << "domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
122  << "rel error = " << rel_error << std::endl;
123 
124  return_flag = 1;
125  }
126  }
127 
128  return return_flag;
129 }
const libMesh::Real two_pi

Generated on Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1