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

Generated on Mon Jun 22 2015 21:32:19 for GRINS-0.6.0 by  doxygen 1.8.9.1