I am written a piece of code which simply solves the Laplace equation in a 3D cube and obtains the current density distribution inside it. The code runs in parallel on HPC and works perfectly. I want to save the result (the current density vector) and then call it in another code which is not in FEniCS and runs in serial. In fact, I need nodal values for each mesh coordinate in a numpy array.
First, I tried to extract the nodal values and save them by np.save. However, in this way, only a part of data was saved (based on the MPI rank).
Second, I tried to use h5py to save data. However, it was not compatible with HDF5 embedded in FEniCS 2019 and the code couldn’t be executed.
Third, I saved data in HDF5 file. Then, I tried to read it in the serial code. However, in this way, I had to define the mesh and function spaces in the serial code. This way was time-consuming and reduced code performance drastically.
Now, I am looking for a way to save the data obtained from running my code in parallel as a numpy array. Any possible help would be highly appreciated.