OGS
NeumannBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <typeinfo>
14
21
22namespace ProcessLib
23{
29
30template <typename ShapeFunction, int GlobalDim>
33 GlobalDim>
34{
35 using Base =
39
40public:
44 MeshLib::Element const& e,
45 std::size_t const local_matrix_size,
46 NumLib::GenericIntegrationMethod const& integration_method,
47 bool const is_axially_symmetric,
49 : Base(e, is_axially_symmetric, integration_method),
50 _data(data),
51 _local_rhs(local_matrix_size)
52 {
53 }
54
55 void assemble(std::size_t const id,
56 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
57 double const t, std::vector<GlobalVector*> const& /*x*/,
58 int const /*process_id*/, GlobalMatrix* /*K*/,
59 GlobalVector& b, GlobalMatrix* /*Jac*/) override
60 {
61 _local_rhs.setZero();
62
63 unsigned const n_integration_points =
65
66 NodalVectorType parameter_node_values;
69 {
70 // Get element nodes for the interpolation from nodes to integration
71 // point.
72 parameter_node_values =
75 .template topRows<
76 ShapeFunction::MeshElement::n_all_nodes>();
77 }
78
79 double integral_measure = 1.0;
80 for (unsigned ip = 0; ip < n_integration_points; ip++)
81 {
82 auto const& ip_data = Base::_ns_and_weights[ip];
83 auto const& N = ip_data.N;
84 auto const& w = ip_data.weight;
85
86 ParameterLib::SpatialPosition const position{
87 std::nullopt, Base::_element.getID(), ip,
91 Base::_element, N))};
92
94 {
95 integral_measure = (*_data.integral_measure)(t, position)[0];
96 }
99 {
100 _local_rhs.noalias() +=
101 N * parameter_node_values.dot(N) * w * integral_measure;
102 }
103 else
104 {
105 auto const value = _data.neumann_bc_parameter(t, position)[0];
106 _local_rhs.noalias() += N * value * w * integral_measure;
107 }
108 }
109
110 auto const indices = NumLib::getIndices(id, dof_table_boundary);
111 b.add(indices, _local_rhs);
112 }
113
114private:
116
118
119public:
121};
122
123} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:76
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
std::vector< NAndWeight, Eigen::aligned_allocator< NAndWeight > > const _ns_and_weights
NeumannBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, 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
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)
A parameter represented by a mesh property vector.
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:164
ParameterLib::Parameter< double > const & neumann_bc_parameter
ParameterLib::Parameter< double > const *const integral_measure