Stress vs time plot at Quadrature Points in FEniCS

Hi Everyone,

I need to plot the stress values versus time at each Gauss quadrature point in FEniCS (Version 2019). I have given part of code below for your consideration:

stress_values = []
W = TensorFunctionSpace(mesh, "P", 1)

while t < tMax:
        print("time: ", t)
        BoundaryU.t = t
        solve(...)
        sigma = as_tensor((1./J)*F[j,k]*P[k,i], (j,i))
        sigma_project = project(sigma, W,...) 

        stress_tensor =
        sigma_project.compute_vertex_values(mesh)

        stress_values.append(stress_tensor)
        Uold.assign(dU)
        t += Dt
stress_values = np.array(stress_values)
time_values = np.linspace(0, tMax, len(stress_values))
plt.plot(time_values, stress_values[:, 0], label="Sigma_xx")
plt.plot(time_values, stress_values[:, 1], label="Sigma_yy")
plt.plot(time_values, stress_values[:, 2], label="Sigma_xy")

I also went through the problem solved for the von Mises stress in the “Numerical Tour…” by Jeremy; however, I still have some problems for implementation. Could you please direct me to the appropriate course of actions regarding this? I do appreciate your time and help.