Save the result of mpirun in a numpy array

This depends on what kind of function space you are using, as in DOLFINx, Nedelec/RT etc is using its proper definition being integral moments, which means that you do not have dof coordinates.

If you are using Lagrange,

dof_coordinates = V.tabulate_dof_coordinates()
uh = Function(V)

out = open("data.csv", "w")
for x, val in zip(dof_coordinates, uh.x.array):
    print(f"{x[0]} {x[1]}, {val}", file=out)
out.close()

This would yield a slight overlap (as it includes duplicate points on process boundaries in parallel).
Slicing the dof coordinates and array using the local size in the index map would resolve this (But as Im not at my laptop, i cannot write that code right now).