Gradient of Unstructured Grid in Python

Thanks, but still the obtained solution is not desirable (zero gradient is calculated). It seems the problem is in mesh generation. In your proposed script, if instead of ‘pv.PolyData(xyz)’, the following command is used:

point_cloud = pv.PolyData(xyz)
mesh = point_cloud.delaunay_3d(alpha=1)

the calculated gradient field is nonzero, but still it is not correct. How can I use pv.PolyData(xyz) so as not to obtain zero gradient as solution?