GRINS-0.8.0
velocity_drag_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
31 
32 // libMesh
33 #include "libmesh/parsed_function.h"
34 
35 namespace GRINS
36 {
37 
38  template<class Mu>
39  VelocityDragBase<Mu>::VelocityDragBase( const std::string& physics_name, const GetPot& input )
40  : IncompressibleNavierStokesBase<Mu>(physics_name,
41  PhysicsNaming::incompressible_navier_stokes(), /* "core" Physics name */
42  input),
43  _coefficient("")
44  {
45  this->read_input_options(input);
46  }
47 
48  template<class Mu>
49  void VelocityDragBase<Mu>::read_input_options( const GetPot& input )
50  {
51  this->set_parameter
52  (_exponent, input, "Physics/"+PhysicsNaming::velocity_drag()+"/exponent", 2);
53 
54  this->set_parameter(_coefficient, input,
55  "Physics/"+PhysicsNaming::velocity_drag()+"/coefficient",
56  "0");
57 
58  if (_coefficient.expression() == "0")
59  libmesh_error_msg("Warning! Zero VelocityDrag specified!" <<
60  std::endl);
61  }
62 
63  template<class Mu>
65  ( const libMesh::Point& point,
66  const libMesh::Real time,
67  const libMesh::NumberVectorValue& U,
68  libMesh::NumberVectorValue& F,
69  libMesh::NumberTensorValue *dFdU)
70  {
71  const libMesh::Number Umag = U.norm();
72 
73  const libMesh::Number coeff_val = _coefficient(point, time);
74 
75  if (coeff_val == 0)
76  return false;
77 
78  const libMesh::Number F_coeff = std::pow(Umag, _exponent-1) * -coeff_val;
79 
80  F = F_coeff * U;
81 
82  if (dFdU)
83  {
84  const libMesh::Number J_coeff =
85  std::pow(Umag, _exponent-2) * -coeff_val * (_exponent-1);
86 
87  const libMesh::Number invUmag = 1/Umag;
88 
89  const libMesh::Number JinvU = J_coeff*invUmag;
90 
91  for (unsigned int i=0; i != 3; ++i)
92  {
93  const libMesh::Number JinvUI = JinvU*U(i);
94  for (unsigned int j=0; j != 3; ++j)
95  (*dFdU)(i,j) = JinvUI*U(j);
96 
97  (*dFdU)(i,i) += F_coeff;
98  }
99  }
100 
101  return true;
102  }
103 
104 } // namespace GRINS
105 
106 // Instantiate
107 INSTANTIATE_INC_NS_SUBCLASS(VelocityDragBase);
bool compute_force(const libMesh::Point &point, const libMesh::Real time, const libMesh::NumberVectorValue &U, libMesh::NumberVectorValue &F, libMesh::NumberTensorValue *dFdU=NULL)
Physics class for Incompressible Navier-Stokes.
static PhysicsName velocity_drag()
GRINS namespace.
INSTANTIATE_INC_NS_SUBCLASS(VelocityDragBase)
void read_input_options(const GetPot &input)
Read options from GetPot input file.

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