GRINS-0.8.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-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 // 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(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,core_physics_name,VariablesParsing::PHYSICS))),
53  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,core_physics_name,VariablesParsing::PHYSICS))),
54  _temp_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<PrimitiveTempFEVariables>(VariablesParsing::temp_variable_name(input,core_physics_name,VariablesParsing::PHYSICS))),
55  _p0_var(NULL),
56  _mu(input,MaterialsParsing::material_name(input,core_physics_name)),
57  _cp(input,MaterialsParsing::material_name(input,core_physics_name)),
58  _k(input,MaterialsParsing::material_name(input,core_physics_name))
59  {
61 
62  _enable_thermo_press_calc = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/enable_thermo_press_calc", false );
64  {
65  _p0_var = &GRINSPrivate::VariableWarehouse::get_variable_subclass<ThermoPressureVariable>(VariablesParsing::thermo_press_variable_name(input,core_physics_name,VariablesParsing::PHYSICS));
67  }
68 
69  this->read_input_options(input);
70 
74  }
75 
76  template<class Mu, class SH, class TC>
78  {
79  // Read thermodynamic state info
81  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/p0",
82  "ThermodynamicPressure",
84  (*this),
85  _p0 );
86 
88  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/T0",
89  "ReferenceTemperature",
91  (*this),
92  _T0 );
93 
95  "Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/R",
96  "GasConstant",
98  (*this),
99  _R );
100 
101  _p0_over_R = _p0/_R;
102 
103  // Read gravity vector
104  unsigned int g_dim = input.vector_variable_size("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g");
105 
106  _g(0) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 0 );
107 
108  if( g_dim > 1)
109  _g(1) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 1 );
110 
111  if( g_dim == 3)
112  _g(2) = input("Physics/"+PhysicsNaming::low_mach_navier_stokes()+"/g", 0.0, 2 );
113  }
114 
115  template<class Mu, class SH, class TC>
117  {
118  const unsigned int dim = system->get_mesh().mesh_dimension();
119 
120  system->time_evolving(_flow_vars.u(), 1);
121 
122  if (dim > 1)
123  system->time_evolving(_flow_vars.v(), 1);
124 
125  if (dim == 3)
126  system->time_evolving(_flow_vars.w(), 1);
127 
128  system->time_evolving(_temp_vars.T(), 1);
129  system->time_evolving(_press_var.p(), 1);
130 
131  if( _enable_thermo_press_calc )
132  system->time_evolving(_p0_var->p0(), 1);
133  }
134 
135  template<class Mu, class SH, class TC>
137  {
138  // We should prerequest all the data
139  // we will need to build the linear system
140  // or evaluate a quantity of interest.
141  context.get_element_fe(_flow_vars.u())->get_JxW();
142  context.get_element_fe(_flow_vars.u())->get_phi();
143  context.get_element_fe(_flow_vars.u())->get_dphi();
144  context.get_element_fe(_flow_vars.u())->get_xyz();
145 
146  context.get_element_fe(_temp_vars.T())->get_JxW();
147  context.get_element_fe(_temp_vars.T())->get_phi();
148  context.get_element_fe(_temp_vars.T())->get_dphi();
149  context.get_element_fe(_temp_vars.T())->get_xyz();
150 
151  context.get_element_fe(_press_var.p())->get_phi();
152  context.get_element_fe(_press_var.p())->get_xyz();
153  }
154 
155  template<class Mu, class SH, class TC>
157  ( const std::string & param_name,
159  const
160  {
161  ParameterUser::register_parameter(param_name, param_pointer);
162  _mu.register_parameter(param_name, param_pointer);
163  _cp.register_parameter(param_name, param_pointer);
164  _k.register_parameter(param_name, param_pointer);
165  }
166 
167 } // namespace GRINS
168 
169 // Instantiate
void read_input_options(const GetPot &input)
Read options from GetPot input file.
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:106
void check_var_subdomain_consistency(const FEVariablesBase &var) const
Check that var is enabled on at least the subdomains this Physics is.
Definition: physics.C:174
static PhysicsName low_mach_navier_stokes()
bool _enable_thermo_press_calc
Flag to enable thermodynamic pressure calculation.
GRINS namespace.
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
Helper functions for parsing material properties.
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.
void set_is_constraint_var(bool is_constraint_var)
Set whether or not this is a "constraint" variable.
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.
static std::string thermo_press_variable_name(const GetPot &input, const std::string &subsection_name, const SECTION_TYPE section_type)

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1