Skip to content

Commit 870304d

Browse files
authored
[GeoMechanicsApplication] Lumped integration for interface elements (#13590)
Lumped integration scheme for triangular and quadrilateral elements, with unit tests.
1 parent b8d0bcd commit 870304d

4 files changed

Lines changed: 316 additions & 39 deletions

File tree

applications/GeoMechanicsApplication/custom_elements/lobatto_integration_scheme.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ Geo::IntegrationPointVectorType LobattoIntegrationScheme::CreateIntegrationPoint
3636
// instance, here: https://en.wikipedia.org/wiki/Gaussian_quadrature#Gauss%E2%80%93Lobatto_rules
3737
switch (NumberOfPoints) {
3838
case 2:
39-
return {{-1.0, 1.0}, {1.0, 1.0}};
39+
return {{Point(-1.0), 1.0}, {Point(1.0), 1.0}};
4040

4141
case 3:
42-
return {{-1.0, 1.0 / 3.0}, {0.0, 4.0 / 3.0}, {1.0, 1.0 / 3.0}};
42+
return {{Point(-1.0), 1.0 / 3.0}, {Point(0.0), 4.0 / 3.0}, {Point(1.0), 1.0 / 3.0}};
4343

4444
default:
4545
KRATOS_ERROR << "Can't construct Lobatto integration scheme: no support for "
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// KRATOS___
2+
// // ) )
3+
// // ___ ___
4+
// // ____ //___) ) // ) )
5+
// // / / // // / /
6+
// ((____/ / ((____ ((___/ / MECHANICS
7+
//
8+
// License: geo_mechanics_application/license.txt
9+
//
10+
// Main authors: Wijtze Pieter Kikstra
11+
//
12+
13+
#include "lumped_integration_scheme.h"
14+
15+
#include "geometries/geometry.h"
16+
#include "geometries/quadrilateral_2d_4.h"
17+
#include "geometries/quadrilateral_2d_8.h"
18+
#include "geometries/triangle_2d_3.h"
19+
#include "geometries/triangle_2d_6.h"
20+
#include "includes/node.h"
21+
22+
namespace
23+
{
24+
25+
using namespace Kratos;
26+
27+
template <typename GeometryType>
28+
Geo::IntegrationPointVectorType MakeLumpedIntegrationPointsVector(const std::vector<Point>& rPoints)
29+
{
30+
std::vector<std::size_t> node_ids(rPoints.size());
31+
std::iota(node_ids.begin(), node_ids.end(), std::size_t{1});
32+
auto node_ptrs = Geometry<Node>::PointsArrayType{};
33+
for (auto i = std::size_t{0}; i < node_ids.size(); ++i) {
34+
node_ptrs.push_back(make_intrusive<Node>(node_ids[i], rPoints[i]));
35+
}
36+
37+
auto geom = GeometryType{node_ptrs};
38+
auto lumping_factors = Vector{};
39+
geom.LumpingFactors(lumping_factors, Geometry<Node>::LumpingMethods::DIAGONAL_SCALING);
40+
41+
auto make_integration_point = [](const Point& rPoint, double Weight) {
42+
return Geo::IntegrationPointType{rPoint, Weight};
43+
};
44+
Geo::IntegrationPointVectorType result;
45+
std::transform(rPoints.begin(), rPoints.end(), lumping_factors.cbegin(),
46+
std::back_inserter(result), make_integration_point);
47+
return result;
48+
}
49+
50+
} // namespace
51+
52+
namespace Kratos
53+
{
54+
55+
LumpedIntegrationScheme::LumpedIntegrationScheme(std::size_t NumberOfPoints)
56+
: mIntegrationPoints(CreateIntegrationPoints(NumberOfPoints))
57+
{
58+
}
59+
60+
std::size_t LumpedIntegrationScheme::GetNumberOfIntegrationPoints() const
61+
{
62+
return mIntegrationPoints.size();
63+
}
64+
65+
const Geo::IntegrationPointVectorType& LumpedIntegrationScheme::GetIntegrationPoints() const
66+
{
67+
return mIntegrationPoints;
68+
}
69+
70+
Geo::IntegrationPointVectorType LumpedIntegrationScheme::CreateIntegrationPoints(std::size_t NumberOfPoints)
71+
{
72+
// Integration scheme used for planar interface elements in GeoMechanicsApplication
73+
// locations coincide with node-pairs, numbering follows the node-pairs too, weights as in lumped mass matrix from diagonal scaling of a surface element ( see geometry.h )
74+
switch (NumberOfPoints) {
75+
case 3: {
76+
const auto points = std::vector{Point(0.0, 0.0), Point(1.0, 0.0), Point(0.0, 1.0)};
77+
return MakeLumpedIntegrationPointsVector<Triangle2D3<Node>>(points);
78+
}
79+
case 4: {
80+
const auto points =
81+
std::vector{Point(-1.0, -1.0), Point(1.0, -1.0), Point(1.0, 1.0), Point(-1.0, 1.0)};
82+
return MakeLumpedIntegrationPointsVector<Quadrilateral2D4<Node>>(points);
83+
}
84+
case 6: {
85+
const auto points = std::vector{Point(0.0, 0.0), Point(1.0, 0.0), Point(0.0, 1.0),
86+
Point(0.5, 0.0), Point(0.5, 0.5), Point(0.0, 0.5)};
87+
return MakeLumpedIntegrationPointsVector<Triangle2D6<Node>>(points);
88+
}
89+
case 8: {
90+
const auto points =
91+
std::vector{Point(-1.0, -1.0), Point(1.0, -1.0), Point(1.0, 1.0), Point(-1.0, 1.0),
92+
Point(0.0, -1.0), Point(1.0, 0.0), Point(0.0, 1.0), Point(-1.0, 0.0)};
93+
return MakeLumpedIntegrationPointsVector<Quadrilateral2D8<Node>>(points);
94+
}
95+
default:
96+
KRATOS_ERROR << "Can't construct Lumped integration scheme: no support for "
97+
<< NumberOfPoints << " point(s)" << std::endl;
98+
}
99+
}
100+
101+
} // namespace Kratos
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// KRATOS___
2+
// // ) )
3+
// // ___ ___
4+
// // ____ //___) ) // ) )
5+
// // / / // // / /
6+
// ((____/ / ((____ ((___/ / MECHANICS
7+
//
8+
// License: geo_mechanics_application/license.txt
9+
//
10+
// Main authors: Wijtze Pieter Kikstra
11+
//
12+
13+
#pragma once
14+
15+
#include "includes/kratos_export_api.h"
16+
#include "integration_scheme.h"
17+
18+
namespace Kratos
19+
{
20+
/**
21+
* @Class LumpedIntegrationScheme
22+
* @brief Integration scheme used for planar interface elements in GeoMechanicsApplication
23+
* @details Integration point locations coincide with node-pairs, numbering follows the node-pairs too. Integrations weights as in lumped mass matrix from diagonal scaling of a surface element ( see geometry.h )
24+
* @author Wijtze Pieter Kikstra
25+
*/
26+
class KRATOS_API(GEO_MECHANICS_APPLICATION) LumpedIntegrationScheme : public IntegrationScheme
27+
{
28+
public:
29+
explicit LumpedIntegrationScheme(std::size_t NumberOfPoints);
30+
~LumpedIntegrationScheme() override = default;
31+
32+
[[nodiscard]] std::size_t GetNumberOfIntegrationPoints() const override;
33+
[[nodiscard]] const Geo::IntegrationPointVectorType& GetIntegrationPoints() const override;
34+
35+
private:
36+
static Geo::IntegrationPointVectorType CreateIntegrationPoints(std::size_t NumberOfPoints);
37+
38+
Geo::IntegrationPointVectorType mIntegrationPoints;
39+
};
40+
41+
} // namespace Kratos

0 commit comments

Comments
 (0)