Loading [MathJax]/extensions/tex2jax.js
OGS
CreateBoundaryCondition.cpp
Go to the documentation of this file.
1 
12 
13 #include "BaseLib/TimeInterval.h"
14 #include "BoundaryCondition.h"
25 #include "RobinBoundaryCondition.h"
28 
29 #ifdef OGS_USE_PYTHON
31 #endif
32 
33 namespace ProcessLib
34 {
35 std::unique_ptr<BoundaryCondition> createBoundaryCondition(
36  const BoundaryConditionConfig& config,
37  const NumLib::LocalToGlobalIndexMap& dof_table,
38  const MeshLib::Mesh& bulk_mesh, const int variable_id,
39  const unsigned integration_order, const unsigned shapefunction_order,
40  const std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
41  const Process& process)
42 {
43  // Surface mesh and bulk mesh must have equal axial symmetry flags!
44  if (config.boundary_mesh.isAxiallySymmetric() !=
45  bulk_mesh.isAxiallySymmetric())
46  {
47  OGS_FATAL(
48  "The boundary mesh {:s} axially symmetric but the bulk mesh {:s}. "
49  "Both must have an equal axial symmetry property.",
50  config.boundary_mesh.isAxiallySymmetric() ? "is" : "is not",
51  bulk_mesh.isAxiallySymmetric() ? "is" : "is not");
52  }
53 
55  auto const type = config.config.peekConfigParameter<std::string>("type");
56 
57  if (type == "Dirichlet")
58  {
60  config.config, config.boundary_mesh, dof_table, variable_id,
61  *config.component_id, parameters);
62  }
63  if (type == "DirichletWithinTimeInterval")
64  {
66  config.config, config.boundary_mesh, dof_table, variable_id,
67  *config.component_id, parameters);
68  }
69  if (type == "Neumann")
70  {
72  config.config, config.boundary_mesh, dof_table, variable_id,
73  *config.component_id, integration_order, shapefunction_order,
74  bulk_mesh.getDimension(), parameters);
75  }
76  if (type == "Robin")
77  {
79  config.config, config.boundary_mesh, dof_table, variable_id,
80  *config.component_id, integration_order, shapefunction_order,
81  bulk_mesh.getDimension(), parameters);
82  }
83  if (type == "VariableDependentNeumann")
84  {
86  config.config, config.boundary_mesh, dof_table, variable_id,
87  *config.component_id, integration_order, shapefunction_order,
88  bulk_mesh.getDimension(), parameters);
89  }
90 
91  if (type == "Python")
92  {
93 #ifdef OGS_USE_PYTHON
95  config.config, config.boundary_mesh, dof_table, bulk_mesh.getID(),
96  variable_id, *config.component_id, integration_order,
97  shapefunction_order, bulk_mesh.getDimension());
98 #else
99  OGS_FATAL("OpenGeoSys has not been built with Python support.");
100 #endif
101  }
102 
103  //
104  // Special boundary conditions
105  //
106  if (type == "ConstraintDirichlet")
107  {
109  config.config, config.boundary_mesh, dof_table, variable_id,
110  integration_order, *config.component_id, parameters, process);
111  }
112  if (type == "PrimaryVariableConstraintDirichlet")
113  {
115  config.config, config.boundary_mesh, dof_table, variable_id,
116  *config.component_id, parameters);
117  }
118  if (type == "SolutionDependentDirichlet")
119  {
121  config.config, config.boundary_mesh, dof_table, variable_id,
122  *config.component_id, parameters);
123  }
124  if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
125  {
127  config.config, config.boundary_mesh, dof_table, variable_id,
128  *config.component_id, integration_order, parameters,
129  bulk_mesh.getDimension(), process, shapefunction_order);
130  }
131  if (type == "NormalTraction")
132  {
133  switch (bulk_mesh.getDimension())
134  {
135  case 2:
136  return ProcessLib::NormalTractionBoundaryCondition::
137  createNormalTractionBoundaryCondition<2>(
138  config.config, config.boundary_mesh, dof_table,
139  variable_id, integration_order, shapefunction_order,
140  parameters);
141  case 3:
142  return ProcessLib::NormalTractionBoundaryCondition::
143  createNormalTractionBoundaryCondition<3>(
144  config.config, config.boundary_mesh, dof_table,
145  variable_id, integration_order, shapefunction_order,
146  parameters);
147  default:
148  OGS_FATAL(
149  "NormalTractionBoundaryCondition can not be instantiated "
150  "for mesh dimensions other than two or three. "
151  "{}-dimensional mesh was given.",
152  bulk_mesh.getDimension());
153  }
154  }
155  if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
156  {
157  return ProcessLib::
160  config.config, dof_table, bulk_mesh, variable_id,
161  *config.component_id);
162  }
163  OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
164 }
165 
166 } // namespace ProcessLib
#define OGS_FATAL(...)
Definition: Error.h:26
T peekConfigParameter(std::string const &param) const
bool isAxiallySymmetric() const
Definition: Mesh.h:126
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:110
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)
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< BoundaryCondition > 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)
std::unique_ptr< SolutionDependentDirichletBoundaryCondition > createSolutionDependentDirichletBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, int const component_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters)
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< 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::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)
std::unique_ptr< PrimaryVariableConstraintDirichletBoundaryCondition > createPrimaryVariableConstraintDirichletBoundaryCondition(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)
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)
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)