Numerical Modeling of Weather and Climate
Christoph Schär, Institute for Atmospheric and Climate Science, ETH Zürich
Lecture Notes Chapter 2:
Repetition of finite differencing
March 2007
Elementary Schemes...
Leapfrog scheme, centered time stepping ...
Upstream scheme, Forward/Euler time stepping...
Stability ...
Courant-Friedrichs-Levy stability criteria...
Von-Neumann Analysis: phase- and amplitude errors ...
Numerical dispersion ...
Classification of time stepping schemes ...
Nonlinear instability...
Consistence and convergence ...
Order of a scheme ...
Higher-order schemes ...
convergence, Lax-Richtmeyer theorem ...
Conservative schemes ...
Further information:
Schär, C, 2006: Skript der Vorlesung "Numerische Methoden in der Umweltphysik".
Verfügbar via Internet unter http://www.iac.ethz.ch/staff/schaer/
Durran, D. R., 1998: Numerical methods for wave equations in geophysical fluid dynamics.
Text in Applied Mathematics, 32, Springer
Derivative with finite differencing
Discretization in space
!
x
i= i " x
#
i= # ( x
i)
Spatial derivative using finite differences
!
x
ix x
i-1analytical
"x
"!
numerical
#
$ !
$ x
xi
:= !
i% !
i%1" x
#
$ !
$ x
xi
: =
"x&0
lim !
i% " x !
i%1Leapfrog Scheme
One-dimensional linear advection (or transport) equation
!
"#
"t + u "#
"x = 0
(u=const) Discretization in space and time
!
x
i= i "x, t
n= n"t
#
in= # (x
i,t
n)
Centered differences in space and time
!
"#
" t
$
% & ' ( )
i n
* #
in+1– #
in–12 +t
!
"#
" x
$
% &
' ( )
i n
* #
i+1n+ #
in+12 ,x
Solving for !
in+1yields the Leapfrog scheme
!
"
in+1= "
in–1– # " (
in+1$ "
in–1) with # = u %x %t = Courant number This is a three-level time-stepping scheme:
n n+1 t
n-1
Upstream Scheme
Forward discretization in time (Euler or forward time stepping)
!
"#
" t
$
% & ' ( )
i n
* #
in+1– #
in+t
Upstream discretization in space
!
"#
" x
$
% & ' ( )
i n
* #
in+ #
i+1n, x (for u - 0).
Solving for !
in+1yields the Upstream scheme
!
"
in+1= "
in– # " (
in$ "
in–1) with # = u %x %t
where α is the Courant number.
This is a two-level time-stepping scheme.
Courant-Friedrichs-Levy stability criterion
Stability criterion for a large class of schemes:
!
u "t
"x # 1
For the advection equation: u refers to the advection velocity
=> Interpretation: the physical domain of dependence of !
jn+1must be included in the numerical domain of dependence.
=> For a large class of schemes, this is a necessary but not sufficient stability criterion!
In the general case, u is the largest speed at which information may propagate in the system under consideration (propagation speed).
Information can propagate by advective processes (with velocity v), or by wave propagation (with group velocity c
g).
Thus, in the general case u represents:
!
u = max v + c
gVon Neumann analysis
Ansatz: wave-like perturbation of the form
!
" ( x, t) = e
i(k x#$t)For linear advection we have
!
" = uk .
Conversion to computational grid
!
( x, t) = ( j"x, n"t)
!
"
nj= e
i k(j#x$u n#t)= e
i k j#x(e
$i k u#t) 1 2 4 3
%4
n
= e
i k j#x%
nThe complex number λ = λ (k) determines time evolution.
Plug Ansatz into numerical scheme to derive λ = λ (k).
Then, λ determines stability of scheme:
• | λ (k)| > 1 for one wave number k: unstable
• | λ (k)| = 1 for all wave numbers k: stable, neutral
• | λ (k)| < 1 for all wave numbers k: stable
In addition, λ (k) contains detailed information about the amplitude and
phase error of a scheme, as a function of wave number k.
Amplitude and phase errors
Example: Upstream scheme
0.1 0.2 0.3 0.4 0.5
0.2 0.4 0.6 0.8 1 1.2
1.4
u
num/ u
wavelength in !x
10 5 3.3 2.5 2
!
wavelength–1 in !x–1
" = 0.5
" = 0.75
" = 1
" = 0.25
0.1 0.2 0.3 0.4 0.5
0.5 1 1.5 2
" = 1
" = 1.25
" = 1.5
" = 0.25
" = 0.5 " = 0.75
|#|
Numerical dispersion
Example: Leapfrog scheme
wavelength in !x
10 5 3.3 2.5 2
!
0.1 0.2 0.3 0.4 0.5
0.5 1 1.5
2
0 0.1 0.2 0.3 0.4 0.5
0.2 0.4 0.6 0.8 1 1.2 1.4
0.1 0.2 0.3 0.4 0.5
-1 -0.5
0.5 1
cnum / u unum / u
| " |
# = 0.5
# = 0.5
–1 " # " 1
| "2| (#=1.5)
| "1| (#=1.5)
wavelength–1 in !x–1