OGS
GenericNaturalBoundaryCondition-impl.h
Go to the documentation of this file.
1
13
14namespace ProcessLib
15{
16template <typename BoundaryConditionData,
17 template <typename /* shp fct */, int /* global dim */>
18 class LocalAssemblerImplementation>
19template <typename Data>
20GenericNaturalBoundaryCondition<BoundaryConditionData,
21 LocalAssemblerImplementation>::
23 unsigned const integration_order, unsigned const shapefunction_order,
24 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
25 int const variable_id, int const component_id,
26 unsigned const global_dim, MeshLib::Mesh const& bc_mesh, Data&& data)
27 : _data(std::forward<Data>(data)), _bc_mesh(bc_mesh)
28{
29 static_assert(std::is_same_v<typename std::decay_t<BoundaryConditionData>,
30 typename std::decay_t<Data>>,
31 "Type mismatch between declared and passed BC data.");
32
33 // check basic data consistency
34 if (variable_id >=
35 static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
36 component_id >=
37 dof_table_bulk.getNumberOfVariableComponents(variable_id))
38 {
40 "Variable id or component id too high. Actual values: ({:d}, "
41 "{:d}), "
42 "maximum values: ({:d}, {:d}).",
43 variable_id, component_id, dof_table_bulk.getNumberOfVariables(),
44 dof_table_bulk.getNumberOfVariableComponents(variable_id));
45 }
46
47 if (!_bc_mesh.getProperties().template existsPropertyVector<std::size_t>(
49 {
51 "The required bulk node ids map does not exist in the boundary "
52 "mesh '{:s}'.",
53 _bc_mesh.getName());
54 }
55
56 std::vector<MeshLib::Node*> const& bc_nodes = _bc_mesh.getNodes();
57 DBUG(
58 "Found {:d} nodes for Natural BCs for the variable {:d} and component "
59 "{:d}",
60 bc_nodes.size(), variable_id, component_id);
61
62 MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);
63
64 // Create local DOF table from the BC mesh subset for the given variable and
65 // component id.
66 _dof_table_boundary = dof_table_bulk.deriveBoundaryConstrainedMap(
67 variable_id, {component_id}, std::move(bc_mesh_subset));
68
69 BoundaryConditionAndSourceTerm::createLocalAssemblers<
70 LocalAssemblerImplementation>(
71 global_dim, _bc_mesh.getElements(), *_dof_table_boundary,
72 shapefunction_order, _local_assemblers,
73 NumLib::IntegrationOrder{integration_order},
74 _bc_mesh.isAxiallySymmetric(), _data);
75}
76
77template <typename BoundaryConditionData,
78 template <typename /* shp fct */, int /* global dim */>
79 class LocalAssemblerImplementation>
80void GenericNaturalBoundaryCondition<BoundaryConditionData,
81 LocalAssemblerImplementation>::
82 applyNaturalBC(const double t,
83 std::vector<GlobalVector*> const& x,
84 int const process_id,
85 GlobalMatrix* K,
86 GlobalVector& b,
87 GlobalMatrix* Jac)
88{
90 &GenericNaturalBoundaryConditionLocalAssemblerInterface::assemble,
91 _local_assemblers, *_dof_table_boundary, t, x, process_id, K, b, Jac);
92}
93
94} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
A subset of nodes on a single mesh.
Definition MeshSubset.h:26
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)
Definition Properties.h:188
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)