GRINS-0.7.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 "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 131 of file gas_recombination_catalytic_wall.C.

132 {
133  if( argc != 3 )
134  {
135  std::cerr << "Error: must specify the test type (cantera or antioch) and the input file name"
136  << std::endl;
137  exit(1);
138  }
139 
140  std::string test_type = argv[1];
141 
142  GetPot input( argv[2] );
143 
144  int return_flag = 0;
145 
146  if( test_type == "cantera" )
147  {
148 #ifdef GRINS_HAVE_CANTERA
149  GRINS::CanteraMixture chem_mixture( input, "TestMaterial" );
150  return_flag = test<GRINS::CanteraMixture>( chem_mixture );
151 #else
152  return_flag = 77;
153 #endif
154  }
155  else if( test_type == "antioch" )
156  {
157 #ifdef GRINS_HAVE_ANTIOCH
158  GRINS::AntiochChemistry chem_mixture( input, "TestMaterial" );
159  return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
160 #else
161  return_flag = 77;
162 #endif
163  }
164  else
165  {
166  std::cerr << "Invalid test type " << test_type << std::endl;
167  return_flag = 1;
168  }
169 
170  return return_flag;
171 }
Wrapper class for Antioch::ChemicalMixture.
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
template<typename ChemicalMixture >
int test ( ChemicalMixture &  chem_mixture)

Definition at line 42 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.

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

Generated on Thu Jun 2 2016 21:52:29 for GRINS-0.7.0 by  doxygen 1.8.10