DirichletBC bad init_facets check for multiple processors

Issue #13 resolved
Mikael Mortensen created an issue

I'm running a large case on multiple processors and noticed that DirichletBC was very slow at applying inside a time loop (it was taking as long as the Krylov solves). The problem seems to be that the body of init_facets is run each time around since some processors do not have boundary facets. This is the check in init_facets:

void DirichletBC::init_facets() const { Timer timer("DirichletBC init facets");

if (facets.size() > 0) return; ....

facets.size() could be zero for some processors and thus the remaining part of the function, which is rather heavy, is called over and over each time step.

The test should be something that picks up whether init_facets has been called even though no facets has been found. I've added a boolean variable to my fork that is set to true the first time around, but there might be even better ways? With the fix the DirichletBC is as fast as one would expect.

Mikael

Comments (1)

  1. Log in to comment