Hi,
If you have a newer version of dolfin (>1.3.0), then it is trivial. For older versions it is not possible.The following bit of code solves the Poisson equation on two processors using a positive source on rank 0 and negative on rank 1. The mesh is not distributed. On rank 0 the mesh is 10x10 and on rank 1 it is 20x20.
script.py:
from dolfin import *
mpi_comm = mpi_comm_world()
my_rank = MPI.rank(mpi_comm)
mesh = UnitSquareMesh(mpi_comm_self(), 10+10*my_rank, 10+10*my_rank)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
u_ = Function(V)
source = Constant(1) if my_rank == 0 else Constant(-1)
solve(inner(grad(u), grad(v))*dx == source*v*dx, u_, bcs=DirichletBC(V, 0, "on_boundary"))
plot(u_, title="Proc {}".format(my_rank))
interactive()
Run with:
mpirun -np 2 python script.py
If you need to solve completely different equations, then split by if my_rank==0 etc, but use mpi_comm_self when creating the mesh.