17 Solving PDEs with time stepping
18 Apr 2019Partial differential equations (PDEs) may depend on both space and time derivatives such as the parabolic heat equation
which describes how temperature changes over time in a material with thermal conductivity , heat capacity , and density . Importantly, in order to solve such PDEs, we need to know both the initial values at all positions in space at and the boundary conditions at all later times .
Leap frog algorithm for solving the heat equation
We can then transform the PDE into a finite difference equation on a lattice. The difference equation can be solved with a time stepping scheme where we start from the initial values and solve the spatial component for increasing times using either an explicit method such as the Leapfrog algorithm or an implicit method such as the Crank-Nicholson method.
Von Neumann stability analysis
Not all combinations of and lead to stable solutions. Using von Neumann stability analysis one can determine analytically the relationship between the discretizations in space and time that lead to stable solutions. The analysis is based on determining the stable eigenmodes of the finite difference equation, i.e., we determine the conditions under which no modes grow in time. This then implies that solutions, which can be written as linear superpositions of these eigenmodes, will also not grow in time and are therefore stable.
Class material
- Student notebooks 1
- Leap-frog method for the heat equation and von Neumann stability analysis: 17_PDEs-Students.ipynb
- Crank-Nicholson method applied to the heat equation: 17_CrankNicholson-Students.ipynb
- Lecture notebooks 2 (correspond to the student notebooks):
- 17_PDEs.ipynb and derivation of of the heat equation (PDF)
- discussion on the stability of the simple leapfrog algorithm and how the relaxation Jacobi algorithm for solving Poisson's equation numerically implements solving a diffusion equation: 17_PDEs_comments.ipynb (PDF) and notes on stability and relaxation (PDF)
- 17_CrankNicholson.ipynb and derivation of the Crank-Nicholson algorithm (PDF)
Additional resources
- Computational Physics, Ch 20
- Numerical Recipes in C, WH Press, SA Teukolsky, WT Vetterling, BP Flannery. 2nd ed, 2002. Cambridge University Press. Chapter 19.
Footnotes
-
As usual,
git pull
the resources repository to get a local copy of the notebook. Then copy the notebook into your work directory in order to complete the exercises. ↩ -
Notebook will be posted after class; in the mean time look at the student notebook. ↩