13#include <dune/common/math.hh>
15#include <Eigen/Geometry>
38 double operator()(
const R& resultArray, [[maybe_unused]]
const auto& pos, [[maybe_unused]]
const auto& fe,
39 [[maybe_unused]]
const int comp)
const {
40 auto sigma =
fromVoigt(resultArray,
false);
42 auto I2 = 1.0 / 2.0 * (sigma.squaredNorm() - 1.0 / 3.0 * Dune::power(sigma.trace(), 2));
43 return std::sqrt(3.0 * I2);
50 constexpr static std::string
name() {
return "VonMises"; }
56 constexpr static int ncomps() {
return 1; }
75 double operator()(
const R& resultArray, [[maybe_unused]]
const auto& pos, [[maybe_unused]]
const auto& fe,
76 [[maybe_unused]]
const int comp)
const {
77 const auto sigma =
fromVoigt(resultArray,
false);
78 return 1.0 / sigma.rows() * sigma.trace();
85 constexpr static std::string
name() {
return "HydrostaticStress"; }
91 constexpr static int ncomps() {
return 1; }
102requires(dim == 2 or dim == 3)
111 double operator()(
const auto& resultArray, [[maybe_unused]]
const auto& pos, [[maybe_unused]]
const auto& fe,
112 const int comp)
const {
113 auto mat =
fromVoigt(resultArray,
false);
114 Eigen::SelfAdjointEigenSolver<
decltype(mat)> eigensolver(mat, Eigen::EigenvaluesOnly);
115 return eigensolver.eigenvalues().reverse()[comp];
122 constexpr static std::string
name() {
return "PrincipalStress"; }
128 constexpr static int ncomps() {
return dim; }
146 template <
typename R>
147 double operator()(
const R& resultArray, [[maybe_unused]]
const auto& pos, [[maybe_unused]]
const auto& fe,
148 [[maybe_unused]]
const int comp)
const {
149 auto sigeq =
VonMises{}(resultArray, pos, fe, 0);
157 constexpr static std::string
name() {
return "Triaxiality"; }
163 constexpr static int ncomps() {
return 1; }
183 template <
typename R>
184 double operator()(
const R& resultArray,
const auto& pos,
const auto& fe,
const int comp)
const {
185 static_assert(R::CompileTimeTraits::RowsAtCompileTime == 3,
"PolarStress is only valid for 2D.");
187 DUNE_THROW(Dune::RangeError,
"PolarStress: Comp out of range.");
191 auto theta = std::atan2(posGlobal[1], posGlobal[0]);
193 const auto sigma =
fromVoigt(resultArray,
false);
194 Eigen::Rotation2D<double> r(theta);
197 auto polarStress = r.inverse() * sigma * r;
200 return polarStress(0, 0);
202 return polarStress(1, 1);
204 return polarStress(1, 0);
206 __builtin_unreachable();
214 constexpr static std::string
name() {
return "PolarStress"; }
220 constexpr static int ncomps() {
return 3; }
Helper for the Eigen::Tensor types.
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: resultevaluators.hh:20
Struct for calculating von Mises stress.
Definition: resultevaluators.hh:29
double operator()(const R &resultArray, const auto &pos, const auto &fe, const int comp) const
Calculate the result quantity (von Mises stress)
Definition: resultevaluators.hh:38
static constexpr int ncomps()
Get the number of components in the result (always 1 for VonMises)
Definition: resultevaluators.hh:56
static constexpr std::string name()
Get the name of the result type.
Definition: resultevaluators.hh:50
Struct for calculating hydrostatic stress.
Definition: resultevaluators.hh:66
static constexpr std::string name()
Get the name of the result type.
Definition: resultevaluators.hh:85
double operator()(const R &resultArray, const auto &pos, const auto &fe, const int comp) const
Calculate the result quantity (hydrostatic stress).
Definition: resultevaluators.hh:75
static constexpr int ncomps()
Get the number of components in the result (always 1 for hydrostatic stress)
Definition: resultevaluators.hh:91
Struct for calculating principal stresses.
Definition: resultevaluators.hh:104
static constexpr std::string name()
Get the name of the result type.
Definition: resultevaluators.hh:122
static constexpr int ncomps()
Get the number of components in the result.
Definition: resultevaluators.hh:128
double operator()(const auto &resultArray, const auto &pos, const auto &fe, const int comp) const
Calculate the result quantity (principal stress)
Definition: resultevaluators.hh:111
Struct for calculating stress triaxiality.
Definition: resultevaluators.hh:138
static constexpr std::string name()
Get the name of the result type.
Definition: resultevaluators.hh:157
double operator()(const R &resultArray, const auto &pos, const auto &fe, const int comp) const
Calculate the result quantity (stress triaxiality)
Definition: resultevaluators.hh:147
static constexpr int ncomps()
Get the number of components in the result (always 1 for stress triaxiality)
Definition: resultevaluators.hh:163
Struct for calculating the 2d polar stress. The center of the coordinate system is to be passed to th...
Definition: resultevaluators.hh:172
double operator()(const R &resultArray, const auto &pos, const auto &fe, const int comp) const
Calculate the result quantity (von Mises stress)
Definition: resultevaluators.hh:184
static constexpr int ncomps()
Get the number of components in the result.
Definition: resultevaluators.hh:220
PolarStress(const Dune::FieldVector< double, 2 > &origin)
Definition: resultevaluators.hh:173
static constexpr std::string name()
Get the name of the result type.
Definition: resultevaluators.hh:214
Header file for material models in Ikarus finite element mechanics.