GRINS-0.7.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 "grins/materials_parsing.h"
#include "grins/physics_naming.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 45 of file cantera_kinetic_rates.C.

References GRINS::MaterialsParsing::material_name(), GRINS::CanteraMixture::n_species(), GRINS::CanteraKinetics::omega_dot(), GRINS::CanteraMixture::R_mix(), GRINS::PhysicsNaming::reacting_low_mach_navier_stokes(), and GRINS::CanteraMixture::species_name().

46 {
47  // Check command line count.
48  if( argc < 2 )
49  {
50  // TODO: Need more consistent error handling.
51  std::cerr << "Error: Must specify input file." << std::endl;
52  exit(1);
53  }
54 
55  GetPot input( argv[1] );
56 
58 
59  GRINS::CanteraKinetics kinetics( mixture );
60 
61  libMesh::Real T0 = input( "Conditions/T0", 300.0 );
62  libMesh::Real T1 = input( "Conditions/T1", 300.0 );
63  libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 );
64 
65  libMesh::Real rho = input( "Conditions/density", 1.0e-3 );
66 
67  const unsigned int n_species = mixture.n_species();
68 
69  std::vector<double> Y(n_species,0.0);
70  for( unsigned int s = 0; s < n_species; s++ )
71  {
72  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
73  }
74 
75  libMesh::Real R_mix = mixture.R_mix(Y);
76 
77  std::vector<double> omega_dot(n_species,0.0);
78 
79  libMesh::Real T = T0;
80 
81  std::ofstream output;
82  output.open( "omega_dot.dat", std::ios::trunc );
83 
84  output << "# Species names" << std::endl;
85  for( unsigned int s = 0; s < n_species; s++ )
86  {
87  output << mixture.species_name( s ) << " ";
88  }
89  output << std::endl;
90  output << "# T [K] omega_dot [kg/m^3-s]" << std::endl;
91 
92  output.close();
93 
94  while( T < T1 )
95  {
96  kinetics.omega_dot( T, rho, 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 }
static PhysicsName reacting_low_mach_navier_stokes()
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
static std::string material_name(const GetPot &input, const std::string &physics)
Get the name of the material in the Physics/physics section.

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