38 [[nodiscard]]
constexpr std::string
nameImpl() const noexcept {
return "NeoHooke"; }
45 : lambdaAndmu_{mpt} {}
49 using StrainMatrix = Eigen::Matrix<ScalarType, worldDimension, worldDimension>;
68 template <
typename Derived>
70 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
72 const auto traceC = C.trace();
73 const auto logdetF = log(sqrt(C.determinant()));
74 return lambdaAndmu_.
mu / 2.0 * (traceC - 3 - 2 * logdetF) + lambdaAndmu_.
lambda / 2.0 * logdetF * logdetF;
77 "NeoHooke energy can only be called with a matrix and not a vector in Voigt notation");
87 template <
bool voigt,
typename Derived>
89 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
90 if constexpr (!voigt) {
92 const auto logdetF = log(sqrt(C.determinant()));
93 const auto invC = C.inverse().eval();
94 return (lambdaAndmu_.
mu * (StrainMatrix::Identity() - invC) + lambdaAndmu_.
lambda * logdetF * invC).eval();
97 "NeoHooke can only be called with a matrix and not a vector in Voigt notation");
99 static_assert(voigt ==
false,
"NeoHooke does not support returning stresses in Voigt notation");
109 template <
bool voigt,
typename Derived>
111 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
112 if constexpr (!voigt) {
113 const auto invC = C.inverse().eval();
114 const auto logdetF = log(sqrt(C.determinant()));
115 const auto CTinv =
tensorView(invC, std::array<Eigen::Index, 2>({3, 3}));
116 static_assert(Eigen::TensorFixedSize<ScalarType, Eigen::Sizes<3, 3>>::NumIndices == 2);
117 Eigen::TensorFixedSize<ScalarType, Eigen::Sizes<3, 3, 3, 3>> moduli =
123 static_assert(voigt ==
false,
"NeoHooke does not support returning tangent moduli in Voigt notation");
131 template <
typename STO>
Helper for the Eigen::Tensor types.
Contains the Material interface class and related template functions for material properties.
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: simpleassemblers.hh:22
Interface classf or materials.
Definition: interface.hh:77
Implementation of the Neo-Hookean material model.The energy is computed as.
Definition: neohooke.hh:37
static constexpr bool energyAcceptsVoigt
Definition: neohooke.hh:55
static constexpr double derivativeFactor
Definition: neohooke.hh:60
Eigen::Matrix< ScalarType, worldDimension, worldDimension > StrainMatrix
Definition: neohooke.hh:49
StrainMatrix StressMatrix
Definition: neohooke.hh:50
auto tangentModuliImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the tangent moduli in the Neo-Hookean material model.
Definition: neohooke.hh:110
static constexpr auto strainTag
Definition: neohooke.hh:52
static constexpr auto tangentModuliTag
Definition: neohooke.hh:54
constexpr std::string nameImpl() const noexcept
Definition: neohooke.hh:38
static constexpr bool stressToVoigt
Definition: neohooke.hh:56
static constexpr int worldDimension
Definition: neohooke.hh:48
static constexpr auto stressTag
Definition: neohooke.hh:53
static constexpr bool moduliAcceptsVoigt
Definition: neohooke.hh:59
auto rebind() const
Rebinds the material to a different scalar type.
Definition: neohooke.hh:132
static constexpr bool stressAcceptsVoigt
Definition: neohooke.hh:57
ScalarType storedEnergyImpl(const Eigen::MatrixBase< Derived > &C) const noexcept
Computes the stored energy in the Neo-Hookean material model.
Definition: neohooke.hh:69
ST ScalarType
Definition: neohooke.hh:47
static constexpr bool moduliToVoigt
Definition: neohooke.hh:58
auto stressesImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the stresses in the Neo-Hookean material model.
Definition: neohooke.hh:88
NeoHookeT(const LamesFirstParameterAndShearModulus &mpt)
Constructor for NeoHookeT.
Definition: neohooke.hh:44
Definition: physicshelper.hh:88
double lambda
Definition: physicshelper.hh:89
double mu
Definition: physicshelper.hh:90
Concept defining the requirements for Eigen vectors.
Definition: concepts.hh:353