Poisson's equation

In this lab you are going to use MPI to parallelize a simple algorithm (finite differences and Jacobi's method) to solve Poisson's equation on the unit square, using Dirichlet boundary conditions. Since the text requires mathematical notation I have use LaTeX instead of HTML. Here is the text. Note, you may not base your code on any Poisson code you may find on the web, that is considered cheating.

Here are the details about zero indices and dynamic memory allocation in Fortran. See the pdf-file "Introduction to C, Fortran 90, FORTRAN 77, tcsh and bash" under the Diary as well. This pdf-file contains a similar discussion for C.

I have been asked about how large the errors may be. Here are some examples. tau is the tolerance (given by the user) and delta <= tau, where delta is the error in Jacobi's method. err is the error in the solution (i.e. the maximum error in a gridpoint). I started the Jacobi iteration using zeros in the approximate solution.

ntauerr
201e-54.8e-4
201e-71.4e-5
201e-91.6e-5
1001e-51.1e-2
1001e-71.1e-4
1001e-91.1e-6
1001e-117.1e-7

2012-05-03: I updated the lab slightly 2012, but I forgot to put the new pdf-file on www. I have put the new file there today, May 3, 17:20 (if you have started with the old version it is OK to continue with it). The table above is slightly different in the old version. See the lab from 2011.

A hint on debugging the parallel version: if you let different processes write, it may be hard ro read the output, since it usually becomes interleaved. In my program I opened four files, F0, F1, F2 and F3, say, and let each process write on its own file (the process with rank 2 writes on F2 etc). You can read about files, in Fortran and C, in the hints for the OpenMP-lab.


Back