If u
is your solution, maybe use the hdf5 format can be useful for what you wants:
# Save solution
output_file = HDF5File(mesh.mpi_comm(), "u.h5", "w")
output_file.write(u, "solution")
output_file.close()
# Load solution
U = Function(V)
input_file = HDF5File(mesh.mpi_comm(), "u.h5", "r")
input_file.read(U, "solution")
input_file.close()
(this also works in parallel).