GRINS-0.6.0
parsed_velocity_source_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_fem_function.h"
34 
35 namespace GRINS
36 {
37 
38  template<class Mu>
39  ParsedVelocitySourceBase<Mu>::ParsedVelocitySourceBase( 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>
57  {
58  std::string base_physics_name = "ParsedVelocitySource";
59 
60  source_function_string =
61  input("Physics/"+base_physics_name+"/source_function",
62  std::string("0"));
63 
64  if (source_function_string == "0")
65  std::cout << "Warning! Zero ParsedVelocitySource specified!" << std::endl;
66  }
67 
68  template<class Mu>
69  void ParsedVelocitySourceBase<Mu>::set_time_evolving_vars ( libMesh::FEMSystem* system)
70  {
71  this->velocity_source_function.reset
72  (new libMesh::ParsedFEMFunction<libMesh::Number>
73  (*system, this->source_function_string));
74  }
75 
76  template<class Mu>
78  ( const libMesh::Point& point,
79  const libMesh::Real time,
80  const AssemblyContext &c,
81  libMesh::NumberVectorValue& F,
82  libMesh::NumberTensorValue *dFdU)
83  {
84  libmesh_assert(velocity_source_function.get());
85 
86  libMesh::DenseVector<libMesh::Number> output_vec(3);
87 
88  (*velocity_source_function)(c, point, time,
89  output_vec);
90 
91  F(0) = output_vec(0);
92  F(1) = output_vec(1);
93  F(2) = output_vec(2);
94 
95  if (dFdU)
96  for (unsigned int i=0; i != 3; ++i)
97  for (unsigned int j=0; j != 3; ++j)
98  (*dFdU)(i,j) = 0; // FIXME
99 
100  if (F(0) || F(1) || F(2))
101  return true;
102 
103  return false;
104  }
105 
106 } // namespace GRINS
107 
108 // Instantiate
109 INSTANTIATE_INC_NS_SUBCLASS(ParsedVelocitySourceBase);
const PhysicsName incompressible_navier_stokes
Physics class for Incompressible Navier-Stokes.
virtual void read_input_options(const GetPot &input)
Read options from GetPot input file.
void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
bool compute_force(const libMesh::Point &point, const libMesh::Real time, const AssemblyContext &c, libMesh::NumberVectorValue &F, libMesh::NumberTensorValue *dFdU=NULL)
GRINS namespace.
INSTANTIATE_INC_NS_SUBCLASS(ParsedVelocitySourceBase)

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