GRINS-0.6.0
reacting_low_mach_navier_stokes_base.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 #include "grins_config.h"
27 
28 // This class
30 
31 // GRINS
32 #include "grins/assembly_context.h"
34 #include "grins/cantera_mixture.h"
35 #include "grins/grins_enums.h"
36 #include "grins/antioch_mixture.h"
37 
38 // libMesh
39 #include "libmesh/string_to_enum.h"
40 #include "libmesh/quadrature.h"
41 #include "libmesh/fem_system.h"
42 
43 namespace GRINS
44 {
45  template<typename Mixture, typename Evaluator>
47  const GetPot& input)
48  : Physics(physics_name, input),
49  _gas_mixture(input),
50  _fixed_density( input("Physics/"+reacting_low_mach_navier_stokes+"/fixed_density", false ) ),
51  _fixed_rho_value(0.0)
52  {
53  this->set_parameter
54  (_fixed_rho_value, input,
55  "Physics/"+reacting_low_mach_navier_stokes+"/fixed_rho_value", 0.0 );
56 
57  this->read_input_options(input);
58 
59  return;
60  }
61 
62  template<typename Mixture, typename Evaluator>
64  {
65  return;
66  }
67 
68  template<typename Mixture, typename Evaluator>
70  {
71  // Read FE family info
72  this->_species_FE_family = libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>( input("Physics/"+reacting_low_mach_navier_stokes+"/species_FE_family", "LAGRANGE") );
73 
74  this->_V_FE_family = libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>( input("Physics/"+reacting_low_mach_navier_stokes+"/V_FE_family", "LAGRANGE") );
75 
76  this->_P_FE_family = libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>( input("Physics/"+reacting_low_mach_navier_stokes+"/P_FE_family", "LAGRANGE") );
77 
78  this->_T_FE_family = libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>( input("Physics/"+reacting_low_mach_navier_stokes+"/T_FE_family", "LAGRANGE") );
79 
80  // Read FE family info
81  this->_species_order = libMesh::Utility::string_to_enum<GRINSEnums::Order>( input("Physics/"+reacting_low_mach_navier_stokes+"/species_order", "SECOND") );
82 
83  this->_V_order = libMesh::Utility::string_to_enum<GRINSEnums::Order>( input("Physics/"+reacting_low_mach_navier_stokes+"/V_order", "SECOND") );
84 
85  this->_P_order = libMesh::Utility::string_to_enum<GRINSEnums::Order>( input("Physics/"+reacting_low_mach_navier_stokes+"/P_order", "FIRST") );
86 
87  this->_T_order = libMesh::Utility::string_to_enum<GRINSEnums::Order>( input("Physics/"+reacting_low_mach_navier_stokes+"/T_order", "SECOND") );
88 
89  // Read variable naming info
90  this->_n_species = input.vector_variable_size("Physics/Chemistry/species");
91 
92  _species_var_names.reserve(this->_n_species);
93  for( unsigned int i = 0; i < this->_n_species; i++ )
94  {
96  std::string var_name = "w_"+std::string(input( "Physics/Chemistry/species", "DIE!", i ));
97  _species_var_names.push_back( var_name );
98  }
99 
100  this->_u_var_name = input("Physics/VariableNames/u_velocity", GRINS::u_var_name_default );
101  this->_v_var_name = input("Physics/VariableNames/v_velocity", GRINS::v_var_name_default );
102  this->_w_var_name = input("Physics/VariableNames/w_velocity", GRINS::w_var_name_default );
103  this->_p_var_name = input("Physics/VariableNames/pressure", GRINS::p_var_name_default );
104  this->_T_var_name = input("Physics/VariableNames/temperature", GRINS::T_var_name_default );
105 
106  // Read thermodynamic state info
107  this->set_parameter
108  (_p0, input, "Physics/"+reacting_low_mach_navier_stokes+"/p0", 0.0 ); /* thermodynamic pressure */
109 
110  _enable_thermo_press_calc = input("Physics/"+reacting_low_mach_navier_stokes+"/enable_thermo_press_calc", false );
111 
112  if( _enable_thermo_press_calc )
113  {
114  _p0_var_name = input("Physics/VariableNames/thermo_presure", "p0" );
115  }
116 
117  // Read gravity vector
118  unsigned int g_dim = input.vector_variable_size("Physics/"+reacting_low_mach_navier_stokes+"/g");
119 
120  _g(0) = input("Physics/"+reacting_low_mach_navier_stokes+"/g", 0.0, 0 );
121  _g(1) = input("Physics/"+reacting_low_mach_navier_stokes+"/g", 0.0, 1 );
122 
123  if( g_dim == 3)
124  _g(2) = input("Physics/"+reacting_low_mach_navier_stokes+"/g", 0.0, 2 );
125 
126  return;
127  }
128 
129  template<typename Mixture, typename Evaluator>
131  {
132  // Get libMesh to assign an index for each variable
133  this->_dim = system->get_mesh().mesh_dimension();
134 
135  _species_vars.reserve(this->_n_species);
136  for( unsigned int i = 0; i < this->_n_species; i++ )
137  {
138  _species_vars.push_back( system->add_variable( _species_var_names[i],
139  this->_species_order, _species_FE_family) );
140  }
141 
142  _u_var = system->add_variable( _u_var_name, this->_V_order, _V_FE_family);
143  _v_var = system->add_variable( _v_var_name, this->_V_order, _V_FE_family);
144 
145  if (_dim == 3)
146  _w_var = system->add_variable( _w_var_name, this->_V_order, _V_FE_family);
147  else
148  _w_var = _u_var;
149 
150  _p_var = system->add_variable( _p_var_name, this->_P_order, _P_FE_family);
151  _T_var = system->add_variable( _T_var_name, this->_T_order, _T_FE_family);
152 
153  /* If we need to compute the thermodynamic pressure, we force this to be a first
154  order scalar variable. */
155  if( _enable_thermo_press_calc )
156  _p0_var = system->add_variable( _p0_var_name, libMesh::FIRST, libMesh::SCALAR);
157 
158  return;
159  }
160 
161  template<typename Mixture, typename Evaluator>
163  {
164  const unsigned int dim = system->get_mesh().mesh_dimension();
165 
166  for( unsigned int i = 0; i < this->_n_species; i++ )
167  {
168  system->time_evolving( _species_vars[i] );
169  }
170 
171  system->time_evolving(_u_var);
172  system->time_evolving(_v_var);
173 
174  if (dim == 3)
175  system->time_evolving(_w_var);
176 
177  system->time_evolving(_T_var);
178  system->time_evolving(_p_var);
179 
180  if( _enable_thermo_press_calc )
181  system->time_evolving(_p0_var);
182 
183  return;
184  }
185 
186  template<typename Mixture, typename Evaluator>
188  {
189  // We should prerequest all the data
190  // we will need to build the linear system
191  // or evaluate a quantity of interest.
192  context.get_element_fe(_species_vars[0])->get_JxW();
193  context.get_element_fe(_species_vars[0])->get_phi();
194  context.get_element_fe(_species_vars[0])->get_dphi();
195  context.get_element_fe(_species_vars[0])->get_xyz();
196 
197  context.get_element_fe(_u_var)->get_JxW();
198  context.get_element_fe(_u_var)->get_phi();
199  context.get_element_fe(_u_var)->get_dphi();
200  context.get_element_fe(_u_var)->get_xyz();
201 
202  context.get_element_fe(_T_var)->get_JxW();
203  context.get_element_fe(_T_var)->get_phi();
204  context.get_element_fe(_T_var)->get_dphi();
205  context.get_element_fe(_T_var)->get_xyz();
206 
207  context.get_element_fe(_p_var)->get_phi();
208  context.get_element_fe(_p_var)->get_xyz();
209 
210  return;
211  }
212 
213 } // end namespace GRINS
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:106
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file.
const std::string p_var_name_default
pressure
const std::string v_var_name_default
y-velocity
GRINS namespace.
const std::string T_var_name_default
temperature
const std::string u_var_name_default
Default physics variable names.
const PhysicsName reacting_low_mach_navier_stokes
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.
const std::string w_var_name_default
z-velocity

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