GRINS-0.6.0
Functions
antioch_kinetic_rates.C File Reference
#include "grins_config.h"
#include <iomanip>
#include <vector>
#include <fstream>
#include "libmesh/getpot.h"
#include "grins/antioch_mixture.h"
#include "grins/antioch_kinetics.h"
Include dependency graph for antioch_kinetic_rates.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 43 of file antioch_kinetic_rates.C.

References GRINS::AntiochChemistry::n_species(), GRINS::AntiochKinetics::omega_dot(), GRINS::AntiochChemistry::R_mix(), and GRINS::AntiochChemistry::species_name().

44 {
45  // Check command line count.
46  if( argc < 2 )
47  {
48  // TODO: Need more consistent error handling.
49  std::cerr << "Error: Must specify input file." << std::endl;
50  exit(1);
51  }
52 
53  GetPot input( argv[1] );
54 
55  GRINS::AntiochMixture antioch_mixture(input);
56 
57  GRINS::AntiochKinetics antioch_kinetics( antioch_mixture );
58 
59  libMesh::Real T0 = input( "Conditions/T0", 300.0 );
60  libMesh::Real T1 = input( "Conditions/T1", 300.0 );
61  libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 );
62 
63 
64  libMesh::Real p0 = input( "Conditions/pressure", 1.0e5 );
65 
66  const unsigned int n_species = antioch_mixture.n_species();
67 
68  std::vector<libMesh::Real> Y(n_species);
69  if( input.vector_variable_size( "Conditions/mass_fractions" ) != n_species )
70  {
71  std::cerr << "Error: mass fractions size not consistent with n_species"
72  << std::endl;
73  libmesh_error();
74  }
75 
76  for( unsigned int s = 0; s < n_species; s++ )
77  {
78  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
79  }
80 
81  libMesh::Real R_mix = antioch_mixture.R_mix(Y);
82 
83 
84  std::vector<libMesh::Real> omega_dot(n_species,0.0);
85 
86  libMesh::Real T = T0;
87 
88  std::ofstream output;
89  output.open( "omega_dot.dat", std::ios::trunc );
90 
91  output << "# Species names" << std::endl;
92  for( unsigned int s = 0; s < n_species; s++ )
93  {
94  output << antioch_mixture.species_name( s ) << " ";
95  }
96  output << std::endl;
97  output << "# T [K] omega_dot [kg/m^3-s]" << std::endl;
98 
99  output.close();
100 
101  while( T < T1 )
102  {
103  Antioch::TempCache<libMesh::Real> T_cache(T);
104 
105  libMesh::Real rho = p0/(R_mix*T);
106 
107  antioch_kinetics.omega_dot( T_cache, rho, Y, omega_dot );
108 
109  output.open( "omega_dot.dat", std::ios::app );
110  output << T << " ";
111 
112  for( unsigned int i = 0; i < n_species; i++ )
113  {
114  output << std::scientific << std::setprecision(16)
115  << omega_dot[i] << " ";
116  }
117 
118  output << std::endl;
119 
120  output.close();
121 
122  T += T_inc;
123  }
124  return 0;
125 }
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:20 for GRINS-0.6.0 by  doxygen 1.8.9.1