METO614 3.3.5, 3.3.6, and 3.4 Junjie Liu. SWE in two dimensions The term in brackets are the...
-
Upload
priscilla-conley -
Category
Documents
-
view
216 -
download
0
Transcript of METO614 3.3.5, 3.3.6, and 3.4 Junjie Liu. SWE in two dimensions The term in brackets are the...
METO614
3.3.5, 3.3.6, and 3.4
Junjie Liu
SWE in two dimensions
∂h
∂t= − h(
∂u
∂x+
∂v
∂y)
⎡
⎣⎢
⎤
⎦⎥− u
∂h
∂x− v
∂h
∂y
∂u
∂t= − g
∂h
∂x+ fv
⎡⎣⎢
⎤⎦⎥
− u∂u
∂x− v
∂u
∂y
∂v
∂t= − g
∂h
∂y− fu
⎡
⎣⎢
⎤
⎦⎥− u
∂v
∂x− v
∂v
∂y The term in brackets are the dominant terms for the geostrophic (2.5.1) and the inertia gravity (2.5.1) wave dynamics.
These terms are computed in different ways depending on the type of grid we use.
The advective terms are less affected by the choice of alternative (staggered) grids.
How to write the terms in brackets in differential (FDE) form??
(0.19)
3.3.5 Staggered grids
Un-staggered grid or Staggered grid??
hj
uj
vj
hj+1
uj+1
vj+1
hj-1
uj-1
vj-1
x
€
δ2xU j =U j +1 −U j−1
2Δx≅Ux +
Δx 2
6Uxxx + ......(3.3.1)
Difference computed over a distance of 2d, while in a staggered grid it is over a distance of 1d
All the variables are at the same location, so easy to implement higher order scheme.
Un-staggered grid:
u v h (i,j)
Horizontal uncoupling in grid A
u v h(i-1,j)
u v h(i,j)
u v h(i+1,j)
u v h(i,j-1)
u v h(i, j+1)
un-staggered grid A
Geopotential height eq.
Zonal wind eq.
advectiony
vv
x
uuh
t
hh nji
nji
nji
njin
ji
nji
nji +
Δ
−+
Δ
−−=
Δ
− −+−++
)22
(2
1,1,,1,1,
,1
,
advectionvfx
hhg
t
uun
ji
nji
nji
nji
nji +×+
Δ
−×−=
Δ
− −+−+
,,1,1
1,
1,
22
the geopotential height is not coupled with the wind at the point (i,j)
U is not coupled with h at point (i,j) either
Un-staggered grid A
Advantage:
Because all variables are available at all the grid points, it is easy to construct a higher order accuracy scheme.
Grid A tends to be favored by proponents of the philosophy "accuracy is more important than conservation".
Disadvantage:
Its main disadvantage is that all differences occur on distances 2d
Neighboring points are not coupled for the pressure and convergence terms. This can give rise in time to a horizontal uncoupling (checkerboard pattern),
uj+1/2
vj+1/2
hj
uj-1/2
vj-1/2
hj+1hj-1x
δ xU j =
Uj +
1
2
− Uj −
1
2
Δx≅ Ux +
1
4×
Δx2
6Uxxx + .....
Staggered grid:
staggered grid happens over a distance of 1d
Types of staggered grid:1) staggered grid C
U
U
V
h(i-1,j) U i+1/2,j
V
V(i,j-1/2)
h(i,j) U i+1/2,j
V(I,j+1/2)
V
h(i+1,j)
V
V
h(i,j+1) U U
h(i,j-1) U
V
U
1) staggered grid C
hi, jn+1 −hi, j
n−1
2Δt=−hi, j
n (u
i+12, j
n −ui−
12, j
n
Δx+
vi, j+
12
n −vi, j−
12
n
Δy) + advection
ui+
12, j
n+1 −ui+
12, j
n−1
2Δt=−g×
hi+1, jn −hi, j
n
Δx+ f ×v
i+12, j
n + advection
Geopotential height eq.
Zonal wind eq.
42
1,1
2
1,1
2
1,
2
1,
,2
1
n
ji
n
ji
n
ji
n
jin
ji
vvvv
v++−++−
+
+++=
1) staggered grid C
Advantage:
The convergence and pressure terms are computed over a distance of only 1d, equivalent to doubling the resolution of grid A
Disadvantage:
The Coriolis acceleration terms, on the other hand, requires horizontal averaging, making the inertia gravity waves (related with Coriolis force) less accurate
This makes the grid C less attractive for situations in which the length of the Rossby radius of deformation is not large compared to the grid size d.
/dR gH f=
2) Staggered grid B
u, v
h (i,j)
u, vu, v
u, v
h (i+1,j+1)
u, v
u, vu (i+1/2,j+1/2), v (i+1/2,j+1/1)
Staggered grid B
Advantage: unnecessary to do averaging to calculate Coriolis force
Disadvantage: the minimum distance for horizontal differences is , rather than as in grid C, 1d
2d
advectiony
vv
x
uu
ht
hhn
ji
n
ji
n
ji
n
jin
ji
nji
nji +
Δ
−+
Δ
−−=
Δ
− −−++−−+++
)22
(2
21
,21
21
,21
21
,21
21
,21
,,
1,
Zonal wind eq.
advectionvfx
hhg
t
uun
ji
nji
nji
n
ji
n
ji
+×+Δ
−×−=
Δ
−
+
++
−
+
+
+
,21
,1,1
1
,21
1
,21
22
Geopotential height eq.
Staggered grid E
The distance is still The NCEP Eta model is defined on a grid B rotated by 45, denoted grid E by Arakawa and Lamb (1977),
Only the index is different with grid B.
u, v
h (i,j)
u, v
u, v
u, v
h (i+1,j) u, v
u, v
u (i+1/2,j), v (i+1/2,j)
2d
3) Staggered grid D
u
h v
u
v
With u, v exchanges the location, grid C becomes grid D.
Grid D has no particular merit;
When staggered in time (as suggested by Eliassen), it becomes ideal for atmospheric flow using the Leap-Frog Scheme (see Fig. 3.14)
4) The Eliassen Grid
Even time steps (n+1)Even time steps (n-1) Odd time steps (n)
u
h v
u
v
v
u
v
u
u
h v
u
v
h
h
h
h
v
u h
v
h h
h
h
v
u h
v
h
u
u
u
u
Even time steps (n-1) Odd time steps (n) Even time steps (n+1)
h
v
Geopotential height eq.
Zonal wind eq.
The Eliassen Grid
advectionvfx
hh
gt
uun
ji
n
ji
n
jin
jin
ji +×+Δ
−×−=
Δ
− −+−+
,
,21
,211
,1
,
2
advectiony
vv
x
uu
ht
hhn
ji
n
ji
n
ji
n
jin
ji
nji
nji +
Δ
−+
Δ
−−=
Δ
− −+−+−+
)(2
21
,21
,,21
,21
,
1,
1,
Geopotential height eq.
Zonal wind eq.
Advantage: almost perfect, the divergence term and pressure gradient are calculated over 1d.
However, it has not been adopted in any major model because of complexity of time staggering… Should be tried?
Vertical differential equatione.g. Quasi-Geostrophic equation
(∂∂t
+ vg • ∇)(∇2ψ + f )− f0
∂ω∂p
=0
(∂∂t
+ vg • ∇)∂ψ∂p
+ωf0
S=0
S ≡−(α /θ)dθdp
Arakawa and Moorthi, 1988
How to write FDE for the terms in green?
Vertical staggering method
Lorenz gridω =0(l =
1
2)
ψ ,θ (l = 1)
ω (l = 11
2)
ω =0(l = 21
2)
&σu,v,T ,φ
&σ
&σ =0u,v,T ,φ ψ ,θ (l = 2)
∂ω∂p
(l = 1) =ω(l = 1
1
2) − ω(l =
1
2)
Vp
∂ψ∂p
(l = 11
2) =
ψ (l = 2) −ψ (l = 1)
Vp
S =−(α /θ )dθdp
θ (l =112) =
θ(l =2)+θ(l =1)2
Right panel:Adapted from Arakawa and Moorthi (1988)
Lorenz grid Problem: Allows the development of a spurious computational mode
Reason: The existence of an extra degree of freedom in potential temperature
Where does this extra freedom come from?∂φ
∂(p / p0 )k= −cpθ
φl − φl +1 = c pθl +
1
2
[(pl +1 / p0 )k − (pl / p0 )k ]
θl +
1
2
=1
2(θ l +θ l +1)
θl +
1
2is not affected by superposing
Produces a zig-zag vertical profile of potential temperature
(−1)lΔθ
Potential temperature
pressure
Vθ
Charney-Phillips grid
&σ ,θ
&σu,v,φ
&σ =0u,v,φ
ω ,θ
ω =0ψ ,φ
ω =0
ψ ,φ
∂φ∂(p / p0 )k
= −cpθ
φl − φl +1 = c pθl +
1
2
[(pl +1 / p0 )k − (pl / p0 )k ]
is not calculated from averaging anymore, so there is no spurious computational mode
θl +
1
2
Un-staggered vertical grid
u v T, , ,φ&σ
&σ =0 u v T, , ,φ
u v T, , ,φ&σ
Introduce computational mode
3.3.6 Finite Volume methods
ij i+1/2,j
A D
B C The basic idea: The governing equations are first written in an integral form for a finite volume, and only then they are discretized.
This is in contrast to the methods we have seen so far, in which the equations in differential form are discretized using finite differences or spectral methods
d
dth∫ dxdy+ H—∫ gnds=0
ddt
h∫αdxdy+ (Hα)—∫ gnds=0
∂hα∂t
+∇ghvα =0
∂h∂t
+∇ghv=0
Example: continuity equation and mass weighted equation
where H is the normal flux of h across the walls, and n is the normal vector to the wall.
Differential form
d
dth
ij
ΔxijΔyij⎛⎝⎜
⎞⎠⎟=−(hu
i+1/2 j)Δyi+1/2 j + (hu
i−1/2 j)Δyi−1/2 j
−(hvij+1/2
)Δxij+1/2 + (hvij−1/2
)Δxij−1/2
ddt
αhijΔxijΔyij
⎛⎝⎜
⎞⎠⎟=−(huα
i+1/2 j)Δyi+1/2 j + (huα
i−1/2 j)Δyi−1/2 j
−(hvαij+1/2
)Δxij+1/2 + (hvαij−1/2
)Δxij−1/2
The overbar indicates a suitable average over the grid volume or area
Any scheme based on these finite-volume equations will conserve the average mass and average mass weighted value of
α is any other variable: u, v, T
α
Characteristics of finite volume method
There are a number of choices on how this average can be carried out over this subgrid domain of each grid volume.
one can assume that h or are constant within the volume, or that they vary linearly.
A simple choice for the estimates of the average values at the center and at the walls leads naturally to the quadratically conservative differences (3.3.4)
hij
=hij ; hui+1/2 j
=(hij + hi+1 j )(uij +ui+1 j ) / 4;
huαi+1/2 j
=(hui+1/2 j
)(α ij +α i+1 j ) / 2
Finite volume allows additional flexibility in the choice of discretization.
Example: semi-Lagrangian finite volume method: Lin and Rood (1996)
α
This approach has been adopted in several NCAR, NASA and DOE global community models because of its conservation properties
t
tn+1
tn
xj-1 xj
AP
t
tn+1
tn
xj-1 xj
DP
AP
The boundaries of the grid volume are transported to the new time step, rather than the centers of the volume as is done in the conventional semi-Lagrangian schemes
It requires considerable care in the detailed formulation in order to remain both conservative and maintain the shape of the transported tracers. To learn detail, check Lin and Rood (1996)
Advantages: Conservative, accurate and no constraint on time step for advection!
Semi-Lagrangian method and semi-Lagrangian finite volume method
Semi-Lagrangian methodSemi-Langrangian method finite volume method
3.4 Boundary value problems
Elliptic equations are boundary value problems (3.1.1)
3.4.1 Introduction
∂2u
∂x2+
∂2u
∂y2= 0( f (x, y))
U can be any variable.
To solve this equation, we need two boundary conditions, one on each x and y boundary
Two examples of such problems arising in NWP.
ζ ζ ζ ζ ζ ζ
ζ ζ ζ ζ
i jn
i jn
i j i j i j i j i j i j
i j i j i j i j i j i j
t
u u
xv v
y
, , / , , , / , , ,
, / , , , / , ,
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
+ −+ + − −
+ + − −
−= −
+ − +
−+ − +
1 11 2 1 1 2 1
1 2 1 1 2 1
2 2
2
Δ Δ
Δ
a) Finding the new stream function from the vorticity after the latter has been updated to time (n+1)Δt. Enstrophy conserving numerical scheme:
Process
(3.4.1)
3.4.1 Introduction
∂ζ∂t
=−vg∇ζ =−∇g(vζ ) =−J (Ψ,ζ )ς i, j ,ψ i, j
vi, j+1/2 ψ i+1/2, j +1/2
ui−1/2, j ui+1/2, j
vi, j−1/2
ψ
ψψ
C-grid
1, , 1, , 1 , , 1,2 2
2 2i j i j i j i j i j i ji jx y
ζ+ − + −Ψ − Ψ +Ψ Ψ − Ψ +Ψ+ =
Δ Δ
For this particular scheme, after solving for , we obtain by averaging from the four surrounding corners
(3.4.2)
After solving for , we can obtain the streamfunction by solving the elliptic equation (Laplace) valid at
ζ i, jn+1
t n t= +( )1 Δ
Ψi jn+ ++1 2 1 21/ , /
3.4.1 Example 1
ζ i jn,+1
ζ =kg∇×v=∇2Ψ, v=k ×∇Ψ
Example 2
b) Solving a semi-implicit elliptic equation for the heights also at (n+1) Δt (section 3.2.5):
(3.4.3)
δ 2φi, j − αφi, j = gi, j
Example 2
For example, if we use spherical harmonics on the globe, and make use of
mn
mn
mnm
n Ya
nnYY
aY
22
2
222 )1(
)](coscos
1
cos
1[
1 +−=
∂∂
∂∂
+∂∂
=∇ϕ
ϕϕϕλϕ
1
0
( , , ) ( ) ( , )N n
n m mn n
n m n
t t Yφ λ ϕ φ λ ϕ+
= =−
=∑ ∑
1 1
2 2
1( ) ( )
( 1) 1n nm p m pt F t
n na t
φ + +=−+⎛ ⎞+⎜ ⎟ΦΔ⎝ ⎠
(4.4)
Suppose: (4.5)
so that the solution for each spherical harmonic coefficient is given by :
(4.6)
Directly solving the equation by spectral methods is easy:
3.4.2 Direct methods for linear system
Aφ =F
Soved by Gaussian elimination.
If the matrix A is fixed (e.g., independent of the time step), the LU decomposition of A=LU
solve LX=F
followed by UΦ=X.
Direct methods involve solving equations like (3.4.2) or (3.4.3), which can be written in matrix form as:
(3.4.7)
Direct method: e.g, double Sweep method
Problem: If the matrix is A tridiagonal, the direct problem is particularly easy to solve. A tridiagonal problem can be written as:
a U b U c U dj j j j j j j− ++ + =1 1
with general boundary conditions
U AU A U B U BJ J0 1 1 2 1 1 2= + = +−,
(3.4.8)
(3.4.9)
a j−1 bj−1 0aj bj cj
0 aj+1 bj+1
⎛
⎝
⎜⎜⎜
⎞
⎠
⎟⎟⎟
U j−1
U j
U j+1
⎛
⎝
⎜⎜⎜
⎞
⎠
⎟⎟⎟=
dj−1
dj
dj+1
⎛
⎝
⎜⎜⎜
⎞
⎠
⎟⎟⎟
( )a E b U c U d a Fj j j j j j j j j− + −+ + = −1 1 1
Ec
a E b
Fd a F
a E b
jj
j j j
jj j j
j j j
=−
+
=−
+
−
−
−
1
1
1
U AU A U B U BJ J0 1 1 2 1 1 2= + = +−,
U E U Fj j j j= ++1Assume
U E U Fj j j j− − −= +1 1 1Then
Boundary condition:
Substitute into (3.4.8), obtain:
(3.4.12)
(3.4.11)
(3.4.10)
double Sweep method
U j =−cj
ajE j−1 +bj
U j+1 +dj −ajFj−1
ajE j−1 +bj
double Sweep method
So the method of solution is
U AU A0 1 1 2= + E A F A0 1 0 2= =,
E F j Jj j, , ,...= −1 1
U UJ J, −1U E U FJ J J J− − −= +1 1 1
U B U BJ J= +−1 1 2
U j Jj , ,...= −2 1
a)use the lower BC to determine
b) sweep forward using (4.12) to obtain
c) determine from
and the upper BC
d) determine using (3.4.10)
UJ−1 =EJ −1(B1U J −1 + B2 ) + FJ −1
3.4.3 iterative methods to solve elliptic equations
Aφ =F It can be written as:
φ φ= − +( )I A F , or
φ φ= +M F (3.4.13)
choosing an initial guess 0φ then iterating (3.4.13)
Basic idea
Compared with the direct method, the iterative method may more economical in memory requirements of a computer
Can solve sets of nonlinear equations.
The method converges if the spectral radius 1max)( <= iM λσ
Jacobi simultaneous relaxation method
Suppose we are in iteration . Then
δ 2φi, jν − αφi, j
ν = gi, j + ∈i, j(3.4.17)
φ φ δφν ν νi j i j i j, , ,
+ = +1 (3.4. 18)
Elliptical equation (3. 4. 3) can be written as: δ 2φi, j − αφi, j = gi, j
δ 2φi, j = (φi+1, j + φi−1, j + φi, j +1 + φi, j −1 − 4φi, j ) (3.4.16)
δφνi j, Is to make ∈ =i j, 0 that’s δ 2φi, j
v+1 − αφi, jv+1 = gi, j
Substitute (3.4.18) into above equation:
δ 2φv+1 − α (φi, jv + δφi, j
v ) = gi, j δ 2φv+1 = δ 2φv − 4δφi, jv
δφi, jv =
δ 2φi, jv − αφi, j
v − gi, j
4 + αφ φ
φ αφα
ν νν ν
i j i ji j i j i jg
, ,, , ,+ = +
− −
+1
4
Δ
Gauss-Seidel relaxation method
φ φφ φ φ φ αφ
αν ν
ν ν ν ν ν
i j i ji j i j i j i j i j i jg
, ,, , , , , ,+ −
++ −
++= +
+ + + − −
+1 1
11 1
11
4(3.4. 20)
Successive Over-relaxation method (SOR)
1 11, 1, , 1 , 1 , ,1
, , , with 1 24
i j i j i j i j i j i ji j i j
gν ν ν ν νν ν φ φ φ φ αφ
φ φ ω ωα
+ +− + − ++ + + + − −
= + < <+
Change the sign rather than making it equal to zero∈i, jv+1
Summary of these three methods
• Relaxation method sets the residual equal to zero in one of the equations, and then solves the value iteratively.
• Jacobi iteration only use the values from last iteration in the right hand side of the equation
• Gauss-Seidel iteration use the values from the current iteration after the values have updated
• Over-relaxation method over-corrects: make the residuals have opposite sign with the last time (SOR)
Covergence speed (from slowest to fastest):Jacobi iteration; Gauss-Seidel iteration; Succesive Over
Relaxation (SOR)
Other iterative methods
∂∂
σ ∂∂
∂∂
u
t
u
x
u
y= +( )
2
2
2
2 (4. 22)
u u
tu
u u
tu
n
x
n
yn
**
*
−=
−=
++
Δ
Δ
σδ
σδ
2
12 1
(4. 23)
1. Alternating Direction Implicit (ADI)
Since each fractional step is implicit, large time steps can be used. And since the solution of each fractional step involves only inverting tridiagonal matrices, it can be performed very efficiently (see, e.g., Hageman and Young, 1981).
2. Multigrid methods
Reason to use multigrid: the iterative schemes depends on the number of grid points, and is much faster for coarser grids
Procedure:
Several steps of a basic method on the full grid are performed first in order to smooth out the error
Select a subset of the grid points, and the iterative method is used to solve the problem on this coarse grid
The coarse grid solution is interpolated back to the original grid
The original method applied again for a few iterations.
The method of descending through a sequence of coarser grids and then ascending back to the full grid is known as a V-cycle. A W-cycle results from visiting the coarse grid twice, with some smoothing steps in between
3. Krylov subspace methods
{ }012000 ,.....,,),( rrrrspanrAK mo
m−= AAA
00 φA−=Fr
),( 00 rKm A+φ
Krylov subspace is defined by:
mφis the residual for arbitrary error
The approximate solution lies in the space
Example: conjugate gradient method, Lanczos method, ),( 0rKF mm AA ⊥− φ
Other methods: GMRES, MINRES, ORTHODIR etc.