OGS 6.2.1-97-g73d1aeda3
GenericNaturalBoundaryCondition-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 GenericNaturalBoundaryCondition<BoundaryConditionData,
20  LocalAssemblerImplementation>::
21  GenericNaturalBoundaryCondition(
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  if (!_bc_mesh.getProperties().template existsPropertyVector<std::size_t>(
54  "bulk_node_ids"))
55  {
56  OGS_FATAL(
57  "The required bulk node ids map does not exist in the boundary "
58  "mesh '%s'.",
59  _bc_mesh.getName().c_str());
60  }
61 
62  std::vector<MeshLib::Node*> const& bc_nodes = _bc_mesh.getNodes();
63  DBUG("Found %d nodes for Natural BCs for the variable %d and component %d",
64  bc_nodes.size(), variable_id, component_id);
65 
66  MeshLib::MeshSubset bc_mesh_subset(_bc_mesh, bc_nodes);
67 
68  // Create local DOF table from the BC mesh subset for the given variable and
69  // component id.
71  variable_id, {component_id}, std::move(bc_mesh_subset)));
72 
73  createLocalAssemblers<LocalAssemblerImplementation>(
75  shapefunction_order, _local_assemblers, _bc_mesh.isAxiallySymmetric(),
76  integration_order, _data);
77 }
78 
79 template <typename BoundaryConditionData,
80  template <typename, typename, unsigned>
81  class LocalAssemblerImplementation>
83  BoundaryConditionData,
84  LocalAssemblerImplementation>::applyNaturalBC(const double t,
85  const GlobalVector& x,
86  GlobalMatrix& K,
87  GlobalVector& b,
88  GlobalMatrix* Jac)
89 {
92  _local_assemblers, *_dof_table_boundary, t, x, K, b, Jac);
93 }
94 
95 } // namespace ProcessLib
MeshLib::Mesh const & _bc_mesh
A lower-dimensional mesh on which the boundary condition is defined.
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
MeshLib::Properties & getProperties()
Definition: Mesh.h:134
bool isAxiallySymmetric() const
Definition: Mesh.h:137
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _dof_table_boundary
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:102
virtual void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, const GlobalVector &x, GlobalMatrix &K, GlobalVector &b, GlobalMatrix *Jac)=0
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
std::vector< std::unique_ptr< GenericNaturalBoundaryConditionLocalAssemblerInterface > > _local_assemblers
Local assemblers for each element of number of _elements.
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:63
void applyNaturalBC(const double t, GlobalVector const &x, GlobalMatrix &K, GlobalVector &b, GlobalMatrix *Jac) override
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26
BoundaryConditionData _data
Data used in the assembly of the specific boundary condition.