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>
88 static constexpr bool isReduced = traits::isSpecializationNonTypeAndTypes<VanishingStress, MaterialImpl>::value or
89 traits::isSpecializationNonTypeAndTypes<VanishingStrain, MaterialImpl>::value;
112 [[nodiscard]]
constexpr static std::string
name() {
return MI::nameImpl(); }
138 template <StrainTags tag,
typename Derived>
140 [[nodiscard]]
auto storedEnergy(
const Eigen::MatrixBase<Derived>& Eraw)
const {
141 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
142 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
145 if constexpr (MaterialImpl::energyAcceptsVoigt)
148 return impl().storedEnergyImpl(E);
150 return impl().storedEnergyImpl(E);
162 template <StrainTags tag,
bool voigt = true,
typename Derived>
164 [[nodiscard]]
auto stresses(
const Eigen::MatrixBase<Derived>& Eraw)
const {
165 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
166 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
167 if constexpr (voigt and MaterialImpl::stressToVoigt ==
false)
169 return toVoigt(stressesMaybeTransformInputToVoigt<false>(E),
false);
171 return stressesMaybeTransformInputToVoigt<voigt>(E);
183 template <StrainTags tag,
bool voigt = true,
typename Derived>
185 [[nodiscard]]
auto tangentModuli(
const Eigen::MatrixBase<Derived>& Eraw)
const {
186 decltype(
auto) Ev = enlargeIfReduced<Material>(Eraw);
187 decltype(
auto) E = transformStrain<tag, MaterialImpl::strainTag>(Ev);
188 if constexpr (voigt and MaterialImpl::moduliToVoigt ==
false)
190 return toVoigt(tangentModuliMaybeTransformInputToVoigt<false>(E));
192 return tangentModuliMaybeTransformInputToVoigt<voigt>(E);
215 template <StrainTags tag,
bool voigt = true,
bool useNumeric = false,
typename Derived>
218 const Eigen::MatrixBase<Derived>& EstartRaw = Derived::Zero().eval(),
219 const double tol = 1e-12,
const int maxIter = 20)
const {
220 const auto S = Impl::maybeFromVoigt(Sraw.derived(),
false).eval();
222 auto [D, Eraw] = [&]() {
223 if constexpr (
requires {
impl().materialInversionImpl(S); } and not useNumeric)
224 return impl().materialInversionImpl(S);
226 const auto Estart = Impl::maybeFromVoigt(EstartRaw.derived(),
true).eval();
231 const auto E = transformStrain<MaterialImpl::strainTag, tag>(Eraw).eval();
233 return std::make_pair(D,
toVoigt(E));
246 template <
typename STO>
248 return impl().template rebind<STO>();
252 template <
bool voigt = true,
typename Derived>
253 auto stressesMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
255 if constexpr (MaterialImpl::stressAcceptsVoigt)
256 return impl().template stressesImpl<voigt>(E);
258 return impl().template stressesImpl<voigt>(
fromVoigt(E.derived()));
260 return impl().template stressesImpl<voigt>(E.derived());
263 template <
bool voigt = true,
typename Derived>
264 auto tangentModuliMaybeTransformInputToVoigt(
const Eigen::MatrixBase<Derived>& E)
const {
265 if constexpr (Concepts::EigenVector<Derived>) {
266 if constexpr (MaterialImpl::moduliAcceptsVoigt)
267 return impl().template tangentModuliImpl<voigt>(E);
269 return impl().template tangentModuliImpl<voigt>(
fromVoigt(E.derived()));
271 return impl().template tangentModuliImpl<voigt>(E.derived());
Contains stl-like type traits.
Helper for the autodiff library.
Definition of several material related enums.
helper functions used by material model implementations.
Implementation of the numerical scheme for material inverison for generic hyperelastic material model...
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: arrudaboyce.hh:27
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
consteval bool hasCorrectSize()
Template function for checking if the strain size is correct.
Definition: finiteelements/mechanics/materials/interface.hh:43
Interface classf or materials.
Definition: finiteelements/mechanics/materials/interface.hh:82
static constexpr std::string name()
Get the name of the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:112
auto materialParameters() const
Returns the material parameters stored in the implemented material.
Definition: finiteelements/mechanics/materials/interface.hh:118
constexpr const MaterialImpl & impl() const
Const accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:98
auto rebind() const
Rebind material to a different scalar type.
Definition: finiteelements/mechanics/materials/interface.hh:247
MI MaterialImpl
Type of material implementation.
Definition: finiteelements/mechanics/materials/interface.hh:83
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:217
auto tangentModuli(const Eigen::MatrixBase< Derived > &Eraw) const
Get the tangentModuli of the material.
Definition: finiteelements/mechanics/materials/interface.hh:185
auto stresses(const Eigen::MatrixBase< Derived > &Eraw) const
Get the stresses of the material.
Definition: finiteelements/mechanics/materials/interface.hh:164
auto storedEnergy(const Eigen::MatrixBase< Derived > &Eraw) const
Return the stored potential energy of the material.
Definition: finiteelements/mechanics/materials/interface.hh:140
static constexpr bool isLinear
Definition: finiteelements/mechanics/materials/interface.hh:91
constexpr MaterialImpl & impl()
Accessor to the underlying material (CRTP).
Definition: finiteelements/mechanics/materials/interface.hh:105
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:126
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:88
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:362