version 0.4.1
eas2d.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
10#pragma once
11
13
14namespace Ikarus::EAS {
15
19template <typename GEO>
20struct E0
21{
22 static constexpr int strainSize = GEO::mydimension * (GEO::mydimension + 1) / 2;
23 static constexpr int enhancedStrainSize = 0;
24 using MType = Eigen::Matrix<double, strainSize, enhancedStrainSize>;
25 using DType = Eigen::Matrix<double, enhancedStrainSize, enhancedStrainSize>;
26
27 E0() = default;
28 explicit E0(const GEO& /*geometry*/) {}
29
30 // returns an Eigen zero expression for optimization purposes
31 static auto calcM(const Dune::FieldVector<double, 2>& /*quadPos*/) { return MType::Zero(); }
32};
33
43template <typename GEO>
44struct Q1E4
45{
46 static constexpr int strainSize = 3;
47 static constexpr int enhancedStrainSize = 4;
48 using MType = Eigen::Matrix<double, strainSize, enhancedStrainSize>;
49 using DType = Eigen::Matrix<double, enhancedStrainSize, enhancedStrainSize>;
50
51 Q1E4() = default;
52 explicit Q1E4(const GEO& geometry)
53 : geometry_{std::make_optional<GEO>(geometry)},
54 T0InverseTransformed_{calcTransformationMatrix2D(geometry)} {}
55
56 auto calcM(const Dune::FieldVector<double, 2>& quadPos) const {
57 MType M;
59 const double xi = quadPos[0];
60 const double eta = quadPos[1];
61 M(0, 0) = 2 * xi - 1.0;
62 M(1, 1) = 2 * eta - 1.0;
63 M(2, 2) = 2 * xi - 1.0;
64 M(2, 3) = 2 * eta - 1.0;
65 const double detJ = geometry_->integrationElement(quadPos);
66 M = T0InverseTransformed_ / detJ * M;
67 return M;
68 }
69
70private:
71 std::optional<GEO> geometry_;
72 Eigen::Matrix3d T0InverseTransformed_;
73};
74
82template <typename GEO>
83struct Q1E5
84{
85 static constexpr int strainSize = 3;
86 static constexpr int enhancedStrainSize = 5;
87 using MType = Eigen::Matrix<double, strainSize, enhancedStrainSize>;
88 using DType = Eigen::Matrix<double, enhancedStrainSize, enhancedStrainSize>;
89
90 Q1E5() = default;
91 explicit Q1E5(const GEO& geometry)
92 : geometry_{std::make_optional<GEO>(geometry)},
93 T0InverseTransformed_{calcTransformationMatrix2D(geometry)} {}
94
95 auto calcM(const Dune::FieldVector<double, 2>& quadPos) const {
96 MType M;
97 M.setZero();
98 const double xi = quadPos[0];
99 const double eta = quadPos[1];
100 M(0, 0) = 2 * xi - 1.0;
101 M(1, 1) = 2 * eta - 1.0;
102 M(2, 2) = 2 * xi - 1.0;
103 M(2, 3) = 2 * eta - 1.0;
104 M(2, 4) = (2 * xi - 1.0) * (2 * eta - 1.0);
105 const double detJ = geometry_->integrationElement(quadPos);
106 M = T0InverseTransformed_ / detJ * M;
107 return M;
108 }
109
110private:
111 std::optional<GEO> geometry_;
112 Eigen::Matrix3d T0InverseTransformed_;
113};
114
122template <typename GEO>
123struct Q1E7
124{
125 static constexpr int strainSize = 3;
126 static constexpr int enhancedStrainSize = 7;
127 using MType = Eigen::Matrix<double, strainSize, enhancedStrainSize>;
128 using DType = Eigen::Matrix<double, enhancedStrainSize, enhancedStrainSize>;
129
130 Q1E7() = default;
131 explicit Q1E7(const GEO& geometry)
132 : geometry_{std::make_optional<GEO>(geometry)},
133 T0InverseTransformed_{calcTransformationMatrix2D(geometry)} {}
134
135 auto calcM(const Dune::FieldVector<double, 2>& quadPos) const {
136 MType M;
137 M.setZero();
138 const double xi = quadPos[0];
139 const double eta = quadPos[1];
140 M(0, 0) = 2 * xi - 1.0;
141 M(1, 1) = 2 * eta - 1.0;
142 M(2, 2) = 2 * xi - 1.0;
143 M(2, 3) = 2 * eta - 1.0;
144 M(0, 4) = (2 * xi - 1.0) * (2 * eta - 1.0);
145 M(1, 5) = (2 * xi - 1.0) * (2 * eta - 1.0);
146 M(2, 6) = (2 * xi - 1.0) * (2 * eta - 1.0);
147 const double detJ = geometry_->integrationElement(quadPos);
148 M = T0InverseTransformed_ / detJ * M;
149 return M;
150 }
151
152private:
153 std::optional<GEO> geometry_;
154 Eigen::Matrix3d T0InverseTransformed_;
155};
156
157} // namespace Ikarus::EAS
Helper for the Eigen::Tensor types.
STL namespace.
Eigen::Matrix3d calcTransformationMatrix2D(const Geometry &geometry)
Calculates the 2D transformation matrix.
Definition: tensorutils.hh:367
Definition: eas2d.hh:14
Dummy struct for displacement-based EAS elements, i.e. 0 enhanced modes.
Definition: eas2d.hh:21
static constexpr int strainSize
Definition: eas2d.hh:22
Eigen::Matrix< double, strainSize, enhancedStrainSize > MType
Definition: eas2d.hh:24
Eigen::Matrix< double, enhancedStrainSize, enhancedStrainSize > DType
Definition: eas2d.hh:25
static auto calcM(const Dune::FieldVector< double, 2 > &)
Definition: eas2d.hh:31
E0(const GEO &)
Definition: eas2d.hh:28
static constexpr int enhancedStrainSize
Definition: eas2d.hh:23
Q1E4 structure for EAS with linear strains and 4 enhanced modes.
Definition: eas2d.hh:45
auto calcM(const Dune::FieldVector< double, 2 > &quadPos) const
Definition: eas2d.hh:56
Eigen::Matrix< double, enhancedStrainSize, enhancedStrainSize > DType
Definition: eas2d.hh:49
static constexpr int strainSize
Definition: eas2d.hh:46
Q1E4(const GEO &geometry)
Definition: eas2d.hh:52
Eigen::Matrix< double, strainSize, enhancedStrainSize > MType
Definition: eas2d.hh:48
static constexpr int enhancedStrainSize
Definition: eas2d.hh:47
Structure representing EAS for Q1 with 5 enhanced strains.
Definition: eas2d.hh:84
Eigen::Matrix< double, enhancedStrainSize, enhancedStrainSize > DType
Definition: eas2d.hh:88
auto calcM(const Dune::FieldVector< double, 2 > &quadPos) const
Definition: eas2d.hh:95
static constexpr int strainSize
Definition: eas2d.hh:85
Q1E5(const GEO &geometry)
Definition: eas2d.hh:91
Eigen::Matrix< double, strainSize, enhancedStrainSize > MType
Definition: eas2d.hh:87
static constexpr int enhancedStrainSize
Definition: eas2d.hh:86
Structure representing EAS for Q1 with 7 enhanced strains.
Definition: eas2d.hh:124
static constexpr int enhancedStrainSize
Definition: eas2d.hh:126
Eigen::Matrix< double, strainSize, enhancedStrainSize > MType
Definition: eas2d.hh:127
static constexpr int strainSize
Definition: eas2d.hh:125
Q1E7(const GEO &geometry)
Definition: eas2d.hh:131
Eigen::Matrix< double, enhancedStrainSize, enhancedStrainSize > DType
Definition: eas2d.hh:128
auto calcM(const Dune::FieldVector< double, 2 > &quadPos) const
Definition: eas2d.hh:135
Definition: utils/dirichletvalues.hh:32