GRINS-0.8.0
spalart_allmaras_helper.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"
36 #include "grins/single_variable.h"
37 #include "grins/physics_naming.h"
38 
39 // libMesh
40 #include "libmesh/quadrature.h"
41 #include "libmesh/elem.h"
42 #include "libmesh/unstructured_mesh.h"
43 #include "libmesh/fem_system.h"
44 
45 namespace GRINS
46 {
48  : _flow_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,PhysicsNaming::spalart_allmaras(),VariablesParsing::PHYSICS))),
49  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,PhysicsNaming::spalart_allmaras(),VariablesParsing::PHYSICS)))
50  {}
51 
52  libMesh::Real SpalartAllmarasHelper::vorticity(AssemblyContext& context, unsigned int qp) const
53  {
54  libMesh::Gradient grad_u, grad_v;
55  grad_u = context.interior_gradient(this->_flow_vars.u(), qp);
56  grad_v = context.interior_gradient(this->_flow_vars.v(), qp);
57 
58  libMesh::Real vorticity_value;
59  vorticity_value = fabs(grad_v(0) - grad_u(1));
60 
61  if(context.get_system().get_mesh().mesh_dimension() == 3)
62  {
63  libMesh::Gradient grad_w;
64  grad_w = context.interior_gradient(this->_flow_vars.w(), qp);
65 
66  libMesh::Real vorticity_component_0 = grad_w(1) - grad_v(2);
67  libMesh::Real vorticity_component_1 = grad_u(2) - grad_v(0);
68 
69  libMesh::Real term = vorticity_component_0*vorticity_component_0
70  + vorticity_component_1*vorticity_component_1
71  + vorticity_value*vorticity_value;
72 
73  vorticity_value += std::sqrt(term);
74  }
75 
76  return vorticity_value;
77  }
78 
79 } // namespace GRINS
GRINS namespace.
const VelocityVariable & _flow_vars
libMesh::Real vorticity(AssemblyContext &context, unsigned int qp) const

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