This is my final project for AMS 562.
To run the driver program and generate the data, one can simply execute
$ make
To generate the data plots (given the existence of the data), one can simply execute
$ ./generate_plots
The 1D Poisson equation is specified by -u'' = f on the interval [a,b],
where f is continuous and u is the desired function to be solved. This
project implements a finite differencing scheme for determining the function
u. This scheme reduces to solving a special linear system Ax = b where A
is symmetric, tridiagonal, and positive definite. The suite provided in the
solvers
library implements this scheme using three different matrix storage
methods:
- Square, dense matrices (
LuSolver
), which implement no data compression at all. - Packed upper triangular matrices (
PpSolver
), which exploits the symmetric property of A. - Packed symmetric tridiagonal matrices (
TriDiagonal
), which exploits both the symmetric and tridiagonal properties of A.
For any of these methods to work, the matrix A must be positive definite.
With these distinct storage methods, the driver program solvers/main.cpp
tests them on simple Poisson problems. These problems involve functions f
which can be readily integrated in order to determine the exact solution u.
For each sample function and for each storage method, it compares the exact
solution with the computed solution according to the finite differencing scheme
by computing the L2 and LInf norm errors between them. It also writes the
computed and exact solutions to a set of files in the data
directory.
The Python script generate_plots
takes data generated from the driver program
and plots the computed and exact solutions. For every problem with a specified
function f and storage method, the resulting solutions are plotted in
individual graphs. The L2 and LInf norm errors are displayed as well. All of
these solutions are also plotted in an additional compiled figure.
The script requires a Python 3 interpreter and uses the following dependencies:
- numpy(==1.12.1)
- matplotlib(==2.0.2)
For prettier graphs, it pays to have the seaborn
library installed as well.
This scheme is startlingly accurate for these toy problems. I would like to find a more interesting function to generate data for, perhaps then to show the limits of finite differencing. But for these examples, the finite difference method is highly successful.