How to make parameters['ghost mode']='shared_facet' work in parallel with periodic boundary conditions?

sample code

parameters[‘ghost_mode’] = ‘shared_facet’
class PeriodicBoundary(SubDomain):
def inside(self, x, on_boundary):
dir_x = bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
dir_y = bool(x[1] < DOLFIN_EPS and x[1] > -DOLFIN_EPS and on_boundary)
return dir_x or dir_y
def map(self, x, y):
if abs(x[0]-1)<1e-6:
y[0] = x[0] - 1.0
y[1] = x[1]
elif abs(x[1]-1)<1e-6:
y[0] = x[0]
y[1] = x[1] - 1.0
mymesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mymesh, “CG”, 1, constrained_domain=PeriodicBoundary())

this results in error when run with mpirun in parallel

1 Like

Hi,
Others would be able to help you better if you could encapsulate the code between triple fences ``` and post the traceback.

‘’‘parameters[‘ghost_mode’] = ‘shared_facet’
class PeriodicBoundary(SubDomain):
def inside(self, x, on_boundary):
dir_x = bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
dir_y = bool(x[1] < DOLFIN_EPS and x[1] > -DOLFIN_EPS and on_boundary)
return dir_x or dir_y
def map(self, x, y):
if abs(x[0]-1)<1e-6:
y[0] = x[0] - 1.0
y[1] = x[1]
elif abs(x[1]-1)<1e-6:
y[0] = x[0]
y[1] = x[1] - 1.0
mymesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mymesh, “CG”, 1, constrained_domain=PeriodicBoundary())’’’

Here is the code encapsulated

Okay, it is still not formatted properly. The key to press to properly format your code is right on top of Tab on your keyboard. You should a single back tick for inline and triple for a code block. See this

But nevertheless, do you have facet integrals in your variational form? If not, what is the reason for turning on the shared_facet mode?
I’ve never had problems with Lagrange elements in parallel, but I do remember having issues with non-conforming CR elements, see Running `CR` in parallel: Error detected in HDF5

I am not on my workstation but can check this and let you know

Yes I do have facet integrals in my variational form in the main project. I am trying to solve the bloch torrey partial differential equations with multiple subdomains, and hence I need the facet integrals.

1 Like