meteorologische modellierung - mi · meteorologische modellierung introduction to numerical...
TRANSCRIPT
![Page 1: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/1.jpg)
1
Frank Lunkeit
Meteorologische Modellierung
Introduction to Numerical Modeling
(of the Global Atmospheric Circulation)
0. Introduction: Where/what is the problem and basics
1. The (linear) evolution (decay) equation (discretization in time)
2. One-dimensional linear advection (discretization in time and space)
3. One-dimensional linear diffusion and one-dimensional linear transport equation
4. Nonlinear advection and 1d nonlinear transport equation (Burgers-equation)
5. More dimensions (grids)
6. Design of an atmospheric general circulation model (AGCM)
(7. An example: qg barotropic channel (weather prediction)) next semester
Outline
Frank Lunkeit
![Page 2: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/2.jpg)
2
References
D. R. Durran: Numerical Methods for Wave Equations in Geophysical
Fluid Dynamic, Springer 1999, ISBN:0-387-98376-7.
G.J. Holtiner & R.T. Williams: Numerical Prediction and Dynamic
Meteorology, Second Edition, John Wiley & Sons 1980, ISBN: 0-471-
05971-4.
D. Randall: An Introduction to Atmospheric Modeling,
http://kiwi.atmos.colostate.edu/group/dave/at604.html
Frank Lunkeit
Introduction to Numerical Modeling
0. Introduction: The Problem and Basics
Frank Lunkeit
![Page 3: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/3.jpg)
3
,..),,(1
TvuFx
Pfv
y
uv
x
uu
t
ux
Nonlinear (quasi-linear) coupled partial differential equations
(without a known analytic solution)
Example: Two dimensional flow
,...),,(1
TvuFy
Pfu
y
vv
x
vu
t
vy
y
v
x
u
yv
xu
t
,...),,( TvuFy
vx
ut
RTP
pcR
P
PT
0
Eq. of motion
Eq. of motion
Continuity eq.
First law of thermodynamics
Eq. of state
Pot. temperature
The Problem
Frank Lunkeit
Example: First law (1-d, p=const.,…)
t
T
x
Tu
2
2
x
TK
,...),( uTF
local
change
with time
advection diffusion other forcing
first
derivative
in time
first
derivative
in space
Second
derivative in
space
?
The Problem The Problem
Frank Lunkeit
![Page 4: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/4.jpg)
4
From theory (the equations) to the numerics:
a) continuous functions -> discrete values
b) differential (integral) equations -> algebraic equations
Tasks:
a) choice of the discretization
b) calculation (representation) of the derivatives
Approaches (Algorithms):
- grid point methods (finite differences)
- series expansion (spectral method and finite elements)
Evaluation of a method:
- consistency, accuracy, convergence and stability
Numerical Solution of (Partial) Differential Equations
Frank Lunkeit
T
T(s)
s
s = t, x, y, z,…
T
s
{
∆s sj sj+1 sj-1
a) continuous function -> discrete values
∆s defines the resolution
Example: The Grid Point Method Example: The Grid Point Method
Frank Lunkeit
![Page 5: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/5.jpg)
5
T
T(s)
s
s = t, x, y, z,…
T
s
{
∆s sj
sj+1 sj-1
b) derivatives -> finite differences (e.g. from Taylor-expansion)
...|)()()2
...|)()()1
sds
dTsTssT
sds
dTsTssT
s
s
...)()(
)1 from1
s
sTsT
ds
dT jj
...)()(
)2 from1
s
sTsT
ds
dT jj
Central differences
Forward differences
Backward differences
...2
)()()2)1 from
11
s
sTsT
ds
dT jj
Example: The Grid Point Method
Frank Lunkeit
derivatives -> analytical derivatives of the basis-functions
T*n differentiable orthogonal (Basis-) functions (Fourier-series;
Legendre Polynomials). The resolution is given by the number of
modes n
T
s
T*2(s)
T
T(s)
s
s = x, y, z,…(t)
+
T
s
T*1(s)
n
nn
ds
dTa
ds
dT *
)()( * sTasTn
nn
Example: Series Expansion -The Spectral Method
Frank Lunkeit
![Page 6: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/6.jpg)
6
T
T(s)
s
s = x, y, z,…(t)
T
s +
example
F1,F2,… arbitrary function which is only locally non zero
Derivatives -> depending on the function
T
s
T
s
+
+ …. T(s)=aF1(s)+bF2(s)+….
F1(s)
F2(s)
F3(s)
Example: Series Expansion –Finite Elements
Frank Lunkeit
Evaluation: Consistency
ds
dT
s
T
s
0limThe discretization must converge to the differential:
Example: forward difference:
ds
dTs
ds
Td
ds
dT
s
sTssT
s
ds
Td
ds
dT
s
sTssT
s
ds
Tds
ds
dTsTssT
ss
...
2lim
)()(lim
...2
)()(
...2
)()()(
2
2
00
2
2
2
2
2
s
sTssT
s
T
)()(
Consistency from Taylor-expansion:
Frank Lunkeit
![Page 7: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/7.jpg)
7
Frank Lunkeit
Evaluation: Accuracy
Accuracy: Smallest power of ∆s in the deviation from the truth
Example: forward differences
)(
...2
)()(
...2
)()()(
2
2
2
2
2
sOds
dT
s
T
s
ds
Td
ds
dT
s
sTssT
s
ds
Tds
ds
dTsTssT
s
sTssT
s
T
)()(
Taylor-expansion
=> forward differences are of first order accuracy
a: Accuracy (order of accuracy) of the discretization
b (mostly): Accuracy (order of accuracy) of the scheme
Considering the whole equation, i.e. including the ‚right hand side‘ (see, e.g.,
Section ‘Evolution (decay) equation’)
Evaluation: Convergence
Convergence: Convergence of the error to 0 for small ∆s:
0)()(lim0
tTtT As
Error: Deviation of the numerical solution (T) from the truth (analytical solution; TA)
Error measure (Norm)
a) Euclidean (quadratic) Norm:
b) Maximum Norm:
2/1
1
2
2
N
j
j
jNj
1max
Examples
Frank Lunkeit
![Page 8: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/8.jpg)
8
Frank Lunkeit
or: A scheme is unstable if the numerical and the analytical solutions diverge with
time:
Stability: A scheme is stable if the difference between the numerical and the
analytical solution is bounded:
Evaluation: Stability
t
A tTtT )()(
Stability analyses: various methods (e.g.):
Direct (heuristic),
Energy Method and Von Neumann Method (see advection equation)
ttCtTtT A )()()(
(most important for practical use)
If TA(t) is bounded:
ttCtT )()(
t
tT )(
stable
unstable
Interrelation (Lax Equivalence Theorem):
‚For a consistent scheme stability is a necessary and sufficient condition for
convergence‘.
Stability may depend on ∆s
0. Introduction: The Problem and Basics
Summary:
• Reason to do numerics: No analytic solution of the problem
• Methods: Grid point method, spectral method, finite elements (,…)
• Finite Differences: forward, backward, central
• Evaluation: consistency, accuracy, convergence and stability
0. Introduction: The Problem and Basics
Frank Lunkeit
![Page 9: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/9.jpg)
9
1. The (Linear) Evolution (Decay) Equation (Discretization in Time)
Introduction to Numerical Modeling
Frank Lunkeit
The (Linear) Evolution (Decay) Equation
FaTt
T
equation:
note: with a imaginary, i.e. a=ib, und complex T, T=TR+iTI an oscillation
equation results: e.g. inertial oscillation:
fut
vfv
t
u
)2 , )1
if
tivu
3) with
)2)3Im( );1)3Re( since
Frank Lunkeit
![Page 10: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/10.jpg)
10
Frank Lunkeit
Analytical Solution
FaTt
T
a
FatTtT )exp()(
equation:
Describes the exponential decay of an
initial perturbation ∆T=T0-F/a (T0=initial
value) to the stationary solution F/a. time
scale: 1/a
solution:
example:
T0=0, F=1, a=0.05
initial value problem (T0 needed; eq. is first order in time)
Numerical Solution
FaTt
T
a) Discretization in time: t -> t0+n ∆t (∆t: timestep; n: integer)
T T(t)
t
T
t
{
∆t tn tn+1 tn-1
Tn Tn+1
Tn-1
timestep ∆t must be chosen adequately (physically meaningful)!
(continuous) (discrete)
Frank Lunkeit
![Page 11: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/11.jpg)
11
Numerical Solution
FaTt
T
T
t
{
∆t tn tn+1 tn-1
Tn Tn+1
Tn-1
t
TT
t
T nn
1
t
TT
t
T nn
1
Centered differences
Forward differences
Backward differences
t
TT
t
T nn
2
11
Improper since T(t) known and T(t+∆t)
needed
Two level scheme (Einschritt-Verfahren)
Three level scheme (Zweischritt-Verfahren)
b) Derivatives -> finite Differences
Frank Lunkeit
Frank Lunkeit
Numerical Solution
FaTt
T
c) dealing with the ‚right hand side‘ (the tangent)
);(Tft
T
general: equation )(1 Tf
t
TT nn
discretization (two level)
Choice of T in f(T): )(1n
nn Tft
TT
Explicit (Euler)
)()( 11
nlinnnl
nn TfTft
TT
Implicit
Semi-implicit
)( 11
n
nn Tft
TT
T
t
{
∆t tn tn+1 tn-1
Tn Tn+1
Tn-1
(fnl=nonlinear part; flin=linear part)
![Page 12: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/12.jpg)
12
Explicit (Euler)
)()( 11
nnnnnn TftTTTf
t
TT
Discretization:
Tangent (gradient) at tn , i.e. computed from Tn
T
t tn tn+1 tn-1
Tn Tn+1
Tn-1
evolution (decay) equation: )(1 FTatTT nnn
Frank Lunkeit
Implicit
)()( 1111
nnnn
nn TftTTTft
TTDiscretization:
Tangent (gradient) at tn+1 , i.e. computed from Tn+1 but used at tn.
T
t tn tn+1 tn-1
Tn Tn+1
Tn-1
evolution (decay) equation: at
FtTTFTa
t
TT nnn
nn
111
1
A re-arrangement of the equation is necessary to obtain Tn+1!
Frank Lunkeit
![Page 13: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/13.jpg)
13
Two Level Scheme: Explicit (Euler)
)(11 FTatTTFaT
t
TTnnnn
nn
)lim(0 t
T
t
T
t
Consistency ?
t
Tt
t
T
t
T
t
TT
t
t
T
t
T
t
TTt
t
Tt
t
TtTttT
t
nn
t
nn
...2
limlim
...2
...2
)()(
2
2
0
1
0
2
2
1
2
2
2
Yes, from Taylor-expansion:
Accuracy (order) of the discretization: first order (Error goes with ∆t)
Frank Lunkeit
Two Level Scheme: Explicit (Euler)
)(11 FTatTTFaT
t
TTnnnn
nn
Accuracy (order) of the scheme?
ErrtTat
tTttTA
AA
)(
)()(Ansatz: insert the
analytic solution
Taylor-expansion: n
A
n
n
n
AAt
T
n
ttTttT
1 !
)()()(
Insert the Taylor-
expansion: )(
)(!
)()(
1 tTat
tTt
T
n
ttT
Err A
A
nn
nn
A
11
1
)!1(
)(
nn
nn
t
T
n
tErr => Err= O(1)
(here with F=0)
Since t
TtaT A
A
)(
Frank Lunkeit
![Page 14: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/14.jpg)
14
Frank Lunkeit
Two Level Scheme: Explicit (Euler)
)(11 FTatTTFaT
t
TTnnnn
nn
Stability t
A tTtT )()( ?
))exp()()exp()( 0 tanTtntTatTtT AA (F=0)
ntaTtntTtaTttT )1()()1()( 00
t
A tTtTAta )()(12=> for (unstable)
=> choice of ∆t such that ∆t ≤ 1/a !
analytically:
numerically:
=> Amplitude increases/diminishes with factor ntaA )1(
(stable) for
)1( 21 Atabut for
bounded )()(12
t
A tTtTAta
+/- jumps
Convergence ? Yes (from Lax equivalence theorem) )0)()(lim(0
tTtT At
Note:
)( 0tTT
)()exp()1()1( 2tOtantanta n
Frank Lunkeit
Two Level Scheme: Implicit
Convergence? Yes
Consistency?
Accuracy (Order)? First order scheme (i.e. error grows with ∆t)
at
FtTTFTa
t
TT nnn
nn
111
1
yes, like explicit
Stability?
with F=0: nta
tTtntT
ta
tTttT
)1(
)()(
)1(
)()(
For all ∆t, since A < 1
but ∆t >1/a not appropriate to the problem!
=> Amplitude diminishes with factor ntaA
)1(
1
ttCtTtT A )()()(=>
=> implicit always stable
![Page 15: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/15.jpg)
15
Two Level Scheme: Crank-Nicolson
Consistency?
Accuracy (Order)?
FTgTgat
TTnn
nn
))1(( 11
yes, like explicit und implicit
(g = 1 : explicit; g = 0 : implicit)
ErrttTgtTgat
tTttTAA
AA
)]()1()([
)()(Insert analytical solution:
Taylor-expansion: n
A
n
n
n
AAt
T
n
ttTttT
1 !
)()()(
Insert Taylor-expansion: )]!
)()()(1()([
)(!
)()(
1
1
n
n
nn
AA
A
nn
nn
A
t
T
n
ttTgtgTa
t
tTt
T
n
ttT
Err
)1
1(
!
)(
11
1
ng
t
T
n
tErr
nn
nn
=> for g= 1,0 (ex., im.): Err= O(1); for g=0.5: Err=O(2))
(with F=0)
=0 for n=1
and g=0.5 }
Frank Lunkeit
Two Level Scheme: Crank-Nicolson
FTgTgat
TTnn
nn
))1(( 11
Stability?
with F=0:
n
tag
tgatTtntT
tag
tgatTttT
))1(1(
)1()()(
))1(1(
)1()()(
For all ∆t, |A| < 1 (denominator > numerator)
but: ∆t >1/a not appropriate to the problem
=> Amplitude changes with factor
n
tag
tgaA
))1(1(
)1(
=>
=> always stable (for g <1)
))()1()(()()( ttTgtTgtatTttT
=> Convergence
ttCtTtT A )()()(
Frank Lunkeit
![Page 16: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/16.jpg)
16
Frank Lunkeit
Two Level Scheme: 4th order Runge-Kutta
4321 226
1)()( KKKKtTttT
),( tTfdt
dTGeneral equation:
Runge-Kutta (4th order):
),)((
)2
,2
)((
)2
,2
)((
)),((with
34
23
12
1
ttKtTftK
tt
KtTftK
tt
KtTftK
ttTftK
Decay equation: on t)dependent explicitly(not )(),( TfFTatTf
Order: Err=O(∆t4)
Stability: Stable for 1|2462
1|443322
tatata
ta
Frank Lunkeit
Two level scheme: 4th order Runge-Kutta
4321 226
1)()( KKKKtTttT
),)(( ),2
,2
)((
)2
,2
)(( ),),((
342
3
121
ttKtTftKt
tK
tTftK
tt
KtTftKttTftK
Idea: Average of tangents for different T (T(t), T(t)+K1/2, T(t)+K2/2, T(t)+K3)
tn
T
t tn+1
T(t)
T(t)+K1/2 T(t)+K2/2
T(t)+K3 f(T(t))=K1/ ∆t
f(T(t)+K1/2)=K2/ ∆t
f(T(t)+K2/2)=K3/ ∆t
f(T(t)+K3)=K4/ ∆t
with ‚artificial‘ base points T(t)+Ki
Expensive since f(T) needs to be computed 4 times
![Page 17: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/17.jpg)
17
Three Level Schemes
...6
|2
)()(
...6
|2
||)()(
...6
|2
||)()(
2
3
3
3
3
32
2
2
3
3
32
2
2
t
dt
Td
t
ttTttT
dt
dT
t
dt
Tdt
dt
Tdt
dt
dTtTttT
t
dt
Tdt
dt
Tdt
dt
dTtTttT
t
ttt
ttt
General: three level schemes do not only consider time t und t+∆t but also time t-∆t.
e.g. From Taylor-expansion:
=> Discretization is consistent, 2nd Order (Err=O(∆t2))
Decay equation: FtTat
ttTttT
)(
2
)()(Leap frog
Frank Lunkeit
Leap Frog
))((2)()()(2
)()(FtTatttTttTFtTa
t
ttTttT
i.e. evaluation of the gradient at t for step T(t-∆t)-> T(t+∆t)
t T(t-1) T(t)
Δt
T(t+1)
dT/dt = F - aT
t T(t-2)
Δt
T(t) T(t-1)
dT/dt = F - aT
T(t+1)
chronology:
Step n:
Step n+1:
Two time levels are needed (t-1 and t)!
Frank Lunkeit
![Page 18: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/18.jpg)
18
Frank Lunkeit
Leap Frog
))((2)()()(2
)()(FtTatttTttTFtTa
t
ttTttT
Stability (Computational Mode)?
nnn TatTT 2 :)0F(with 11
121 nnn TTT Assumption: T changes each time
step by factor λ 1112 2 nnn TatTT
i.e. two solutions: 2/122
2,1 1 tata
For ∆t ->0 : λ1=1 (physical since correct); λ2=-1 (unphysical)
For ∆t > 0: physical mode 0 < λ1 < 1 (attenuation)
computational Mode λ2 < -1 i.e. oscillating instability!
Leap Frog not suited for damped (dissipative) systems!
Leap Frog: Unstable Computational Mode
T
t 1
ttttt ATTtaTTT 111 2
Leap-Frog initialization T0=0 ; T1<0
t=2 T2=T0-AT1= 0-AT1 > 0
t=3 T3=T1-AT2=T1-A(T0-AT1)=T1(1+4A2) < T1
t=4 T4=T2-AT3 > T2
2 3 4
Frank Lunkeit
![Page 19: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/19.jpg)
19
Frank Lunkeit
Three Level Scheme: Adams-Bashforth(2)
FttTtTa
t
tTttT
))()(3(
2
)()(
gradient by averaging gradient from T(t) and gradient from ‚extrapolated‘ T‘(t+∆t)
(=T(t)+(T(t)-T(t-∆t)))
stability (computational mode)?
2)
2
31()3(
2 :)0F(with 111 at
Tat
TTTat
TT nnnnnn
121 nnn TTT
i.e. two solutions:
2/1
2
2,14
)2
31(
22
)2
31(
tata
ta
for ∆t ->0 : λ1=1 (physical, correct solution); λ2=0 (unphysical)
for ∆t > 0: physical mode 0 < λ1 < 1 (damped)
computational mode 0 < λ2 <1 (damped) => stability!
2)
2
31(2 atat
consistent and 2nd order (Err=O(∆t2))
1. The Decay Equation: Discretization in Time
Summary:
• Decay (linear evolution) equation: first order in time, initial value
• Schemes: implicit, explicit, semi-implicit, two-level, three-level
• Specific schemes: Euler, Crank-Nicolson, Runge-Kutta, Leapfrog, Adams-Bashford
• Computational mode
• Leapfrog unstable for dissipative systems!
The (Linear) Evolution (Decay) Equation
Frank Lunkeit
![Page 20: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/20.jpg)
20
2. One-Dimensional Linear Advection (Discretization in Time and Space)
Introduction to Numerical Modeling
Frank Lunkeit
The Linear 1-d Advection Equation
x
Tu
t
T
equation: u=const.
analytical solution: )(),( utxftxT with any function f
example: Superposition of waves
with wave number k and
phase velocity u
k
k utxikTtxT ))(exp(),(
hyperbolic, first order in time and space: initial and boundary conditions needed
02
22
2
2
f
x
Te
t
Td
x
Tc
xt
Tb
t
Ta
hyperbolic: b2-4ac > 0
parabolic: b2-4ac = 0
elliptic: b2-4ac < 0
Frank Lunkeit
![Page 21: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/21.jpg)
21
Numerical Solution: Spectral Method
x
Tu
t
T
Idea: transformation of T into new basis functions which are differentiable orthogonal
functions of x => derivations in space can be calculated analytically.
N
Nk
k ikxtTxtT )exp()(),(Example: Fourier-series
Tk(t) = time dependent (complex) Fourier coeff.; N = considered modes (resolution)
(N<< ∞ => T might not be perfectly represented)
)exp()()exp()(
ikxtTikuikxt
tTk
N
Nk
N
Nk
k
Insert into advection equation: =>
=> 2N+1 uncoupled ordinary differential equations kk iukTt
T
Frank Lunkeit
Spectral Method
Analytical solution:
kk iukTt
T
x
Tu
t
T
kk iukTt
T
Similar to the evolution (decay) equation but with imaginary a=iuk
and complex T (oscillation equation)
)exp(0 iuktTT kk
=> complete solution of the advection eq: ))(exp(0 utxikTT k
k
(as expected)
=> local: oscillation, global: non dispersive waves with phase velocity u
Frank Lunkeit
![Page 22: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/22.jpg)
22
Frank Lunkeit
Spectral Method: Explicit
kk iukTt
T
x
Tu
t
T
Numerical solution: Analog to evolution (decay) eq. but: different characteristics
example: explicit (Euler) )()()(
tiukTt
tTttTiukT
t
T
Stability?
)( since 3
)(1error Phase b)
12
)(1)(1A with increases Amplitude a)
)3
)(1(
3
)()arctan( and
)(1)1(with
)exp()()1)(()(
)()()(
2
22
23
2
tuklyanalyticaltuk
tuktuk
tuktuk
tuktuktuk
tuktiukA
iAtTtiuktTttT
tiukTt
tTttT
A
A
N
always unstable
slower and k-dependent, i.e. numerical dispersion
(one wave k only,
index k omitted)
Frank Lunkeit
Spectral Method: Implicit
kk iukTt
T
x
Tu
t
T
example: implicit )()()(
ttiukTt
tTttTiukT
t
T
Stability?
)( since 3
)(1error Phase b)
decreases Amplitude a)
)3
)(1(
3
)()arctan( and
)(1
1with
)exp()()1(
)()(
)()()(
2
23
2
tuklyanalyticaltuk
tuktuk
tuktuktuk
tukA
iAtTtiuk
tTttT
ttiukTt
tTttT
A
A
N
always stable but k-dependent damping,
i.e. numerical diffusion
slower and k-dependent, i.e. numerical dispersion
![Page 23: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/23.jpg)
23
t T(t-1) T(t)
Δt
T(t+1)
dT/dt=-iukT
t T(t-2)
Δt
T(t) T(t-1)
dT/dt=-iukT
T(t+1)
chronology:
Step n:
Step n+1:
Leap frog: n
nn iukTt
TTiukT
t
T
2 11
Recall:
Spectral Method: Leap Frog
Frank Lunkeit
Spectral Method: Leap Frog
Leap frog: n
nn iukTt
TTiukT
t
T
2 11
Stability?
)(2)()()(2
)()( ttTiukttTttTtiukT
t
ttTttT
22 )(1012)()(with tuktiuktiuktTttT
phase) ofout 180 mode (-) onal(computati
(faster) )6
)(1()
)(1arctan(
1 :error phase c)
neutral) modes(both 11)( with b)
mode) (-) nal'computatio' and )( (physical solutions Two a)
2
2
2
tuk
tuk
tuk
tuk
tuk
Leapfrog appropriate (but numerical dispersion); computational mode bothers
Frank Lunkeit
![Page 24: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/24.jpg)
24
Leap Frog: Computational Mode
iukTt
T
equation: with k=0 (advection of the zonal mean) 0
t
T
1)(1 ) change (amplitude b)
)()(02
)()( (Leapfrog) a)
2
tuktiuk
ttTttTt
ttTttT
0
a)
...)6()4()2( TtTtTtT initial condition: T(t=0)=T0 even Δt correct
problem: T(Δt) needed but unknown (in most cases computed with Euler).
let T(Δt)=T0+E (E=small error) 2
)1()2
()( :solution complete 0
EETtnT n
2 :-1)( mode nalcomputatio b)
)2
(:1)( mode physical a) 0
E
ET
the computational mode is determined by the initialization error (E) only
Frank Lunkeit
Frank Lunkeit
Leap Frog: Robert-Asselin Filter
Modification of the leap frog scheme:
Computation of T(t) (or T(t-Δt)) by weighted averages of T(t+Δt), T(t) and T(t-Δt)
Calculation role:
)()( );()( 3.
.) ( ))()(2)(()()( 2.
))((2)()( 1.
**
**
*
tTttTttTtT
constfilterttTtTttTtTtT
tTftttTttT
step t
step t+1
t T*(t-1) T(t) Δt T(t+1)
dT/dt = f(T(t))
T*(t)
t T*(t-1) T(t) Δt T(t+1)
dT/dt = f(T(t))
T*(t)
![Page 25: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/25.jpg)
25
Frank Lunkeit
Leap Frog with Robert-Asselin Filter
iukTt
T
)2( b)
2 a)
1
*
1
*
*
11
ttttt
ttt
TTTTT
tukTiTT
Stability?
1
*
*
11
2)221(
2
ttt
ttt
TtukiTT
tukTiTT
Tt+1 from a) insert into b)
(plus rearrange):
*
1
*
1
2221
12
t
t
t
t
T
T
tuki
tuki
T
T
old
Matrix-formulation:
new transition-matrix
XX AEigenvalue problem
02221
12
tuki
tuki
Eigenvalues λi from
2/122
2
2/122
1
)()1()(
)()1()(
tuktiuk
tuktiuk
=>
• For (uk∆t)2 <(1- γ)2 the scheme is always stable!
• For ∆t ->0 : λ1=1 (physical, neutral); λ2=2 γ-1 (computational, damped)
• For ∆t > 0 : |λ2|< |λ1|<1, i.e. both modes damped, stronger for computational
• Damping k dependent (larger k stronger damp.): Numerical diffusion
• Numerical dispersion (k dependent phase error)
Grid Point Method: Finite Differences
x
Tu
t
T
Discretization in space and time, i.e. space and time derivatives are approximated
by differences.
Two level schemes (explicit):
x
TTu
t
TT
x
Tu
t
Tn
j
n
j
n
j
n
j
2
11
1
centered differences
x
TTu
t
TT
x
Tu
t
Tn
j
n
j
n
j
n
j
1
1
downstream (u>0)
x
TTu
t
TT
x
Tu
t
Tn
j
n
j
n
j
n
j
1
1
upstream (u>0)
n = time; j = space
Frank Lunkeit
![Page 26: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/26.jpg)
26
Finite Differences
Two level scheme (Einschritt-Verfahren): accuracy and order
)()()!
)()1(
!
)((
!
)(
2
!
)()1(
!
)(
!
)(
2
!
)()1(),(
!
)(),(),(
!
)(),(
2
),(),(),(),(
2
2
1
2
1
2
1
xOtOx
T
n
x
x
T
n
xu
t
T
n
t
x
Tu
t
TErr
x
x
T
n
x
x
T
n
x
ut
t
T
n
t
Err
Errx
x
T
n
xtxT
x
T
n
xtxT
ut
txTt
T
n
ttxT
Errx
txxTtxxTu
t
txTttxT
nn
nnn
nn
nn
nn
nn
n
nnn
n
nn
n
nn
n
nnn
n
nn
n
nn
a) centered differences:
2nd order in Δx
1st order in Δ t
Frank Lunkeit
)()(!
)()1(
!
)(
!
)()1(),(),(),(
!
)(),(
),(),(),(),(
2
1
2
1
xOtOx
T
n
xu
t
T
n
t
x
Tu
t
TErr
Errx
x
T
n
xtxTtxT
ut
txTt
T
n
ttxT
Errx
txxTtxTu
t
txTttxT
nn
nnn
nn
nn
n
nnn
n
nn
)()(!
)(
!
)(
),(!
)(),(),(
!
)(),(
),(),(),(),(
2
1
2
1
xOtOx
T
n
xu
t
T
n
t
x
Tu
t
TErr
Errx
txTx
T
n
xtxT
ut
txTt
T
n
ttxT
Errx
txTtxxTu
t
txTttxT
nn
nn
nn
nn
n
nn
n
nn
Finite Differences
Two level scheme: accuracy and order
b) Downsteam:
c) Upsteam:
1st order in Δx
and Δ t
1st order in Δx
and Δ t
Frank Lunkeit
![Page 27: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/27.jpg)
27
Finite Differences: Stability
x
Tu
t
T
Two level scheme: Stability
x
TTu
t
TT n
j
n
j
n
j
n
j
2
11
1
a) centered differences: )(2
11
1 n
j
n
j
n
j
n
j TTx
tuTT
1. Energy Method
general: take a (scalar) quadratic norm for the total ‚energy‘ (E) in the space state of the
system and show that E remains bounded with time.
j
jTE 2)(Here:
(1)
square (1) and sum up:
j
n
j
n
j
n
j
j
n
j TTTT 2
11
21 ))(()( x
tu
2
j
n
j
n
j
n
j
n
j
n
j
n
j TTTTTT 2
11
2
11
2 )()(2)(
cyclic boundary conditions:
j
n
j
n
j
n
j
n
j
j
n
j TTTTT ))()((2)()( 11
22221
j
n
j
j
n
j
n
j TTT 22
11 )()(
Schwarz‘sche inequality:
j
n
j
j
n
j TT )()( 221=> unstable
Advantage: applicable also for non linear problems. Disadvantage: definition of E needed
Frank Lunkeit
Frank Lunkeit
Finite Differences: Stability
x
Tu
t
T
Two level scheme: Stability
x
TTu
t
TT n
j
n
j
n
j
n
j
2
11
1
a) centered differences: )(2
11
1 n
j
n
j
n
j
n
j TTx
tuTT
2. Von Neumann Method General: Linearize the problem. Replace dependence in space by Fourier expansion
(analytical). Investigate the ‚amplification factor‘ A of one time step (Tn+1=ATn). The scheme is
stable if |A|≤1.
xikj
k
kj etTtT )()(Here: already linear, Fourier-expansion:
(1)
Insert into (1): x
tu
Advantage: Relatively easy. Disadvantage: Linearization
linear -> only one k to consider
i
xikxik
eAA
xkieeA
)sin(1)(1
)( )1()1( xjikxjiknxikjnxikjn eeTeTeAT
21
22 ))(sin1( xkA ))sin(arctan( xk with
ikk etTAttT )()( Numerical solution (k):
1. Amplification factor |A| > 1 => unstable =>
tuk2. Phase error since (=analytical solution)
![Page 28: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/28.jpg)
28
Frank Lunkeit
Finite Differences: Stability
x
Tu
t
T
Two level scheme: Stability analysis
x
TTu
t
TT n
j
n
j
n
j
n
j
1
1
b) Downstream: x
TTtuTT
n
j
n
jn
j
n
j
11
21
))1))(cos(1(21( xkA
))cos(1(1
)sin(arctan
xk
xk
Von Neumann method xikj
k
kj etTtT )()( Tn+1=ATn ) ; investigate (
Insert into (1): x
tu
i
xik
eAA
xkixkeA
)sin())cos(1(1)1(1
)( )1( xikjxjiknxikjnxikjn eeTeTeAT
with
ikk etTAttT )()( Numerical solution (k):
1. amplification factor |A| > 1 => unstable =>
tuk2. Phase error since (=analytical solution)
(1)
Frank Lunkeit
Finite Differences: Stability
x
Tu
t
T
Two level scheme: Stability analysis
x
TTu
t
TT n
j
n
j
n
j
n
j
1
1
c) Upstream: x
TTtuTT
n
j
n
jn
j
n
j
11
21
))1))(cos(1(21( xkA
))cos(1(1
)sin(arctan
xk
xk
Von Neumann method
Insert into (1): x
tu
i
xik
eAA
xkixkeA
)sin())cos(1(1)1(1
)( )1( xjikxikjnxikjnxikjn eeTeTeAT
with
(1)
Stable for 1A 1)1((211)1))(cos(1(21 xk 0))cos(1( since xk
10
x
tu=> Upstream stable for Courant-Friedrich-Levy criterion
100)1(2
x
tu
= Courant-number
Tn+1=ATn ) ; investigate ( xikj
k
kj etTtT )()(
![Page 29: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/29.jpg)
29
Frank Lunkeit
Finite Differences: Upstream
One level scheme: Upstream x
TTtuTT
n
j
n
jn
j
n
j
11
21
))1))(cos(1(21( xkA
))cos(1(1
)sin(arctan
xk
xk
with
ikk etTAttT )()( Numerical solution (one wave k):
with u > 0
- |A|<1 => Numerical diffusion (for μ<1; stronger damping for larger k; O(μΔx2))
- Phase error k-dependent => Numerical dispersion (slower; O(Δx2))
x
tu
For small Δx:
...2
)1(12
)1(1
))1(1())1))(cos(1(21(
222
21
2221
txukxk
xkxkA
...36
1...36
1
))cos(1(1
)sin(arctan
2222222222 xk
x
tuxktuk
xkxkxk
xk
xk
Error
Frank Lunkeit
Finite Differences: Leap Frog
Three level scheme: Leapfrog x
TTu
t
TT
x
Tu
t
Tn
j
n
j
n
j
n
j
22
11
11
Stability:
1)sin(2
)(1
)(
)(
2
2
)1(1)1(1112
11
11
xkiAA
eeAA
eTeTAeTeTA
TTTT
xikxik
xjiknxjiknxikjnxikjn
n
j
n
j
n
j
n
j
• Stable (neutral; |A| = 1) for (ut/x)2 1 (Courant-Friedrich-Levy criterion)
• Phase error => Numerical dispersion
• Computational Mode (-) => Robert-Asselin Filter
...
6)(sin1
)sin(arctan and 333
33
22xk
xktuk
xk
xk
ieAxkxkiA )(sin1)sin( 22
1for 1with
2
2
x
tuA
x
tu
Von Neumann method Tn+1=ATn xikj
k
kj etTtT )()( ) ; investigate (
+ = physical mode
![Page 30: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/30.jpg)
30
Frank Lunkeit
(Semi-) Lagrange Method
x
Tu
t
T
Idea: During advection the property (here T) of a particle/volume remains constant:
=> New T distribution from parcel re-distribution by advection
Explicit: New parcel positions from velocities
Implicit: Old parcel positions from velocities
0dt
dT
tuxttxxn )(1
tuxtxxn )(
T typically at fixed grid => interpolation (Semi-Lagrange) =>diffusion
u
x(t+∆t)
=x3
x(t)
T(x1) T(x2)
T T
One-Dimensional Linear Advection
• Numerical methods: Spectral, finite differences and semi-Lagrange
• Stability analysis: Energy method, Von Neumann method
• Numerical diffusion: Amplitude damping (wave number dependent)
• Numerical dispersion: Error in phase velocity (wave number dependent)
• Important parameter: Courant-number (ut/x)
• Courant-Friedrich-Levy criterion
Summary
Frank Lunkeit
![Page 31: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/31.jpg)
31
3. One-Dimensional Linear Diffusion and One-Dimensional Linear Transport Equation
Introduction to Numerical Modeling
Frank Lunkeit
The (Linear) Diffusion Equation (Heat Equation)
2
2
x
TK
t
T
equation (one dimensional):
K=const.= Diffusion coeff.
an analytic solution:
)exp()exp(),( 2
0 tKkikxTtxT damped wave (wave number k):
Exponential decay of the
amplitude dependent on k2
(the shorter the faster)
(parabolic, first order in time,
second order in space)
Initial and boundary values needed
Frank Lunkeit
![Page 32: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/32.jpg)
32
Numerical Solution: Spectral Method
2
2
x
TK
t
T
N
Nk
k ikxtTxtT )exp()(),(T as Fourier-series:
)exp()()exp()( 2 ikxtTkKikx
t
tTk
N
Nk
N
Nk
k
Insert =>
=> 2N uncoupled ordinary differential equations kk TKkt
T 2
Numerical solution similar to decay equation
Frank Lunkeit
Frank Lunkeit
Grid Point Method: Finite Differences
2
2
x
TK
t
T
Discretization for second derivative in space:
2
11
22
2 2)(2)()(
x
TTT
x
xTxxTxxT
x
T jjj
1iT iT 1iT
xx x xx
x
TT
x
T ii
1
x
TT
x
T ii
1
x
T
xx
T2
2
a) from discretization of x
T
)()(2)()(
...2
)()(
...2
)()(
2
22
2
2
22
2
22
xOx
xTxxTxxT
x
T
x
Tx
x
TxxTxxT
x
Tx
x
TxxTxxT
b) from Taylor expansion
2
2
x
T
![Page 33: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/33.jpg)
33
Finite Differences
2
2
x
TK
t
T
Possible discretizations (two level schemes)
a) Explicit (forward in time centered in space; FTCS): 2
11
1 2
x
TTTK
t
TT n
j
n
j
n
j
n
j
n
j
b) Implicit: 2
11
1
1
1
1 2
x
TTTK
t
TT n
j
n
j
n
j
n
j
n
j
c) Crank-Nicolson: 2
11
2
11
1
1
1
1 2)1(
2
x
TTTKg
x
TTTgK
t
TT n
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
2
11
2
2 2
x
TTT
x
T jjj
with
Note: Leap frog is unstable
Frank Lunkeit
Frank Lunkeit
Finite Differences
Forward in Time Centered in Space; FTCS
),(!)1(
!!
),(2),(),(),(),(
2
2
2
xtOErrErrx
x
T
n
x
x
T
n
x
Kt
t
T
n
t
Errx
txTtxxTtxxTK
t
txTttxT
n
nnn
n
nn
n
nn
)2
(sin4
1)1)(cos(2
1))2(1( 2
222
xk
x
tKxk
x
tKAee
x
tKTAT xikxiknn
=> stable for 14
12
x
tKA
For small Δx: )1())2
(4
1( 22
2
1 tKkTxk
x
tKTT nnn
analytical: ...)1()exp( 221 tKkTtKkTT nnn
Accuracy/order:
Stability: Von Neumann method Tn+1=ATn xikj
k
kj etTtT )()( and (
convergence
)
![Page 34: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/34.jpg)
34
The (Linear) Transport Equation (Advection and Diffusion)
2
2
x
TK
x
Tu
t
T
equation (one dimensional):
An analytical solution:
)exp())(exp(),( 2
0 tKkutxikTtxT
damped traveling wave
(2nd order parabolic)
Frank Lunkeit
Finite Differences
2
2
x
TK
x
Tu
t
T
Previous knowledge: FTCS improper for advection; Leap frog improper for diffusion
2
11
1
1
111
11 2
22 x
TTTK
x
TTu
t
TT n
j
n
j
n
j
n
j
n
j
n
j
n
j
=> mixed scheme:
Leap frog für Advektion FTCS für Diffusion
More general:
Time splitting method:
Partitioning of tendencies and different numerical treatments
Climate models (ECHAM, PlaSim): Adiabatic part (leap frog) und diabatic parts (Euler or impl.)
Frank Lunkeit
![Page 35: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/35.jpg)
35
Frank Lunkeit
Finite Differences
2
11
1
1
111
11 2
22 x
TTTK
x
TTu
t
TT n
j
n
j
n
j
n
j
n
j
n
j
n
j
Time splitting (Leap frog und FTCS)
i.e. stable for 2
2
2
2
44
u
K
u
x
u
Kt
22
2
)()4(4 xuKK
xt
or
Stability (Von Neumann method) Tn+1=ATn xikj
k
kj etTtT )()( ) and (
(1)
i
xikxiknxikxiknnn
eAxkxkx
tKxkiA
xkx
tKxkAiA
eeTx
tKeeTTT
)(sin))cos(1(4
1)sin(
))cos(1(4
1)sin(2
22
22
2
2
2
1
2
11
x
tu
(+=physical)
1...1))cos(1(4
1 2
2/1
2
tKkxk
x
tKAwith (i.e. analytical +…)
2
22
22
2
61)(6
11
sin)cos(1(4
1
sinarctan
x
tKxktuk
xkxkx
tK
xk
(1)
dependent on K
1-d Linear Diffusion and 1-d Linear Transport Equation
Summary
a) Diffusion equation (heat equation)
• Spectral: like decay equation
• Grid point: FTCS
b) Transport equation
• Time spitting method
Frank Lunkeit
![Page 36: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/36.jpg)
36
4. Nonlinear Advection and 1-d Nonlinear Transport Equation (Burgers Equation)
Introduction to Numerical Modeling
Frank Lunkeit
The Nonlinear Advection Equation (Inviscid Burgers Equation)
equation (one dimensional): 02
10
2
x
u
t
u
x
uu
t
u
dt
du
Solution: )(),( utxftxu with any function f
Like linear advection, but f depends on u itself (implicit equation)
Solvable (for practical use) in few special cases only.
A ‚formal‘ (geometrical) solution can be constructed by using the method of
characteristics
)sin()0,( xtxu Initial condition:
1
)sin(),(~),(k
s kxtkutxuSolution: kt
ktItku k
s
)(2),(~ with
Ik(kt) = first kind Bessel function
e.g. Platzmann 1964, Tellus:
Frank Lunkeit
![Page 37: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/37.jpg)
37
The Method of Characteristics
0
x
uu
t
u
dt
du
00 )0,( xttxux
Lagrangian perspective: discussing the paths of individual parcels (points)
(paths = characteristics)
0dt
du=> velocity of individual parcel is constant in time
=> parcels are moving on a straight lines:
=> characteristics are straight lines with slope u(x0,t=0)
if u(x0,t=0) varies in space: characteristics cross at a certain time tc
=> b) after tc one parcel can have more than one location (unphysical!)
=> physical solutions only possible up to t=tc
from
=> a) discontinuities (shock waves) are formed
Frank Lunkeit
Frank Lunkeit After: Platzmann, G.W., 1964: An exact integral of complete spectral equations for unsteady
one-dimensional flow. Tellus, 16, 422-431.
Characteristics of Platzmanns Solution
Analytic solution characteristics
t=0
t=1
t=2
t=3
u
x
![Page 38: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/38.jpg)
38
Frank Lunkeit
Non linear term after inserting sine-series:
1 2
21
1 2
21
2
2
1
1
]))sin[(]))(sin[(()(
)cos()sin()()(
)cos()()sin()(
21212
212
221
k k
kk
k k
kk
k
k
k
k
xkkxkktutuk
xkxktutuk
xktukxktux
uu
The non linear wave-wave interaction of the waves k1 and k2 forces waves with
wave number k1+k2 and k1-k2.
=> Energy/momentum is redistributed within the wave spectrum
0
x
uu
t
u
L
nk
2Example:
Sine-series (waves) with time dependent amplitudes
k
k kxtutxu )sin()(),(
The nonlinear term:
The Nonlinear Advection Equation
1 2 3 40j=
Problem: With a finite number of grid points (e.g. 0-M) waves with wave
numbers k > M/2 get erroneously interpreted (as M-k)
Example: M=4; k=3 => ‚false‘ wave with k‘=1
Grid Point Method: Aliasing
Frank Lunkeit
![Page 39: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/39.jpg)
39
Frank Lunkeit
Aliasing: Consequence for Energy
20 cos)sin()0,( 00
x(kx) ku
x
ukxutxulet
=> kin. Energy:
2
0
2
022
00
2)(sin
2
udxkx
uE
Energy change:
2
0
2
0
2
0
2
2
1dx
x
uuudx
t
uudx
t
u
t
E
Example:
2
0
3
0
2
0
2
0
0)2sin()sin(2
)2sin(2
)cos()sin(with
dxkxkxku
t
E
kxuk
kxkxkux
uu
But With resolution M=3k
2
0
3
0
3
0sin
2)sin()sin(
2)sin()2sin(
kudxkxkx
ku
t
Ekxkx
gAlia
=> Energy increase (due to aliasing from limited resolution)
=> analytically the total energy is conserved
• At each time level short waves (k1+k2) may be forced which (potentially)
are not resolved and, therefore, erroneously interpreted.
• This leads to unrealistic increase of wave amplitudes (i.e. energy), in
particular in the short wave part of the spectrum, and finally to a ‘blow up’ of
the numerical solution.
• This mechanism is, in principal, independent of the time step length or the
grid size.
• Nonlinear instability
Nonlinear Instability
Frank Lunkeit
![Page 40: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/40.jpg)
40
Solutions
• Artificial elimination of short waves
• Diffusive schemes (e.g. upstream)
• Explicit diffusion
• Appropriate discretization of non linear terms
Nonlinear Instability
Frank Lunkeit
Frank Lunkeit
Analytically:
i.e. total energy (~u2) is conserved
x
dxt
u
x
u
t
u
x
uu
t
uu
x
uu
t
u0
2
1
3
1
2
1 2322
If this would also be the case numerically => no non linear instability
Solution: Discretization of the non linear term
x
uuu
x
uu ii
i
i
2
111st try:
02
1
21
2
1
2112
j
jjjj
j
jj
j uuuuuu
udxt
uuudx
t
uu
t
E
02
12
2
31
2
31
2
23
2
23
2
12
2
1 uuuuuuuuuuuu
example: 3 Points, cyclic boundary conditions:
Not appropriate
Discretization of the Nonlinear Term
![Page 41: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/41.jpg)
41
j
jjjjj
jjjjjjjjjjjjj
j
uuuuuxt
E
x
uuu
x
uuu
x
uuu
x
uuuu
x
uu
06
1
2
)(
2
)(
2
)(
3
1
6
2121
21211121212nd try:
But: Still transfere of energy into ‚wrong‘ waves (unphysical)
06
1123213312132231321 uuuuuuuuuuuuuuuuuu
example: 3 points, cyclic boundary
conditions
appropriate
j
jjjjjjj
jjjjjj
jjjjj
j
uuuuuuuxt
E
uuuuuuxx
uuuuu
x
uu
06
1
6
1
23
2
111
2
1
2
111
2
1
11113rd try:
appropriate
Discretization of the Nonlinear Term
Frank Lunkeit
x
uuuu
t
uu
x
uu
t
unnnnn
i
n
i iiii
6
2121
1
options
Two level Euler:
x
uuuu
t
uu
x
uu
t
unnnnn
i
n
i iiii
62
2121
11
Three level Leap frog:
Caution: a) slightly unstable due to t-discretization
b) linear instability may occur => mind the CFL criterion
Finite Differences
Frank Lunkeit
![Page 42: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/42.jpg)
42
Frank Lunkeit
=> right hand side:
N
Nk
k
k k
kk
k
k
k
k
ikxF
xkkiuuik
xikuikxikux
uu
2
2
212
221
)exp(
))(exp(
)exp()exp(
1 2
21
2
2
1
1
0
x
uu
t
u
N
Nk
k ikxtutxu )exp()(),(
Ansatz: transformation of u into new basis functions which are differentiable
orthogonal functions of x, e.g. Fourier-series:
N
Nk
k ikxt
u
t
u)exp(=> left hand side:
Since contributions to
wavenumbers -2N to 2N are
obtained
with k=k1+k2 and
2
1
)(L
Ll
lklk uulkiF (interaction coefficients)
L1=max(-N,k-N); L2=min(N,k+N), i.e. L1=k-N, L2=N for k ≥ 0,
and L1=-N, L2=k+N for k < 0
Spectral Method
Frank Lunkeit
with
N
Nk
k
N
Nk
k ikxFikxt
u
x
uu
t
u 2
2
)exp()exp( with
2
1
)(L
Ll
lklk uulkiF
L1=max(-N,k-N); L2=min(N,k+N)
NkN
k
N
Nk
k
N
Nk
k ikxFikxFikxF2
2
2
)exp()exp()exp(
resolved
waves
unresolved
waves
Neglecting the unresolved waves leads to 2N coupled ordinary differential
equations (ODE‘s):
2
1
)(L
Ll
lklkk uulkiFt
u L1=max(-N,k-N); L2=min(N,k+N)
-N ≤ k ≤ N
Cut off: no aliasing but not conserving moments higher than u2
To be solved using common methods
Spectral Method
![Page 43: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/43.jpg)
43
Frank Lunkeit
spectral method versus finite differences:
spectral: exact spatial derivatives but numerical effort goes with N2
finite differences: numerical effort goes with N but spatial derivatives not exact
Improvement by combination: The spectral transform method
Idea: compute derivatives (and linear terms) in spectral space and non linear term
on corresponding grid (≥ 3N+1 grid points to avoid aliasing). The effort goes with N
ln(N) (using a fast fourier transform (fft)).
Non linear advection:
Step 1: transform u into grid point domain (inverse Fourier transformation (via fft))
Step 2: compute u2 on grid points
Step 3: transform u2 into spectral space (via fft)
Step 4: compute the x-derivative of u2 in spectral space, and do the time stepping
Step 1: ….
02
10
2
x
u
t
u
x
uu
t
u
The Spectral Transform Method
Frank Lunkeit
The (Viscid) Burgers Equation: Advection and Diffusion
equation (one dimension): 2
2
x
uK
x
uu
t
u
Various applications to describe processes in science and technology in a ‚simple‘
way (e.g. road traffic) and important test bed for numerical schemes.
Numerical Solution: Spectral or finite differences with the known schemes.
In most cases by using time splitting (separating advection and diffusion)
(formal) analytic solution using Cole-Hopf transformation: x
zK
x
z
z
Ku
ln2
2
2
2
2
22
2
2
2
22
ln2
ln2
ln2
2
1
x
zK
t
z
x
z
xK
x
z
xK
t
z
xK
x
uK
x
u
t
u
dK
txG
dK
txG
t
x
u
)2
),;(exp(
)2
),;(exp(
=>
t
xdutxG
2
)()(),;(
2
0
0
Linear heat equation
![Page 44: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/44.jpg)
44
Numerical Solution of Burgers Equation using different K
Frank Lunkeit
Nonlinear Advection and 1-d Nonlinear Transport Equation (Burgers Equation)
Summary
• Viscid and inviscid Burgers equation
• Aliasing
• Non linear instability
• Energy conserving discretization
• Spectral transform method
Frank Lunkeit
![Page 45: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/45.jpg)
45
5. More Dimensions (Grids)
Introduction to Numerical Modeling
Frank Lunkeit
Problem: not only one dimension and variable but three (x,y,z) dimensions and
various (coupled) variables (scalars and vectors).
typically: Scalars (temperature, height, vorticity, divergence, etc.) and 3d flow (u,v,w)
Numerics:
Grid point models: discretization using staggered grids (e.g. scalars shifted
compared to vectors).
(Semi-) Spectral models: (non linear terms) and parameterizations on corresponding
(Gaussian) grids with staggering in the vertical.
Three Dimensions with Scalar and Vector Fields
Frank Lunkeit
![Page 46: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/46.jpg)
46
Frank Lunkeit
u u
v
v
T
u u
v
v
T u u
v
v
T
u u
v
v
T u u
v
v
T
E = two shifted C-grids
Grids
Horizontal: ‚classical‘ grids according to Arakawa (T=scalar, (u,v)=flow)
w vertically staggered to all other
variables (u,v,T), horizontally at T
or u or v grid points
z
w
u,v,T
u,v,T
w
w
Grids
Vertical: staggered
Frank Lunkeit
![Page 47: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/47.jpg)
47
Frank Lunkeit
Grids
Global grids
‚classical‘: lon-lat grid
New: Icosahedron
ui ui-1
v
v
Ti
Staggered grid: Discretization using appropriate averaging:
x
TTu
x
TTu
x
Tu ii
iii
i
i
111
2
1
z
wk+1
Tk
wk
Example: Advection (x-direction) on C-grid:
Vertical advection:
z
TTw
z
TTw
z
Tw kk
kkk
k
k
11
1
2
1
x
TTuu
x
Tu ii
ii
i
2)(
2
1 111or (better)
∆x
z
TTww
z
Tw kk
kk
k
2)(
2
1 111or
Grids: Discretizations
Frank Lunkeit
![Page 48: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/48.jpg)
48
More Dimensions (Grids)
Summary
• Grids after Arakawa (A,B,C,D,E)
• Staggered grid
• Lon-lat- und icosahedral-grids
Frank Lunkeit
6. Design of an Atmospheric General Circulation Model (AGCM)
Introduction to Numerical Modeling
Frank Lunkeit
![Page 49: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/49.jpg)
49
Frank Lunkeit
An Atmospheric General Circulation Model (AGCM) ECHAM
Variables:
prognostic (dynamic) variables
boundary conditions (partially
prognostic)
Processes:
Adiabatic: moist atmospheric fluid
dynamics
Diabatic: forcing (sources) and
dissipation (sinks)
Representation (equations):
Adiabatic: resolved scales; based
on fundamental laws
(approximated; e.g.
primitive eq.)
Diabatic: unresolved scales;
parametrerized, i.e.
linked to the prognostic
variables (resolved
scales)
Numerics
Representation and discretization:
Horizontal: spectral transform method (Legendre polynomials) or grid point (finite
diff.); semi-Lagrangian tracer transport (q)
Vertical: staggered grid (z-, p-, σ- and/or θ-system (mostly mixed: p (top) and σ
(ground))
Time: time splitting method; adiabatic: mostly leapfrog with Asselin filter; semi-
implicit (divergence eq.); diabatic: explicit or implicit (e.g. diffusion)
Resolution:
Horizontal: about 10-500km
Vertical: about 20-100 levels; 0-30/100km
Time: some minutes
An Atmospheric General Circulation Model (AGCM)
Frank Lunkeit
![Page 50: Meteorologische Modellierung - MI · Meteorologische Modellierung Introduction to Numerical Modeling (of the Global Atmospheric Circulation) 0. Introduction: Where/what is the problem](https://reader031.vdocuments.us/reader031/viewer/2022040715/5e1e1a163959527ed0297d42/html5/thumbnails/50.jpg)
50
Numerics
Input: Initial fields (or restart files) and boundary conditions
Output: Prognostic variables, deduced parameters, history (restart files)
Work flow:
1 Initialization: read boundary conditions (z0, albedo, SST, ice, etc.)
Set initial conditions (e.g. normal mode initialization for NWP,
start date for climate) or read history (restart files)
2 Time stepping: a) update boundary conditions (e.g. radiation, SST)
b) compute adiabatic and diabatic tendencies
c) update prognostic variables
d) write output
a) …
3 Termination: write history (restart files) for continuation
An Atmospheric General Circulation Model (AGCM)
Frank Lunkeit
Design of an Atmospheric General Circulation Model (AGCM)
Summary
• Time splitting method (adiabatic/diabatic)
• Resolved and unresolved processes -> parameterizations
• Prognostic and diagnostic variables
• Boundary an initial conditions
Frank Lunkeit