GRINS-0.7.0
Functions
gas_solid_catalytic_wall.C File Reference
#include <iomanip>
#include "grins/math_constants.h"
#include "grins/gas_solid_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_solid_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 190 of file gas_solid_catalytic_wall.C.

191 {
192  if( argc != 3 )
193  {
194  std::cerr << "Error: must specify the test type (cantera or antioch) and the input file name"
195  << std::endl;
196  exit(1);
197  }
198 
199  std::string test_type = argv[1];
200 
201  GetPot input( argv[2] );
202 
203  int return_flag = 0;
204 
205  if( test_type == "cantera" )
206  {
207 #ifdef GRINS_HAVE_CANTERA
208  GRINS::CanteraMixture chem_mixture( input, "CanteraMaterial" );
209  return_flag = test<GRINS::CanteraMixture>( chem_mixture );
210 #else
211  return_flag = 77;
212 #endif
213  }
214  else if( test_type == "antioch" )
215  {
216 #ifdef GRINS_HAVE_ANTIOCH
217  GRINS::AntiochChemistry chem_mixture( input, "AntiochMaterial" );
218  return_flag = test<GRINS::AntiochChemistry>( chem_mixture );
219 #else
220  return_flag = 77;
221 #endif
222  }
223  else
224  {
225  std::cerr << "Invalid test type " << test_type << std::endl;
226  return_flag = 1;
227  }
228 
229  return return_flag;
230 }
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_solid_catalytic_wall.C.

References GRINS::GasSolidCatalyticWall< Chemistry >::compute_product_mass_flux(), GRINS::GasSolidCatalyticWall< Chemistry >::compute_reactant_gas_mass_flux(), GRINS::GasSolidCatalyticWall< Chemistry >::compute_reactant_solid_mass_consumption(), 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 C_index = chem_mixture.species_index("C");
46  const unsigned int CN_index = chem_mixture.species_index("CN");
47 
48  const double gamma = 0.03;
49 
50  GRINS::ConstantCatalycity gamma_r( gamma );
51 
52  GRINS::GasSolidCatalyticWall<ChemicalMixture> wall( chem_mixture, gamma_r, N_index, C_index, CN_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  const double mdot_C_exact = -omega_dot_exact*chem_mixture.M( chem_mixture.species_index("C") )/chem_mixture.M( chem_mixture.species_index("N") );
71 
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") );
73 
74  int return_flag = 0;
75 
76  const double omega_dot_N = wall.omega_dot( rho_s, T );
77 
78  const double domega_dot_dT_N = wall.domega_dot_dT( rho_s, T );
79 
80  const double domega_dot_dws_N = wall.domega_dot_dws( rho_s, w_s, T, R );
81 
82  const double mdot_N = wall.compute_reactant_gas_mass_flux( rho, w_s, T );
83 
84  const double mdot_C = wall.compute_reactant_solid_mass_consumption( rho, w_s, T );
85 
86  const double mdot_CN = wall.compute_product_mass_flux( rho, w_s, T );
87 
88  const double tol = 1.0e-15;
89 
90  /* omega_dot tests */
91  {
92  double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
93 
94  if( rel_error > tol )
95  {
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;
101 
102  return_flag = 1;
103  }
104  }
105 
106  /* domega_dot_dT tests */
107  {
108  double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
109 
110  if( rel_error > tol )
111  {
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;
117 
118  return_flag = 1;
119  }
120  }
121 
122  /* domega_dot_dws tests */
123  {
124  double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
125 
126  if( rel_error > tol )
127  {
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;
133 
134  return_flag = 1;
135  }
136  }
137 
138  /* mdot_N tests */
139  {
140  double rel_error = std::fabs( (mdot_N-(-omega_dot_exact))/(-omega_dot_exact) );
141 
142  if( rel_error > tol )
143  {
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;
149 
150  return_flag = 1;
151  }
152  }
153 
154  /* mdot_C tests */
155  {
156  double rel_error = std::fabs( (mdot_C - mdot_C_exact)/mdot_C_exact );
157 
158  if( rel_error > tol )
159  {
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;
165 
166  return_flag = 1;
167  }
168  }
169 
170  /* mdot_CN tests */
171  {
172  double rel_error = std::fabs( (mdot_CN - mdot_CN_exact)/mdot_CN_exact );
173 
174  if( rel_error > tol )
175  {
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;
181 
182  return_flag = 1;
183  }
184  }
185 
186  return return_flag;
187 }
const libMesh::Real two_pi

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