GRINS-0.7.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-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
42 #include "grins/physics_naming.h"
43 
44 template<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 
134  int return_flag = 0;
135 
136  if( mixing_model == std::string("wilke") )
137  {
138  if( thermo_model == std::string("stat_mech") )
139  {
140  if( diffusivity_model == std::string("constant_lewis") )
141  {
142  if( conductivity_model == std::string("eucken") )
143  {
144  if( viscosity_model == std::string("sutherland") )
145  {
146  return_flag = do_transport_eval<Antioch::StatMechThermodynamics<libMesh::Real>,
147  Antioch::SutherlandViscosity<libMesh::Real>,
148  Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> >,
149  Antioch::ConstantLewisDiffusivity<libMesh::Real> >(input);
150  }
151  else if( viscosity_model == std::string("blottner") )
152  {
153  return_flag = do_transport_eval<Antioch::StatMechThermodynamics<libMesh::Real>,
154  Antioch::BlottnerViscosity<libMesh::Real>,
155  Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> >,
156  Antioch::ConstantLewisDiffusivity<libMesh::Real> >(input);
157  }
158  else
159  {
160  std::cerr << "Error: Unknown viscosity_model "
161  << viscosity_model << "!" << std::endl;
162  return_flag = 1;
163  }
164  }
165  else
166  {
167  std::cerr << "Error: Unknown conductivity_model "
168  << conductivity_model << "!" << std::endl;
169  return_flag = 1;
170  }
171  }
172  else
173  {
174  std::cerr << "Error: Unknown diffusivity_model "
175  << diffusivity_model << "!" << std::endl;
176  return_flag = 1;
177  }
178  }
179  else
180  {
181  std::cerr << "Error: Unknown thermo_model "
182  << thermo_model << "!" << std::endl;
183  return_flag = 1;
184  }
185  }
186  else
187  {
188  std::cerr << "Error: Unknown mixing_model "
189  << mixing_model << "!" << std::endl;
190  return_flag = 1;
191  }
192 
193  return return_flag;
194 }
195 
196 #endif //GRINS_HAVE_ANTIOCH
libMesh::Real cp(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
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.
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
int do_transport_eval(const GetPot &input)
std::string species_name(unsigned int species_index) const
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)
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