Hello,
I have the expansion coefficients of a function saved as a numpy array and now I need to load it in parallel. This simple script demonstrates what I’m trying to do
import dolfin as dl
from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
mesh = dl.Mesh(comm, ‘path_of_mesh.xml’)
V = dl.FunctionSpace(mesh,‘CG’, 1)
coeff = np.load(‘data_path.npz’)[‘coeff’]
func = Function(V)
func.vector().set_local(coeff)
This code does not work because coeff does not have the same dimension for each rank. Do you know how I can distribute coeff
?
PS: I created coeff on a single process so all has the full vector of the coefficients.
thank you