Giter Site home page Giter Site logo

poisson1d's Introduction

Poisson 1D numerical BVP solver

This is my final project for AMS 562.

TL;DR: Running the project

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

Description

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:

  1. Square, dense matrices (LuSolver), which implement no data compression at all.
  2. Packed upper triangular matrices (PpSolver), which exploits the symmetric property of A.
  3. 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.

Driver program

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.

Data visualization

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.

plots

Dependencies

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.

Discussion

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.

poisson1d's People

Contributors

davidnkraemer avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.