OGS
ConstraintDirichletBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
14#include "ProcessLib/Process.h"
15
16namespace ProcessLib
17{
19{
20 IntegrationPointData(double const& detJ,
21 double const& integral_measure,
22 double const& integration_weight,
23 MathLib::Point3d&& bulk_element_point_)
24 : detJ_times_integralMeasure_times_weight(detJ * integral_measure *
25 integration_weight),
26 bulk_element_point(bulk_element_point_)
27 {
28 }
29
32
34};
35
37{
38public:
40 default;
41
42 virtual double integrate(
43 std::vector<GlobalVector*> const& x, double const t,
44 std::function<Eigen::Vector3d(
45 std::size_t const, MathLib::Point3d const&, double const,
46 std::vector<GlobalVector*> const&)> const& getFlux) = 0;
47};
48
49template <typename ShapeFunction, int GlobalDim>
52{
53protected:
57
58public:
67 MeshLib::Element const& surface_element,
68 std::size_t /* local_matrix_size */,
69 NumLib::GenericIntegrationMethod const& integration_method,
70 bool const is_axially_symmetric, MeshLib::Mesh const& bulk_mesh,
71 std::vector<std::pair<std::size_t, unsigned>> bulk_ids)
72 : _surface_element(surface_element),
73 _integration_method(integration_method),
74 _bulk_element_id(bulk_ids[_surface_element.getID()].first),
75 _surface_element_normal(MeshLib::calculateNormalizedSurfaceNormal(
76 _surface_element, *(bulk_mesh.getElements()[_bulk_element_id])))
77 {
78 auto const shape_matrices =
81 _surface_element, is_axially_symmetric, _integration_method);
82
83 auto const bulk_face_id = bulk_ids[_surface_element.getID()].second;
84 auto const& bulk_element = *bulk_mesh.getElement(_bulk_element_id);
85
86 auto const n_integration_points =
87 _integration_method.getNumberOfPoints();
88 _ip_data.reserve(n_integration_points);
89
90 for (unsigned ip = 0; ip < n_integration_points; ++ip)
91 {
92 auto const& wp = _integration_method.getWeightedPoint(ip);
93 auto bulk_element_point =
94 MeshLib::getBulkElementPoint(bulk_element, bulk_face_id, wp);
95 _ip_data.emplace_back(shape_matrices[ip].detJ,
96 shape_matrices[ip].integralMeasure,
97 wp.getWeight(),
98 std::move(bulk_element_point));
99 }
100 }
101
108 double integrate(
109 std::vector<GlobalVector*> const& x, double const t,
110 std::function<Eigen::Vector3d(
111 std::size_t const, MathLib::Point3d const&, double const,
112 std::vector<GlobalVector*> const&)> const& getFlux) override
113 {
114 auto const n_integration_points =
115 _integration_method.getNumberOfPoints();
116 // integrated_value +=
117 // int_{\Gamma_e} \alpha \cdot flux \cdot normal \d \Gamma
118 double integrated_value = 0;
119 for (unsigned ip = 0; ip < n_integration_points; ip++)
120 {
121 auto const bulk_flux = getFlux(
122 _bulk_element_id, _ip_data[ip].bulk_element_point, t, x);
123
124 // TODO find solution for 2d case
125 double const bulk_grad_times_normal(
126 Eigen::Map<Eigen::RowVectorXd const>(bulk_flux.data(),
127 bulk_flux.size())
129
130 integrated_value +=
131 bulk_grad_times_normal *
132 _ip_data[ip].detJ_times_integralMeasure_times_weight;
133 }
134 return integrated_value;
135 }
136
137private:
139
140 std::vector<IntegrationPointData> _ip_data;
141
143 std::size_t const _bulk_element_id;
144 Eigen::Vector3d const _surface_element_normal;
145};
146
147} // namespace ProcessLib
EigenFixedShapeMatrixPolicy< ShapeFunction, GlobalDim > ShapeMatrixPolicyType
const Element * getElement(std::size_t idx) const
Get the element with the given index.
Definition Mesh.h:85
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_)