GRINS-0.6.0
Functions
antioch_kinetics_regression.C File Reference
#include "grins_config.h"
#include <iomanip>
#include <limits>
#include <vector>
#include "grins/antioch_mixture.h"
#include "grins/antioch_kinetics.h"
#include "libmesh/getpot.h"
Include dependency graph for antioch_kinetics_regression.C:

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 40 of file antioch_kinetics_regression.C.

References GRINS::AntiochKinetics::omega_dot().

41 {
42 #ifdef GRINS_HAVE_ANTIOCH
43  // Check command line count.
44  if( argc < 2 )
45  {
46  // TODO: Need more consistent error handling.
47  std::cerr << "Error: Must specify input file." << std::endl;
48  exit(1);
49  }
50 
51  GetPot input( argv[1] );
52 
53  GRINS::AntiochMixture antioch_mixture(input);
54 
55  GRINS::AntiochKinetics antioch_kinetics( antioch_mixture );
56 
57  libMesh::Real T = 1000;
58 
59  Antioch::TempCache<libMesh::Real> T_cache(T);
60 
61  libMesh::Real rho = 1.0e-3;
62 
63  const unsigned int n_species = 5;
64 
65  std::vector<libMesh::Real> Y(n_species,0.2);
66 
67  std::vector<libMesh::Real> omega_dot(n_species,0.0);
68 
69  antioch_kinetics.omega_dot( T_cache, rho, Y, omega_dot );
70 
71  for( unsigned int i = 0; i < n_species; i++ )
72  {
73  std::cout << std::scientific << std::setprecision(16)
74  << "omega_dot(" << i << ") = " << omega_dot[i] << std::endl;
75  }
76 
77  int return_flag = 0;
78  double tol = std::numeric_limits<double>::epsilon()*40;
79 
80  // Check that omega_dot sums to 1
81  libMesh::Real sum = 0.0;
82  for( unsigned int s = 0; s < n_species; s++ )
83  {
84  sum += omega_dot[s];
85  }
86 
87  if( std::fabs(sum) > tol )
88  {
89  std::cout << "Error: Sum of mass sources not equal to zero!" << std::endl
90  << "sum = " << sum << std::endl;
91  return_flag = 1;
92  }
93 
94  // Now check against regression values
95  std::vector<libMesh::Real> omega_dot_reg(n_species,0.0);
96  omega_dot_reg[0] = 4.3561014567820650e-01;
97  omega_dot_reg[1] = -3.6797207156306633e+00;
98  omega_dot_reg[2] = 2.9970582875850726e+00;
99  omega_dot_reg[3] = -1.8346634812051223e+00;
100  omega_dot_reg[4] = 2.0817157635725065e+00;
101 
102  for( unsigned int s = 0; s < n_species; s++ )
103  {
104  if( std::fabs( (omega_dot[s] - omega_dot_reg[s])/omega_dot_reg[s] ) > tol )
105  {
106  std::cerr << "Error: Mismatch in omega_dot." << std::endl
107  << std::setprecision(16) << std::scientific
108  << "s = " << s << std::endl
109  << "omega_dot = " << omega_dot[s] << std::endl
110  << "omega_dot_reg = " << omega_dot_reg[s] << std::endl;
111  return_flag = 1;
112  }
113  }
114 
115 #else //GRINS_HAVE_ANTIOCH
116  // automake expects 77 for a skipped test
117  int return_flag = 77;
118 #endif
119 
120  return return_flag;
121 }
Wrapper class for evaluating chemical kinetics using Antioch.
Wrapper class for storing state for Antioch thermo and kinetics.

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