Numerical Solution of the Advection Partial Differential Equation: Finite Differences, Fixed Step Methods
This Demonstration shows some numerical methods for the solution of partial differential equations: in particular we solve the advection equation. We use finite differences with fixed-step discretization in space and time and show the relevance of the Courant–Friedrichs–Lewy stability criterion for some of these discretizations.
It is hard to find reliable numerical methods for the solution of partial differential equations (PDEs). Often they turn out to be either unstable or strongly diffusive, giving inaccurate solutions even to simple equations.
Our case study is one of the simplest PDEs, the advection equation
that describes the propagation of an unchanging shape at constant speed . Trivially, this equation is solved by any function .
To solve it numerically we approximate to a discrete solution defined in a rectangular grid, . For the spatial derivative we use a first-order, centered approximation
We can think now of many discrete approximations for the time derivative. The simplest one is the explicit Euler discretization:
Then we arrive at the method usually abbreviated FTCS (forward in time, centered in space). Unfortunately, this discretization turns out to be numerically unstable for any value of and .
A first improvement to the FTCS scheme would be to replace the term in the time discretization by an average . This approach, often called the Lax method, is equivalent to adding an artificial diffusion term to the advection equation. The resulting scheme is now stable if it satisfies the Courant–Friedrichs–Lewy condition:
where is called the Courant number. However, since we are adding an artificial diffusive term, the scheme becomes too diffusive and therefore inaccurate when . The Lax method gives optimal results for .
Fortunately, the differential equation solver of Mathematica, NDSolve, comes with many numerical schemes that avoid the shortcomings of the FTCS and Lax methods. In this Demonstration you can choose some of these methods with a fixed-step time discretization.
R. Courant, K. Friedrichs, and H. Lewy, On the Partial Difference Equations of Mathematical Physics, IBM J. Res. Develop., 11, 1967 pp. 215–234.
W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, Numerical Recipes: The Art of Scientific Computing, 3rd ed., Cambridge, UK: Cambridge University Press, 2007.