Title: Introduction to numerical fluid dynamics for geophysical flows
1Introduction to numerical fluid dynamics for
geophysical flows
- Peter Jan van Leeuwen
- IMAU
2(No Transcript)
3The basics discretization
Write xj j ?x and tn n ?t
Time
n1
n
n-1
j
j1
j3
j-1
j-2
space
4Discretization of derivatives
Euler
How good is this?
Use Tayor-series expansion
To find
5So, the discretization error is of order ?t
Can we make this any better?
Yes! Consider
Leap Frog
An error of only ?t2 !
6Can we do even better?
Choose ????? and ? such that m is maximal.
Solution m2, for Leap-Frog scheme
7Numerical diffusion and - dispersion
Example
From Taylor
and
Leading to
8Use
and a similar equation for the 3rd derivatives,
to find
numerical diffusion
numerical dispersion
, the Courant number
in which
The computer puts the right-hand side to zero
(upwind scheme). So, in fact, it solves the
left-hand side 0
9Stability
When we solve a physical ocean model
numerically, the numerical scheme used is applied
every time step. When the time step is chosen
too large the solution may blow up, i.e. become
very irregular and starts to produce Infinitely
large values for the model variables. Sometimes
the solution blows up with a very small time
step, and making the time step even smaller
doesnt help. We say that the numerical scheme
is unstable with that time step.
10Wave equation
power
The numerical solution can be written as
index
in which
and ? is the amplification factor.
The numerical scheme is stable when
11Representation of waves
x
x
x
x
x
x
x
x
x
x
x
Long wave is well represented
Short wave is represented very badly
Shortest wave length that can be represented is
2??x
12A simple example
Discretize as
Plug in expression for unj to find
or
For a stable scheme ??has to be smaller than 1
for all ??
Use
to find
Hence this scheme will always blow up!!!
13Leap-frog scheme
Discretize
Leading to
or
Two numerical solutions, dont excite the
negative root !!!
For the positive root
when
or
14Courant-Friedrichs-Lewy (CFL) criterion
A limit on the time step, can we understand that?
15Diffusion equation
Discretize
Find
or
in which
or
Stable when
16Leap-frog for diffusion
Discretize
Leading to
or
hence
Always unstable !!!
17Implicit schemes
Can the limitations on the time step be avoided?
Yes! Discretize the diffusion equation as
Leading to
This scheme is stable independent of ? when
18So the time step can be as large as possible. Why
cant one take one 100 year time step with a
climate model?
Indeed, accuracy, ?t can never be too large
Moreover, have a good look at the numerical
scheme
One equation with 3 unknowns Hence the
equations for all grid points have to be
combined one has to solve a system of coupled
(nonlinear) equations at each time step.
19Staggered grids
Shallow water non rotating
Assume wave solution (as always)
Gives dispersion relation
and phase velocity
20A numerical equivalent
Just concentrate on discretization in space
Plug in ( yes)
Gives dispersion relation
So
and
Shortest waves c 0 and cg -cg !!!
21Leap-frog scheme
u,h
u,h
u,h
u,h
u,h
tn-1
Two grids that do not communicate
22Staggered grid
h
u
h
u
h
tn1
h
u
h
u
h
tn
h
u
h
u,
h
tn-1
- No 2-grid interval waves
- Same truncation error
- Factor 2 faster !
23Now in 2 dimensions
Shallow-water equations
Plug in
Dispersion relation
24Ordinary discretization
Again, for the shortest waves, the numerical
phase velocity is too small, and the group
velocity has the wrong sign.
EFASSITR
25Some staggered grids
26The Arakawa B-grid
Interpolation needed for pressure gradients and
horizontal mass divergences.
27The Arakawa C-grid
Interpolation needed for Coriolis force
28Which grid should one choose?
Dispersion relation
in which
Rewrite
so that
Large ? gives gravity waves, small ? gives
inertial oscillations.
Look at the B and C grid.
29d0.1
d1
d10
30The time scale problem
Shallow-water equations
Plug in plane wave solution to find
geostrophic
Inertial-gravity waves
31The CFL criterion
Time scale geostrophic motions weeks to months
to
Time scale inertial-gravity waves (tides) few
hours
Suppose ?x 10 km
Phase velocity baroclinic Rossby waves 0.05 m/s.
From CFL the time step has to be
2.5 days
Phase velocity of tides is 200 m/s.
From CFL the time step has to be
50 s
32Possible solutions
- Filter out fast gravity waves, e.g.
quasi-geostrophic models - Rigid-lid approximation (not used
-
anymore) - Use mode splitting
- Make code fully implicit
- Make code semi implicit
33Semi-implicit codes
34From the implicit momentum equations one finds
Use this in the continuity equation
This leads to an elliptic equation for hn1 .
The new velocities can be found from the the
implicit momentum equations
35An example to increase accuracy
Start from the modified equation for the upwind
scheme
numerical diffusion
numerical dispersion
Now discretize the numerical diffusion error and
put it into the numerical scheme
n
upwind
negative diffusion
Lax-Wendroff
36We increased the accuracy by putting a
discretization of minus the numerical diffusion
in the scheme.
So, we have put in anti diffusion in the
numerical scheme.
However, at large gradients the anti diffusion
can be too large, giving rise to ripples.
To avoid this, we first do a predictor step,
followed by a corrector step.
37Predictor
(With ? 0 we get Lax-Wendroff back)
Corrector
with
In this way the anti-diffusive fluxes are limited.
Flux-Corrected Transport (FCT)
38Summary what we did
- Discretization
- Numerical diffusion and dispersion from
truncation of Taylor-series expansions - Stability, CFL, implicit schemes
- Staggered grids
- Time-scale problem
39 and what should be covered also
- More accurate schemes
- Conservative schemes
- Boundary conditions
- Open boundaries
- Mixed-layer models
- Parameterizations of sub-grid-scale processes
- Coupling to atmosphere and biosphere
- Sea ice
- .