I am trying to solve the time dependent heat equation with backward euler timestepping and second order space finite differences. This results in a Poisson system needing to be inverted. In serial this is trivial to solve, but I am not sure how one would go about doing this parallel with MPI. Does anyone know how to solve the 2d heat equation (implicit) with MPI? I am using a 1d parallelization. I have looked online for different parallel solvers, but it has been difficult to find a paper that actually explains clearly how to implement this problem. Any references would be helpful.

Note: What I am really solving is the 2d heat equation where I used spectral differentiation (fft's) in the periodic horizontal and second order finite differences in the vertical (so I specify dirichlet BC's on the top and bottom boundaries). I parallelize my domain by decomposing it in strips of rows in the horizontal that way computing the global fft's is trivial on each process. I am then left with trying to solve what is basically a modified heat equation system for the vertical direction. If my domain was decomposed as groups of columns insted of strips of rows, then this would be trivial as it would amount to solving a bunch of tridiagonal systems. One thing that I could do is do an MPI_ALLTOALL call, solve the tridiagonal systems on each process, then MPI_ALLTOALL call back, but this is communication instensive.


1 Answer 1


Use a library such as PETSc or Trilinos. They offer you data structures for parallel linear systems and algorithms that can work on them, such as parallel implementations of CG or GMRES. The PETSc manual provides extensive examples on how to use all of this. I'm quite certain that there's in fact even a tutorial program that already gets you 90% there.

  • $\begingroup$ Not to mention that you can use a 2D (mesh) decomposition which will allow you to scale the problem to more processors. $\endgroup$
    – Bill Barth
    Mar 15, 2014 at 14:26
  • 1
    $\begingroup$ Thanks, I will take a look at this, however I am not really looking for a external "black box" solution, but rather want to code it up as much as possible myself (for learning purposes) $\endgroup$
    – James
    Mar 15, 2014 at 15:51
  • 2
    $\begingroup$ You'll spend a year of your life doing something that is completely standard today. Spend this year doing something that nobody has done before, instead! $\endgroup$ Mar 15, 2014 at 23:21
  • $\begingroup$ If your goal is to learn MPI, just get a book. $\endgroup$ Mar 16, 2014 at 5:09
  • 1
    $\begingroup$ @WolfgangBangerth great advice. I know too many grad students who waste time repeating old work rather than building on it and doing something new. $\endgroup$ Mar 19, 2014 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.