Poisson's equation

In this lab you are going to use MPI to parallelize a simple algorithm (finite differences andJacobi'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. For C, see the tutorial about C-programming (look under the Diary).

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-58.7e-4
201e-71.4e-5
201e-91.6e-5
1001e-52.1e-2
1001e-72.1e-4
1001e-92.0e-6
1001e-117.0e-7

Update 2011-05-06: I have added a Matlab-code to help debugging. It can provide you with the approximate solution, for different values of tau and n, and a few other things. I have created a p-code which implies that you cannot read my Matlab code (since I do not want you to try an implement my example code). In /chalmers/groups/thomas_math/HPC/MPI (in the file system) you find two files mpi_lab.p (executable code) and mpi_lab.m (just comments). Fetch them both and type help mpi_lab in Matlab for instructions. The code works for Matlab 2009b (I cannot generate p-code för newer Matlab versions, but perhaps my code works for newer versions as well, but I cannot guarantee it).

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