OGS
ConstraintDirichletBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
21#include "ProcessLib/Process.h"
22
23namespace ProcessLib
24{
26{
27 IntegrationPointData(double const& detJ,
28 double const& integral_measure,
29 double const& integration_weight,
30 MathLib::Point3d&& bulk_element_point_)
31 : detJ_times_integralMeasure_times_weight(detJ * integral_measure *
32 integration_weight),
33 bulk_element_point(bulk_element_point_)
34 {
35 }
36
39
41};
42
44{
45public:
47 default;
48
49 virtual double integrate(
50 std::vector<GlobalVector*> const& x, double const t,
51 std::function<Eigen::Vector3d(
52 std::size_t const, MathLib::Point3d const&, double const,
53 std::vector<GlobalVector*> const&)> const& getFlux) = 0;
54};
55
56template <typename ShapeFunction, int GlobalDim>
59{
60protected:
64
65public:
74 MeshLib::Element const& surface_element,
75 std::size_t /* local_matrix_size */,
76 NumLib::GenericIntegrationMethod const& integration_method,
77 bool const is_axially_symmetric, MeshLib::Mesh const& bulk_mesh,
78 std::vector<std::pair<std::size_t, unsigned>> bulk_ids)
79 : _surface_element(surface_element),
80 _integration_method(integration_method),
81 _bulk_element_id(bulk_ids[_surface_element.getID()].first),
82 _surface_element_normal(MeshLib::calculateNormalizedSurfaceNormal(
83 _surface_element, *(bulk_mesh.getElements()[_bulk_element_id])))
84 {
85 auto const shape_matrices =
88 _surface_element, is_axially_symmetric, _integration_method);
89
90 auto const bulk_face_id = bulk_ids[_surface_element.getID()].second;
91 auto const& bulk_element = *bulk_mesh.getElement(_bulk_element_id);
92
93 auto const n_integration_points =
95 _ip_data.reserve(n_integration_points);
96
97 for (unsigned ip = 0; ip < n_integration_points; ++ip)
98 {
99 auto const& wp = _integration_method.getWeightedPoint(ip);
100 auto bulk_element_point =
101 MeshLib::getBulkElementPoint(bulk_element, bulk_face_id, wp);
102 _ip_data.emplace_back(shape_matrices[ip].detJ,
103 shape_matrices[ip].integralMeasure,
104 wp.getWeight(),
105 std::move(bulk_element_point));
106 }
107 }
108
115 double integrate(
116 std::vector<GlobalVector*> const& x, double const t,
117 std::function<Eigen::Vector3d(
118 std::size_t const, MathLib::Point3d const&, double const,
119 std::vector<GlobalVector*> const&)> const& getFlux) override
120 {
121 auto const n_integration_points =
123 // integrated_value +=
124 // int_{\Gamma_e} \alpha \cdot flux \cdot normal \d \Gamma
125 double integrated_value = 0;
126 for (unsigned ip = 0; ip < n_integration_points; ip++)
127 {
128 auto const bulk_flux = getFlux(
129 _bulk_element_id, _ip_data[ip].bulk_element_point, t, x);
130
131 // TODO find solution for 2d case
132 double const bulk_grad_times_normal(
133 Eigen::Map<Eigen::RowVectorXd const>(bulk_flux.data(),
134 bulk_flux.size())
136
137 integrated_value +=
138 bulk_grad_times_normal *
139 _ip_data[ip].detJ_times_integralMeasure_times_weight;
140 }
141 return integrated_value;
142 }
143
144private:
146
147 std::vector<IntegrationPointData> _ip_data;
148
150 std::size_t const _bulk_element_id;
151 Eigen::Vector3d const _surface_element_normal;
152};
153
154} // namespace ProcessLib
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
const Element * getElement(std::size_t idx) const
Get the element with the given index.
Definition Mesh.h:94
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
virtual double integrate(std::vector< GlobalVector * > const &x, double const t, std::function< Eigen::Vector3d(std::size_t const, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &)> const &getFlux)=0
double integrate(std::vector< GlobalVector * > const &x, double const t, std::function< Eigen::Vector3d(std::size_t const, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &)> const &getFlux) override
ConstraintDirichletBoundaryConditionLocalAssembler(MeshLib::Element const &surface_element, std::size_t, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, MeshLib::Mesh const &bulk_mesh, std::vector< std::pair< std::size_t, unsigned > > bulk_ids)
MathLib::Point3d getBulkElementPoint(MeshLib::CellType const bulk_element_cell_type, std::size_t const bulk_face_id, MathLib::WeightedPoint const &point_on_face)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
@ N_J
calculates N, dNdr, J, and detJ
MatrixType< ShapeFunction::NPOINTS, ShapeFunction::NPOINTS > NodalMatrixType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
IntegrationPointData(double const &detJ, double const &integral_measure, double const &integration_weight, MathLib::Point3d &&bulk_element_point_)