OGS 6.1.0-1721-g6382411ad
CreateBoundaryCondition.cpp
Go to the documentation of this file.
1 
11 
12 #include "BoundaryCondition.h"
23 #include "RobinBoundaryCondition.h"
24 
25 #include "BaseLib/TimeInterval.h"
26 
27 #ifdef OGS_USE_PYTHON
29 #endif
30 
31 namespace ProcessLib
32 {
33 std::unique_ptr<BoundaryCondition> createBoundaryCondition(
34  const BoundaryConditionConfig& config,
35  const NumLib::LocalToGlobalIndexMap& dof_table,
36  const MeshLib::Mesh& bulk_mesh, const int variable_id,
37  const unsigned integration_order, const unsigned shapefunction_order,
38  const std::vector<std::unique_ptr<ProcessLib::ParameterBase>>& parameters,
39  const Process& process)
40 {
41  // Surface mesh and bulk mesh must have equal axial symmetry flags!
42  if (config.boundary_mesh.isAxiallySymmetric() !=
43  bulk_mesh.isAxiallySymmetric())
44  {
45  OGS_FATAL(
46  "The boundary mesh %s axially symmetric but the bulk mesh %s. Both "
47  "must have an equal axial symmetry property.",
48  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
49  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
50  }
51 
53  auto const type = config.config.peekConfigParameter<std::string>("type");
54 
55  if (type == "Dirichlet")
56  {
58  config.config, config.boundary_mesh, dof_table, variable_id,
59  *config.component_id, parameters);
60  }
61  if (type == "DirichletWithinTimeInterval")
62  {
64  config.config, config.boundary_mesh, dof_table, variable_id,
65  *config.component_id, parameters);
66  }
67  if (type == "Neumann")
68  {
70  config.config, config.boundary_mesh, dof_table, variable_id,
71  *config.component_id, integration_order, shapefunction_order,
72  bulk_mesh.getDimension(), parameters);
73  }
74  if (type == "Robin")
75  {
77  config.config, config.boundary_mesh, dof_table, variable_id,
78  *config.component_id, integration_order, shapefunction_order,
79  bulk_mesh.getDimension(), parameters);
80  }
81  if (type == "NonuniformDirichlet")
82  {
84  config.config, config.boundary_mesh, dof_table, variable_id,
85  *config.component_id);
86  }
87  if (type == "NonuniformNeumann")
88  {
90  config.config, config.boundary_mesh, dof_table, variable_id,
91  *config.component_id, integration_order, shapefunction_order,
92  bulk_mesh);
93  }
94 
95  if (type == "NonuniformVariableDependentNeumann")
96  {
97  return ProcessLib::
99  config.config, config.boundary_mesh, dof_table, variable_id,
100  *config.component_id, integration_order, shapefunction_order,
101  bulk_mesh);
102  }
103 
104  if (type == "Python")
105  {
106 #ifdef OGS_USE_PYTHON
108  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
109  variable_id, *config.component_id, integration_order,
110  shapefunction_order, bulk_mesh.getDimension());
111 #else
112  OGS_FATAL("OpenGeoSys has not been built with Python support.");
113 #endif
114  }
115 
116  //
117  // Special boundary conditions
118  //
119  if (type == "ConstraintDirichlet")
120  {
122  config.config, config.boundary_mesh, dof_table, variable_id,
123  integration_order, *config.component_id, parameters, process);
124  }
125  if (type == "NormalTraction")
126  {
129  config.config, config.boundary_mesh, dof_table, variable_id,
130  integration_order, shapefunction_order,
131  bulk_mesh.getDimension(), parameters);
132  }
133  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
134  {
135  return ProcessLib::
138  config.config, dof_table, bulk_mesh, variable_id,
139  *config.component_id);
140  }
141  OGS_FATAL("Unknown boundary condition type: `%s'.", type.c_str());
142 }
143 
144 } // namespace ProcessLib
std::unique_ptr< RobinBoundaryCondition > createRobinBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterBase >> const &parameters)
std::unique_ptr< NeumannBoundaryCondition > createNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterBase >> const &parameters)
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, std::size_t bulk_mesh_id, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim)
Creates a new PythonBoundaryCondition object.
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:123
std::unique_ptr< DirichletBoundaryCondition > createDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ProcessLib::ParameterBase >> &parameters)
std::unique_ptr< DirichletBoundaryConditionWithinTimeInterval > createDirichletBoundaryConditionWithinTimeInterval(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, const std::vector< std::unique_ptr< ProcessLib::ParameterBase >> &parameters)
bool isAxiallySymmetric() const
Definition: Mesh.h:137
std::unique_ptr< NormalTractionBoundaryCondition< NormalTractionBoundaryConditionLocalAssembler > > createNormalTractionBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::unique_ptr< ParameterBase >> const &parameters)
std::unique_ptr< ConstraintDirichletBoundaryCondition > createConstraintDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, unsigned const integration_order, int const component_id, std::vector< std::unique_ptr< ProcessLib::ParameterBase >> const &parameters, Process const &constraining_process)
std::unique_ptr< NonuniformDirichletBoundaryCondition > createNonuniformDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id)
std::unique_ptr< NonuniformNeumannBoundaryCondition > createNonuniformNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, MeshLib::Mesh const &bulk_mesh)
T peekConfigParameter(std::string const &param) const
boost::optional< int > const component_id
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
std::unique_ptr< BoundaryCondition > createBoundaryCondition(const BoundaryConditionConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table, const MeshLib::Mesh &bulk_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, const std::vector< std::unique_ptr< ProcessLib::ParameterBase >> &parameters, const Process &process)
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
std::unique_ptr< PhaseFieldIrreversibleDamageOracleBoundaryCondition > createPhaseFieldIrreversibleDamageOracleBoundaryCondition(BaseLib::ConfigTree const &config, NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, int const variable_id, int const component_id)
std::unique_ptr< NonuniformVariableDependentNeumannBoundaryCondition > createNonuniformVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, MeshLib::Mesh const &bulk_mesh)