|
| 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 |
0 commit comments