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.

Fortran
C (a PDF-file)

2008-05-22: I have been asked about how large the errors may be. Here are some examples (delta is the error in Jacobi, and err is the error in the solution, the maximum error in a gridpoint). I started the Jacobi iteration using zeros in the approximate solution.

ndeltaerr
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

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