27template <auto stressIndexPair,
typename MImpl>
28struct VanishingStress;
30template <auto strainIndexPair,
typename MImpl>
31struct VanishingStrain;
42template <
typename MAT,
typename S>
44 if constexpr (Concepts::EigenVector6<S> or Concepts::EigenMatrix33<S>)
47 return S::RowsAtCompileTime == MAT::freeStrains;
58template <
typename MAT,
typename S>
65template <
typename MAT,
bool isReduced = MAT::isReduced>
68template <
typename MAT>
71 using type = MAT::Underlying;
72 static auto material(
const MAT& mat) {
return mat.underlying(); }
75template <
typename MAT>
79 static auto material(
const MAT& mat) {
return mat; }
83template <
typename MAT>
87template <
typename MAT>
117 traits::isSpecializationNonTypeAndTypes<VanishingStrain, MaterialImpl>::value;
119 traits::isSpecializationNonTypeAndTypes<VanishingStress, MaterialImpl>::value;
131 typename MI::Underlying::DeviatoricType;
132 typename MI::Underlying::VolumetricType;
136 typename MI::DeviatoricType;
137 typename MI::VolumetricType;
161 [[nodiscard]]
constexpr static std::string
name() {
return MI::nameImpl(); }
187 template <StrainTags tag,
typename Derived>
189 [[nodiscard]]
auto storedEnergy(
const Eigen::MatrixBase<Derived>& Eraw)
const {
190 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
191 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
194 if constexpr (MaterialImpl::energyAcceptsVoigt)
197 return impl().storedEnergyImpl(E);
199 return impl().storedEnergyImpl(E);
211 template <StrainTags tag,
bool voigt = true,
typename Derived>
213 [[nodiscard]]
auto stresses(
const Eigen::MatrixBase<Derived>& Eraw)
const {
214 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
215 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
216 if constexpr (voigt and MaterialImpl::stressToVoigt ==
false)
218 return toVoigt(stressesMaybeTransformInputToVoigt<false>(E),
false);
220 return stressesMaybeTransformInputToVoigt<voigt>(E);
232 template <StrainTags tag,
bool voigt = true,
typename Derived>
234 [[nodiscard]]
auto tangentModuli(
const Eigen::MatrixBase<Derived>& Eraw)
const {
235 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
236 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
237 if constexpr (voigt and MaterialImpl::moduliToVoigt ==
false)
239 return toVoigt(tangentModuliMaybeTransformInputToVoigt<false>(E));
241 return tangentModuliMaybeTransformInputToVoigt<voigt>(E);
264 template <StrainTags tag,
bool voigt = true,
bool useNumeric = false,
typename Derived>
267 const Eigen::MatrixBase<Derived>& EstartRaw = Derived::Zero().eval(),
268 const double tol = 1e-12,
const int maxIter = 20)
const {
269 const auto S = Impl::maybeFromVoigt(Sraw.derived(),
false).eval();
271 auto [D, Eraw] = [&]() {
272 if constexpr (
requires {
impl().materialInversionImpl(S); } and not useNumeric)
273 return impl().materialInversionImpl(S);
275 const auto Estart = Impl::maybeFromVoigt(EstartRaw.derived(),
true).eval();
280 const auto E = transformStrain<MaterialImpl::strainTag, tag>(Eraw).eval();
282 return std::make_pair(D,
toVoigt(E));
295 template <
typename STO>
297 return impl().template rebind<STO>();
301 template <
bool voigt = true,
typename Derived>
302 auto stressesMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
304 if constexpr (MaterialImpl::stressAcceptsVoigt)
305 return impl().template stressesImpl<voigt>(E);
307 return impl().template stressesImpl<voigt>(
fromVoigt(E.derived()));
309 return impl().template stressesImpl<voigt>(E.derived());
312 template <
bool voigt = true,
typename Derived>
313 auto tangentModuliMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
314 if constexpr (Concepts::EigenVector<Derived>) {
315 if constexpr (MaterialImpl::moduliAcceptsVoigt)
316 return impl().template tangentModuliImpl<voigt>(E);
318 return impl().template tangentModuliImpl<voigt>(
fromVoigt(E.derived()));
320 return impl().template tangentModuliImpl<voigt>(E.derived());
Contains stl-like type traits.
Helper for the autodiff library.
Implementation of the numerical scheme for material inverison for generic hyperelastic material model...
helper functions used by material model implementations.
Definition of several material related enums.
Implementation of transformations for different strain measures.
Material property functions and conversion utilities.
auto fromVoigt(const Eigen::Matrix< ST, size, 1, Options, maxSize, 1 > &EVoigt, bool isStrain=true)
Converts a vector given in Voigt notation to a matrix.
Definition: tensorutils.hh:296
constexpr Eigen::Index toVoigt(Eigen::Index i, Eigen::Index j) noexcept
Converts 2D indices to Voigt notation index.
Definition: tensorutils.hh:182
Definition: decomposehyperelastic.hh:15
auto numericalMaterialInversion(const Material &mat, const Eigen::MatrixBase< Derived > &S, const Eigen::MatrixBase< Derived > &Estart=Derived::Zero().eval(), const double tol=1e-12, const int maxIter=20)
Computes numerically an approximation of the complementary strain energy function and returns the mat...
Definition: numericalmaterialinversion.hh:34
auto underlyingMaterial(const MAT &mat)
Helper function to access the underlying material model.
Definition: finiteelements/mechanics/materials/interface.hh:88
consteval bool hasCorrectSize()
Template function for checking if the strain size is correct.
Definition: finiteelements/mechanics/materials/interface.hh:43
typename UnderlyingMaterial< MAT >::type UnderlyingMaterial_t
Type alias for the underlying material model.
Definition: finiteelements/mechanics/materials/interface.hh:84
A helper struct to access the underling material model if reduced (or vanished).
Definition: finiteelements/mechanics/materials/interface.hh:66
static auto material(const MAT &mat)
Definition: finiteelements/mechanics/materials/interface.hh:72
MAT::Underlying type
Definition: finiteelements/mechanics/materials/interface.hh:71
static auto material(const MAT &mat)
Definition: finiteelements/mechanics/materials/interface.hh:79
MAT type
Definition: finiteelements/mechanics/materials/interface.hh:78
Interface classf or materials.
Definition: finiteelements/mechanics/materials/interface.hh:113
static constexpr std::string name()
Get the name of the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:161
auto materialParameters() const
Returns the material parameters stored in the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:167
constexpr const MaterialImpl & impl() const
Const accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:147
auto rebind() const
Rebind material to a different scalar type.
Definition: finiteelements/mechanics/materials/interface.hh:296
MI MaterialImpl
Type of material implementation.
Definition: finiteelements/mechanics/materials/interface.hh:114
auto materialInversion(const Eigen::MatrixBase< Derived > &Sraw, const Eigen::MatrixBase< Derived > &EstartRaw=Derived::Zero().eval(), const double tol=1e-12, const int maxIter=20) const
Computes the corresponding strain measure and inverse material tangent for a given stress state.
Definition: finiteelements/mechanics/materials/interface.hh:266
auto tangentModuli(const Eigen::MatrixBase< Derived > &Eraw) const
Get the tangentModuli of the material.
Definition: finiteelements/mechanics/materials/interface.hh:234
static constexpr bool isHyperelastic
Definition: finiteelements/mechanics/materials/interface.hh:128
auto stresses(const Eigen::MatrixBase< Derived > &Eraw) const
Get the stresses of the material.
Definition: finiteelements/mechanics/materials/interface.hh:213
auto storedEnergy(const Eigen::MatrixBase< Derived > &Eraw) const
Return the stored potential energy of the material.
Definition: finiteelements/mechanics/materials/interface.hh:189
static constexpr bool isStrainVanished
Definition: finiteelements/mechanics/materials/interface.hh:116
static constexpr bool isStressVanished
Definition: finiteelements/mechanics/materials/interface.hh:118
static constexpr bool isLinear
Definition: finiteelements/mechanics/materials/interface.hh:126
constexpr MaterialImpl & impl()
Accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:154
static constexpr double derivativeFactor
This factor denotes the differences between the returned stresses and moduli and the passed strain.
Definition: finiteelements/mechanics/materials/interface.hh:175
static constexpr bool isReduced
Static constant for determining if the material has vanishing stress or strain components (is reduced...
Definition: finiteelements/mechanics/materials/interface.hh:124
Template concept for ensuring correct strain size.
Definition: finiteelements/mechanics/materials/interface.hh:59
Concept defining the requirements for Eigen vectors.
Definition: utils/concepts.hh:365