40 using StrainMatrix = Eigen::Matrix<ScalarType, worldDimension, worldDimension>;
54 [[nodiscard]]
constexpr static std::string
nameImpl() noexcept {
return "NeoHooke"; }
61 : materialParameter_{mpt} {}
74 template <
typename Derived>
76 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
78 const auto traceC = C.trace();
79 const auto detC = C.determinant();
80 checkPositiveDetC(detC);
81 const auto logdetF = log(sqrt(detC));
82 return materialParameter_.
mu / 2.0 * (traceC - 3 - 2 * logdetF) +
83 materialParameter_.
lambda / 2.0 * logdetF * logdetF;
86 "NeoHooke energy can only be called with a matrix and not a vector in Voigt notation");
96 template <
bool voigt,
typename Derived>
98 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
99 if constexpr (!voigt) {
101 const auto detC = C.determinant();
102 checkPositiveDetC(detC);
103 const auto logdetF = log(sqrt(detC));
104 const auto invC = C.inverse().eval();
105 return (materialParameter_.
mu * (StrainMatrix::Identity() - invC) + materialParameter_.
lambda * logdetF * invC)
109 "NeoHooke can only be called with a matrix and not a vector in Voigt notation");
111 static_assert(voigt ==
false,
"NeoHooke does not support returning stresses in Voigt notation");
121 template <
bool voigt,
typename Derived>
123 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
124 if constexpr (!voigt) {
125 const auto invC = C.inverse().eval();
126 const auto detC = C.determinant();
127 checkPositiveDetC(detC);
128 const auto logdetF = log(sqrt(detC));
129 const auto CTinv =
tensorView(invC, std::array<Eigen::Index, 2>({3, 3}));
130 static_assert(Eigen::TensorFixedSize<ScalarType, Eigen::Sizes<3, 3>>::NumIndices == 2);
131 Eigen::TensorFixedSize<ScalarType, Eigen::Sizes<3, 3, 3, 3>> moduli =
133 2 * (materialParameter_.
mu - materialParameter_.
lambda * logdetF) *
138 static_assert(voigt ==
false,
"NeoHooke does not support returning tangent moduli in Voigt notation");
146 template <
typename STO>
154 void checkPositiveDetC(
ScalarType detC)
const {
155 if (Dune::FloatCmp::le(
static_cast<double>(detC), 0.0, 1e-10))
156 DUNE_THROW(Dune::InvalidStateException,
157 "Determinant of right Cauchy Green tensor C must be greater than zero. detC = " +
158 std::to_string(
static_cast<double>(detC)));
Helper for the Eigen::Tensor types.
Eigen::Tensor< typename Derived::Scalar, rank > tensorView(const Eigen::EigenBase< Derived > &matrix, const std::array< T, rank > &dims)
View an Eigen matrix as an Eigen Tensor with specified dimensions.
Definition: tensorutils.hh:32
auto fourthOrderIKJL(const Eigen::MatrixBase< AType > &A, const Eigen::MatrixBase< BType > &B)
Computes the IKJL product of two matrices.
Definition: tensorutils.hh:122
auto dyadic(const auto &A_ij, const auto &B_kl)
Computes the dyadic product of two Eigen tensors.
Definition: tensorutils.hh:47
auto symTwoSlots(const Eigen::TensorFixedSize< ScalarType, Eigen::Sizes< dim, dim, dim, dim > > &t, const std::array< size_t, 2 > &slots)
Creates a symmetric fourth-order tensor in the two specified slots of the input tensor.
Definition: tensorutils.hh:145
Definition: assemblermanipulatorbuildingblocks.hh:22
Interface classf or materials.
Definition: finiteelements/mechanics/materials/interface.hh:80
Implementation of the Neo-Hookean material model.The energy is computed as.
Definition: neohooke.hh:37
static constexpr bool energyAcceptsVoigt
Definition: neohooke.hh:47
Eigen::Matrix< ScalarType, worldDimension, worldDimension > StrainMatrix
Definition: neohooke.hh:40
LamesFirstParameterAndShearModulus MaterialParameters
Definition: neohooke.hh:42
StrainMatrix StressMatrix
Definition: neohooke.hh:41
auto tangentModuliImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the tangent moduli in the Neo-Hookean material model.
Definition: neohooke.hh:122
ScalarType storedEnergyImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the stored energy in the Neo-Hookean material model.
Definition: neohooke.hh:75
static constexpr auto strainTag
Definition: neohooke.hh:44
static constexpr auto tangentModuliTag
Definition: neohooke.hh:46
static constexpr bool stressToVoigt
Definition: neohooke.hh:48
MaterialParameters materialParametersImpl() const
Returns the material parameters stored in the material.
Definition: neohooke.hh:66
static constexpr int worldDimension
Definition: neohooke.hh:39
static constexpr auto stressTag
Definition: neohooke.hh:45
static constexpr bool moduliAcceptsVoigt
Definition: neohooke.hh:51
auto rebind() const
Rebinds the material to a different scalar type.
Definition: neohooke.hh:147
static constexpr std::string nameImpl() noexcept
Definition: neohooke.hh:54
static constexpr double derivativeFactorImpl
Definition: neohooke.hh:52
static constexpr bool stressAcceptsVoigt
Definition: neohooke.hh:49
ST ScalarType
Definition: neohooke.hh:38
NeoHookeT(const MaterialParameters &mpt)
Constructor for NeoHookeT.
Definition: neohooke.hh:60
static constexpr bool moduliToVoigt
Definition: neohooke.hh:50
auto stressesImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the stresses in the Neo-Hookean material model.
Definition: neohooke.hh:97
Definition: physicshelper.hh:54
double lambda
Definition: physicshelper.hh:55
double mu
Definition: physicshelper.hh:56
Concept defining the requirements for Eigen vectors.
Definition: concepts.hh:355
Contains the Material interface class and related template functions for material properties.