GRINS-0.8.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 "grins/chemistry_builder.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 191 of file gas_solid_catalytic_wall.C.

References GRINS::ChemistryBuilder::build_chemistry().

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

44 {
45  const unsigned int N_index = chem_mixture.species_index("N");
46  const unsigned int C_index = chem_mixture.species_index("C");
47  const unsigned int CN_index = chem_mixture.species_index("CN");
48 
49  const double gamma = 0.03;
50 
51  GRINS::ConstantCatalycity gamma_r( gamma );
52 
53  GRINS::GasSolidCatalyticWall<ChemicalMixture> wall( chem_mixture, gamma_r, N_index, C_index, CN_index );
54 
55  const double w_s = 0.2;
56 
57  const double rho = 1.0e-3;
58  const double rho_s = rho*w_s;
59 
60  const double T = 620.1;
61  const double R_N = chem_mixture.R( chem_mixture.species_index("N") );
62 
63  const double R = 30.1;
64 
65  const double omega_dot_exact = rho_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
66  const double domega_dot_dT_exact = 0.5*rho_s*gamma*std::sqrt( R_N/(T*GRINS::Constants::two_pi) );
67  const double drho_dws = -rho*rho_s/R;
68  const double domega_dot_dws_exact = drho_dws*w_s*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) )
69  + rho*gamma*std::sqrt( R_N*T/(GRINS::Constants::two_pi) );
70 
71  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 
73  const double mdot_CN_exact = omega_dot_exact*chem_mixture.M( chem_mixture.species_index("CN") )/chem_mixture.M( chem_mixture.species_index("N") );
74 
75  int return_flag = 0;
76 
77  const double omega_dot_N = wall.omega_dot( rho_s, T );
78 
79  const double domega_dot_dT_N = wall.domega_dot_dT( rho_s, T );
80 
81  const double domega_dot_dws_N = wall.domega_dot_dws( rho_s, w_s, T, R );
82 
83  const double mdot_N = wall.compute_reactant_gas_mass_flux( rho, w_s, T );
84 
85  const double mdot_C = wall.compute_reactant_solid_mass_consumption( rho, w_s, T );
86 
87  const double mdot_CN = wall.compute_product_mass_flux( rho, w_s, T );
88 
89  const double tol = 1.0e-15;
90 
91  /* omega_dot tests */
92  {
93  double rel_error = std::fabs( (omega_dot_N - omega_dot_exact)/omega_dot_exact );
94 
95  if( rel_error > tol )
96  {
97  std::cerr << std::setprecision(16) << std::scientific
98  << "Mismatch in omega_dot_N!" << std::endl
99  << "omega_dot_N = " << omega_dot_N << std::endl
100  << "omega_dot_exact = " << omega_dot_exact << std::endl
101  << "rel error = " << rel_error << std::endl;
102 
103  return_flag = 1;
104  }
105  }
106 
107  /* domega_dot_dT tests */
108  {
109  double rel_error = std::fabs( (domega_dot_dT_N - domega_dot_dT_exact)/domega_dot_dT_exact );
110 
111  if( rel_error > tol )
112  {
113  std::cerr << std::setprecision(16) << std::scientific
114  << "Mismatch in domega_dot_dT_N!" << std::endl
115  << "domega_dot_dT_N = " << domega_dot_dT_N << std::endl
116  << "domega_dot_dT_exact = " << domega_dot_dT_exact << std::endl
117  << "rel error = " << rel_error << std::endl;
118 
119  return_flag = 1;
120  }
121  }
122 
123  /* domega_dot_dws tests */
124  {
125  double rel_error = std::fabs( (domega_dot_dws_N - domega_dot_dws_exact)/domega_dot_dws_exact );
126 
127  if( rel_error > tol )
128  {
129  std::cerr << std::setprecision(16) << std::scientific
130  << "Mismatch in domega_dot_dws_N!" << std::endl
131  << "domega_dot_dws_N = " << domega_dot_dws_N << std::endl
132  << "domega_dot_dws_exact = " << domega_dot_dws_exact << std::endl
133  << "rel error = " << rel_error << std::endl;
134 
135  return_flag = 1;
136  }
137  }
138 
139  /* mdot_N tests */
140  {
141  double rel_error = std::fabs( (mdot_N-(-omega_dot_exact))/(-omega_dot_exact) );
142 
143  if( rel_error > tol )
144  {
145  std::cerr << std::setprecision(16) << std::scientific
146  << "Mismatch in mdot_N!" << std::endl
147  << "mdot_N = " << mdot_N << std::endl
148  << "mdot_N_exact = " << -omega_dot_exact << std::endl
149  << "rel error = " << rel_error << std::endl;
150 
151  return_flag = 1;
152  }
153  }
154 
155  /* mdot_C tests */
156  {
157  double rel_error = std::fabs( (mdot_C - mdot_C_exact)/mdot_C_exact );
158 
159  if( rel_error > tol )
160  {
161  std::cerr << std::setprecision(16) << std::scientific
162  << "Mismatch in mdot_C!" << std::endl
163  << "mdot_C = " << mdot_C << std::endl
164  << "mdot_C_exact = " << mdot_C_exact << std::endl
165  << "rel error = " << rel_error << std::endl;
166 
167  return_flag = 1;
168  }
169  }
170 
171  /* mdot_CN tests */
172  {
173  double rel_error = std::fabs( (mdot_CN - mdot_CN_exact)/mdot_CN_exact );
174 
175  if( rel_error > tol )
176  {
177  std::cerr << std::setprecision(16) << std::scientific
178  << "Mismatch in mdot_CN!" << std::endl
179  << "mdot_CN = " << mdot_CN << std::endl
180  << "mdot_CN_exact = " << mdot_CN_exact << std::endl
181  << "rel error = " << rel_error << std::endl;
182 
183  return_flag = 1;
184  }
185  }
186 
187  return return_flag;
188 }
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