GRINS-0.6.0
Functions
cantera_kinetic_rates.C File Reference
#include "grins_config.h"
#include <fstream>
#include <iomanip>
#include "grins/cantera_mixture.h"
#include "grins/cantera_kinetics.h"
#include "libmesh/getpot.h"
#include "libmesh/libmesh_common.h"
Include dependency graph for cantera_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 cantera_kinetic_rates.C.

References GRINS::CanteraMixture::n_species(), GRINS::CanteraKinetics::omega_dot_TPY(), GRINS::CanteraMixture::R_mix(), and GRINS::CanteraMixture::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::CanteraMixture mixture( input );
56 
57  GRINS::CanteraKinetics kinetics( 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  libMesh::Real rho = input( "Conditions/density", 1.0e-3 );
64 
65  const unsigned int n_species = mixture.n_species();
66 
67  std::vector<double> Y(n_species,0.0);
68  for( unsigned int s = 0; s < n_species; s++ )
69  {
70  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
71  }
72 
73  libMesh::Real R_mix = mixture.R_mix(Y);
74 
75  std::vector<double> omega_dot(n_species,0.0);
76 
77  libMesh::Real T = T0;
78 
79  std::ofstream output;
80  output.open( "omega_dot.dat", std::ios::trunc );
81 
82  output << "# Species names" << std::endl;
83  for( unsigned int s = 0; s < n_species; s++ )
84  {
85  output << mixture.species_name( s ) << " ";
86  }
87  output << std::endl;
88  output << "# T [K] omega_dot [kg/m^3-s]" << std::endl;
89 
90  output.close();
91 
92  while( T < T1 )
93  {
94  libMesh::Real p = rho*R_mix*T;
95 
96  kinetics.omega_dot_TPY( T, p, Y, omega_dot );
97 
98  output.open( "omega_dot.dat", std::ios::app );
99  output << T << " ";
100 
101  for( unsigned int i = 0; i < n_species; i++ )
102  {
103  output << std::scientific << std::setprecision(16)
104  << omega_dot[i] << " ";
105  }
106 
107  output << std::endl;
108 
109  output.close();
110 
111  T += T_inc;
112  }
113 
114 
115  return 0;
116 }
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...

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