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

DirichletBC in parallel

+1 vote

I'm little bit confused about working of DirichletBC in parallel. Examining the code of

void DirichletBC::apply(GenericMatrix* A,
                        GenericVector* b,
                        const GenericVector* x) const

it seems to me that when user does

u = Function(V)
bc = DirichletBC(V, uD, facet_func, 42, method='topological')
bc.apply(u.vector())

bc.gather(...) is never called. This would cause that DOF residing on different process than corresponding boundary facet is not taken into account.

Only one who calls DirichletBC::gather in DOLFIN ever is

void SystemAssembler::assemble(GenericMatrix* A, GenericVector* b,
                               const GenericVector* x0)

Is this a bug or am I missing something?

asked Jun 25, 2013 by Jan Blechta FEniCS Expert (51,420 points)

I guess that call of b.apply("insert") in the end of bc.apply(b) does the trick of syncing not owned dofs, is it so?

1 Answer

+1 vote
 
Best answer

For DirichletBC::apply, only one process needs to set the boundary condition.

Via SystemAssembler::assemble, each process that contributes to a dof needs to be aware of any boundary condition applied to that dof, which is why DirichletBC::gather is used.

answered Jun 25, 2013 by Garth N. Wells FEniCS Expert (35,930 points)
selected Jun 25, 2013 by Jan Blechta

Follow-up question: Does it also mean that for a Dirichlet facet f which is shared between 2 processes it suffice that

facet_func[f] == 42

holds on one arbitrary process having f in its partition and on second process value of facet_func[f] can be arbitrary? Simply said: facet_func does not need to be synced, right?

Follow-up question: ...

Answer: yes, checked by experiment.

...