25template <auto stressIndexPair,
typename MImpl>
26struct VanishingStress;
28template <auto strainIndexPair,
typename MImpl>
29struct VanishingStrain;
40template <
typename MAT,
typename S>
42 if constexpr (Concepts::EigenVector6<S> or Concepts::EigenMatrix33<S>)
45 return S::RowsAtCompileTime == MAT::freeStrains;
56template <
typename MAT,
typename S>
86 static constexpr bool isReduced = traits::isSpecializationNonTypeAndTypes<VanishingStress, MaterialImpl>::value or
87 traits::isSpecializationNonTypeAndTypes<VanishingStrain, MaterialImpl>::value;
108 [[nodiscard]]
constexpr static std::string
name() {
return MI::nameImpl(); }
134 template <StrainTags tag,
typename Derived>
136 [[nodiscard]]
auto storedEnergy(
const Eigen::MatrixBase<Derived>& Eraw)
const {
137 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
138 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
141 if constexpr (MaterialImpl::energyAcceptsVoigt)
144 return impl().storedEnergyImpl(E);
146 return impl().storedEnergyImpl(E);
158 template <StrainTags tag,
bool voigt = true,
typename Derived>
160 [[nodiscard]]
auto stresses(
const Eigen::MatrixBase<Derived>& Eraw)
const {
161 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
162 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
163 if constexpr (voigt and MaterialImpl::stressToVoigt ==
false)
165 return toVoigt(stressesMaybeTransformInputToVoigt<false>(E),
false);
167 return stressesMaybeTransformInputToVoigt<voigt>(E);
179 template <StrainTags tag,
bool voigt = true,
typename Derived>
181 [[nodiscard]]
auto tangentModuli(
const Eigen::MatrixBase<Derived>& Eraw)
const {
182 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
183 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
184 if constexpr (voigt and MaterialImpl::moduliToVoigt ==
false)
186 return toVoigt(tangentModuliMaybeTransformInputToVoigt<false>(E));
188 return tangentModuliMaybeTransformInputToVoigt<voigt>(E);
199 template <
typename STO>
201 return impl().template rebind<STO>();
205 template <
bool voigt = true,
typename Derived>
206 auto stressesMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
208 if constexpr (MaterialImpl::stressAcceptsVoigt)
209 return impl().template stressesImpl<voigt>(E);
211 return impl().template stressesImpl<voigt>(
fromVoigt(E.derived()));
213 return impl().template stressesImpl<voigt>(E.derived());
216 template <
bool voigt = true,
typename Derived>
217 auto tangentModuliMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
218 if constexpr (Concepts::EigenVector<Derived>) {
219 if constexpr (MaterialImpl::moduliAcceptsVoigt)
220 return impl().template tangentModuliImpl<voigt>(E);
222 return impl().template tangentModuliImpl<voigt>(
fromVoigt(E.derived()));
224 return impl().template tangentModuliImpl<voigt>(E.derived());
Contains stl-like type traits.
Helper for the autodiff library.
Material property functions and conversion utilities.
Implementation of strain-related functions.
Definition of several material related enums.
constexpr Eigen::Index toVoigt(Eigen::Index i, Eigen::Index j) noexcept
Converts 2D indices to Voigt notation index.
Definition: tensorutils.hh:166
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:271
Definition: assemblermanipulatorbuildingblocks.hh:22
consteval bool hasCorrectSize()
Template function for checking if the strain size is correct.
Definition: finiteelements/mechanics/materials/interface.hh:41
Interface classf or materials.
Definition: finiteelements/mechanics/materials/interface.hh:80
constexpr const MaterialImpl & impl() const
Const accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:94
auto tangentModuli(const Eigen::MatrixBase< Derived > &Eraw) const
Get the tangentModuli of the material.
Definition: finiteelements/mechanics/materials/interface.hh:181
auto rebind() const
Rebind material to a different scalar type.
Definition: finiteelements/mechanics/materials/interface.hh:200
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:122
MI MaterialImpl
Type of material implementation.
Definition: finiteelements/mechanics/materials/interface.hh:81
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:86
static constexpr std::string name()
Get the name of the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:108
auto storedEnergy(const Eigen::MatrixBase< Derived > &Eraw) const
Return the stored potential energy of the material.
Definition: finiteelements/mechanics/materials/interface.hh:136
constexpr MaterialImpl & impl()
Accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:101
auto stresses(const Eigen::MatrixBase< Derived > &Eraw) const
Get the stresses of the material.
Definition: finiteelements/mechanics/materials/interface.hh:160
auto materialParameters() const
Returns the material parameters stored in the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:114
Template concept for ensuring correct strain size.
Definition: finiteelements/mechanics/materials/interface.hh:57
Concept defining the requirements for Eigen vectors.
Definition: concepts.hh:355