#914 Created stress tensor rotation method, including tests

This commit is contained in:
Jacob Støren
2016-10-17 15:14:45 +02:00
parent 323f7893cb
commit 941eed6625
3 changed files with 140 additions and 5 deletions

View File

@@ -46,10 +46,11 @@ public:
void setFromInternalLayout(S* tensorData);
void setFromAbaqusLayout(S* tensorData);
cvf::Vec3f calculatePrincipals(cvf::Vec3f principalDirections[3]);
float calculateVonMises();
};
cvf::Vec3f calculatePrincipals(cvf::Vec3f principalDirections[3]) const;
float calculateVonMises() const;
Tensor3 rotate(const cvf::Matrix3<S>& rotMx) const;
};
typedef Tensor3<float> Ten3f;

View File

@@ -168,7 +168,7 @@ cvf::Vec3d eigenVector3(const cvf::Mat3d& mx, double eigenValue, bool* computedO
/// The tensor must be laid out as follows: SXX, SYY, SZZ, SXY, SYZ, SZX
//--------------------------------------------------------------------------------------------------
template<typename S>
cvf::Vec3f Tensor3<S>::calculatePrincipals( cvf::Vec3f principalDirections[3])
cvf::Vec3f Tensor3<S>::calculatePrincipals( cvf::Vec3f principalDirections[3]) const
{
CVF_TIGHT_ASSERT(m_tensor);
@@ -314,12 +314,31 @@ cvf::Vec3f Tensor3<S>::calculatePrincipals( cvf::Vec3f principalDirections[3])
///
//--------------------------------------------------------------------------------------------------
template< typename S>
float caf::Tensor3<S>::calculateVonMises()
float caf::Tensor3<S>::calculateVonMises() const
{
return (float) sqrt( ( (m_tensor[0]*m_tensor[0] + m_tensor[1]*m_tensor[1] + m_tensor[2]*m_tensor[2]) ) +
( -(m_tensor[0]*m_tensor[1] + m_tensor[1]*m_tensor[2] + m_tensor[0]*m_tensor[2]) ) +
( 3*(m_tensor[3]*m_tensor[3] + m_tensor[4]*m_tensor[4] + m_tensor[5]*m_tensor[5]) ) );
}
//--------------------------------------------------------------------------------------------------
/// Calculates Trot = rotMx*T*transpose(rotMx)
//--------------------------------------------------------------------------------------------------
template< typename S>
Tensor3<S> caf::Tensor3<S>::rotate(const cvf::Matrix3<S>& rotMx) const
{
cvf::Matrix3<S> tensor(m_tensor[SXX], m_tensor[SXY], m_tensor[SZX],
m_tensor[SXY], m_tensor[SYY], m_tensor[SYZ],
m_tensor[SZX], m_tensor[SYZ], m_tensor[SZZ]);
cvf::Matrix3<S> transposedRotMx = rotMx;
transposedRotMx.transpose();
cvf::Matrix3<S> rotatedTensor = rotMx * tensor * transposedRotMx;
return Tensor3(rotatedTensor(0,0), rotatedTensor(1,1), rotatedTensor(2,2),
rotatedTensor(1,0), rotatedTensor(1,2), rotatedTensor(0,2));
}
}