Skip to content

Notes and examples on how to solve partial differential equations with numerical methods, using Python.

License

Notifications You must be signed in to change notification settings

gilbertfrancois/partial-differential-equations

Repository files navigation

Numerical methods for Partial Differential Equations with Python

Gilbert François Duivesteijn

About

This repository is a collection of Jupyter Notebooks, containing methods for solving different types of PDEs, using Numpy and SciPy. Most notebooks take a special case of the general convection-diffusion equation

and use a specific method to solve it using a most suitable numerical method. With time, more and more notebooks will be added. The goal is to have the written out formulas and code in par with each other, and make a direct translation between the mathematical notation and programming code.

Figure 1: Example of numerical solution of a 2D Poisson PDE

Table of contents

Finite difference

1D heat equation, finite difference, SciPy integration

1D heat equation, finite difference, direct method

1D heat equation, finite difference, forward Euler

1D heat equation, finite difference, Neumann BC

1D heat equation, finite difference, p1 MIT 2016

1D convection equation, finite difference, SciPy integration

1D wave equation, finite difference, SciPy integration

2D Poisson equation, finite difference

2D Poisson equation, finite difference, BC

Finite volume

1D Burgers' equation, finite volume, central scheme

1D Burgers' equation, finite volume, upwind scheme

1D Burgers' equation, finite volume, reconstructed upwind scheme

1D Burgers' equation, finite volume, Godunov scheme with limiter

1D ODE

Solving ODE with SciPy

Computational Fluid Dynamics, panel method

Potential flow

Potential flow around an airfoil << Work in progress >>

Miscellaneous

Euler's formula and Euler's Identity

Taylor expansion

Truncation error analysis with Taylor expansions

Fibonacci Numbers

Matlab code

Some Matlab scripts for verification and validation of the Python implementations:

1D Burgers' equation, finite volume, Godunov scheme with limiter

2D Poisson equation Solution with Matlab PDE Toolkit

2D Poisson equation BC Solution with Matlab PDE Toolkit