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.
The code must be written i Fortran.
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.
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.
n | tau | err |
20 | 1e-5 | 4.8e-4 |
20 | 1e-7 | 1.4e-5 |
20 | 1e-9 | 1.6e-5 |
100 | 1e-5 | 1.1e-2 |
100 | 1e-7 | 1.1e-4 |
100 | 1e-9 | 1.1e-6 |
100 | 1e-11 | 7.1e-7 |
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 the hints for the OpenMP-lab.
Another debug hint. Switch on array bounds checking by: mpif90 -fbounds-check
etc. Do not forget the err-parameter in the MPI-subroutines.