GRINS-0.8.0
antioch_transport_values.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 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
42 #include "grins/physics_naming.h"
43 
44 template<typename KineticsThermo, typename Thermo, typename Viscosity, typename Conductivity, typename Diffusivity>
45 int do_transport_eval( const GetPot& input )
46 {
48 
50 
51  libMesh::Real T0 = input( "Conditions/T0", 300.0 );
52  libMesh::Real T1 = input( "Conditions/T1", 300.0 );
53  libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 );
54 
55  libMesh::Real rho = input( "Conditions/density", 1.0e-3 );
56 
57  const unsigned int n_species = mixture.n_species();
58 
59  std::vector<libMesh::Real> Y(n_species);
60  if( input.vector_variable_size( "Conditions/mass_fractions" ) != n_species )
61  {
62  std::cerr << "Error: mass fractions size not consistent with n_species"
63  << std::endl;
64  libmesh_error();
65  }
66 
67  for( unsigned int s = 0; s < n_species; s++ )
68  {
69  Y[s] = input( "Conditions/mass_fractions", 0.0, s );
70  }
71 
72  libMesh::Real T = T0;
73 
74  libMesh::Real p0 = rho*T*evaluator.R_mix(Y);
75 
76  std::ofstream output;
77  output.open( "transport.dat", std::ios::trunc );
78 
79  output << "# Species names" << std::endl;
80  for( unsigned int s = 0; s < n_species; s++ )
81  {
82  output << mixture.species_name( s ) << " ";
83  }
84  output << std::endl;
85  output << "# T [K] mu k D[s]" << std::endl;
86 
87  output.close();
88 
89  while( T < T1 )
90  {
91  output.open( "transport.dat", std::ios::app );
92  output << std::scientific << std::setprecision(16);
93  output << T << " ";
94 
95  libMesh::Real mu;
96  libMesh::Real k;
97  std::vector<libMesh::Real> D(n_species);
98  evaluator.mu_and_k_and_D( T, rho, evaluator.cp(T,p0,Y), Y, mu, k, D );
99 
100  output << mu << " ";
101  output << k << " ";
102 
103  for( unsigned int s = 0; s< n_species; s++ )
104  {
105  output << D[s] << " ";
106  }
107  output << std::endl;
108  output.close();
109 
110  T += T_inc;
111  }
112 
113  return 0;
114 }
115 
116 int main(int argc, char* argv[])
117 {
118  // Check command line count.
119  if( argc < 2 )
120  {
121  // TODO: Need more consistent error handling.
122  std::cerr << "Error: Must specify input file." << std::endl;
123  exit(1);
124  }
125 
126  GetPot input( argv[1] );
127 
128  std::string mixing_model = input( "Physics/Antioch/mixing_model", "wilke");
129  std::string thermo_model = input( "Physics/Antioch/thermo_model", "stat_mech");
130  std::string viscosity_model = input( "Physics/Antioch/viscosity_model", "sutherland");
131  std::string conductivity_model = input( "Physics/Antioch/conductivity_model", "eucken");
132  std::string diffusivity_model = input( "Physics/Antioch/diffusivity_model", "constant_lewis");
133  std::string kinetics_thermo_model = input( "Physics/Antioch/kinetics_thermo_model", "cea");
134 
135  int return_flag = 0;
136 
137  if( mixing_model == std::string("wilke") )
138  {
139  if( kinetics_thermo_model == std::string("cea") )
140  {
141  if( thermo_model == std::string("stat_mech") )
142  {
143  if( diffusivity_model == std::string("constant_lewis") )
144  {
145  if( conductivity_model == std::string("eucken") )
146  {
147  if( viscosity_model == std::string("sutherland") )
148  {
149  return_flag = do_transport_eval<Antioch::CEACurveFit<libMesh::Real>,
150  Antioch::StatMechThermodynamics<libMesh::Real>,
151  Antioch::SutherlandViscosity<libMesh::Real>,
152  Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> >,
153  Antioch::ConstantLewisDiffusivity<libMesh::Real> >(input);
154  }
155  else if( viscosity_model == std::string("blottner") )
156  {
157  return_flag = do_transport_eval<Antioch::CEACurveFit<libMesh::Real>,
158  Antioch::StatMechThermodynamics<libMesh::Real>,
159  Antioch::BlottnerViscosity<libMesh::Real>,
160  Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> >,
161  Antioch::ConstantLewisDiffusivity<libMesh::Real> >(input);
162  }
163  else
164  {
165  std::cerr << "Error: Unknown viscosity_model "
166  << viscosity_model << "!" << std::endl;
167  return_flag = 1;
168  }
169  }
170  else
171  {
172  std::cerr << "Error: Unknown conductivity_model "
173  << conductivity_model << "!" << std::endl;
174  return_flag = 1;
175  }
176  }
177  else
178  {
179  std::cerr << "Error: Unknown diffusivity_model "
180  << diffusivity_model << "!" << std::endl;
181  return_flag = 1;
182  }
183  }
184  else
185  {
186  std::cerr << "Error: Unknown thermo_model "
187  << thermo_model << "!" << std::endl;
188  return_flag = 1;
189  }
190  }
191  else
192  {
193  std::cerr << "Error: Unknown kinetics_thermo_model "
194  << thermo_model << "!" << std::endl;
195  return_flag = 1;
196  }
197  }
198  else
199  {
200  std::cerr << "Error: Unknown mixing_model "
201  << mixing_model << "!" << std::endl;
202  return_flag = 1;
203  }
204 
205  return return_flag;
206 }
207 
208 #endif //GRINS_HAVE_ANTIOCH
unsigned int n_species() const
static PhysicsName reacting_low_mach_navier_stokes()
Wrapper class for storing state for computing Wilke transport properties using Antioch.
Wrapper class for evaluating Wilke transport properties using Antioch.
std::string species_name(unsigned int species_index) const
libMesh::Real cp(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
int do_transport_eval(const GetPot &input)
void mu_and_k_and_D(const libMesh::Real T, const libMesh::Real rho, const libMesh::Real cp, const std::vector< libMesh::Real > &Y, libMesh::Real &mu, libMesh::Real &k, std::vector< libMesh::Real > &D)
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
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 Tue Dec 19 2017 12:47:27 for GRINS-0.8.0 by  doxygen 1.8.9.1