Dear all,
solving a time dependent non-linear problem, I need to evaluate the values of the nodal degrees of freedom and the dof’s coordinates at the end of each time step.
To be more precise, I need to find the position of the dof, where the dof’s current value (scalar c_res) is lower than a constant and the dot product of the position vector with a constant vector is maximal.
That’s why I dealt with Dolfin’s MPI wrapper and tried to use one of the gather functions implemented in Dolfin. As a first step, I tried to gather the nodal dof vector c_res.
Later, I’d like to gather an array containing one nodal dof and its position per process.
- Code snippet common for all the attempts:
#… mesh definition etc. …
meshcomm = mesh.mpi_comm()
#…
V = FunctionSpace(mesh,element)
c_res = Function(Vc)
#… boundary conditions etc. …
while t<totalTime
#… solve …
u_res,c_res = uc.split(True)
- First, I tried to follow the approach described in https://www.allanswered.com/post/vxknw/is-there-a-way-to-retrieve-global-array-when-running-in-parallel/ in Dolfin 2018.1:
c_res_arr=c_res.get_local()
c_res_glob=meshcomm.gather(c_res_arr)
Resulting in the following error:
AttributeError: ‘dolfin.cpp.MPICommWrapper’ object has no attribute ‘gather’
srun: error: taurusi6336: tasks 0-1: Exited with exit code 1
- Than, I tried to use the gather_on_zero function of the GenericVector class:
x=Vector()
c_res.vector().gather_on_zero(x)
This gave me an error I don’t really understand:
c_res.vector().gather_on_zero(x)
TypeError: GenericVector_gather_on_zero() takes exactly one argument (2 given)