GRINS-0.6.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-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
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  incompressible_navier_stokes, /* "core" Physics name */
42  input)
43  {
44  this->read_input_options(input);
45 
46  return;
47  }
48 
49  template<class Mu>
51  {
52  return;
53  }
54 
55  template<class Mu>
56  void VelocityDragBase<Mu>::read_input_options( const GetPot& input )
57  {
58  this->set_parameter
59  (_exponent, input, "Physics/"+velocity_drag+"/exponent", 2);
60 
61  std::string coefficient_function =
62  input("Physics/"+velocity_drag+"/coefficient",
63  std::string("0"));
64 
65  this->_coefficient.reset
66  (new libMesh::ParsedFunction<libMesh::Number>(coefficient_function));
67 
68  if (coefficient_function == "0")
69  std::cout << "Warning! Zero VelocityDrag specified!" << std::endl;
70  }
71 
72  template<class Mu>
74  ( const libMesh::Point& point,
75  const libMesh::Real time,
76  const libMesh::NumberVectorValue& U,
77  libMesh::NumberVectorValue& F,
78  libMesh::NumberTensorValue *dFdU)
79  {
80  libmesh_assert(_coefficient.get());
81 
82  const libMesh::Number Umag = U.size();
83 
84  const libMesh::Number coeff_val = (*_coefficient)(point, time);
85 
86  if (coeff_val == 0)
87  return false;
88 
89  const libMesh::Number F_coeff = std::pow(Umag, _exponent-1) * -coeff_val;
90 
91  F = F_coeff * U;
92 
93  if (dFdU)
94  {
95  const libMesh::Number J_coeff =
96  std::pow(Umag, _exponent-2) * -coeff_val * (_exponent-1);
97 
98  const libMesh::Number invUmag = 1/Umag;
99 
100  const libMesh::Number JinvU = J_coeff*invUmag;
101 
102  for (unsigned int i=0; i != 3; ++i)
103  {
104  const libMesh::Number JinvUI = JinvU*U(i);
105  for (unsigned int j=0; j != 3; ++j)
106  (*dFdU)(i,j) = JinvUI*U(j);
107 
108  (*dFdU)(i,i) += F_coeff;
109  }
110  }
111 
112  return true;
113  }
114 
115 } // namespace GRINS
116 
117 // Instantiate
118 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)
const PhysicsName incompressible_navier_stokes
Physics class for Incompressible Navier-Stokes.
GRINS namespace.
INSTANTIATE_INC_NS_SUBCLASS(VelocityDragBase)
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file.
const PhysicsName velocity_drag

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