OGS 6.2.0-97-g4a610c866
CreateBoundaryCondition.cpp
Go to the documentation of this file.
1 
11 
12 #include "BoundaryCondition.h"
20 #include "RobinBoundaryCondition.h"
22 
23 #include "BaseLib/TimeInterval.h"
24 
25 #ifdef OGS_USE_PYTHON
27 #endif
28 
29 namespace ProcessLib
30 {
31 std::unique_ptr<BoundaryCondition> createBoundaryCondition(
32  const BoundaryConditionConfig& config,
33  const NumLib::LocalToGlobalIndexMap& dof_table,
34  const MeshLib::Mesh& bulk_mesh, const int variable_id,
35  const unsigned integration_order, const unsigned shapefunction_order,
36  const std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
37  const Process& process)
38 {
39  // Surface mesh and bulk mesh must have equal axial symmetry flags!
40  if (config.boundary_mesh.isAxiallySymmetric() !=
41  bulk_mesh.isAxiallySymmetric())
42  {
43  OGS_FATAL(
44  "The boundary mesh %s axially symmetric but the bulk mesh %s. Both "
45  "must have an equal axial symmetry property.",
46  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
47  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
48  }
49 
51  auto const type = config.config.peekConfigParameter<std::string>("type");
52 
53  if (type == "Dirichlet")
54  {
56  config.config, config.boundary_mesh, dof_table, variable_id,
57  *config.component_id, parameters);
58  }
59  if (type == "DirichletWithinTimeInterval")
60  {
62  config.config, config.boundary_mesh, dof_table, variable_id,
63  *config.component_id, parameters);
64  }
65  if (type == "Neumann")
66  {
68  config.config, config.boundary_mesh, dof_table, variable_id,
69  *config.component_id, integration_order, shapefunction_order,
70  bulk_mesh.getDimension(), parameters);
71  }
72  if (type == "Robin")
73  {
75  config.config, config.boundary_mesh, dof_table, variable_id,
76  *config.component_id, integration_order, shapefunction_order,
77  bulk_mesh.getDimension(), parameters);
78  }
79  if (type == "VariableDependentNeumann")
80  {
82  config.config, config.boundary_mesh, dof_table, variable_id,
83  *config.component_id, integration_order, shapefunction_order,
84  bulk_mesh.getDimension(), parameters);
85  }
86 
87  if (type == "Python")
88  {
89 #ifdef OGS_USE_PYTHON
91  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
92  variable_id, *config.component_id, integration_order,
93  shapefunction_order, bulk_mesh.getDimension());
94 #else
95  OGS_FATAL("OpenGeoSys has not been built with Python support.");
96 #endif
97  }
98 
99  //
100  // Special boundary conditions
101  //
102  if (type == "ConstraintDirichlet")
103  {
105  config.config, config.boundary_mesh, dof_table, variable_id,
106  integration_order, *config.component_id, parameters, process);
107  }
108  if (type == "NormalTraction")
109  {
112  config.config, config.boundary_mesh, dof_table, variable_id,
113  integration_order, shapefunction_order,
114  bulk_mesh.getDimension(), parameters);
115  }
116  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
117  {
118  return ProcessLib::
121  config.config, dof_table, bulk_mesh, variable_id,
122  *config.component_id);
123  }
124  OGS_FATAL("Unknown boundary condition type: `%s'.", type.c_str());
125 }
126 
127 } // namespace ProcessLib
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< ParameterLib::ParameterBase >> const &parameters, Process const &constraining_process)
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< 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< ParameterLib::ParameterBase >> &parameters)
bool isAxiallySymmetric() const
Definition: Mesh.h:137
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< ParameterLib::ParameterBase >> &parameters)
T peekConfigParameter(std::string const &param) const
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< ParameterLib::ParameterBase >> const &parameters)
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< ParameterLib::ParameterBase >> &parameters, const Process &process)
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
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
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< 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< ParameterLib::ParameterBase >> const &parameters)
std::unique_ptr< VariableDependentNeumannBoundaryCondition > createVariableDependentNeumannBoundaryCondition(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< ParameterLib::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< ParameterLib::ParameterBase >> const &parameters)