GRINS-0.7.0
antioch_kinetic_rates.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 
26 // GRINS
27 #include "grins_config.h"
28 
29 #ifdef GRINS_HAVE_ANTIOCH
30 
31 // C++
32 #include <iomanip>
33 #include <vector>
34 #include <fstream>
35 
36 // libMesh
37 #include "libmesh/getpot.h"
38 
39 // GRINS
40 #include "grins/antioch_mixture.h"
41 #include "grins/antioch_kinetics.h"
43 #include "grins/physics_naming.h"
44 
45 int main(int argc, char* argv[])
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::AntiochKinetics antioch_kinetics( antioch_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 
66  libMesh::Real p0 = input( "Conditions/pressure", 1.0e5 );
67 
68  const unsigned int n_species = antioch_mixture.n_species();
69 
70  std::vector<libMesh::Real> Y(n_species);
71  if( input.vector_variable_size( "Conditions/mass_fractions" ) != n_species )
72  {
73  std::cerr << "Error: mass fractions size not consistent with n_species"
74  << std::endl;
75  libmesh_error();
76  }
77 
78  for( unsigned int s = 0; s < n_species; s++ )
79  {
80  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
81  }
82 
83  libMesh::Real R_mix = antioch_mixture.R_mix(Y);
84 
85 
86  std::vector<libMesh::Real> omega_dot(n_species,0.0);
87 
88  libMesh::Real T = T0;
89 
90  std::ofstream output;
91  output.open( "omega_dot.dat", std::ios::trunc );
92 
93  output << "# Species names" << std::endl;
94  for( unsigned int s = 0; s < n_species; s++ )
95  {
96  output << antioch_mixture.species_name( s ) << " ";
97  }
98  output << std::endl;
99  output << "# T [K] omega_dot [kg/m^3-s]" << std::endl;
100 
101  output.close();
102 
103  while( T < T1 )
104  {
105  Antioch::TempCache<libMesh::Real> T_cache(T);
106 
107  libMesh::Real rho = p0/(R_mix*T);
108 
109  antioch_kinetics.omega_dot( T_cache, rho, Y, omega_dot );
110 
111  output.open( "omega_dot.dat", std::ios::app );
112  output << T << " ";
113 
114  for( unsigned int i = 0; i < n_species; i++ )
115  {
116  output << std::scientific << std::setprecision(16)
117  << omega_dot[i] << " ";
118  }
119 
120  output << std::endl;
121 
122  output.close();
123 
124  T += T_inc;
125  }
126  return 0;
127 }
128 
129 #endif //GRINS_HAVE_ANTIOCH
unsigned int n_species() const
Wrapper class for evaluating chemical kinetics using Antioch.
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
Mixture gas constant, [J/kg-K].
static PhysicsName reacting_low_mach_navier_stokes()
std::string species_name(unsigned int species_index) const
void omega_dot(const libMesh::Real &T, const libMesh::Real rho, const std::vector< libMesh::Real > &mass_fractions, std::vector< libMesh::Real > &omega_dot)
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.
int main(int argc, char *argv[])

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