OGS 6.1.0-1721-g6382411ad
GenericNonuniformNaturalBoundaryCondition-impl.h
Go to the documentation of this file.
1 
12 
13 namespace ProcessLib
14 {
15 template <typename BoundaryConditionData,
16  template <typename, typename, unsigned>
17  class LocalAssemblerImplementation>
18 template <typename Data>
19 GenericNonuniformNaturalBoundaryCondition<BoundaryConditionData,
20  LocalAssemblerImplementation>::
21  GenericNonuniformNaturalBoundaryCondition(
22  unsigned const integration_order, unsigned const shapefunction_order,
23  NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
24  int const variable_id, int const component_id,
25  unsigned const global_dim, MeshLib::Mesh const& bc_mesh, Data&& data)
26  : _data(std::forward<Data>(data)), _bc_mesh(bc_mesh)
27 {
28  static_assert(std::is_same<typename std::decay<BoundaryConditionData>::type,
29  typename std::decay<Data>::type>::value,
30  "Type mismatch between declared and passed BC data.");
31 
32  // check basic data consistency
33  if (variable_id >=
34  static_cast<int>(dof_table_bulk.getNumberOfVariables()) ||
35  component_id >=
36  dof_table_bulk.getNumberOfVariableComponents(variable_id))
37  {
38  OGS_FATAL(
39  "Variable id or component id too high. Actual values: (%d, %d), "
40  "maximum values: (%d, %d).",
41  variable_id, component_id, dof_table_bulk.getNumberOfVariables(),
42  dof_table_bulk.getNumberOfVariableComponents(variable_id));
43  }
44 
45  if (_bc_mesh.getDimension() + 1 != global_dim)
46  {
47  OGS_FATAL(
48  "The dimension of the given boundary mesh (%d) is not by one lower "
49  "than the bulk dimension (%d).",
50  _bc_mesh.getDimension(), global_dim);
51  }
52 
53  std::vector<MeshLib::Node*> const& bc_nodes = _bc_mesh.getNodes();
54  DBUG("Found %d nodes for Natural BCs for the variable %d and component %d",
55  bc_nodes.size(), variable_id, component_id);
56 
57  MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);
58 
59  // Create local DOF table from the BC mesh subset for the given variable and
60  // component id.
62  variable_id, {component_id}, std::move(bc_mesh_subset)));
63 
64  createLocalAssemblers<LocalAssemblerImplementation>(
66  shapefunction_order, _local_assemblers, _bc_mesh.isAxiallySymmetric(),
67  integration_order, _data);
68 }
69 
70 template <typename BoundaryConditionData,
71  template <typename, typename, unsigned>
72  class LocalAssemblerImplementation>
74  BoundaryConditionData,
75  LocalAssemblerImplementation>::applyNaturalBC(const double t,
76  const GlobalVector& x,
77  GlobalMatrix& K,
78  GlobalVector& b,
79  GlobalMatrix* Jac)
80 {
83  assemble,
84  _local_assemblers, *_dof_table_boundary, t, x, K, b, Jac);
85 }
86 
87 } // namespace ProcessLib
void applyNaturalBC(const double t, GlobalVector const &x, GlobalMatrix &K, GlobalVector &b, GlobalMatrix *Jac) override
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)
int getNumberOfVariableComponents(int variable_id) const
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:105
BoundaryConditionData _data
Data used in the assembly of the specific boundary condition.
MeshLib::Mesh const & _bc_mesh
A lower-dimensional mesh on which the boundary condition is defined.
bool isAxiallySymmetric() const
Definition: Mesh.h:137
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:108
LocalToGlobalIndexMap * deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _dof_table_boundary
std::vector< std::unique_ptr< GenericNonuniformNaturalBoundaryConditionLocalAssemblerInterface > > _local_assemblers
Local assemblers for each element of the boundary mesh.