GRINS-0.6.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-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 // This class
28 
29 // GRINS
30 #include "grins/assembly_context.h"
34 
35 // libMesh
36 #include "libmesh/quadrature.h"
37 #include "libmesh/elem.h"
38 #include "libmesh/unstructured_mesh.h"
39 #include "libmesh/fem_system.h"
40 
41 namespace GRINS
42 {
43 
45  : _flow_vars(input)
46  {}
47 
48  void SpalartAllmarasHelper::init_variables( libMesh::FEMSystem* system )
49  {
50  this->_dim = system->get_mesh().mesh_dimension();
51 
52  this->_flow_vars.init(system);
53 
54  return;
55  }
56 
57  libMesh::Real SpalartAllmarasHelper::vorticity(AssemblyContext& context, unsigned int qp) const
58  {
59  libMesh::Gradient grad_u, grad_v;
60  grad_u = context.interior_gradient(this->_flow_vars.u_var(), qp);
61  grad_v = context.interior_gradient(this->_flow_vars.v_var(), qp);
62 
63  libMesh::Real vorticity_value;
64  vorticity_value = fabs(grad_v(0) - grad_u(1));
65 
66  if(this->_dim == 3)
67  {
68  libMesh::Gradient grad_w;
69  grad_w = context.interior_gradient(this->_flow_vars.w_var(), qp);
70 
71  libMesh::Real vorticity_component_0 = grad_w(1) - grad_v(2);
72  libMesh::Real vorticity_component_1 = grad_u(2) - grad_v(0);
73 
74  libMesh::Real term = vorticity_component_0*vorticity_component_0
75  + vorticity_component_1*vorticity_component_1
76  + vorticity_value*vorticity_value;
77 
78  vorticity_value += std::sqrt(term);
79  }
80 
81  return vorticity_value;
82  }
83 
84 } // namespace GRINS
GRINS namespace.
virtual void init(libMesh::FEMSystem *system)
libMesh::Real vorticity(AssemblyContext &context, unsigned int qp) const
void init_variables(libMesh::FEMSystem *system)

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