OGS
NormalTractionBoundaryCondition-impl.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <numeric>
14
17#include "ParameterLib/Utils.h"
19
20namespace ProcessLib
21{
23{
24template <int GlobalDim, template <typename /* shp fct */, int /* global dim */>
25 class LocalAssemblerImplementation>
26NormalTractionBoundaryCondition<GlobalDim, LocalAssemblerImplementation>::
28 unsigned const integration_order, unsigned const shapefunction_order,
29 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
30 int const variable_id, MeshLib::Mesh const& bc_mesh,
31 ParameterLib::Parameter<double> const& pressure)
32 : _bc_mesh(bc_mesh),
33 _integration_order(integration_order),
34 _pressure(pressure)
35{
36 // Create component ids vector for the current variable.
37 auto const& number_of_components =
38 dof_table_bulk.getNumberOfVariableComponents(variable_id);
39 std::vector<int> component_ids(number_of_components);
40 std::iota(std::begin(component_ids), std::end(component_ids), 0);
41
42 // BC mesh subset creation
43 std::vector<MeshLib::Node*> const bc_nodes = _bc_mesh.getNodes();
44 DBUG("Found {:d} nodes for Natural BCs for the variable {:d}",
45 bc_nodes.size(), variable_id);
46
47 MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);
48
49 // Create local DOF table from the BC mesh subset for the given variable and
50 // component ids.
51 _dof_table_boundary = dof_table_bulk.deriveBoundaryConstrainedMap(
52 variable_id, component_ids, std::move(bc_mesh_subset));
53
54 BoundaryConditionAndSourceTerm::detail::createLocalAssemblers<
55 GlobalDim, LocalAssemblerImplementation>(
56 *_dof_table_boundary, shapefunction_order, _bc_mesh.getElements(),
57 _local_assemblers, NumLib::IntegrationOrder{integration_order},
58 _bc_mesh.isAxiallySymmetric(), _pressure);
59}
60
61template <int GlobalDim, template <typename /* shp fct */, int /* global dim */>
62 class LocalAssemblerImplementation>
63void NormalTractionBoundaryCondition<GlobalDim, LocalAssemblerImplementation>::
64 applyNaturalBC(const double t, std::vector<GlobalVector*> const& x,
65 int const /*process_id*/, GlobalMatrix* K, GlobalVector& b,
66 GlobalMatrix* Jac)
67{
69 &NormalTractionBoundaryConditionLocalAssemblerInterface::assemble,
70 _local_assemblers, *_dof_table_boundary, t, x, K, b, Jac);
71}
72
73template <int GlobalDim>
77 BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
78 NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
79 unsigned const integration_order, unsigned const shapefunction_order,
80 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
81{
82 DBUG("Constructing NormalTractionBoundaryCondition from config.");
84 config.checkConfigParameter("type", "NormalTraction");
85
86 auto const parameter_name =
88 config.getConfigParameter<std::string>("parameter");
89 DBUG("Using parameter {:s}", parameter_name);
90
91 auto const& pressure = ParameterLib::findParameter<double>(
92 parameter_name, parameters, 1, &bc_mesh);
93 return std::make_unique<NormalTractionBoundaryCondition<
95 integration_order, shapefunction_order, dof_table, variable_id, bc_mesh,
96 pressure);
97}
98
99} // namespace NormalTractionBoundaryCondition
100} // namespace ProcessLib
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
A subset of nodes on a single mesh.
Definition MeshSubset.h:26
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)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)