Problem with assign in parallel

Hello,

I am working with an advection-diffusion problem that works fine when running it in serial. However, when running it in serial with the following command:

mpirun -n 6 python NSfracStep.py problem=TayCyl

It the following error:

*** Error:   Unable to successfully call PETSc function 'VecCopy'.
*** Reason:  PETSc error code is: 73. (Object is in wrong state).
*** Where:   This error was encountered inside /build/dolfin-fyfCiA/dolfin-2017.2.0.post0/dolfin/la/PETScVector.cpp.

in this line:

 cp_n.assign(cp)

in which cp is the solution function that is just solved, which I am assigning to cp_n which is the solution of the previous timestep.

Does anyone know how to fix this problem in parallel?

Would it help to use the assign function rather than class method?

assign(cp_n, cp)

Alternatively, copy instead of assign

cp_n = cp.copy()

or

cp_n = cp.copy(deepcopy=True)
1 Like