GRINS-0.6.0
Functions
gas_recombination_catalytic_wall_unit.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 "libmesh/getpot.h"
Include dependency graph for gas_recombination_catalytic_wall_unit.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 129 of file gas_recombination_catalytic_wall_unit.C.

130 {
131  if( argc != 3 )
132  {
133  std::cerr << "Error: must specify the test type (cantera or antioch) and the input file name"
134  << std::endl;
135  exit(1);
136  }
137 
138  std::string test_type = argv[1];
139 
140  GetPot input( argv[2] );
141 
142  int return_flag = 0;
143 
144  if( test_type == "cantera" )
145  {
146 #ifdef GRINS_HAVE_CANTERA
147  GRINS::CanteraMixture chem_mixture( input );
148  return_flag = test<GRINS::CanteraMixture>( chem_mixture );
149 #else
150  return_flag = 77;
151 #endif
152  }
153  else if( test_type == "antioch" )
154  {
155 #ifdef GRINS_HAVE_ANTIOCH
156  GRINS::AntiochChemistry chem_mixture( input );
157  return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
158 #else
159  return_flag = 77;
160 #endif
161  }
162  else
163  {
164  std::cerr << "Invalid test type " << test_type << std::endl;
165  return_flag = 1;
166  }
167 
168  return return_flag;
169 }
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 40 of file gas_recombination_catalytic_wall_unit.C.

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

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

Generated on Mon Jun 22 2015 21:32:21 for GRINS-0.6.0 by  doxygen 1.8.9.1