GRINS-0.8.0
symmetry_type_bc_factories.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_SYMMETRY_TYPE_BC_FACTORIES_H
26 #define GRINS_SYMMETRY_TYPE_BC_FACTORIES_H
27 
28 // GRINS
30 
31 // libMesh
32 #include "libmesh/zero_function.h"
33 
34 namespace GRINS
35 {
36  class SymmetryTypeBCFactories : public DirichletBCFactoryFunctionBase<libMesh::FunctionBase<libMesh::Number> >
37  {
38  public:
39 
40  SymmetryTypeBCFactories( const std::string& bc_type_name )
41  : DirichletBCFactoryFunctionBase(bc_type_name)
42  {}
43 
45 
46  protected:
47 
49 
53  virtual void trim_var_names( std::vector<std::string>& var_names ) =0;
54 
56  virtual libMesh::UniquePtr<libMesh::FunctionBase<libMesh::Number> >
57  build_func( const GetPot& /*input*/,
58  MultiphysicsSystem& /*system*/,
59  std::vector<std::string>& var_names,
60  const std::string& /*section*/ )
61  {
62  this->trim_var_names(var_names);
63  return libMesh::UniquePtr<libMesh::FunctionBase<libMesh::Number> >( new libMesh::ZeroFunction<libMesh::Number> );
64  }
65 
66  };
67 
70  {
71  public:
72  YZSymmetryBCFactory( const std::string& bc_type_name )
73  : SymmetryTypeBCFactories(bc_type_name)
74  {}
75 
76  protected:
77  virtual void trim_var_names( std::vector<std::string>& var_names )
78  {
79  if( var_names.size() !=3 )
80  libmesh_error_msg("ERROR: YZSymmetry requires 3 components in the Variable!");
81 
82  // We want to pin the x-component, so remove the last two components
83  var_names.pop_back();
84  var_names.pop_back();
85 
86  libmesh_assert_equal_to(var_names.size(), 1);
87  }
88  };
89 
92  {
93  public:
94  XZSymmetryBCFactory( const std::string& bc_type_name )
95  : SymmetryTypeBCFactories(bc_type_name)
96  {}
97 
98  protected:
99  virtual void trim_var_names( std::vector<std::string>& var_names )
100  {
101  if( var_names.size() < 2 )
102  libmesh_error_msg("ERROR: XZSymmetry requires at least 2 components in the Variable!");
103 
104  // We want to pin the y-component, so remove the z-component if it's there
105  if( var_names.size() == 3 )
106  var_names.pop_back();
107 
108  // Now remove x-component
109  var_names.erase(var_names.begin());
110 
111  libmesh_assert_equal_to(var_names.size(), 1);
112  }
113  };
114 
117  {
118  public:
119  XYSymmetryBCFactory( const std::string& bc_type_name )
120  : SymmetryTypeBCFactories(bc_type_name)
121  {}
122 
123  protected:
124  virtual void trim_var_names( std::vector<std::string>& var_names )
125  {
126  if( var_names.size() !=3 )
127  libmesh_error_msg("ERROR: XYSymmetry requires 3 components in the Variable!");
128 
129  // We want to pin the z-component, so remove the x- and y-components
130  var_names.erase(var_names.begin());
131  var_names.erase(var_names.begin());
132 
133  libmesh_assert_equal_to(var_names.size(), 1);
134  }
135  };
136 
139  {
140  public:
141  RollerXBCFactory( const std::string& bc_type_name )
142  : SymmetryTypeBCFactories(bc_type_name)
143  {}
144 
145  protected:
146  virtual void trim_var_names( std::vector<std::string>& var_names )
147  {
148  if( var_names.size() < 2 )
149  libmesh_error_msg("ERROR: RollerX requires at least 2 components in the Variable!");
150 
151  // We want to pin the y- and z-components, so remove the x-component
152  var_names.erase(var_names.begin());
153 
154  libmesh_assert_less_equal(var_names.size(), 2);
155  }
156  };
157 
160  {
161  public:
162  RollerYBCFactory( const std::string& bc_type_name )
163  : SymmetryTypeBCFactories(bc_type_name)
164  {}
165 
166  protected:
167  virtual void trim_var_names( std::vector<std::string>& var_names )
168  {
169  if( var_names.size() < 2 )
170  libmesh_error_msg("ERROR: RollerY requires at least 2 components in the Variable!");
171 
172  // We want to pin the x- and z-components, so remove the y-component
173  var_names.erase(var_names.begin()+1);
174 
175  libmesh_assert_less_equal(var_names.size(), 2);
176  }
177  };
178 
181  {
182  public:
183  RollerZBCFactory( const std::string& bc_type_name )
184  : SymmetryTypeBCFactories(bc_type_name)
185  {}
186 
187  protected:
188  virtual void trim_var_names( std::vector<std::string>& var_names )
189  {
190  if( var_names.size() !=3 )
191  libmesh_error_msg("ERROR: RollerZ requires 3 components in the Variable!");
192 
193  // We want to pin the x- and y-components, so remove the z-component
194  var_names.pop_back();
195 
196  libmesh_assert_equal_to(var_names.size(), 2);
197  }
198  };
199 
203  {
204  public:
205  AxisymmetryBCFactory( const std::string& bc_type_name )
206  : SymmetryTypeBCFactories(bc_type_name)
207  {}
208 
209  protected:
210  virtual void trim_var_names( std::vector<std::string>& var_names )
211  {
212  if( var_names.size() !=2 )
213  libmesh_error_msg("ERROR: Axisymmetry requires 2 components in the Variable!");
214 
215  // We want to pin the x-components, so remove the y-component
216  var_names.pop_back();
217 
218  libmesh_assert_equal_to(var_names.size(), 1);
219  }
220  };
221 
222 } // end namespace GRINS
223 
224 #endif // GRINS_SYMMETRY_TYPE_BC_FACTORIES_H
virtual void trim_var_names(std::vector< std::string > &var_names)=0
Trim out the variables that are pinned.
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
RollerXBCFactory(const std::string &bc_type_name)
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
XZSymmetryBCFactory(const std::string &bc_type_name)
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
GRINS namespace.
virtual libMesh::UniquePtr< libMesh::FunctionBase< libMesh::Number > > build_func(const GetPot &, MultiphysicsSystem &, std::vector< std::string > &var_names, const std::string &)
All the variables are 0, so just return 0 function.
Pins y-component of variable (symmetry about xz-plane)
SymmetryTypeBCFactories(const std::string &bc_type_name)
RollerZBCFactory(const std::string &bc_type_name)
YZSymmetryBCFactory(const std::string &bc_type_name)
Interface with libMesh for solving Multiphysics problems.
Pins y- and z-component of variable, so can "roll" in the x-direction.
Pins x- and y-component of variable, so can "roll" in the z-direction.
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
RollerYBCFactory(const std::string &bc_type_name)
Pins x-component of variable (symmetry about yz-plane)
Pins x- and z-component of variable, so can "roll" in the y-direction.
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
AxisymmetryBCFactory(const std::string &bc_type_name)
r-coordinate is assumed to be the x-coordinate in the axisymmetric case, so we need to pin the x-coor...
Pins z-component of variable (symmetry about xy-plane)
XYSymmetryBCFactory(const std::string &bc_type_name)
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.
virtual void trim_var_names(std::vector< std::string > &var_names)
Trim out the variables that are pinned.

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