Deviatoric stress from beams3D demo

Hi,

Apologies in advance for my lack of knowledge in FEA and FEniCS.

I’ve recently modeled a beam in 1D using this demo, https://comet-fenics.readthedocs.io/en/latest/demo/beams_3D/beams_3D.html
I’m now wondering how calculate and extract von_Mises stress from this as I’m not too sure how the stresses are represented. I’ve tried

d = u.geometric_dimension()
Sig = generalised_stresses(u)
s = Sig - (1./3)*tr(Sig*Identity(d))  # deviatoric stress
von_Mises = sqrt(3./2*inner(s, s))
V = FunctionSpace(mesh, 'CG', 2)
von_Mises = project(von_Mises, V)

However this gives the error Invalid ranks 1 and 2 in product.. It works if I use Sig[4] or another number but I’m not to sure what this is representing.

Any guidance would be much appreciated!

Hi,

Apologies, I haven’t had chance to properly look at the linked demo, but at first glance it appears the problem is that in your calculation of the deviatoric stress, you seem to be assuming that the object returned by the generalised_stresses function is the Cauchy stress tensor (a rank 2 tensor). However, based on the demo you linked, this is not the case. The demo defines the “generalised stress” as a vector (a rank 1 tensor) with 6 components corresponding to the normal force, two shear forces, a torsional moment, and two bending moments. Hence, when you index this vector, e.g. sig[i], the number returned is just the ith component of this vector.

Thanks,

Joe