GRINS-0.8.0
neumann_bc_parsed.h
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 #ifndef GRINS_NEUMANN_BC_PARSED_H
26 #define GRINS_NEUMANN_BC_PARSED_H
27 
28 // GRINS
30 #include "grins/multiphysics_sys.h"
31 
32 // libMesh
33 #include "libmesh/parsed_function.h"
34 #include "libmesh/composite_function.h"
35 #include "libmesh/parsed_fem_function.h"
36 #include "libmesh/composite_fem_function.h"
37 
38 namespace GRINS
39 {
40  template<typename FEShape>
41  class ParsedNeumannBC : public NeumannBCFunctionBase<libMesh::FunctionBase<FEShape>,FEShape>
42  {
43  public:
44  ParsedNeumannBC( const std::string& expression,
45  VariableIndex var )
46  : NeumannBCFunctionBase<libMesh::FunctionBase<FEShape>,FEShape>( var )
47  {
48  this->_func.reset( new libMesh::ParsedFunction<FEShape>(expression) );
49  }
50 
51  virtual ~ParsedNeumannBC(){};
52  };
53 
54  template<typename FEShape>
55  class CompositeParsedNeumannBC : public NeumannBCFunctionBase<libMesh::FunctionBase<FEShape>,FEShape>
56  {
57  public:
58  CompositeParsedNeumannBC( const std::vector<std::string>& expressions,
59  const std::vector<VariableIndex>& vars )
60  : NeumannBCFunctionBase<libMesh::FunctionBase<FEShape>,FEShape>( vars )
61  {
62  libmesh_assert_equal_to( expressions.size(), vars.size() );
63 
64  libMesh::UniquePtr<libMesh::CompositeFunction<FEShape> >
65  composite_func( new libMesh::CompositeFunction<FEShape> );
66 
67  for( unsigned int i = 0; i < vars.size(); i++ )
68  {
69  libMesh::ParsedFunction<FEShape> parsed_func(expressions[i]);
70  std::vector<unsigned int> index(1,vars[i]);
71  composite_func->attach_subfunction(parsed_func, index);
72  }
73 
74  this->_func.reset(composite_func.release());
75  }
76 
78  };
79 
80  template<typename FEShape>
81  class ParsedFEMNeumannBC : public NeumannBCFunctionBase<libMesh::FEMFunctionBase<FEShape>,FEShape>
82  {
83  public:
84  ParsedFEMNeumannBC( const std::string& expression,
85  const MultiphysicsSystem& system,
86  VariableIndex var )
87  : NeumannBCFunctionBase<libMesh::FEMFunctionBase<FEShape>,FEShape>( var )
88  {
89  this->_func.reset( new libMesh::ParsedFEMFunction<FEShape>(system,expression) );
90  }
91 
92  virtual ~ParsedFEMNeumannBC(){};
93  };
94 
95  template<typename FEShape>
96  class CompositeParsedFEMNeumannBC : public NeumannBCFunctionBase<libMesh::FEMFunctionBase<FEShape>,FEShape>
97  {
98  public:
99  CompositeParsedFEMNeumannBC( const std::vector<std::string>& expressions,
100  const std::vector<VariableIndex>& vars,
101  const MultiphysicsSystem& system )
102  : NeumannBCFunctionBase<libMesh::FEMFunctionBase<FEShape>,FEShape>( vars )
103  {
104  libmesh_assert_equal_to( expressions.size(), vars.size() );
105 
106  libMesh::UniquePtr<libMesh::CompositeFEMFunction<FEShape> >
107  composite_func( new libMesh::CompositeFEMFunction<FEShape> );
108 
109  for( unsigned int i = 0; i < vars.size(); i++ )
110  {
111  libMesh::ParsedFEMFunction<FEShape> parsed_func(system,expressions[i]);
112  std::vector<unsigned int> index(1,vars[i]);
113  composite_func->attach_subfunction(parsed_func, index);
114  }
115 
116  this->_func.reset(composite_func.release());
117  }
118 
120  };
121 } // end namespace GRINS
122 
123 #endif // GRINS_NEUMANN_BC_PARSED_H
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
CompositeParsedFEMNeumannBC(const std::vector< std::string > &expressions, const std::vector< VariableIndex > &vars, const MultiphysicsSystem &system)
GRINS namespace.
ParsedFEMNeumannBC(const std::string &expression, const MultiphysicsSystem &system, VariableIndex var)
CompositeParsedNeumannBC(const std::vector< std::string > &expressions, const std::vector< VariableIndex > &vars)
ParsedNeumannBC(const std::string &expression, VariableIndex var)
Interface with libMesh for solving Multiphysics problems.
libMesh::UniquePtr< libMesh::FunctionBase< FEShape > > _func
Function object for the actual Neumann flux.

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