See my comment at: How to compute the strain & stress matrices? - #7 by dokken
You can also use DOLFINx Expression for this purpose.
In particular, use: dolfinx/function.py at 9548c27e45bd0ca78d351964820cc4a4a7c0957d · FEniCS/dolfinx · GitHub
dolfinx/test_expression.py at 9548c27e45bd0ca78d351964820cc4a4a7c0957d · FEniCS/dolfinx · GitHub
You could also have a look at
https://jsdokken.com/fenics22-tutorial/heat_eq.html#post-processing-without-projections