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

Running solver for mixed formulation for Poisson equation in parallel

0 votes

I am trying to run the mixed formulation of the Poisson equation several times in parallel so the equation is solved multiple times concurrently, but each time the solver is run all work is performed on the same process. For example, I am able to run the following using mpiexec -n 1 python X.py, but using mpiexec -n 2 python X.py does not yield the correct results. Any ideas on what I might be doing wrong? Thanks in advance and I'd be very grateful for any help or ideas.

from dolfin import *

mpi_comm = mpi_comm_world()
my_rank = MPI.rank(mpi_comm)

mesh = UnitSquareMesh(mpi_comm_self(), 32, 32)

BDM = FunctionSpace(mesh, "BDM", 1)
DG = FunctionSpace(mesh, "DG", 0)
W = BDM * DG

(sigma, u) = TrialFunctions(W)
(tau, v) = TestFunctions(W)

f = Constant(1.0)

a = (dot(sigma, tau) + div(tau)u + div(sigma)v)dx
L = - f
v*dx

bc=DirichletBC(W.sub(1), 0, "on_boundary")

w = Function(W)
solve(a == L, w, bc)
(sigma, u) = w.split()

plot(u)
interactive()

asked Sep 16, 2015 by Louis3 FEniCS Novice (120 points)
...