OGS
ConstraintDirichletBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1 
11 #pragma once
12 
15 #include "MeshLib/Elements/Utils.h"
19 #include "ParameterLib/Parameter.h"
20 #include "ProcessLib/Process.h"
21 
22 namespace ProcessLib
23 {
25 {
26  IntegrationPointData(double const& detJ,
27  double const& integral_measure,
28  double const& integration_weight,
29  MathLib::Point3d&& bulk_element_point_)
30  : detJ_times_integralMeasure_times_weight(detJ * integral_measure *
31  integration_weight),
32  bulk_element_point(bulk_element_point_)
33  {
34  }
35 
38 
40 };
41 
43 {
44 public:
46  default;
47 
48  virtual double integrate(
49  std::vector<GlobalVector*> const& x, double const t,
50  std::function<Eigen::Vector3d(
51  std::size_t const, MathLib::Point3d const&, double const,
52  std::vector<GlobalVector*> const&)> const& getFlux) = 0;
53 };
54 
55 template <typename ShapeFunction, typename IntegrationMethod, int GlobalDim>
58 {
59 protected:
63 
64 public:
73  MeshLib::Element const& surface_element,
74  std::size_t /* local_matrix_size */, bool const is_axially_symmetric,
75  unsigned const integration_order, MeshLib::Mesh const& bulk_mesh,
76  std::vector<std::pair<std::size_t, unsigned>> bulk_ids)
77  : _surface_element(surface_element),
78  _integration_method(integration_order),
79  _bulk_element_id(bulk_ids[_surface_element.getID()].first),
81  _surface_element, *(bulk_mesh.getElements()[_bulk_element_id])))
82  {
83  auto const shape_matrices =
85  GlobalDim, NumLib::ShapeMatrixType::N_J>(
86  _surface_element, is_axially_symmetric, _integration_method);
87 
88  auto const bulk_face_id = bulk_ids[_surface_element.getID()].second;
89 
90  auto const n_integration_points =
91  _integration_method.getNumberOfPoints();
92  _ip_data.reserve(n_integration_points);
93 
94  for (unsigned ip = 0; ip < n_integration_points; ++ip)
95  {
96  auto const& wp = _integration_method.getWeightedPoint(ip);
97  auto bulk_element_point = MeshLib::getBulkElementPoint(
98  bulk_mesh, _bulk_element_id, bulk_face_id, wp);
99  _ip_data.emplace_back(shape_matrices[ip].detJ,
100  shape_matrices[ip].integralMeasure,
101  wp.getWeight(),
102  std::move(bulk_element_point));
103  }
104  }
105 
112  double integrate(
113  std::vector<GlobalVector*> const& x, double const t,
114  std::function<Eigen::Vector3d(
115  std::size_t const, MathLib::Point3d const&, double const,
116  std::vector<GlobalVector*> const&)> const& getFlux) override
117  {
118  auto const n_integration_points =
119  _integration_method.getNumberOfPoints();
120  // integrated_value +=
121  // int_{\Gamma_e} \alpha \cdot flux \cdot normal \d \Gamma
122  double integrated_value = 0;
123  for (unsigned ip = 0; ip < n_integration_points; ip++)
124  {
125  auto const bulk_flux = getFlux(
126  _bulk_element_id, _ip_data[ip].bulk_element_point, t, x);
127 
128  // TODO find solution for 2d case
129  double const bulk_grad_times_normal(
130  Eigen::Map<Eigen::RowVectorXd const>(bulk_flux.data(),
131  bulk_flux.size())
133 
134  integrated_value +=
135  bulk_grad_times_normal *
136  _ip_data[ip].detJ_times_integralMeasure_times_weight;
137  }
138  return integrated_value;
139  }
140 
141 private:
143 
144  std::vector<IntegrationPointData> _ip_data;
145 
146  IntegrationMethod const _integration_method;
147  std::size_t const _bulk_element_id;
148  Eigen::Vector3d const _surface_element_normal;
149 };
150 
151 } // namespace ProcessLib
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:82
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
ConstraintDirichletBoundaryConditionLocalAssembler(MeshLib::Element const &surface_element, std::size_t, bool const is_axially_symmetric, unsigned const integration_order, MeshLib::Mesh const &bulk_mesh, std::vector< std::pair< std::size_t, unsigned >> bulk_ids)
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
MathLib::Point3d getBulkElementPoint(Tri const &, std::size_t const face_id, MathLib::WeightedPoint1D const &wp)
Eigen::Vector3d calculateNormalizedSurfaceNormal(MeshLib::Element const &surface_element, MeshLib::Element const &bulk_element)
Definition: Utils.h:44
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_)