18 PDEs: Wave equation
25 Apr 2019The wave equation is a hyperbolic partial differential equations (PDEs) which describes the displacement as a function of position and time. The 1D linear wave equation is
whose solutions are traveling waves with wave velocity , for example, the waves that are generated by plucking a string:
The wave equation in 2D can be derived in the same fashion as for the 1D case and reads
or in general (3D)
Leap frog algorithm for solving the wave 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 an explicit method such as the Leapfrog algorithm, similar to the solution for the heat equation.
For example, in the 2D case, the finite difference approximation for the Laplace operator is
Setting (same spacing in and ) and we obtain the discretized 2D wave equation
where the unknown (future) term is on the left hand site and can be computed from all known (present and past) terms on the right hand side.
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.
For the wave equation the Courant condition follows
(1D case) or when written as
it means that the time step (for a given ) must be smaller than the time that the wave takes to travel one grid step.
In the 2D case, the Courant condition is .
Class material
- Student notebook: 1: Leap-frog method for the wave equation and von Neumann stability analysis: 18_PDEs_waves-students.ipynb
- Lecture notebooks 2 (correspond to the student notebooks):18_PDEs_waves.ipynb.
- Lecture notebook for 2D waves: 18_PDEs_2D_waves.ipynb
Additional resources
- Computational Physics, Ch 21
- Computational Modeling, Ch 6.5
- 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. ↩