11#include <dune/common/float_cmp.hh>
27 "These are hard-coded function you should use the material library Ikarus::LinearElasticity")]]
inline Eigen::
32 C(0, 0) = C(1, 1) = 1;
33 C(0, 1) = C(1, 0) = nu;
34 C(2, 2) = (1 - nu) / 2;
35 C *= E / (1 - nu * nu);
48 "These are hard-coded function you should use the material library: Ikarus::LinearElasticity")]]
inline Eigen::
51 Eigen::Matrix<double, 6, 6> C;
53 C(0, 0) = C(1, 1) = C(2, 2) = 1 - nu;
54 C(0, 1) = C(1, 0) = C(2, 0) = C(0, 2) = C(1, 2) = C(2, 1) = nu;
55 C(3, 3) = C(4, 4) = C(5, 5) = (1 - 2 * nu) / 2;
56 C *= E / ((1 + nu) * (1 - 2 * nu));
67 template <
typename Basis_,
typename FERequirements_,
bool useRef = false>
88 using Element =
typename LocalView::Element;
94 static constexpr int worlddim = Element::Geometry::coorddimension;
97 static constexpr int mydim = Element::mydimension;
103 template <
typename ScalarType =
double>
104 using VectorType = std::conditional_t<useRef, Eigen::Ref<Eigen::VectorX<ScalarType>>, Eigen::VectorX<ScalarType>&>;
107 template <
typename ScalarType =
double>
108 using MatrixType = std::conditional_t<useRef, Eigen::Ref<Eigen::MatrixX<ScalarType>>, Eigen::MatrixX<ScalarType>&>;
153 template <
typename MaterialParameter>
155 MaterialParameter, YoungsModulusAndBulkModulus> or std::is_same_v<MaterialParameter,
156 YoungsModulusAndLamesFirstParameter> or std::
157 is_same_v<MaterialParameter, BulkModulusAndLamesFirstParameter> or std::is_same_v<
158 MaterialParameter, LamesFirstParameterAndShearModulus> or std::is_same_v<MaterialParameter,
159 YoungsModulusAndShearModulus>;
166 template <
typename ValuePair>
171 YoungsModulusAndLamesFirstParameter> and !std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter> and !std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
172 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
173 const auto& E = vp.emodul;
174 const auto& nu = vp.nu;
175 return Dune::FloatCmp::eq(nu, 0.5) ? std::numeric_limits<double>::infinity()
176 : E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
177 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
178 const auto& E = vp.emodul;
179 const auto& mu = vp.mu;
180 return mu * (E - 2.0 * mu) / (3.0 * mu - E);
181 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
182 const auto& E = vp.emodul;
183 const auto& K = vp.K;
184 return 3.0 * K * (3.0 * K - E) / (9.0 * K - E);
186 assert(
false &&
"Your LameParameter request is not implemented");
192 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
193 const auto& E = vp.emodul;
194 const auto& nu = vp.nu;
195 return E / (3.0 * (1.0 - 2.0 * nu));
196 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
197 const auto& E = vp.emodul;
198 const auto& mu = vp.mu;
199 return E * mu / (3.0 * (3.0 * mu - E));
200 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
201 const auto& E = vp.emodul;
202 const auto& lambda = vp.lambda;
203 return (E + 3.0 * lambda + calcR(vp)) / 6.0;
204 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
205 const auto& lambda = vp.lambda;
206 const auto& mu = vp.mu;
207 return lambda + 2.0 * mu / 3.0;
209 assert(
false &&
"Your LameParameter request is not implemented");
216 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
217 const auto& E = vp.emodul;
218 const auto& nu = vp.nu;
219 return E / (2.0 * (1.0 + nu));
220 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
221 const auto& E = vp.emodul;
222 const auto& K = vp.K;
223 return 3.0 * K * E / (9.0 * K - E);
224 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
225 const auto& E = vp.emodul;
226 const auto& lambda = vp.lambda;
227 return (E - 3.0 * lambda + calcR(vp)) / 4.0;
228 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
229 const auto& K = vp.K;
230 const auto& lambda = vp.lambda;
231 return 3.0 * (K - lambda) / 2.0;
233 assert(
false &&
"Your LameParameter request is not implemented");
237 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
238 const auto& E = vp.emodul;
239 const auto& nu = vp.nu;
240 return E * (1.0 - nu) / ((1.0 + nu) * (1.0 - 2.0 * nu));
241 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
242 const auto& E = vp.emodul;
243 const auto& mu = vp.mu;
244 return mu * (4.0 * mu - E) / (3.0 * mu - E);
245 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
246 const auto& E = vp.emodul;
247 const auto& K = vp.K;
248 return 3.0 * K * (3.0 * K + E) / (9.0 * K - E);
249 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
250 const auto& E = vp.emodul;
251 const auto& lambda = vp.lambda;
252 return (E - lambda + calcR(vp)) / 2.0;
253 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
254 const auto& K = vp.K;
255 const auto& lambda = vp.lambda;
256 return 3.0 * K - 2.0 * lambda;
257 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
258 const auto& lambda = vp.lambda;
259 const auto& mu = vp.mu;
260 return lambda + 2.0 * mu;
262 assert(
false &&
"Your LameParameter request is not implemented");
265 constexpr double toPoissonsRatio()
requires(!std::is_same_v<ValuePair, YoungsModulusAndPoissonsRatio>) {
266 if constexpr (std::is_same_v<ValuePair, YoungsModulusAndShearModulus>) {
267 const auto& E = vp.emodul;
268 const auto& mu = vp.mu;
269 return E / (2.0 * mu) - 1.0;
270 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndBulkModulus>) {
271 const auto& E = vp.emodul;
272 const auto& K = vp.K;
273 return (3.0 * K - E) / (6.0 * K);
274 }
else if constexpr (std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
275 const auto& E = vp.emodul;
276 const auto& lambda = vp.lambda;
277 return 2.0 * lambda / (E + lambda + calcR(vp));
278 }
else if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
279 const auto& K = vp.K;
280 const auto& lambda = vp.lambda;
281 return lambda / (3 * K - lambda);
282 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
283 const auto& lambda = vp.lambda;
284 const auto& mu = vp.mu;
285 return lambda / (2.0 * (lambda + mu));
287 assert(
false &&
"Your LameParameter request is not implemented");
293 YoungsModulusAndPoissonsRatio> and !std::is_same_v<ValuePair, YoungsModulusAndShearModulus> and !std::is_same_v<ValuePair, YoungsModulusAndBulkModulus> and !std::is_same_v<ValuePair, YoungsModulusAndLamesFirstParameter>) {
294 if constexpr (std::is_same_v<ValuePair, BulkModulusAndLamesFirstParameter>) {
295 return 9.0 * vp.K * (vp.K - vp.lambda) / (3.0 * vp.K - vp.lambda);
296 }
else if constexpr (std::is_same_v<ValuePair, LamesFirstParameterAndShearModulus>) {
297 const auto& lambda = vp.lambda;
298 const auto& mu = vp.mu;
299 return mu * (3.0 * lambda + 2.0 * mu) / (lambda + mu);
301 assert(
false &&
"Your LameParameter request is not implemented");
318 ConvertLameConstants(
const ValuePair& p_vp) : vp(p_vp) {}
320 double calcR(
const YoungsModulusAndLamesFirstParameter& vp_) {
321 const auto& E = vp_.emodul;
322 const auto& lambda = vp_.lambda;
323 return std::sqrt(E * E + 9 * lambda * lambda + 2 * E * lambda);
Definition of the LinearElastic class for finite element mechanics computations.
Definition: simpleassemblers.hh:21
auto toLamesFirstParameterAndShearModulus(const YoungsModulusAndPoissonsRatio &matParameter)
Converts Young's modulus and Poisson's ratio to Lame's first parameter and shear modulus.
Definition: physicshelper.hh:354
auto toYoungsModulusAndPoissonsRatio(const LamesFirstParameterAndShearModulus &matParameter)
Converts Lame's first parameter and shear modulus to Young's modulus and Poisson's ratio.
Definition: physicshelper.hh:367
Eigen::Matrix3d planeStressLinearElasticMaterialTangent(double E, double nu)
Computes the plane stress linear elastic material tangent matrix.
Definition: physicshelper.hh:29
ConvertLameConstants< YoungsModulusAndPoissonsRatio > convertLameConstants(const YoungsModulusAndPoissonsRatio &p_vp)
Definition: physicshelper.hh:327
Eigen::Matrix< double, 6, 6 > linearElasticMaterialTangent3D(double E, double nu)
Computes the 3D linear elastic material tangent matrix.
Definition: physicshelper.hh:50
Class representing the requirements for obtaining specific results.
Definition: ferequirements.hh:405
Traits for handling finite elements.see https://en.wikipedia.org/wiki/Lam%C3%A9_parameters.
Definition: physicshelper.hh:68
std::conditional_t< useRef, Eigen::Ref< Eigen::VectorX< ScalarType > >, Eigen::VectorX< ScalarType > & > VectorType
Type of the internal forces.
Definition: physicshelper.hh:104
typename LocalView::Element Element
Type of the grid element.
Definition: physicshelper.hh:88
static constexpr int worlddim
Dimension of the world space.
Definition: physicshelper.hh:94
typename FlatBasis::LocalView LocalView
Type of the local view.
Definition: physicshelper.hh:82
typename Basis::FlatBasis FlatBasis
Type of the flat basis.
Definition: physicshelper.hh:79
Basis_ Basis
Type of the basis of the finite element.
Definition: physicshelper.hh:70
std::conditional_t< useRef, Eigen::Ref< Eigen::MatrixX< ScalarType > >, Eigen::MatrixX< ScalarType > & > MatrixType
Type of the stiffness matrix.
Definition: physicshelper.hh:108
static constexpr int mydim
Dimension of the geometry.
Definition: physicshelper.hh:97
static constexpr int dimension
Dimension of the grid.
Definition: physicshelper.hh:100
typename FlatBasis::GridView GridView
Type of the grid view.
Definition: physicshelper.hh:85
FERequirements_ FERequirementType
Type of the requirements for the finite element.
Definition: physicshelper.hh:73
typename Element::Geometry Geometry
Type of the element geometry.
Definition: physicshelper.hh:91
Structure representing Young's modulus and shear modulus.
Definition: physicshelper.hh:113
double emodul
Definition: physicshelper.hh:114
double nu
Definition: physicshelper.hh:115
Structure representing Young's modulus and bulk modulus.
Definition: physicshelper.hh:119
double mu
Definition: physicshelper.hh:121
double emodul
Definition: physicshelper.hh:120
Structure representing Young's modulus and Lame's first parameter.
Definition: physicshelper.hh:125
double emodul
Definition: physicshelper.hh:126
double K
Definition: physicshelper.hh:127
Structure representing bulk modulus and Lame's first parameter.
Definition: physicshelper.hh:131
double lambda
Definition: physicshelper.hh:133
double emodul
Definition: physicshelper.hh:132
Structure representing Lame's first parameter and shear modulus.
Definition: physicshelper.hh:137
double K
Definition: physicshelper.hh:138
double lambda
Definition: physicshelper.hh:139
Definition: physicshelper.hh:143
double lambda
Definition: physicshelper.hh:144
double mu
Definition: physicshelper.hh:145
Conversion utility for Lame's constants.
Definition: physicshelper.hh:167
constexpr double toBulkModulus()
Definition: physicshelper.hh:189
constexpr double toYoungsModulus()
Definition: physicshelper.hh:290
constexpr double toPoissonsRatio()
Definition: physicshelper.hh:265
friend ConvertLameConstants< YoungsModulusAndPoissonsRatio > convertLameConstants(const YoungsModulusAndPoissonsRatio &p_vp)
Definition: physicshelper.hh:327
constexpr double toLamesFirstParameter()
Definition: physicshelper.hh:168
constexpr double toPWaveModulus()
Definition: physicshelper.hh:236
constexpr double toShearModulus()
Definition: physicshelper.hh:212
decltype(Dune::Functions::DefaultGlobalBasis(Ikarus::flatPreBasis(std::declval< PreBasis >()))) FlatBasis
The type of the flattened basis.
Definition: utils/basis.hh:36
Concept for checking if a type is a valid material parameter tuple.
Definition: physicshelper.hh:154