GRINS-0.7.0
inc_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/common.h"
31 #include "grins/assembly_context.h"
32 #include "grins/physics_naming.h"
37 
38 // libMesh
39 #include "libmesh/utility.h"
40 #include "libmesh/string_to_enum.h"
41 #include "libmesh/getpot.h"
42 #include "libmesh/fem_system.h"
43 
44 namespace GRINS
45 {
46  template<class Mu>
48  const std::string& core_physics_name,
49  const GetPot& input )
50  : Physics(my_physics_name, input),
51  _flow_vars(input, core_physics_name),
52  _press_var(input, core_physics_name, true /*is_constraint_var*/),
53  _rho(0.0),
54  _mu(input,MaterialsParsing::material_name(input,core_physics_name))
55  {
56  MaterialsParsing::read_density( core_physics_name, input, (*this), this->_rho );
57  this->register_variables();
58  }
59 
60  template<class Mu>
62  {
64  this->_press_var);
66  this->_flow_vars);
67  }
68 
69  template<class Mu>
70  void IncompressibleNavierStokesBase<Mu>::init_variables( libMesh::FEMSystem* system )
71  {
72  this->_dim = system->get_mesh().mesh_dimension();
73 
74  this->_flow_vars.init(system);
75  this->_press_var.init(system);
76 
77  this->_mu.init(system);
78 
79  return;
80  }
81 
82  template<class Mu>
83  libMesh::Real IncompressibleNavierStokesBase<Mu>::get_viscosity_value(AssemblyContext& context, unsigned int qp) const
84  {
85  return this->_mu(context, qp);
86  }
87 
88  template<class Mu>
90  {
91  const unsigned int dim = system->get_mesh().mesh_dimension();
92 
93  // Tell the system to march velocity forward in time, but
94  // leave p as a constraint only
95  system->time_evolving(_flow_vars.u());
96  system->time_evolving(_flow_vars.v());
97 
98  if (dim == 3)
99  system->time_evolving(_flow_vars.w());
100 
101  return;
102  }
103 
104  template<class Mu>
106  {
107  // We should prerequest all the data
108  // we will need to build the linear system
109  // or evaluate a quantity of interest.
110  context.get_element_fe(_flow_vars.u())->get_JxW();
111  context.get_element_fe(_flow_vars.u())->get_phi();
112  context.get_element_fe(_flow_vars.u())->get_dphi();
113  context.get_element_fe(_flow_vars.u())->get_xyz();
114 
115  context.get_element_fe(_press_var.p())->get_phi();
116  context.get_element_fe(_press_var.p())->get_xyz();
117 
118  context.get_side_fe(_flow_vars.u())->get_JxW();
119  context.get_side_fe(_flow_vars.u())->get_phi();
120  context.get_side_fe(_flow_vars.u())->get_dphi();
121  context.get_side_fe(_flow_vars.u())->get_xyz();
122 
123  return;
124  }
125 
126  template<class Mu>
128  ( const std::string & param_name,
130  const
131  {
132  ParameterUser::register_parameter(param_name, param_pointer);
133  _mu.register_parameter(param_name, param_pointer);
134  }
135 
136 } // namespace GRINS
137 
138 // Instantiate
139 INSTANTIATE_INC_NS_SUBCLASS(IncompressibleNavierStokesBase);
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.
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:107
libMesh::Number _rho
Material parameters, read from input.
static void check_and_register_variable(const std::string &var_name, const FEVariablesBase &variable)
First check if var_name is registered and then register.
libMesh::Real get_viscosity_value(AssemblyContext &context, unsigned int qp) const
virtual void init_variables(libMesh::FEMSystem *system)
Initialization of Navier-Stokes variables.
static void read_density(const std::string &core_physics_name, const GetPot &input, ParameterUser &params, libMesh::Real &rho)
Helper function to reading density from input.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
GRINS namespace.
static std::string velocity_section()
Helper functions for parsing material properties.
static std::string pressure_section()
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
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.
INSTANTIATE_INC_NS_SUBCLASS(IncompressibleNavierStokesBase)

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