This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How can I use DirichletBC.gather()?

0 votes

Dear FEniCS person,
I am running an application in parallel and wondering how I can get the global set of boundary values for an object of type DirichletBC.

I test with the following script

global_bc.py

from dolfin import *
m = UnitCubeMesh(1,1,1)
V = FunctionSpace(m, "CG", 1)
bc = DirichletBC(V, 1.0, "near(x[0], 0.0)")
bc.gather()
bc_dofs = bc.get_boundary_values().keys()
print bc_dofs

If i run the script
mpirun -n 3 python global_bc.py

I get the output
[]
[2L, 4L, 5L, 7L]
[]

Which looks like only the second processor owns the dofs in the bc. The method gather() returns a dictionary and accepts no parameters so I am confused as to how it should be used if not as in the script.

Best Regards,
Gabriel

asked Feb 13, 2014 by Gabriel Balaban FEniCS User (1,210 points)

1 Answer

0 votes

This looks like a bug in the Python wrapping of gather.

The function gather is used by DirichletBC to distribute shared boundary values between processes. However, the C++ version takes the boundary values as argument, checks if the bv dof is shared and in that case the bv is distributed to its neighbours. This does not work from the Python since you're not allowed to send the boundary values in as argument (the Python gather takes no arguments). You should report the bug on bitbucket.

answered Feb 14, 2014 by mikael-mortensen FEniCS Expert (29,340 points)
...