Skip to content
Snippets Groups Projects
Commit ee4b2639 authored by wenqing's avatar wenqing
Browse files

[Math] Added a function to calculate the norm of deviatoric vector

parent 0330afab
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@
*
*/
#include <cmath>
namespace MathLib
{
namespace KelvinVector
......@@ -20,6 +22,13 @@ double Invariants<KelvinVectorSize>::equivalentStress(
return std::sqrt(3 * J2(deviatoric_v));
}
template <int KelvinVectorSize>
double Invariants<KelvinVectorSize>::Norm(
Eigen::Matrix<double, KelvinVectorSize, 1> const& deviatoric_v)
{
return std::sqrt(deviatoric_v.transpose() * deviatoric_v);
}
template <int KelvinVectorSize>
double Invariants<KelvinVectorSize>::J2(
Eigen::Matrix<double, KelvinVectorSize, 1> const& deviatoric_v)
......
......@@ -87,6 +87,10 @@ struct Invariants final
static double equivalentStress(
Eigen::Matrix<double, KelvinVectorSize, 1> const& deviatoric_v);
/// Get the norm of the deviatoric stress.
static double Norm(
Eigen::Matrix<double, KelvinVectorSize, 1> const& deviatoric_v);
/// Second invariant of deviatoric tensor.
/// \note The input vector must have trace equal zero.
static double J2(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment