Writing deformation / gradient in paraview

Assuming that your function u_function is a Lagrange function, the gradient of it is a DG-0 function, not a P1 function. Thus the interpolation of the gradient is not well defined. Please use a tensor DG-0 space.

Also note that without a minimal reproducible example it is hard to give you further guidance. Please see: Read before posting: How do I get my question answered?