Next: The 1d wave equation
Up: The wave equation
Previous: The CrankNicholson scheme
Upwind differencing
We might be forgiven for concluding that the CrankNicholson scheme represents an
efficient and accurate general purpose numerical method for solving the advection equation.
This is indeed the case, provided we restrict ourselves to fairly smooth waveforms.
Unfortunately, the CrankNicholson scheme does a very poor
job at advecting waveforms with sharp leading or trailing edges. This is illustrated in
Fig. 78, which shows a calculation in which the CrankNicholson scheme
is used to advect a square wavepulse. It can be seen that spurious oscillations are generated
at both the leading and trailing edges of the waveform. It turns out that all central
difference schemes for solving the advection equation suffer from a
similar problem.
Figure 78:
Advection of a 1d square wavepulse.
Numerical calculation performed using
,
, and . The
dotted curve shows the initial condition at , whereas the solid curve shows the numerical solution
at .

The only known way to suppress spurious oscillations
at the leading and trailing edges of a sharp waveform is to adopt a socalled upwind
differencing scheme. In such a scheme, the spatial differences are skewed in the ``upwind''
direction: i.e., the direction from which the advecting flow emanates. Thus, the
upwind version of the simple explicit differencing scheme (236)
is written

(248) 
or

(249) 
Note that this scheme is only firstorder in space, whereas every other scheme
we have discussed has been secondorder. A von Neumann stability analysis
of the above scheme yields

(250) 
Note that

(251) 
It follows that for all provided that . Thus, the upwind differencing
scheme is stable provided that the CFL condition is satisfied.
Fig. 79 shows a calculation in which the above scheme
is used to advect a square wavepulse. There are now no spurious oscillations generated
at the sharp edges of the waveform. On the other hand, the waveform shows evidence
of dispersion. Indeed, the upwind differencing scheme suffers from the
same type of spurious dispersion problem as the Lax scheme.
Unfortunately, there is no known differencing scheme which is both
nondispersive and
capable of dealing well with sharp wavefronts.
In fact, sophisticated
codes which solve the advection (or wave) equation generally employ an upwind scheme in regions close to
sharp wavefronts, or shocks, and a more accurate nondispersive scheme elsewhere.
Figure 79:
Advection of a 1d square wavepulse.
Numerical calculation performed using
,
, and . The
dotted curve shows the initial condition at , whereas the solid curve shows the numerical solution
at .

Incidentally, it is easily demonstrated that the downwind differencing scheme,

(252) 
is unconditionally unstable.
Next: The 1d wave equation
Up: The wave equation
Previous: The CrankNicholson scheme
Richard Fitzpatrick
20060329