presentation slides for chapter 6 of fundamentals of atmospheric modeling 2 nd edition
DESCRIPTION
Presentation Slides for Chapter 6 of Fundamentals of Atmospheric Modeling 2 nd Edition. Mark Z. Jacobson Department of Civil & Environmental Engineering Stanford University Stanford, CA 94305-4020 [email protected] March 10, 2005. ODEs and PDEs. Ordinary differential equation (ODE) - PowerPoint PPT PresentationTRANSCRIPT
Presentation Slides for
Chapter 6of
Fundamentals of Atmospheric Modeling 2nd Edition
Mark Z. JacobsonDepartment of Civil & Environmental Engineering
Stanford UniversityStanford, CA [email protected]
March 10, 2005
Ordinary differential equation (ODE)Equation with one independent variable
ODEs and PDEs
Partial differential equation (PDE)Equation with more than one independent variable
OrderHighest derivative of an equation
DegreeHighest polynomial value of the highest derivative
Initial value problemConditions are known at one end of domain but not other
Boundary value problemConditions are known at both ends of domain
ODEs and PDEs
Operator Splitting Scheme
Fig. 6.1
Dynamics
Transport
Gas chemistry
Time interval 1
Dynamics
Transport
Gas chemistry
Time interval 2
Operator-split advection-diffusion equations (6.1-6.3)
Operator Splitting
Operator-split external source/sink terms (6.4)
∂N∂t
+∂ uN( )
∂x−
∂∂x
Kh,xx∂N∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ =0
∂N∂t
+∂ vN( )
∂y−
∂∂y
Kh,yy∂N∂y
⎛
⎝ ⎜
⎞
⎠ ⎟ =0
∂N∂t
+∂ wN( )
∂z−
∂∂z
Kh,zz∂N∂z
⎛ ⎝ ⎜
⎞ ⎠ ⎟ =0
∂N∂t
= Rnn=1
Ne,t
∑
Replacement of continuous differential operator (d) with discrete difference analog () written in terms of a finite number of values along a temporal or spatial direction.
Examples:
Finite-Difference Approximation
dNdt
→ΔNΔt
∂N∂x
→ΔNΔx
∂u∂x
→ΔuΔx
Finite Difference Example
Fig. 6.2
First, replace continuous function ux with a finite number of values in the x direction.
ux
u
x
i-1 i i+1
ui-1 ui ui+1 ui+2
xi-1 xi xi+1 xi+2
Finite Difference ApproximationSecond, define differences of du at point xi
-->
-->
-->
Δui =ui+1−ui−1
Δui =ui+1−ui
Δui =ui −ui−1 backward difference
forward difference
central difference
Central difference approximation to tangent slope at xi (6.10)
∂u∂x
≈ΔuiΔxi
=ui+1−ui−1xi+1−xi−1
ux
u
x
i-1 i i+1
ui-1 ui ui+1 ui+2
xi-1 xi xi+1 xi+2
Finite-Difference Approximations
Fig. 6.3
Central (AC), forward (BC), and backward (AB) approximations to slope of tangent at point B
Nx
N
x
xi-1 xi xi+1
A
B
C
x- x x x+x
x x
Taylor series expansion at point x+x (6.11)
Taylor Series Expansion
Taylor series expansion at point x-x (6.12)
Nx+Δx =Nx +Δx∂Nx∂x
+12
Δx2∂2Nx∂x2 +
16
Δx3∂3Nx∂x3
+124
Δx4∂4Nx∂x4
+...
Nx−Δx =Nx −Δx∂Nx∂x
+12
Δx2∂2Nx∂x2
−16
Δx3∂3Nx∂x3
+124
Δx4∂4Nx∂x4
−...
Nx
N
x
xi-1 xi xi+1
A
B
C
x- x x x+x
x x
Sum the Taylor series expansions (6.13)
Finite Difference Approximations
Rearrange (6.14)
Truncation error (neglect 2nd-order terms and higher) (6.15)
2nd-order central difference approx. of 2nd derivative (6.16)
Nx+Δx +Nx−Δx =2Nx+Δx2 ∂2Nx∂x2 +
112
Δx4∂4Nx∂x4 +...
∂2Nx∂x2
=Nx+Δx−2Nx+Nx−Δx
Δx2+O Δx2( )
O Δx2( ) =−112
Δx2∂4Nx∂x4
−...
∂2Nx∂x2
≈Nx+Δx−2Nx+Nx−Δx
Δx2
Subtract the Taylor series expansions (6.17)
Finite Difference Approximations
Rearrange (6.18)
Truncation error (6.19)
2nd-order central difference approx. of 1st derivative (6.20)
Nx+Δx −Nx−Δx =2Δx∂Nx∂x
+13
Δx3∂3Nx∂x3
+...
∂Nx∂x
=Nx+Δx−Nx−Δx
2Δx+O Δx2( )
O Δx2( ) =−16
Δx2∂3Nx∂x3
−...
∂Nx∂x
≈Nx+Δx−Nx−Δx
2Δx=Ni+1−Ni−1
2Δx
Finite Difference Approximations
1st-order backward difference approx. of 1st derivative (6.22)
First two terms of Taylor series
1st-order forward difference approx. of 1st derivative (6.21)
∂Nx∂x
≈Nx+Δx−Nx
Δx=Ni+1−Ni
Δx
∂Nx∂x
≈Nx −Nx−Δx
Δx=Ni −Ni−1
Δx
Differencing Time Derivative
Central, forward, backward difference approximations (6.23)
∂Nt∂t
≈Nt+h −Nt−h
2h
∂Nt∂t
≈Nt+h −Nt
h
∂Nt∂t
≈Nt −Nt−h
h
Convergence of finite difference analog (6.6)
Consistency, Convergence
Consistency of finite difference analog (6.7)
Convergence of overall solution (6.8)
∂N∂x
= limΔx→ 0
ΔNΔx
limΔx→ 0
T.E.ΔNΔx
⎛ ⎝ ⎜ ⎞
⎠ ⎟ =0
limΔx,Δt→ 0
Ne,x,t −Nf,x,t =0
StabilityStability (6.9)lim
t→ ∞Ne,x,t −Nf,x,t ≤C
Conditionally stable: Stable for limited time-step rangeUnconditionally stable: Stable for all time stepsUnconditionally unstable: Unstable for all time steps
An unconditionally unstable scheme cannot be convergent overall, but individual finite-difference analogs in an unstable scheme may converge and may be consistent.
In other words, consistency and convergence of individual analogs do not guarantee stability.
Stability is guaranteed if a scheme is convergent overall and its finite-difference analogs are convergent and consistent.
Numerical Diffusion, DispersionNumerically diffusive scheme:
Peaks spread artificially across grid cells
Numerically dispersive (oscillatory) scheme: Waves appear ahead of or behind peaks
Unbounded scheme: Transported values artificially rise above the largest existing value or fall below the smallest existing value in domain.
Nonmonotonic scheme: Gradients are not preserved during transport
High Order Approximations
Finite difference approximation of ∂mN/∂xm
• Order of derivative = m• Approximation expanded across q discrete nodes• Minimum number of nodes = m + 1• Maximum order of approximation = q - m
ExampleOrder of derivative: m = 1Number of nodes: q = 5
--> Order of approximation: q - m = 4
High Order Approximations
Grid spacing where q=5. Derivative is taken at x3. Fig. 6.4
Distance between two nodes
Approximation to the mth derivative across q nodes (6.24)
x
x1 x2 x3 x4 x5
*
Δxi =xi+1−xi
∂mN
∂xm≈ γiNii=1
q
∑ =γ1N1+γ2N2 +...+γqNq
High Order Approximations
Taylor series expansion for each node about point x* (6.25)
Combine (6.24) with (6.25) and gather terms (6.26)
Redefine (6.27)
Ni =N* + xi −x*( )∂N*∂x
+12xi −x*( )
2 ∂2N*∂x2 +
16xi −x*( )
3 ∂3N*∂x3
+...
∂mN
∂xm≈ γiNii=1
q
∑ = γiN*i=1
q
∑ + γi xi −x*( )∂N*∂x
i=1
q
∑ + γi12xi −x*( )
2 ∂2N*∂x2
i=1
q
∑ +...
γiNii=1
q
∑ =B0N* +B1∂N*∂x
+B2∂2N*∂x2
+...
Approximation to the mth derivative across q nodes (6.24)
∂mN
∂xm≈ γiNii=1
q
∑
Bn = γi1n!
xi −x*( )n
i=1
q
∑
High Order Approximations
for n = 0…q - 1 (6.28)
• Set Bn=0 for all n, except n = m• Set Bn=1 when n = m
Multiply (6.28) through by n! and set matrix (6.29)
Bn = γi1n!
xi −x*( )n
i=1
q
∑
1 1 1 ... 1
x1−x*( ) x2 −x*( ) x3−x*( ) ... xq −x*( )
x1−x*( )2 x2 −x*( )
2 x3−x*( )2 ... xq −x*( )
2
: : : :
x1−x*( )q−1 x2−x*( )
q−1 x3 −x*( )q−1 ... xq −x*( )
q−1
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
γ1γ2γ3:
γq
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
0!B01!B12!B2
:
q−1( )!Bq−1
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
2nd-Order Central Diff. Approx.
Find second-order central difference approx. to ∂N/∂x
Order of derivative: m = 1Order of approximation: q - m = 2
--> Number of nodes: q = 3
Example
Set matrix(6.32)
1 1 1
−Δx 0 Δx
−Δx( )2 0 Δx( )2
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
γi−1γi
γi+1
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
=
0
1
0
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
2nd-Order Central Diff. Approx.
Apply the 's to (6.24)
Substitute 's to obtain central difference approx. Table 6.2 (c)
∂N∂x
≈γ1N1+γ2N2 +γ3N3 =γi−1Ni−1+γiNi +γi+1Ni+1
∂N∂x
≈Ni+1−Ni−1
2Δx
γi+1 =1
2Δxγi−1=−
12Δx
γi =0
Solve matrix
1st-Order Backward Diff. Approx.
Find first-order backward difference approx. to ∂N/∂x
Order of derivative: m = 1Order of approximation: q - m = 1
--> Number of nodes: q = 2
Example
Set matrix(6.30)
1 1
−Δx 0⎡
⎣ ⎢ ⎤
⎦ ⎥ γi−1γi
⎡
⎣ ⎢ ⎤
⎦ ⎥ =0
1⎡
⎣ ⎢ ⎤
⎦ ⎥
1st-Order Backward Diff. Approx.
Apply the 's to (6.24)
Substitute 's to obtain backward difference approx. Table 6.2 (a)
Solve matrix
γi−1=−1Δx
γi =1Δx
∂N∂x
≈γi−1Ni−1+γiNi
∂N∂x
≈Ni −Ni−1
Δx
2nd-Order Backward Diff. Approx.
Find second-order backward difference approx. to ∂N/∂x
Order of derivative: m = 1Order of approximation: q - m = 2
--> Number of nodes: q = 3
Example
Set matrix (6.32)1 1 1
−2Δx −Δx 0
−2Δx( )2 −Δx( )2 0
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
γi−2γi−1γi
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ =
0
1
0
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
∂N∂x
≈Ni−2 −4Ni−1+3Ni
2Δx
Solve (Table 6.2d)
Higher-Order Approximations
Third-order forward difference (m = 1, q = 4) Table 6.2 (g)
Fourth-order backward difference (m = 1, q = 5) Table 6.2 (i)
Third-order backward difference (m = 1, q = 4) Table 6.2 (f)
Fourth-order forward difference (m = 1, q = 5) Table 6.2 (j)
∂N∂x
≈Ni−2 −6Ni−1+3Ni +2Ni+1
6Δx
∂N∂x
≈−2Ni−1−3Ni +6Ni+1−Ni+2
6Δx
∂N∂x
≈−Ni−3+6Ni−2 −18Ni−1+10Ni +3Ni+1
12Δx
∂N∂x
≈−3Ni−1−10Ni +18Ni+1−6Ni+2 +Ni+3
12Δx
Fourth-Order Approximations
Fourth-order backward diff. scheme (m = 1, q = 5) Table 6.2 (k)
Discretize around furthest cell
Fourth-order forward difference (m = 1, q = 5) Table 6.2 (l)
1 1 1 1 1
−4Δx −3Δx −2Δx −Δx 0
−4Δx( )2 −3Δx( )2 −2Δx( )2 −Δx( )2 0
−4Δx( )3 −3Δx( )3 −2Δx( )3 −Δx( )3 0
−4Δx( )4 −3Δx( )4 −2Δx( )4 −Δx( )4 0
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
γi−4γi−3γi−2γi−1γi
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
0
1
0
0
0
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
∂N∂x
≈−3Ni−4+16Ni−3 −36Ni−2 +48Ni−1−25Ni
12Δx
∂N∂x
≈25Ni −48Ni+1+36Ni+2 −16Ni+3+3Ni+4
12Δx
Fourth-Order Central Diff. Approx.
Fourth-order central difference of ∂N/∂x (m = 1, q = 5) (6.33)
Table 6.2 (h)
1 1 1 1 1
−2Δx −Δx 0 Δx 2Δx
−2Δx( )2 −Δx( )2 0 Δx( )2 2Δx( )2
−2Δx( )3 −Δx( )3 0 Δx( )3 2Δx( )3
−2Δx( )4 −Δx( )4 0 Δx( )4 2Δx( )4
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
γi−2γi−1γi
γi+1γi+2
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
0
1
0
0
0
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
∂N∂x
≈Ni−2 −8Ni−1+8Ni+1−Ni+2
12Δx
Fourth-Order Central Diff. Approx.
Fourth-order central difference of ∂2N/∂x2 (m = 2, q = 5)
Table 6.2 (n)
1 1 1 1 1
−2Δx −Δx 0 Δx 2Δx
−2Δx( )2 −Δx( )2 0 Δx( )2 2Δx( )2
−2Δx( )3 −Δx( )3 0 Δx( )3 2Δx( )3
−2Δx( )4 −Δx( )4 0 Δx( )4 2Δx( )4
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
γi−2γi−1γi
γi+1γi+2
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
0
0
2
0
0
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥
∂2N
∂x2 ≈−Ni−2 +16Ni−1−30Ni +16Ni+1−Ni+2
12Δx2
Advection-Diffusion Eqn. SolutionsSpecies continuity equation in west-east direction (6.1)
CFL stability criterion for advection
Stability criterion for diffusion
∂N∂t
+∂ uN( )
∂x−
∂∂x
Kh,xx∂N∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ =0
h<Δxmin umax
h<Δxmin2 Kmax
Example:xmin=5 km, |umax|=20 m/s --> h=250 s (Hydrostatic model)xmin=5 km, |umax|=346 m/s --> h=14.5 s (Nonhydrostatic model)
Example:zmin=20 m, Kmax=50 m2/s --> h=8 s (in the vertical)
FTCS SolutionForward in time, centered in space (FTCS) solution (6.35)
1st-order approximation in time
Unconditionally unstable for K=0, large K; otherwise conditionally stable
Ni,t −Ni,t−hh
+uN( )i+1,t−h − uN( )i−1,t−h
2Δx
−KNi+1,t−h −2Ni,t−h +Ni−1,t−h
Δx2 =0
Advection-Diffusion Eqn. SolutionsImplicit solution: 1st-order approximation in time (6.36)
Unconditionally stable for all u, K
Rearrange and write in tridiagonal matrix form (6.37)
Ai =−hu
2Δx+
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i−1
Bi =1+h2K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i
Di =hu
2Δx−
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i+1
(6.38)
Ni,t −Ni,t−hh
+uN( )i+1,t − uN( )i−1,t
2Δx−K
Ni+1,t −2Ni,t +Ni−1,t
Δx2=0
AiNi−1,t +BiNi,t +DiNi+1,t =Ni,t−h
Advection-Diffusion Eqn. SolutionsRearrange and write in tridiagonal matrix form (6.39)
B1 D1 0 0 ... 0 0 0
A2 B2 D2 0 ... 0 0 0
0 A3 B3 D3 ... 0 0 0
0 0 A4 B4 ... 0 0 0
: : : : : : :
0 0 0 0 ... BI−2 DI−2 0
0 0 0 0 ... AI−1 BI−1 DI−10 0 0 0 ... 0 AI BI
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
N1,tN2,tN3,tN4,t
:
NI −2,tNI−1,tNI,t
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
N1,t−hN2,t−hN3,t−hN4,t−h
:
NI−2,t−hNI−1,t−hNI ,t−h
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
−
A1N0,t0
0
0
:
0
0
DINI+1,t
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
Tridiagonal Matrix SolutionMatrix decomposition: (6.40)
i = 2..I
i = 2..I
Matrix backsubstitution: (6.41)
i = I -1..1, -1
γ1 =−D1B1
γi =−Di
Bi +Aiγi−1
α1 =R1B1
αi =Ri −Aiαi−1Bi +Aiγi−1
NI ,t =α I Ni,t =αi +γiNi+1,t
Tridiagonal Matrix SolutionMatrix for solution for periodic boundary conditions (6.42)
B1 D1 0 0 ... 0 0 A1A2 B2 D2 0 ... 0 0 0
0 A3 B3 D3 ... 0 0 0
0 0 A4 B4 ... 0 0 0
: : : : : : :
0 0 0 0 ... BI−2 DI−2 0
0 0 0 0 ... AI−1 BI −1 DI −1DI 0 0 0 ... 0 AI BI
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
N1,tN2,tN3,tN4,t
:
NI−2,tNI −1,tNI ,t
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
=
N1,t−hN2,t−hN3,t−hN4,t−h
:
NI−2,t−hNI−1,t−hNI,t−h
⎡
⎣
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥
Values at node I are adjacent to those at node 1
Crank-Nicolson SchemeCrank-Nicolson form (6.44)
c = Crank-Nicolson parameter= 0.5 --> Crank-Nicolson solution (unconditionally stable all u, K)
2nd-order approximation in time = 0. --> explicit (FTCS) solution= 1 --> implicit solution
Ni,t −Ni,t−hh
+ μcuN( )i+1,t − uN( )i−1,t
2Δx+ 1−μc( )
uN( )i+1,t−h− uN( )i−1,t−h2Δx
⎡
⎣ ⎢
⎤
⎦ ⎥
−K μcNi+1,t −2Ni,t +Ni−1,t
Δx2+ 1−μc( )
Ni+1,t−h −2Ni,t−h +Ni−1,t−h
Δx2⎡
⎣ ⎢ ⎤
⎦ ⎥ =0
Crank-Nicolson SchemeTridiagonal form (6.45)
Ai =−μchu
2Δx+
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i−1
Ei = 1−μc( )hu
2Δx+
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i−1
Bi =1+μch2K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i
Fi =1− 1−μc( )h2K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i
Di =μchu
2Δx−
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i+1
Gi =−1−μc( )hu
2Δx−
K
Δx2⎛
⎝ ⎜
⎞
⎠ ⎟ i+1
AiNi−1,t +BiNi,t +DiNi+1,t =EiNi−1,t−h +FiNi,t−h+GiNi+1,t−h
Leapfrog Scheme2nd-order approximation in time (6.48)
Unconditionally unstable for all nonzero K; conditionally stable for linear equations when K=0; unstable for nonlinear equations
Ni,t −Ni,t−2h2h
+uN( )i+1,t−h − uN( )i−1,t−h
2Δx−K
Ni+1,t−h −2Ni,t−h +Ni−1,t−h
Δx2=0
Matsuno Scheme
Prediction step (6.49)
Correction step (6.49)
Ni,est−Ni,t−hh
+uN( )i+1,t−h −uN( )i−1,t−h
2Δx−K
Ni+1,t−h−2Ni,t−h+Ni−1,t−h
Δx2=0
Ni,t −Ni,t−hh
+uN( )i+1,est− uN( )i−1,est
2Δx−K
Ni+1,est−2Ni,est+Ni−1,est
Δx2=0
1st-order approximation in time
Conditionally stable for all u when K=0 or small; unconditionally unstable for large K
Heun Scheme2nd-order approximation in time (6.51)
Unconditionally unstable for all u when K=0 and K large; conditionally stable for other values of K
Ni,t −Ni,t−hh
+12
uN( )i+1,est− uN( )i−1,est2Δx
−K2
Ni+1,est−2Ni,est+Ni−1,est
Δx2
+12
uN( )i+1,t−h − uN( )i−1,t−h2Δx
−K2
Ni+1,t−h −2Ni,t−h +Ni−1,t−h
Δx2 =0
Prediction step same as first Matsuno step
Adams-Bashforth Scheme2nd-order approximation in time (6.52)
Unconditionally unstable for all u when K=0 and K large; conditionally stable for other values of K.
Ni,t −Ni,t−hh
+32
uN( )i+1,t−h −uN( )i−1,t−h2Δx
−32KNi+1,t−h −2Ni,t−h +Ni−1,t−h
Δx2
−12
uN( )i+1,t−2h − uN( )i−1,t−2h2Δx
+12KNi+1,t−2h −2Ni,t−2h +Ni−1,t−2h
Δx2=0
Fourth-Order Runge-Kutta SchemeConditionally stable (6.53-5)
Ni,t =Ni,t−h+k16
+k23
+k33
+k46
k1 =h −uN( )i+1,t−h− uN( )i−1,t−h
2Δx+K
Ni+1,t−h−2Ni,t−h+Ni−1,t−h
Δx2⎡
⎣ ⎢
⎤
⎦ ⎥
k2 =h −ut−hNest1( )i+1−ut−hNest1( )i−1
2Δx+K
Ni+1,est1−2Ni,est1+Ni−1,est1
Δx2⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥
Ni,est1=Ni,t−h +k12
Ni , est 2
= Ni , t − h
+
k2
2
Fourth-Order Runge-Kutta Scheme
Ni,est3 =Ni,t−h +k3
k4 =h −ut−hNest3( )i+1−ut−hNest3( )i−1
2Δx+K
Ni+1,est3−2Ni,est3+Ni−1,est3
Δx2⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥
k3=h −ut−hNest2( )i+1−ut−hNest2( )i−1
2Δx+K
Ni+1,est2 −2Ni,est2+Ni−1,est2
Δx2⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥
Convergence of Four Schemes
(Ketefian and Jacobson 2004b) Fig. 6.5
10
-11
10
-9
10
-7
10
-5
10
-3
10
-1
0.1 1 10
Runge-Kutta
Adams-Bashforth
Matsuno
Forward Euler
Error
Time step (s)
1
st
-order
5
th
-6
th
order
2
nd
-order
Err
or
Fourth-Order in Space SolutionCentral difference implicit solution (6.56)
Write in Crank-Nicolson and pentadiagonal form
Ni,t −Ni,t−hh
+uN( )i−2,t −8uN( )i−1,t +8uN( )i+1,t − uN( )i+2,t
12Δx
−K−Ni−2,t +16Ni−1,t −30Ni,t +16Ni+1,t −Ni+2,t
12Δx2 =0
AiNi−2,t+BiNi−1,t +DiNi,t +EiNi+1,t +FiNi+2,t
=PiNi−2,t−h+QiNi−1,t−h +SiNi,t−h+TiNi+1,t−h +UiNi+2,t−h
Variable Grid Spacing, WindsSecond-order central difference of advection term (6.57)
Solve matrix equation to obtain coefficients (6.58)
∂ uN( )∂x
=γa,i−1 uN( )i−1+γa,i uN( )i +γa,i+1 uN( )i+1
1 1 1
−xi −xi−1( ) 0 xi+1−xi( )
xi −xi−1( )2 0 xi+1−xi( )
2
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
γa,i−1γa,i
γa,i+1
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
=
0
1
0
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
Variable Grid Spacing, Winds
Solve matrix equation to obtain coefficients (6.59)
γa,i+1 =xi −xi−1
xi+1−xi( ) xi+1−xi−1( )
γa,i =xi+1−xi( ) − xi −xi−1( )xi+1−xi( ) xi −xi−1( )
γa,i−1 =−xi+1−xi( )
xi −xi−1( ) xi+1−xi−1( )
Variable Grid Spacing, DiffusionExpand analytical diffusion term (6.60)
Second-order central-difference approx. to terms (6.61)
∂∂x
K∂N∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ =
∂K∂x
∂N∂x
+K∂2N
∂x2
∂K∂x
≈γa,i−1Ki−1+γa,iKi +γa,i+1Ki+1
∂N∂x
≈γa,i−1Ni−1+γa,iNi +γa,i+1Ni+1
K∂2N
∂x2≈Ki γd,i−1Ni−1+γd,iNi +γd,i+1Ni+1( )
Variable Grid Spacing, DiffusionSolve matrix equation to obtain coefficients (6.63)
γd,i−1=2
xi −xi−1( ) xi+1−xi−1( )
γd,i =−2
xi+1−xi( ) xi −xi−1( )
γd,i+1=2
xi+1−xi( ) xi+1−xi−1( )
Variable Grid Spacing SolutionCrank-Nicolson form (c=0.5--> 2nd order time, space) (6.66)
Coefficients for diffusion term(6.65)
Write in tridiagonal form
Ni,t −Ni,t−hh
=−μc γau−βK( )N[ ]i−1+ γau−βK( )N[ ]i + γau−βK( )N[ ]i+1{ }t
−1−μc( ) γau−βK( )N[ ]i−1+ γau−βK( )N[ ]i + γau−βK( )N[ ]i+1{ }t−h
βK ,i−1 = γa,i−1Ki−1+γa,iKi +γa,i+1Ki+1( )γa,i−1+Kiγd,i−1
βK ,i = γa,i−1Ki−1+γa,iKi +γa,i+1Ki+1( )γa,i +Kiγd,i
βK ,i+1 = γa,i−1Ki−1+γa,iKi +γa,i+1Ki+1( )γa,i+1+Kiγd,i+1
AiNi−1,t +BiNi,t +DiNi+1,t =EiNi−1,t−h +FiNi,t−h+GiNi+1,t−h
Two Dimensional Solution Advection-diffusion equation in two dimensions
(6.67)
Central difference approximation(6.68)
Solve
∂N∂t
+∂ uN( )
∂x+
∂ vN( )∂y
−∂∂x
Kh,xx∂N∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ −
∂∂y
Kh,yy∂N∂y
⎛
⎝ ⎜
⎞
⎠ ⎟ =0
Ni, j,t −Ni,j,t−hh
+uN( )i+1, j − uN( )i−1, j
2Δx+vN( )i, j+1− vN( )i,j−1
2Δy
⎡
⎣ ⎢ ⎢
⎤
⎦ ⎥ ⎥ t
− Kh,xxNi−1, j −2Ni, j +Ni+1, j
Δx2 +Kh,yyNi, j−1−2Ni, j +Ni, j+1
Δy2⎛
⎝ ⎜
⎞
⎠ ⎟ t=0
Ai, jNi−1, j,t +Bi, jNi, j,t +Di, jNi+1,j,t +Ei, jNi, j−1,t +Fi,jNi, j+1,t =Ni, j,t−h
Semi-Lagrangian Method
Nx,t =Nx−uh,t−h
Concentration at current time t and existing node x (6.69)
Values at time x-uh, t-h interpolated from existing nodes
Finite Element Method Advection equation at node i
(6.70)
Trial function = series expansion approximation to N (6.71) = linear combination of basis functions
ej(x) = basis function
j = trial space
∂Ni∂t
+∂ uN( )i
∂x=0
Ni ≈Ni x( ) = Njej x( )
j∑
Finite Element Method
Minimize residual (6.72) Force its weighted average to zero over domain
Residual in advection equation (6.73)
ei(x) = weight function
ei(x) = ej(x) --> Galerkin method of weighted residuals
ei(x) ≠ ej(x) --> Petrov-Galerkin technique
Ri x( )ei x( )dxx∫ =0
Ri x( ) =∂Ni x( )
∂t+u
∂Ni x( )∂x
⎡
⎣ ⎢ ⎤
⎦ ⎥ −∂Ni∂t
+u∂Ni∂x
⎡ ⎣ ⎢
⎤ ⎦ ⎥ =
∂Ni x( )∂t
+u∂Ni x( )
∂x⎡
⎣ ⎢ ⎤
⎦ ⎥ −0
Finite Element Method Substitute
∂Ni x( )∂t
+u∂Ni x( )
∂x⎡
⎣ ⎢ ⎤
⎦ ⎥ ei x( )dxx∫
=∂∂t
Njej x( )
j∑
⎛
⎝
⎜ ⎜
⎞
⎠
⎟ ⎟ +u
∂∂x
Njej x( )
j∑
⎛
⎝
⎜ ⎜
⎞
⎠
⎟ ⎟
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥ ei x( )dx
x∫
=∂Nj∂t
ej x( )ei x( )dxx∫
⎛
⎝ ⎜
⎞
⎠ ⎟
j∑ +u Nj
dej x( )
dxei x( )dx
x∫⎛
⎝ ⎜
⎞
⎠ ⎟
j∑ =0
Ri x( )ei x( )dxx∫ =0
Ri x( ) =∂Ni x( )
∂t+u
∂Ni x( )∂x
Ni x( )= Njej x( )
j∑
into
to obtain (6.74)
Finite Element Method Take time difference of (6.74) over three nodes
(6.75)Ni−1,t −Ni−1,t−h
hei−1 x( )ei x( )xi−1
xi∫ dx+Ni,t −Ni,t−h
hei x( )ei x( )xi−1
xi+1∫ dx
+Ni+1,t −Ni+1,t−h
hei+1 x( )ei x( )xi
xi+1∫ dx
+u
Ni−1,tdei−1 x( )
dxei
xi−1
xi∫ x( )dx+Ni,t
dei x( )dx
ei x( )xi−1
xi+1
∫ dx
+Ni+1,tdei+1 x( )
dxei
xi
xi+1
∫ x( )dx
⎛
⎝
⎜ ⎜ ⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟ ⎟ ⎟
=0
Finite Element Method Define basis functions as chapeau functions
(6.76)
Solve each integral(6.77)
ei x( )=
x−xi−1xi −xi−1
xi−1≤x≤xi
xi+1−xxi+1−xi
xi ≤x≤xi+1
0 all other cases
⎧
⎨
⎪ ⎪ ⎪
⎩
⎪ ⎪ ⎪
ei−1 x( )ei x( )xi−1
xi∫ dx=
xi −xxi −xi−1
⎛
⎝ ⎜
⎞
⎠ ⎟
x−xi−1xi −xi−1
⎛
⎝ ⎜
⎞
⎠ ⎟
xi−1
xi∫ dx=
x−xi−16
Finite Element Method Substitute integral solutions back into (6.75)
(6.78)Ni−1,t −Ni−1,t−h( )Δxi + Ni,t −Ni,t−h( )2 Δxi+1+Δxi( ) + Ni+1,t −Ni+1,t−h( )Δxi+1
6h
+uNi+1,t −Ni−1,t
2=0
Solve with tridiagonal matrix solution --> 4th-order in space, 2nd order in time
Tests with a Finite Element Method Preservation of a Gaussian peak during finite element transport after
eight revolutions around a circular grid when uh/x= 0.02
-200
0
200
400
600
800
1000
1200
0 5 10 15 20 25 30
Concentration (generic)
Grid cell number
Fig. 6.8
Con
cent
ratio
n
Tests with a Finite Element Method Preservation of a Gaussian peak during finite element transport after
eight revolutions around a circular grid when uh/x= 0.6
-400
-200
0
200
400
600
800
1000
1200
0 5 10 15 20 25 30
Concentration (generic)
Grid cell number Fig. 6.8
Con
cent
ratio
n
Pseudospectral Method Advection equation
(6.87)∂N∂t
+u∂N∂x
=0
Represent solution with infinite Fourier series(6.88)
N x,t( )= ak t( )eik2πx L
k=0
∞
∑For t=0, integrate both sides of (6.88) from 0≤x≤L
(6.89)
ak 0( )=1L
N x,0( )0
L
∫ e−ik2πx Ldx
Pseudospectral Method Truncate infinite series
(6.90)
Central time-difference approximation of (6.90)(6.91)
Partial derivative of (6.90) with respect to space(6.92)
N x,t( )= ak t( )eik2πx L
k=0
K
∑
∂N∂t
≈12h
ak,teik2πx L
k=0
K
∑ − ak,t−2heik2πx L
k=0
K
∑⎛
⎝
⎜ ⎜
⎞
⎠
⎟ ⎟
∂N∂x
=ik2πak,t−h
Leik2πx L
k=0
K
∑
Pseudospectral Method
Substitute (6.91) and (6.92) into (6.87)(6.93)
Separate into K equations --> solve(6.94)
12h
ak,t−ak,t−2h( )eik2πx L
k=0
K
∑ =−uik2πak,t−h
Leik2πx L
k=0
K
∑
ak,t −ak,t−2h2h
=−uik2πak,t−h
L
Traits of a Good Advection Scheme
Final shape after six rotations around a 2-D grid. Walcek (2000)
Fig 6.9
BoundedNonoscillatoryMonotonic