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.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+