OGS
CreateBoundaryCondition.cpp
Go to the documentation of this file.
1
12
14#include "BoundaryCondition.h"
29
30namespace ProcessLib
31{
32std::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 [[maybe_unused]] std::vector<std::reference_wrapper<ProcessVariable>> const&
40 all_process_variables_for_this_process,
41 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
42{
43 // Surface mesh and bulk mesh must have equal axial symmetry flags!
44 if (config.boundary_mesh.isAxiallySymmetric() !=
45 bulk_mesh.isAxiallySymmetric())
46 {
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 (bool const component_id_required = type != "NormalTraction";
58 component_id_required && !config.component_id.has_value())
59 {
61 "Specifying the component id (<component>) for a boundary "
62 "condition of type {} is mandatory.",
63 type);
64 }
65
66 if (type == "Dirichlet")
67 {
69 config.config, config.boundary_mesh, dof_table, variable_id,
70 *config.component_id, parameters);
71 }
72 if (type == "DirichletWithinTimeInterval")
73 {
75 config.config, config.boundary_mesh, dof_table, variable_id,
76 *config.component_id, parameters);
77 }
78 if (type == "Neumann")
79 {
81 config.config, config.boundary_mesh, dof_table, variable_id,
82 *config.component_id, integration_order, shapefunction_order,
83 bulk_mesh.getDimension(), parameters);
84 }
85 if (type == "Robin")
86 {
88 config.config, config.boundary_mesh, dof_table, variable_id,
89 *config.component_id, integration_order, shapefunction_order,
90 bulk_mesh.getDimension(), parameters);
91 }
92 if (type == "VariableDependentNeumann")
93 {
95 config.config, config.boundary_mesh, dof_table, variable_id,
96 *config.component_id, integration_order, shapefunction_order,
97 bulk_mesh.getDimension(), parameters);
98 }
99
100 if (type == "Python")
101 {
103 config.config, config.boundary_mesh, dof_table, bulk_mesh,
104 variable_id, *config.component_id, integration_order,
105 shapefunction_order, all_process_variables_for_this_process);
106 }
107
108 //
109 // Special boundary conditions
110 //
111 if (type == "ConstraintDirichlet")
112 {
114 config.config, config.boundary_mesh, dof_table, variable_id,
115 integration_order, *config.component_id, parameters, process);
116 }
117 if (type == "PrimaryVariableConstraintDirichlet")
118 {
120 config.config, config.boundary_mesh, dof_table, variable_id,
121 *config.component_id, parameters);
122 }
123 if (type == "WellboreCompensateNeumann")
124 {
126 config.config, config.boundary_mesh, dof_table, variable_id,
127 *config.component_id, integration_order, shapefunction_order,
128 bulk_mesh.getDimension(), media);
129 }
130 if (type == "SolutionDependentDirichlet")
131 {
133 config.config, config.boundary_mesh, dof_table, variable_id,
134 *config.component_id, parameters);
135 }
136 if (type == "HCNonAdvectiveFreeComponentFlowBoundary")
137 {
139 config.config, config.boundary_mesh, dof_table, variable_id,
140 *config.component_id, integration_order, parameters,
141 bulk_mesh.getDimension(), process, shapefunction_order);
142 }
143 if (type == "NormalTraction")
144 {
145 switch (bulk_mesh.getDimension())
146 {
147 case 2:
150 config.config, config.boundary_mesh, dof_table,
151 variable_id, integration_order, shapefunction_order,
152 parameters);
153 case 3:
156 config.config, config.boundary_mesh, dof_table,
157 variable_id, integration_order, shapefunction_order,
158 parameters);
159 default:
160 OGS_FATAL(
161 "NormalTractionBoundaryCondition can not be instantiated "
162 "for mesh dimensions other than two or three. "
163 "{}-dimensional mesh was given.",
164 bulk_mesh.getDimension());
165 }
166 }
167 if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
168 {
169 return ProcessLib::
172 config.config, dof_table, bulk_mesh, variable_id,
173 *config.component_id);
174 }
175 OGS_FATAL("Unknown boundary condition type: `{:s}'.", type);
176}
177
178} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
T peekConfigParameter(std::string const &param) const
bool isAxiallySymmetric() const
Definition Mesh.h:137
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
std::unique_ptr< NormalTractionBoundaryCondition< GlobalDim, 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, 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< 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< 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< 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< WellboreCompensateNeumannBoundaryCondition > createWellboreCompensateNeumannBoundaryCondition(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::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
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< 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< 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< 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::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
std::unique_ptr< PythonBoundaryCondition > createPythonBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, MeshLib::Mesh const &bulk_mesh, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
Creates a new PythonBoundaryCondition object.
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< 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< 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)