Get Values of Stress Counter Plot

I’m currently working on a linear elastic circular inclusion problem using fenics, and I have a pretty good plot, but in order to verify my results I want to be able to extract the data shown on the plot. Is there any way to do this… as of right now I am plotting sigxx by the following code below

stress = sigma(u)
sigX = stress[0,0]
plot(sigX)

You should project stress over a suitable function space e.g.:

Vsig = TensorFunctionSpace(mesh, "DG", 0)
stress = project(sigma(u), Vsig)

You can then evaluate the field at any point e.g.

print(stress(0., 0.))

or get the corresponding array of values at the dofs of the Vsig space.
Ultimately just export the solution to XDMF format, read it with Paraview and then you can do many various postprocessing tasks (including data export, plots over lines, etc…)

1 Like

Hi guys! I have a problem related from this issue… I wanna to get all the points values in the 3 axes to build a colormap in Python. Who can solve this problem?
displacement magnetude
![Stress intesity|640x480]