OGS
RobinBoundaryCondition.cpp
Go to the documentation of this file.
1
12
13#include "ParameterLib/Utils.h"
14
15namespace ProcessLib
16{
17std::unique_ptr<RobinBoundaryCondition> createRobinBoundaryCondition(
18 BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
19 NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
20 int const component_id, unsigned const integration_order,
21 unsigned const shapefunction_order, unsigned const global_dim,
22 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
23{
24 DBUG("Constructing RobinBcConfig from config.");
26 config.checkConfigParameter("type", "Robin");
27
28 if (bc_mesh.getDimension() >= global_dim)
29 {
31 "The dimension ({:d}) of the given boundary mesh '{:s}' is not "
32 "lower than the bulk dimension ({:d}).",
33 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
34 }
35
37 auto const alpha_name = config.getConfigParameter<std::string>("alpha");
39 auto const u_0_name = config.getConfigParameter<std::string>("u_0");
40
41 auto const& alpha = ParameterLib::findParameter<double>(
42 alpha_name, parameters, 1, &bc_mesh);
43 auto const& u_0 =
44 ParameterLib::findParameter<double>(u_0_name, parameters, 1, &bc_mesh);
45
46 ParameterLib::Parameter<double> const* integral_measure(nullptr);
47 if (global_dim - bc_mesh.getDimension() != 1)
48 {
49 auto const area_parameter_name =
51 config.getConfigParameter<std::string>("area_parameter");
52 DBUG("area parameter name '{:s}'", area_parameter_name);
53 integral_measure = &ParameterLib::findParameter<double>(
54 area_parameter_name, parameters, 1, &bc_mesh);
55 }
56
57 // In case of partitioned mesh the boundary could be empty, i.e. there is no
58 // boundary condition.
59#ifdef USE_PETSC
60 // This can be extracted to createBoundaryCondition() but then the config
61 // parameters are not read and will cause an error.
62 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
63 // subtree and move the code up in createBoundaryCondition().
64 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
65 bc_mesh.getNumberOfElements() == 0)
66 {
67 return nullptr;
68 }
69#endif // USE_PETSC
70
71 return std::make_unique<RobinBoundaryCondition>(
72 integration_order, shapefunction_order, dof_table, variable_id,
73 component_id, global_dim, bc_mesh,
74 RobinBoundaryConditionData{alpha, u_0, integral_measure});
75}
76
77} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
const std::string getName() const
Get name of the mesh.
Definition Mesh.h:103
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:100
std::size_t getNumberOfElements() const
Get the number of elements.
Definition Mesh.h:97
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)