41 static constexpr int dim = 3;
44 using MaterialTensor = Eigen::TensorFixedSize<ScalarType, Eigen::Sizes<dim, dim, dim, dim>>;
58 [[nodiscard]]
constexpr static std::string
nameImpl() noexcept {
return "NeoHooke"; }
65 : materialParameter_{mpt} {}
78 template <
typename Derived>
80 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
82 const auto traceC = C.trace();
83 const auto detC = C.determinant();
84 Impl::checkPositiveOrAbort(detC);
85 const auto logdetF = log(sqrt(detC));
86 return materialParameter_.
mu / 2.0 * (traceC - 3 - 2 * logdetF) +
87 materialParameter_.
lambda / 2.0 * logdetF * logdetF;
90 "NeoHooke energy can only be called with a matrix and not a vector in Voigt notation");
100 template <
bool voigt,
typename Derived>
102 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
103 if constexpr (!voigt) {
105 const auto detC = C.determinant();
106 Impl::checkPositiveOrAbort(detC);
107 const auto logdetF = log(sqrt(detC));
108 const auto invC = C.inverse().eval();
109 return (materialParameter_.
mu * (StrainMatrix::Identity() - invC) + materialParameter_.
lambda * logdetF * invC)
113 "NeoHooke can only be called with a matrix and not a vector in Voigt notation");
115 static_assert(voigt ==
false,
"NeoHooke does not support returning stresses in Voigt notation");
125 template <
bool voigt,
typename Derived>
127 static_assert(Concepts::EigenMatrixOrVoigtNotation3<Derived>);
128 if constexpr (!voigt) {
129 const auto invC = C.inverse().eval();
130 const auto detC = C.determinant();
131 Impl::checkPositiveOrAbort(detC);
132 const auto logdetF = log(sqrt(detC));
133 const auto CTinv =
tensorView(invC, std::array<Eigen::Index, 2>({3, 3}));
136 2 * (materialParameter_.
mu - materialParameter_.
lambda * logdetF) *
141 static_assert(voigt ==
false,
"NeoHooke does not support returning tangent moduli in Voigt notation");
149 template <
typename STO>
164 template <
typename Derived>
166 decltype(
auto) S = Impl::maybeFromVoigt(Sraw,
false);
167 auto C = Derived::Zero().eval();
168 const auto I = Derived::Identity();
170 auto mu = materialParameter_.
mu;
171 auto Lambda = materialParameter_.
lambda;
172 if (Dune::FloatCmp::eq(Lambda, 0.0))
173 C = (I - (1.0 / mu) * S).inverse();
175 const auto A = 1.0 / Lambda * (mu * I - S);
176 const auto a = A.determinant();
177 checkInvertabilityOrAbort(a);
179 const auto b = 2.0 /
dim * mu / Lambda - log(
static_cast<double>(
dim) / 2) + 1.0 /
dim * log(abs(a));
180 const auto lnJ = mu / Lambda -
static_cast<double>(
dim) / 2 *
util::lambertW0(Dune::sign(a) * exp(b));
181 C = (mu / Lambda - lnJ) * A.inverse();
183 const auto tangentModulus =
toVoigt(tangentModuliImpl<false>(C));
184 const auto D = tangentModulus.inverse().eval();
185 return std::make_pair(D,
toVoigt(C));
191 template <
typename ScalarType>
193 const bool req1 = Dune::FloatCmp::ne(a, 0.0, eps);
194 const bool req2 = [&]() {
195 if constexpr (
dim == 3)
196 return Dune::FloatCmp::gt(
198 -pow(
static_cast<double>(
dim) / 2,
dim) * exp(-
dim - 2 * materialParameter_.mu / materialParameter_.lambda),
201 return Dune::FloatCmp::gt(a, 0.0, eps);
203 if (!(req1 && req2)) {
204 std::cerr <<
"NeoHooke: Requirements for material law inversion not met.";
Helper for the Eigen::Tensor types.
Implementation of the zeroth branch of the lambertW function.
helper functions used by material model implementations.
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:135
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:158
constexpr Eigen::Index toVoigt(Eigen::Index i, Eigen::Index j) noexcept
Converts 2D indices to Voigt notation index.
Definition: tensorutils.hh:182
Definition: arrudaboyce.hh:27
ST lambertW0(ST z, int maxIterations=20, ST eps=std::numeric_limits< ST >::epsilon())
Implementation of the principal branch of the Lambert-W function (branch 0 in the domain ),...
Definition: lambertw.hh:42
Implementation of the Neo-Hookean material model.The energy is computed as.
Definition: neohooke.hh:39
auto materialInversionImpl(const Eigen::MatrixBase< Derived > &Sraw) const
Computes the strain measure and inverse material tangent for a given stress state.
Definition: neohooke.hh:165
auto rebind() const
Rebinds the material to a different scalar type.
Definition: neohooke.hh:150
ST ScalarType
Definition: neohooke.hh:40
StrainMatrix StressMatrix
Definition: neohooke.hh:43
MaterialParameters materialParametersImpl() const
Returns the material parameters stored in the material.
Definition: neohooke.hh:70
static constexpr bool moduliAcceptsVoigt
Definition: neohooke.hh:55
static constexpr int dim
Definition: neohooke.hh:41
static constexpr bool moduliToVoigt
Definition: neohooke.hh:54
static constexpr bool stressToVoigt
Definition: neohooke.hh:52
static constexpr bool stressAcceptsVoigt
Definition: neohooke.hh:53
Eigen::TensorFixedSize< ScalarType, Eigen::Sizes< dim, dim, dim, dim > > MaterialTensor
Definition: neohooke.hh:44
static constexpr auto stressTag
Definition: neohooke.hh:49
ScalarType storedEnergyImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the stored energy in the Neo-Hookean material model.
Definition: neohooke.hh:79
MaterialTensor tangentModuliImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the tangent moduli in the Neo-Hookean material model.
Definition: neohooke.hh:126
NeoHookeT(const MaterialParameters &mpt)
Constructor for NeoHookeT.
Definition: neohooke.hh:64
StressMatrix stressesImpl(const Eigen::MatrixBase< Derived > &C) const
Computes the stresses in the Neo-Hookean material model.
Definition: neohooke.hh:101
static constexpr auto strainTag
Definition: neohooke.hh:48
Eigen::Matrix< ScalarType, dim, dim > StrainMatrix
Definition: neohooke.hh:42
static constexpr std::string nameImpl() noexcept
Definition: neohooke.hh:58
static constexpr bool energyAcceptsVoigt
Definition: neohooke.hh:51
LamesFirstParameterAndShearModulus MaterialParameters
Definition: neohooke.hh:46
static constexpr double derivativeFactorImpl
Definition: neohooke.hh:56
static constexpr auto tangentModuliTag
Definition: neohooke.hh:50
Interface classf or materials.
Definition: finiteelements/mechanics/materials/interface.hh:82
Definition: physicshelper.hh:54
double lambda
Definition: physicshelper.hh:55
double mu
Definition: physicshelper.hh:56
Concept defining the requirements for Eigen vectors.
Definition: utils/concepts.hh:365
Contains the Material interface class and related template functions for material properties.