OGS
NormalTractionBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
18
19namespace ProcessLib
20{
21namespace NormalTractionBoundaryCondition
22{
23template <typename ShapeMatricesType>
25{
27 typename ShapeMatricesType::ShapeMatrices::ShapeType const N_,
28 typename ShapeMatricesType::GlobalDimVectorType const n_,
29 double const integration_weight_)
30 : N(N_), n(n_), integration_weight(integration_weight_)
31 {
32 }
33
34 typename ShapeMatricesType::ShapeMatrices::ShapeType const N;
35 typename ShapeMatricesType::GlobalDimVectorType const n;
36 double const integration_weight;
37};
38
40{
41public:
42 virtual void assemble(
43 std::size_t const id,
44 NumLib::LocalToGlobalIndexMap const& dof_table_boundary, double const t,
45 std::vector<GlobalVector*> const& /*x*/, GlobalMatrix* /*K*/,
46 GlobalVector& b, GlobalMatrix* /*Jac*/) = 0;
48};
49
50template <typename ShapeFunctionDisplacement, int GlobalDim>
53{
54public:
59
61 MeshLib::Element const& e,
62 std::size_t const local_matrix_size,
63 NumLib::GenericIntegrationMethod const& integration_method,
64 bool const is_axially_symmetric,
65 ParameterLib::Parameter<double> const& pressure,
66 std::vector<Eigen::Vector3d> const& element_normals)
67 : _integration_method(integration_method),
68 _pressure(pressure),
69 _element(e)
70 {
71 _local_rhs.setZero(local_matrix_size);
72
73 unsigned const n_integration_points =
75
76 _ip_data.reserve(n_integration_points);
77
78 auto const shape_matrices_u =
79 NumLib::initShapeMatrices<ShapeFunctionDisplacement,
80 ShapeMatricesType, GlobalDim>(
81 e, is_axially_symmetric, _integration_method);
82
83 for (unsigned ip = 0; ip < n_integration_points; ip++)
84 {
85 double const integration_weight =
87 shape_matrices_u[ip].integralMeasure *
88 shape_matrices_u[ip].detJ;
89
90 _ip_data.emplace_back(shape_matrices_u[ip].N,
91 element_normals[e.getID()].head<GlobalDim>(),
92 integration_weight);
93 }
94 }
95
96 void assemble(std::size_t const id,
97 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
98 double const t, std::vector<GlobalVector*> const& /*x*/,
99 GlobalMatrix* /*K*/, GlobalVector& local_rhs,
100 GlobalMatrix* /*Jac*/) override
101 {
102 _local_rhs.setZero();
103
104 unsigned const n_integration_points =
106
107 NodalVectorType pressure =
109
110 for (unsigned ip = 0; ip < n_integration_points; ip++)
111 {
112 auto const& w = _ip_data[ip].integration_weight;
113 auto const& N = _ip_data[ip].N;
114 auto const& n = _ip_data[ip].n;
115
116 typename ShapeMatricesType::template MatrixType<GlobalDim,
118 N_u = ShapeMatricesType::template MatrixType<
119 GlobalDim, displacement_size>::Zero(GlobalDim,
121 for (int i = 0; i < GlobalDim; ++i)
122 {
123 N_u.template block<1, displacement_size / GlobalDim>(
124 i, i * displacement_size / GlobalDim)
125 .noalias() = N;
126 }
127
128 _local_rhs.noalias() -= n.transpose() * N_u * pressure.dot(N) * w;
129 }
130
131 auto const indices = NumLib::getIndices(id, dof_table_boundary);
132 local_rhs.add(indices, _local_rhs);
133 }
134
135private:
138
139 static const int displacement_size =
140 ShapeFunctionDisplacement::NPOINTS * GlobalDim;
141 std::vector<
143 Eigen::aligned_allocator<IntegrationPointData<ShapeMatricesType>>>
145
146 typename ShapeMatricesType::template VectorType<displacement_size>
148
150
151public:
153};
154
155} // namespace NormalTractionBoundaryCondition
156} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:26
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:77
constexpr double getWeight() const
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:91
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
virtual void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &, GlobalMatrix *, GlobalVector &b, GlobalMatrix *)=0
NormalTractionBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, ParameterLib::Parameter< double > const &pressure, std::vector< Eigen::Vector3d > const &element_normals)
void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &, GlobalMatrix *, GlobalVector &local_rhs, GlobalMatrix *) override
std::vector< IntegrationPointData< ShapeMatricesType >, Eigen::aligned_allocator< IntegrationPointData< ShapeMatricesType > > > _ip_data
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
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)
VectorType< GlobalDim > GlobalDimVectorType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
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
IntegrationPointData(typename ShapeMatricesType::ShapeMatrices::ShapeType const N_, typename ShapeMatricesType::GlobalDimVectorType const n_, double const integration_weight_)