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