I am trying to plot stress vs strain graph. I have used quadrature scheme to implement plasticity model.

``````def project(function, space):

p = ufl.TrialFunction(space)
q = ufl.TestFunction(space)
a = ufl.inner(p, q) * dz
L = ufl.inner(function, q) * dz
problem = fem.petsc.LinearProblem(a, L, bcs = [])

return problem.solve()

stress_11 = fem.functionspace(domain, ("DG", 0))
sigma_11 = fem.Function(stress_11)
sigma_11 = project(sig[0], stress_11)
print(sigma_11)
``````

Now I am not able to obtain the value of stress along 11. It is the same code implemented by @Jeremy_Bleyer in his website.

how can the value of stress be obtained so that I can save the stress values and plot for stress vs strain.

What do you mean by obtaining the value of the stress along 11. Do you mean the (y,y) or (1,1) component of the stress tensor?

Do you want to plot something along a line, evaluated in a point or something else?

Please provide a minimal reproducible example of what you would like to do.
Please note that you do not need to solve a PDE to illustrate this. Just create functions `u` and appropriate expression `sig`, such that people are able to run the code (and reproduce any error message).