Hi,
I am trying to output functions using MPI. The value in was updated by a user function before output. Seems as if the values at the border of two local meshes were not correct. A simple example to demonstrate this issue is given as follows -> test.py . I am using Fenics 1.5.
# test.py
from dolfin import *
import numpy
# Extrapolation needed to avoid errors beacuse each process looks for the point even if it does not own it
parameters["allow_extrapolation"]=True
mesh=UnitSquareMesh(10,10)
V=FunctionSpace(mesh,'CG',1)
U = Function(V)
size = (U.vector().local_size())
print size
vector = []
#set values for local mesh
if MPI.rank(mpi_comm_world())==0:
vector = [-20.0]*size;
else:
vector = [-10.0]*size;
#set local values to the U function
U.vector().set_local(numpy.array(vector))
File('mesh.xdmf') << U
plot(U)
interactive()
and run the code with:
mpirun -np 2 python test.py
I guess this could be due to the ghost values in the local vector? So any suggestions to solve this?
Thanks!