MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
linear_elastic.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_ELASTICITY_MAT_LIN_ELAST_HPP
13#define MFEM_ELASTICITY_MAT_LIN_ELAST_HPP
14
15#include "linalg/tensor.hpp"
16#include "mfem.hpp"
17
18using mfem::internal::tensor;
19
20/** @brief Linear elastic material.
21 *
22 * Defines a linear elastic material response. It satisfies the material_type
23 * interface for ElasticityOperator::SetMaterial.
24 */
25template <int dim> struct LinearElasticMaterial
26{
27 /**
28 * @brief Compute the stress response.
29 *
30 * @param[in] dudx derivative of the displacement
31 * @return tensor<double, dim, dim>
32 */
33 tensor<mfem::real_t, dim, dim>
34 MFEM_HOST_DEVICE stress(const tensor<mfem::real_t, dim, dim> &dudx) const
35 {
36 constexpr auto I = mfem::internal::IsotropicIdentity<dim>();
37 auto epsilon = sym(dudx);
38 return lambda * tr(epsilon) * I + 2.0 * mu * epsilon;
39 }
40
41 /**
42 * @brief Apply the gradient of the stress.
43 *
44 */
45 tensor<mfem::real_t, dim, dim> MFEM_HOST_DEVICE
46 action_of_gradient(const tensor<mfem::real_t, dim, dim> & /* dudx */,
47 const tensor<mfem::real_t, dim, dim> &ddudx) const
48 {
49 return stress(ddudx);
50 }
51
52 /**
53 * @brief Compute the gradient.
54 *
55 * This method is used in the ElasticityDiagonalPreconditioner type to
56 * compute the gradient matrix entries of the current quadrature point,
57 * instead of the action.
58 *
59 * @return tensor<double, dim, dim, dim, dim>
60 */
61 tensor<mfem::real_t, dim, dim, dim, dim>
62 MFEM_HOST_DEVICE gradient(tensor<mfem::real_t, dim, dim> /* dudx */) const
63 {
64 return mfem::internal::make_tensor<dim, dim, dim, dim>([&](int i, int j, int k,
65 int l)
66 {
67 return lambda * (i == j) * (k == l) +
68 mu * ((i == l) * (j == k) + (i == k) * (j == l));
69 });
70 }
71
72 /// First Lame parameter
74 /// Second Lame parameter
76};
77
78#endif
real_t epsilon
Definition: ex25.cpp:141
float real_t
Definition: config.hpp:43
Linear elastic material.
tensor< mfem::real_t, dim, dim, dim, dim > MFEM_HOST_DEVICE gradient(tensor< mfem::real_t, dim, dim >) const
Compute the gradient.
tensor< mfem::real_t, dim, dim > MFEM_HOST_DEVICE stress(const tensor< mfem::real_t, dim, dim > &dudx) const
Compute the stress response.
tensor< mfem::real_t, dim, dim > MFEM_HOST_DEVICE action_of_gradient(const tensor< mfem::real_t, dim, dim > &, const tensor< mfem::real_t, dim, dim > &ddudx) const
Apply the gradient of the stress.
mfem::real_t lambda
First Lame parameter.
mfem::real_t mu
Second Lame parameter.
Implementation of the tensor class.