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

References GRINS::MaterialsParsing::material_name(), GRINS::AntiochChemistry::n_species(), GRINS::AntiochKinetics< KineticsThermoCurveFit >::omega_dot(), GRINS::AntiochChemistry::R_mix(), GRINS::PhysicsNaming::reacting_low_mach_navier_stokes(), and GRINS::AntiochChemistry::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 
59 
60  GRINS::AntiochKinetics<Antioch::CEACurveFit<libMesh::Real> > antioch_kinetics( antioch_mixture );
61 
62  libMesh::Real T0 = input( "Conditions/T0", 300.0 );
63  libMesh::Real T1 = input( "Conditions/T1", 300.0 );
64  libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 );
65 
66 
67  libMesh::Real p0 = input( "Conditions/pressure", 1.0e5 );
68 
69  const unsigned int n_species = antioch_mixture.n_species();
70 
71  std::vector<libMesh::Real> Y(n_species);
72  if( input.vector_variable_size( "Conditions/mass_fractions" ) != n_species )
73  {
74  std::cerr << "Error: mass fractions size not consistent with n_species"
75  << std::endl;
76  libmesh_error();
77  }
78 
79  for( unsigned int s = 0; s < n_species; s++ )
80  {
81  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
82  }
83 
84  libMesh::Real R_mix = antioch_mixture.R_mix(Y);
85 
86 
87  std::vector<libMesh::Real> omega_dot(n_species,0.0);
88 
89  libMesh::Real T = T0;
90 
91  std::ofstream output;
92  output.open( "omega_dot.dat", std::ios::trunc );
93 
94  output << "# Species names" << std::endl;
95  for( unsigned int s = 0; s < n_species; s++ )
96  {
97  output << antioch_mixture.species_name( s ) << " ";
98  }
99  output << std::endl;
100  output << "# T [K] omega_dot [kg/m^3-s]" << std::endl;
101 
102  output.close();
103 
104  while( T < T1 )
105  {
106  Antioch::TempCache<libMesh::Real> T_cache(T);
107 
108  libMesh::Real rho = p0/(R_mix*T);
109 
110  antioch_kinetics.omega_dot( T_cache, rho, Y, omega_dot );
111 
112  output.open( "omega_dot.dat", std::ios::app );
113  output << T << " ";
114 
115  for( unsigned int i = 0; i < n_species; i++ )
116  {
117  output << std::scientific << std::setprecision(16)
118  << omega_dot[i] << " ";
119  }
120 
121  output << std::endl;
122 
123  output.close();
124 
125  T += T_inc;
126  }
127  return 0;
128 }
Wrapper class for evaluating chemical kinetics using Antioch.
static PhysicsName reacting_low_mach_navier_stokes()
Wrapper class for storing state for Antioch thermo and kinetics.
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 Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1