GRINS-0.8.0
bc_builder.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 // This class
26 #include "grins/bc_builder.h"
27 
28 // GRINS
34 
35 // libMesh
36 #include "libmesh/dof_map.h"
37 #include "libmesh/periodic_boundary.h"
38 
39 namespace GRINS
40 {
41  void BCBuilder::build_boundary_conditions( const GetPot& input,
42  MultiphysicsSystem& system,
43  std::vector<SharedPtr<NeumannBCContainer> >& neumann_bcs )
44  {
45  libMesh::UniquePtr<BCBuilder>
46  bc_builder = BCBuilder::build_builder(input);
47 
48  bc_builder->build_bcs(input,system,neumann_bcs);
49  }
50 
51  libMesh::UniquePtr<BCBuilder> BCBuilder::build_builder( const GetPot& input )
52  {
53  bool is_new_style = BCBuilder::is_new_bc_input_style( input );
54 
55  libMesh::UniquePtr<BCBuilder> bc_builder;
56 
57  if( is_new_style )
58  bc_builder.reset( new DefaultBCBuilder );
59 
60  else
61  bc_builder.reset( new OldStyleBCBuilder );
62 
63  return bc_builder;
64  }
65 
66  bool BCBuilder::is_new_bc_input_style( const GetPot& input )
67  {
68  bool new_style = false;
69 
70  if( input.have_section(BoundaryConditionNames::bc_section()) )
71  new_style = true;
72 
73  return new_style;
74  }
75 
76  void BCBuilder::construct_dbc_core( const GetPot& input,
77  MultiphysicsSystem& system,
78  const std::set<BoundaryID>& bc_ids,
79  const FEVariablesBase& fe_var,
80  const std::string& section,
81  const std::string& bc_type,
82  libMesh::DofMap& dof_map )
83  {
84  // Give the BC factory access to the System
86 
87  // Give the BC factory access to the GetPot object
89 
90  // Set the boundary id. This gets reset each time inside the factory.
92 
93  // Set the FEVariable. This gets reset each time inside the factory.
95 
96  // Tell the DirichletBCFactory where to parse the value of the BC,
97  // if it needs to
99 
100  libMesh::UniquePtr<libMesh::DirichletBoundary>
101  dbc = DirichletBCFactoryAbstract::build( bc_type );
102 
103  dof_map.add_dirichlet_boundary( *dbc );
104  }
105 
106  void BCBuilder::construct_nbc_core( const GetPot& input,
107  MultiphysicsSystem& system,
108  const std::set<BoundaryID>& bc_ids,
109  const FEVariablesBase& fe_var,
110  const std::string& section,
111  const std::string& bc_type,
112  std::vector<SharedPtr<NeumannBCContainer> >& neumann_bcs )
113  {
114  // Give the BC factory access to the System
116 
117  // Give the BC factory access to the GetPot object
119 
120  // Set the boundary id. This gets reset each time inside the factory.
122 
123  // Set the FEVariable. This gets reset each time inside the factory.
125 
126  // Tell the NeumannBCFactory where to parse the value of the BC,
127  // if it needs to
129 
130  libMesh::UniquePtr<NeumannBCContainer>
131  nbc = NeumannBCFactoryAbstract::build(bc_type);
132 
133  // Get nothing if it's a homogeneous Neumann BC
134  // so only try to add it if something was built.
135  if(nbc)
136  neumann_bcs.push_back(nbc.release());
137  }
138 
139  bool BCBuilder::is_dirichlet_bc_type( const std::string& bc_type )
140  {
141  // We query the factory to see if it's registered there or not.
143  }
144 
145  bool BCBuilder::is_neumann_bc_type( const std::string& bc_type )
146  {
147  // We query the factory to see if it's registered there or not.
148  return NeumannBCFactoryAbstract::have_bc_type( bc_type );
149  }
150 
151  void BCBuilder::add_periodic_bc_to_dofmap( libMesh::boundary_id_type master_id,
152  libMesh::boundary_id_type slave_id,
153  const libMesh::RealVectorValue& offset_vector,
154  libMesh::DofMap& dof_map )
155  {
156  libMesh::PeriodicBoundary bc( offset_vector );
157  bc.myboundary = master_id;
158  bc.pairedboundary = slave_id;
159 
160  dof_map.add_periodic_boundary( bc );
161  }
162 
163 } // end namespace GRINS
static void set_fe_var(const FEVariablesBase &fe_var)
Active variable for the current boundary condition.
void construct_dbc_core(const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string &section, const std::string &bc_type, libMesh::DofMap &dof_map)
Definition: bc_builder.C:76
void construct_nbc_core(const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string &section, const std::string &bc_type, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
Definition: bc_builder.C:106
static void build_boundary_conditions(const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
Definition: bc_builder.C:41
bool is_dirichlet_bc_type(const std::string &bc_type)
Definition: bc_builder.C:139
void add_periodic_bc_to_dofmap(libMesh::boundary_id_type master_id, libMesh::boundary_id_type slave_id, const libMesh::RealVectorValue &offset_vector, libMesh::DofMap &dof_map)
Definition: bc_builder.C:151
static void set_section(const std::string &section)
Sets the current section of the input file.
static void set_system(MultiphysicsSystem &system)
Manages runtime construction of Dirichlet boundary conditions.
static libMesh::UniquePtr< libMesh::DirichletBoundary > build(const std::string &name)
Use this method to build objects of type Base.
static bool have_bc_type(const std::string &bc_type)
GRINS namespace.
Manages runtime construction of Dirichlet boundary conditions.
Interface with libMesh for solving Multiphysics problems.
static bool is_new_bc_input_style(const GetPot &input)
Definition: bc_builder.C:66
static libMesh::UniquePtr< BCBuilder > build_builder(const GetPot &input)
Definition: bc_builder.C:51
static std::string bc_section()
Outer section name for boundary conditions section in input file.
bool is_neumann_bc_type(const std::string &bc_type)
Definition: bc_builder.C:145
static void set_bc_ids(const std::set< BoundaryID > &bc_ids)
Boundary id for the current boundary condition section.

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