GRINS-0.7.0
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-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 // This class
28 
29 // GRINS
30 #include "grins/assembly_context.h"
34 #include "grins/grins_enums.h"
38 
39 // libMesh
40 #include "libmesh/getpot.h"
41 #include "libmesh/string_to_enum.h"
42 #include "libmesh/fem_system.h"
43 
44 namespace GRINS
45 {
46 
47  template<class Mu, class SH, class TC>
49  const std::string& core_physics_name,
50  const GetPot& input)
51  : Physics(physics_name, input),
52  _flow_vars(input, core_physics_name),
53  _press_var(input,core_physics_name, true /*is_constraint_var*/),
54  _temp_vars(input, core_physics_name),
55  _mu(input,MaterialsParsing::material_name(input,core_physics_name)),
56  _cp(input,MaterialsParsing::material_name(input,core_physics_name)),
57  _k(input,MaterialsParsing::material_name(input,core_physics_name))
58  {
59  _enable_thermo_press_calc = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/enable_thermo_press_calc", false );
61  _p0_var.reset( new ThermoPressureFEVariable(input,core_physics_name, true /*is_constraint_var*/) );
62 
63  this->read_input_options(input);
64  this->register_variables();
65  }
66 
67  template<class Mu, class SH, class TC>
69  {
71  this->_press_var);
73  this->_flow_vars);
75  this->_temp_vars);
76  if( this->_enable_thermo_press_calc )
78  *(this->_p0_var));
79  }
80 
81  template<class Mu, class SH, class TC>
83  {
84  // Read thermodynamic state info
86  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/p0",
87  "ThermodynamicPressure",
89  (*this),
90  _p0 );
91 
93  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/T0",
94  "ReferenceTemperature",
96  (*this),
97  _T0 );
98 
100  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/R",
101  "GasConstant",
103  (*this),
104  _R );
105 
106  _p0_over_R = _p0/_R;
107 
108  // Read gravity vector
109  unsigned int g_dim = input.vector_variable_size("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g");
110 
111  _g(0) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 0 );
112  _g(1) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 1 );
113 
114  if( g_dim == 3)
115  _g(2) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 2 );
116  }
117 
118  template<class Mu, class SH, class TC>
119  void LowMachNavierStokesBase<Mu,SH,TC>::init_variables( libMesh::FEMSystem* system )
120  {
121  // Get libMesh to assign an index for each variable
122  this->_dim = system->get_mesh().mesh_dimension();
123 
124  this->_flow_vars.init(system);
125  this->_press_var.init(system);
126  this->_temp_vars.init(system);
127 
128  /* If we need to compute the thermodynamic pressure, we force this to be a first
129  order scalar variable. */
130  if( _enable_thermo_press_calc )
131  _p0_var->init(system);
132 
133  return;
134  }
135 
136  template<class Mu, class SH, class TC>
138  {
139  const unsigned int dim = system->get_mesh().mesh_dimension();
140 
141  system->time_evolving(_flow_vars.u());
142  system->time_evolving(_flow_vars.v());
143 
144  if (dim == 3)
145  system->time_evolving(_flow_vars.w());
146 
147  system->time_evolving(_temp_vars.T());
148  system->time_evolving(_press_var.p());
149 
150  if( _enable_thermo_press_calc )
151  system->time_evolving(_p0_var->p0());
152 
153  return;
154  }
155 
156  template<class Mu, class SH, class TC>
158  {
159  // We should prerequest all the data
160  // we will need to build the linear system
161  // or evaluate a quantity of interest.
162  context.get_element_fe(_flow_vars.u())->get_JxW();
163  context.get_element_fe(_flow_vars.u())->get_phi();
164  context.get_element_fe(_flow_vars.u())->get_dphi();
165  context.get_element_fe(_flow_vars.u())->get_xyz();
166 
167  context.get_element_fe(_temp_vars.T())->get_JxW();
168  context.get_element_fe(_temp_vars.T())->get_phi();
169  context.get_element_fe(_temp_vars.T())->get_dphi();
170  context.get_element_fe(_temp_vars.T())->get_xyz();
171 
172  context.get_element_fe(_press_var.p())->get_phi();
173  context.get_element_fe(_press_var.p())->get_xyz();
174 
175  return;
176  }
177 
178  template<class Mu, class SH, class TC>
180  ( const std::string & param_name,
182  const
183  {
184  ParameterUser::register_parameter(param_name, param_pointer);
185  _mu.register_parameter(param_name, param_pointer);
186  _cp.register_parameter(param_name, param_pointer);
187  _k.register_parameter(param_name, param_pointer);
188  }
189 
190 } // namespace GRINS
191 
192 // Instantiate
void read_input_options(const GetPot &input)
Read options from GetPot input file.
libMesh::UniquePtr< ThermoPressureFEVariable > _p0_var
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:107
static std::string temperature_section()
static PhysicsName low_mach_navier_stokes()
bool _enable_thermo_press_calc
Flag to enable thermodynamic pressure calculation.
virtual void init_variables(libMesh::FEMSystem *system)
Initialize variables for this physics.
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
GRINS namespace.
static std::string velocity_section()
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
Helper functions for parsing material properties.
static std::string thermo_pressure_section()
static std::string pressure_section()
Physics class for Incompressible Navier-Stokes.
static void read_property(const GetPot &input, const std::string &old_option, const std::string &property, const std::string &core_physics, ParameterUser &param_user, libMesh::Real &value)
Helper function for parsing/maintaing backward compatibility.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.

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