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

mpi4py how to disable automatic distribution of mesh

+1 vote

I am trying to solve two different Poisson problems simultaneously on two processors. It appears that fenics is automatically distributing the mesh between the two processors. I can't seem to figure out how to disable this.

I am currently generating my mesh via

domain = Circle(Point(circle_outx,circle_outy),circle_outr) - Circle(Point(circle_inx,circle_iny),circle_inr)
mesh = generate_mesh ( domain, 30 )
asked Nov 3, 2015 by mhs13c FEniCS Novice (260 points)

1 Answer

0 votes

You can create a mesh with a given MPI communicator, and generate mesh by using mshr._generate:

import mshr
from mshr import *
from dolfin import *

if MPI.rank(mpi_comm_world()) == 0:
   mesh = Mesh(mpi_comm_self())
   domain = Circle(Point(0.0,0.0),2.0) - Circle(Point(0.0,0.0),1.0)
   mshr._generate(mesh, domain, 30)
else:
   mesh = None

print mesh
answered Nov 4, 2015 by Øyvind Evju FEniCS Expert (17,700 points)
...