OGS
NeumannBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1 
11 #pragma once
12 
17 #include "ParameterLib/Parameter.h"
18 
19 namespace ProcessLib
20 {
22 {
25 };
26 
27 template <typename ShapeFunction, typename IntegrationMethod, int GlobalDim>
30  ShapeFunction, IntegrationMethod, GlobalDim>
31 {
33  ShapeFunction, IntegrationMethod, GlobalDim>;
36 
37 public:
41  MeshLib::Element const& e,
42  std::size_t const local_matrix_size,
43  bool const is_axially_symmetric,
44  unsigned const integration_order,
45  NeumannBoundaryConditionData const& data)
46  : Base(e, is_axially_symmetric, integration_order),
47  _data(data),
48  _local_rhs(local_matrix_size)
49  {
50  }
51 
52  void assemble(std::size_t const id,
53  NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
54  double const t, std::vector<GlobalVector*> const& /*x*/,
55  int const /*process_id*/, GlobalMatrix& /*K*/,
56  GlobalVector& b, GlobalMatrix* /*Jac*/) override
57  {
58  _local_rhs.setZero();
59 
60  unsigned const n_integration_points =
61  Base::_integration_method.getNumberOfPoints();
62 
63  // Get element nodes for the interpolation from nodes to integration
64  // point.
65  NodalVectorType parameter_node_values =
68  .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
69 
70  double integral_measure = 1.0;
71  for (unsigned ip = 0; ip < n_integration_points; ip++)
72  {
73  auto const& ip_data = Base::_ns_and_weights[ip];
74  auto const& N = ip_data.N;
75  auto const& w = ip_data.weight;
76 
77  ParameterLib::SpatialPosition const position{
78  std::nullopt, Base::_element.getID(), ip,
80  NumLib::interpolateCoordinates<ShapeFunction,
82  Base::_element, N))};
83 
85  {
86  integral_measure = (*_data.integral_measure)(t, position)[0];
87  }
88  _local_rhs.noalias() +=
89  N * parameter_node_values.dot(N) * w * integral_measure;
90  }
91 
92  auto const indices = NumLib::getIndices(id, dof_table_boundary);
93  b.add(indices, _local_rhs);
94  }
95 
96 private:
98 
100 
101 public:
103 };
104 
105 } // namespace ProcessLib
Global vector based on Eigen vector.
Definition: EigenVector.h:26
void add(IndexType rowId, double v)
add entry
Definition: EigenVector.h:80
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:82
std::vector< NAndWeight, Eigen::aligned_allocator< NAndWeight > > const _ns_and_weights
NeumannBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const local_matrix_size, bool const is_axially_symmetric, unsigned const integration_order, NeumannBoundaryConditionData const &data)
void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &, int const, GlobalMatrix &, GlobalVector &b, GlobalMatrix *) override
MathLib::TemplatePoint< double, 3 > Point3d
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > getNodalValuesOnElement(MeshLib::Element const &element, double const t) const
Returns a matrix of values for all nodes of the given element.
Definition: Parameter.h:163
ParameterLib::Parameter< double > const & neumann_bc_parameter
ParameterLib::Parameter< double > const *const integral_measure