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 
20 namespace ProcessLib
21 {
23 {
24 template <int GlobalDim,
25  template <typename, typename, int> class 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.
52  variable_id, component_ids, std::move(bc_mesh_subset));
53 
55  GlobalDim, LocalAssemblerImplementation>(
56  *_dof_table_boundary, shapefunction_order, _bc_mesh.getElements(),
58  _pressure);
59 }
60 
61 template <int GlobalDim,
62  template <typename, typename, int> class LocalAssemblerImplementation>
64  applyNaturalBC(const double t, std::vector<GlobalVector*> const& x,
65  int const /*process_id*/, GlobalMatrix& K, GlobalVector& b,
66  GlobalMatrix* Jac)
67 {
70  _local_assemblers, *_dof_table_boundary, t, x, K, b, Jac);
71 }
72 
73 template <int GlobalDim>
74 std::unique_ptr<NormalTractionBoundaryCondition<
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(char const *fmt, Args const &... args)
Definition: Logging.h:27
void checkConfigParameter(std::string const &param, T const &value) const
T getConfigParameter(std::string const &param) const
Global vector based on Eigen vector.
Definition: EigenVector.h:28
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26
bool isAxiallySymmetric() const
Definition: Mesh.h:126
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:95
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
int getNumberOfVariableComponents(int variable_id) const
std::unique_ptr< LocalToGlobalIndexMap > deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
virtual void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &, GlobalMatrix &, GlobalVector &b, GlobalMatrix *)=0
unsigned const _integration_order
Integration order for integration over the lower-dimensional elements.
std::vector< std::unique_ptr< NormalTractionBoundaryConditionLocalAssemblerInterface > > _local_assemblers
Local assemblers for each element of number of _elements.
static const double t
void createLocalAssemblers(NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
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)