See my comments in the previous posts.
If you simply want to read and write the function data in the same script, you could use something alot more lightweight (as then the number of processes are the same, all the data is local). I would use either the adios2 python interface or just h5py
to read and write local chunks of the u.x.array
to and from file.