Chapter 6 - Stanford University

advertisement
Presentation Slides
for
Chapter 6
of
Fundamentals of Atmospheric Modeling
2nd Edition
Mark Z. Jacobson
Department of Civil & Environmental Engineering
Stanford University
Stanford, CA 94305-4020
jacobson@stanford.edu
March 10, 2005
ODEs and PDEs
Ordinary differential equation (ODE)
Equation with one independent variable
Partial differential equation (PDE)
Equation with more than one independent variable
Order
Highest derivative of an equation
Degree
Highest polynomial value of the highest derivative
Initial value problem
Conditions are known at one end of domain but not other
Boundary value problem
Conditions are known at both ends of domain
ODEs and PDEs
First-order,
degree
First-order,
degree
Ordinary Differential
Equations
first- (a) dN  16  4N 2
dt
first- (b) dN  3AB  4NC
dt
Partial Differential
Equations
N uN 
(e)

0
t
x
u
u
u
(f)
u  v
0
t
x
y
Second-order,
first-degree
d 2 N dN
(c)

 5t  0
dt
dt 2
2 N 2 N
2 x
(g)


3t
t 2
x 2
Second-order,
second-degree
2 N 

d
dN
(d)  2  
40
dt
 dt 
2
2 N 


N
(h)  2  
tx
x
 t 
2
Operator Splitting Scheme
Fig. 6.1
Operator Splitting
Operator-split advection-diffusion equations
(6.1-6.3)
N uN   
N 


Kh,xx
  0
t
x
x 
x 
N vN   
N 

 Kh,yy
  0
t
y
y 
y 
N wN  
N 

 Kh,zz
  0
t
z
z 
z 
Operator-split external source/sink terms
N

t
Ne,t
 Rn
n1
(6.4)
Finite-Difference Approximation
Replacement of continuous differential operator (d) with
discrete difference analog (D) written in terms of a finite
number of values along a temporal or spatial direction.
Examples:
dN
DN

dt
Dt
N
DN

x
Dx
u
Du

x
Dx
Finite Difference Example
First, replace continuous function ux with a finite number of
values in the x direction.
Fig. 6.2
Finite Difference Approximation
Second, define differences of du at point xi
--> Dui  ui 1  ui1 central difference
--> Dui  ui 1  ui
forward difference
--> Dui  ui  ui 1
backward difference
Central difference approximation to tangent slope at xi (6.10)
u Dui ui 1  ui1


x Dx i xi 1  xi1
Finite-Difference Approximations
Central (AC), forward (BC), and backward (AB) approximations
to slope of tangent at point B
Fig. 6.3
Taylor Series Expansion
Taylor series expansion at point x+Dx
(6.11)
4N
Nx 1 2  2 N x 1 3 3 Nx 1

4
x  ...
Nx  Dx  Nx  Dx
 Dx

Dx

Dx
x
2
6
24
x 2
x 3
x 4
Taylor series expansion at point x-Dx
(6.12)
4
Nx 1 2  2 N x 1 3 3 N x 1
4  Nx
Nx  Dx  Nx  Dx
 Dx
 Dx

Dx
 ...
2
3
4
x
2
6
24
x
x
x
Finite Difference Approximations
Sum the Taylor series expansions
(6.13)
2N
4N

1

4
x 
x  ...
Nx  Dx  Nx  Dx  2Nx  Dx 2
Dx
2
4
12
x
x
Rearrange
(6.14)
 
 2N x
N x Dx  2Nx  Nx  Dx
2


O
Dx
2
2
x
Dx
Truncation error (neglect 2nd-order terms and higher)
4N
1

x  ...
O Dx 2   Dx 2
4
12
x
(6.15)
2nd-order central difference approx. of 2nd derivative
(6.16)
 
 2N x
Nx  Dx  2Nx  Nx  Dx
2 
x
Dx 2
Finite Difference Approximations
Subtract the Taylor series expansions
(6.17)
N x 1 3 3 N x
Nx  Dx  Nx  Dx  2Dx
 Dx
 ...
3
x
3
x
Rearrange
(6.18)
N x N x Dx  N x Dx
2

 O Dx
x
2Dx
 
Truncation error
(6.19)
2nd-order central difference approx. of 1st derivative
N x Nx  Dx  N x Dx Ni1  Ni1


x
2Dx
2Dx
(6.20)
 
3N
1

x  ...
O Dx 2   Dx 2
6
x 3
Finite Difference Approximations
First two terms of Taylor series
1st-order forward difference approx. of 1st derivative
(6.21)
N x Nx  Dx  N x Ni1  Ni


x
Dx
Dx
1st-order backward difference approx. of 1st derivative (6.22)
N x Nx  Nx  Dx Ni  Ni1


x
Dx
Dx
Differencing Time Derivative
Central, forward, backward difference approximations (6.23)
Nt Nt h  Nt h

t
2h
Nt Nt h  Nt

t
h
Nt Nt  Nt h

t
h
Consistency, Convergence
Convergence of finite difference analog
N
DN
 lim
x Dx 0 Dx
(6.6)
Consistency of finite difference analog
(6.7)
DN 
lim T.E.    0
 Dx 
Dx0
Convergence of overall solution
lim
Dx,Dt0
Ne,x,t  N f ,x,t  0
(6.8)
Stability
Stability
lim Ne,x,t  N f ,x,t  C
(6.9)
t
Conditionally stable: Stable for limited time-step range
Unconditionally stable: Stable for all time steps
Unconditionally 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, Dispersion
Numerically 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
Example
Order of derivative:
Number of nodes:
--> Order of approximation:
m=1
q=5
q-m=4
High Order Approximations
Grid spacing where q=5. Derivative is taken at x3.
Fig. 6.4
Distance between two nodes
Dxi  xi1  xi
Approximation to the mth derivative across q nodes
 mN
x
m 
q
  iNi   1N1   2N2  ...   qNq
i 1
(6.24)
High Order Approximations
Approximation to the mth derivative across q nodes
q
m
 N
 i Ni
m 
x
(6.24)
Taylor series expansion for each node about point x*
(6.25)

i 1
2
3
N* 1
2  N* 1
3  N*
Ni  N*  xi  x * 
 x i  x* 
 x i  x* 
 ...
2
3
x
2
6
x
x
Combine (6.24) with (6.25) and gather terms
(6.26)
 mN
x
m 
q
q
q
i 1
i 1
i1
  i Ni    i N*  
N*
 i xi  x* 

x
q

i1
2
1
2  N*
 i x i  x* 
 ...
2
2
x
Redefine
q

i 1
 2N
N
*  ...
 i Ni  B0 N*  B1 *  B2
2
x
x
q
Bn 

i1
(6.27)
1
n
 i x i  x* 
n!
High Order Approximations
q
Bn 

i1
1
n
 i x i  x* 
n!
for n = 0…q - 1
Multiply (6.28) through by n! and set matrix
1

 x  x 
 1 *
 x  x 2
 1 *
:


q1
x

x



*
 1
1
1
x2  x* 
x2  x* 2
x3  x* 
x3  x* 2
:
:
x 2  x * q1 x3  x* q1
• Set Bn=0 for all n, except n = m
• Set Bn=1 when n = m
...
...
...
...
(6.28)
(6.29)
 
1

x q  x*
 
 2 
2 
x q  x*
 3 
 
:
 : 
q1  
 
xq  x *

 q 



1



 0!B0

 1!B

1


 2!B2



:



q  1!Bq1 

nd
2 -Order
Central Diff. Approx.
Example
Find second-order central difference approx. to ∂N/∂x
Order of derivative:
Order of approximation:
--> Number of nodes:
m=1
q-m=2
q=3
Set matrix
(6.32)
 1
 Dx

2

Dx 
1  i1  0





Dx   i   1
2 
0 Dx  
 i1 
 
0

1
0
nd
2 -Order
Central Diff. Approx.
Solve matrix
i  0
1
 i1  
2Dx
1
 i1 
2Dx
Apply the 's to
(6.24)
N
  1 N1   2 N2   3 N3   i 1 Ni1   i Ni   i1 Ni 1
x
Substitute 's to obtain central difference approx.
N Ni 1  Ni 1

x
2Dx
Table 6.2 (c)
st
1 -Order
Backward Diff. Approx.
Example
Find first-order backward difference approx. to ∂N/∂x
Order of derivative:
Order of approximation:
--> Number of nodes:
m=1
q-m=1
q=2
Set matrix
(6.30)
1 i 1  0 
 1
Dx 0   1 

 i   
st
1 -Order
Backward Diff. Approx.
Solve matrix
1
 i1  
Dx
1
i 
Dx
Apply the 's to (6.24)
N
  i1 Ni 1   i Ni
x
Substitute 's to obtain backward difference approx.
N Ni  Ni1

x
Dx
Table 6.2 (a)
nd
2 -Order
Backward Diff. Approx.
Example
Find second-order backward difference approx. to ∂N/∂x
Order of derivative:
Order of approximation:
--> Number of nodes:
Set matrix
Solve
 1
 2Dx

2


2Dx


1
Dx
Dx 2
m=1
q-m=2
q=3
1 i 2  0 

 1 
0
 i1   
0

  i 
 
0 

N Ni 2  4Ni1  3Ni

x
2Dx
(6.32)
(Table 6.2d)
Higher-Order Approximations
Third-order backward difference (m = 1, q = 4)
Table 6.2 (f)
N Ni 2  6Ni1  3Ni  2Ni 1

x
6Dx
Third-order forward difference (m = 1, q = 4)
Table 6.2 (g)
N 2Ni 1  3Ni  6Ni1  Ni2

x
6Dx
Fourth-order backward difference (m = 1, q = 5)
Table 6.2 (i)
N  Ni 3  6Ni 2  18Ni1  10 Ni  3Ni1

x
12Dx
Fourth-order forward difference (m = 1, q = 5)
Table 6.2 (j)
N 3Ni1  10Ni  18Ni1  6Ni 2  Ni3

x
12Dx
Fourth-Order Approximations
Discretize around furthest cell
Fourth-order backward diff. scheme (m = 1, q = 5)
 1
 4Dx

2

4Dx


4Dx 3

4


4Dx


1
1
1
3Dx
2Dx
Dx
3Dx 2 2Dx 2 Dx 2
3Dx 3 2Dx 3 Dx 3
3Dx 4 2Dx 4 Dx 4
Table 6.2 (k)
1 i 4 
0 i 3 


0 i 2 
0 i1 


0

  i 

0
1 
 
0
0
 

0

N 3Ni 4  16Ni3  36Ni2  48Ni1  25Ni

x
12Dx
Fourth-order forward difference (m = 1, q = 5)
Table 6.2 (l)
N 25 Ni  48Ni1  36Ni 2 16 Ni 3  3Ni 4

x
12 Dx
Fourth-Order Central Diff. Approx.
Fourth-order central difference of ∂N/∂x (m = 1, q = 5) (6.33)
 1
 2Dx

2

2Dx


2Dx 3

4


2Dx


1
1
Dx
0
Dx 2 0
Dx 3 0
Dx 4 0
 i 2  0 
Dx
2Dx  i1  1 
  
2
2 
Dx  2Dx    i  0 

 0 
Dx 3 2 Dx 3 
i1   


Dx 4 2Dx 4 
0 


 i 2 
 
1
1
Table 6.2 (h)
N Ni 2  8Ni 1  8Ni1  Ni 2

x
12 Dx
Fourth-Order Central Diff. Approx.
Fourth-order central difference of ∂2N/∂x2 (m = 2, q = 5)
 1
 2Dx

2

2Dx


2Dx 3

4


2Dx


1
1
Dx
0
Dx 2 0
Dx 3 0
Dx 4 0
 i 2  0 
Dx
2Dx  i1  0 
  
2
2 
Dx  2Dx    i  2 

 0 
Dx 3 2 Dx 3 
i1   


Dx 4 2Dx 4 
0 


 i 2 
 
1
1
Table 6.2 (n)
 2N
x
2 
 Ni 2  16Ni1  30Ni  16Ni1  Ni2
12 Dx
2
Advection-Diffusion Eqn. Solutions
Species continuity equation in west-east direction
(6.1)
N uN   
N 


Kh,xx
  0
t
x
x 
x 
CFL stability criterion for
advection
h  Dx min umax
Example:
Dxmin=5 km, |umax|=20 m/s --> h=250 s (Hydrostatic model)
Dxmin=5 km, |umax|=346 m/s --> h=14.5 s (Nonhydrostatic model)
Stability criterion for
diffusion
h  Dx 2min Kmax
Example:
Dzmin=20 m, Kmax=50 m2/s --> h=8 s (in the vertical)
FTCS Solution
Forward 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 h uN i1,t h  uNi1,t h

h
2Dx
Ni1,t h  2Ni,t h  Ni1,t h
K
0
2
Dx
Advection-Diffusion Eqn. Solutions
Implicit solution: 1st-order approximation in time
Unconditionally stable for all u, K
(6.36)
Ni,t  Ni,th uN i1,t  uNi1,t
Ni1,t  2Ni,t  Ni1,t

K
0
2
h
2Dx
Dx
Rearrange and write in tridiagonal matrix form
(6.37)
Ai Ni1,t  Bi Ni,t  Di Ni1,t  Ni,t h
 u
K 
Ai  h
 2 
2Dx Dx i1
(6.38)
 2K 
Bi  1 h 2 
Dx i
 u
K 
Di  h
 2 
2Dx Dx i1
Advection-Diffusion Eqn. Solutions
Rearrange and write in tridiagonal matrix form
B1
A
 2
 0
 0

 :
 0

 0

 0
D1
B2
A3
0
:
0
0
0
0
D2
B3
A4
:
0
0
0
0
0
D3
B4
:
0
0
0
...
...
...
...
0
0
0
0
:
0
0
0
0
:
...
...
...
BI 2
AI 1
0
DI  2
BI 1
AI
(6.39)
 N1,t   N 1,t h   A1 N 0,t 

 N 2,t   N 2,t h   0
 
 



 N 3,t   N 3,t h   0

 N 4,t   N 4,t h   0
  
 


:
:
 

 :  

N I 2,t  N I  2,t h   0
 
 


DI 1 N I 1,t  N I 1,t h   0


 
 

BI 
 N I,t   N I ,t h  DI N I 1,t 
0
0
0
0
:
0
Tridiagonal Matrix Solution
Matrix decomposition:
(6.40)
D1
1  
B1
Di
i  
Bi  Ai  i 1
R1
1 
B1
Ri  Ai  i1
i 
Bi  Ai  i1
Matrix backsubstitution:
NI ,t   I
i=
i=
2..I
2..I
(6.41)
Ni,t   i   i Ni1,t
i = I -1..1, 1
Tridiagonal Matrix Solution
Matrix for solution for periodic boundary conditions
B1
A
 2
 0
 0

 :
 0

 0

DI
D1
B2
A3
0
:
0
0
0
0
D2
B3
A4
:
0
0
0
0
0
D3
B4
:
0
0
0
...
...
...
...
0
0
0
0
:
0
0
0
0
:
...
...
...
BI  2
AI 1
0
DI  2
BI 1
AI
(6.42)
A1  N1,t   N1,t h 
N2,t   N 2,t h 
0 
 


0  N3,t   N 3,t h 
N 4,t   N 4,t h 
0 
 


:
:  :  

N I 2,t  N I  2,t h 
0 
 


DI 1 N I 1,t  N I 1,t h 

 

BI 
 N I ,t   N I,t h 
Values at node I are adjacent to those at node
1
Crank-Nicolson Scheme
Crank-Nicolson form
(6.44)
uN i1,t h  uN i1,t h 
Ni,t  Ni,t h  uN i1,t  uNi1,t
 c
 1  c 

h
2Dx
2Dx


Ni1,t h  2Ni,t h  Ni1,t h 
 Ni1,t  2Ni,t  Ni1,t
 K c
 1   c 
  0
2
2


Dx
Dx
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
Crank-Nicolson Scheme
Tridiagonal form
(6.45)
Ai Ni1,t  Bi Ni,t  Di Ni1,t  Ei Ni1,t h  Fi Ni,t h  Gi Ni1,t h
 u
K 
Ai  c h
 2 
2Dx Dx i1
 u
K 
Ei  1   c h
 2 
2Dx Dx i 1
 2K 
Bi  1 ch  2 
Dx i
 2K 
Fi  1 1 c h 2 
Dx i
 u
K 
Di   ch 
 2 
2Dx Dx i1
 u
K 
Gi   1 c h
 2 
2Dx Dx i1
Leapfrog Scheme
2nd-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2h uNi1,t h  uNi 1,th
Ni1,th  2Ni,th  Ni1,th

K
0
2
2h
2Dx
Dx
Matsuno Scheme
1st-order approximation in time
Conditionally stable for all u when K=0 or small;
unconditionally unstable for large K
Prediction step
(6.49)
Ni,est  Ni,t h uNi 1,th  uN i1,t h
Ni 1,th  2Ni,th  Ni 1,th

K
0
2
h
2Dx
Dx
Correction step
(6.49)
Ni,t  Ni,th uN i1,est  uNi 1,est
Ni1,est  2Ni,est  Ni1,est

K
0
2
h
2Dx
Dx
Heun Scheme
2nd-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h 1 uNi 1,est  uNi1,est K Ni1,est  2Ni,est  Ni1,est


2
h
2
2Dx
2
Dx
1 uN i1,t h  uNi1,t h K Ni1,t h  2Ni,t h  Ni1,t h


0
2
2
2Dx
2
Dx
Prediction step same as first Matsuno step
Adams-Bashforth Scheme
2nd-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h 3 uNi 1,th  uN i1,t h 3 Ni1,t h  2Ni,t h  Ni1,t h

 K
2
h
2
2Dx
2
Dx
1 uN i1,t 2h  uNi 1,t2h 1 Ni1,t 2h  2Ni,t2h  Ni 1,t2h

 K
0
2
2
2Dx
2
Dx
Fourth-Order Runge-Kutta Scheme
Conditionally stable
(6.53-5)
k1 k 2 k 3 k4
Ni,t  Ni,th 



6
3
3
6
 uN i 1,t h  uN i1,t h
Ni1,t h  2Ni,t h  Ni1,t h 
k1  h
K

2
2Dx
Dx


k1
Ni,est1  Ni,t  h 
2
 ut h Nest1   ut h Nest1 
Ni1,est1  2Ni,est1  Ni1,est1 
i
1
i1
k 2  h 
K

2
2Dx

Dx



k2
Ni, est2  Ni, th 
2
Fourth-Order Runge-Kutta Scheme
 ut h Nest2   ut h Nest2 
Ni 1,est2  2Ni,est2  Ni 1,est2 
i
1
i
1
k 3  h
K

2
2Dx

Dx


Ni,est3  Ni,t h  k3
 uth Nest3   ut h Nest3 
Ni1,est3  2Ni,est3  Ni1,est3 
i1
i1
k 4  h 
K

2
2Dx

Dx



Error
Error
Convergence of Four Schemes
10
-1
10
-3
st
10
-5
10
-7
1 -order
2 -order
th
Runge-Kutta
Adams-Bashforth
M atsuno
Forward Euler
10 -9
10
nd
th
5 -6
order
-11
0.1
1
Time step (s)
(Ketefian and Jacobson 2004b)
10
Fig. 6.5
Fourth-Order in Space Solution
Central difference implicit solution
(6.56)
Ni,t  Ni,t h uN i 2,t  8uN i1,t  8uNi1,t  uNi 2,t

h
12Dx
Ni 2,t 16Ni1,t  30Ni,t  16Ni 1,t  Ni 2,t
K
0
2
12Dx
Write in Crank-Nicolson and pentadiagonal form
Ai Ni 2,t  Bi Ni 1,t  Di Ni,t  Ei Ni1,t  Fi Ni 2,t
 Pi Ni2,t  h  Qi Ni1,t h  Si Ni,t h  Ti Ni1,t h  Ui Ni 2,t  h
Variable Grid Spacing, Winds
Second-order central difference of advection term
(6.57)
uN
  a,i1uNi1   a,i uN i   a,i1 uNi 1
x
Solve matrix equation to obtain coefficients

1
1

x i  xi 1  0
2
 x  x
0
 i
i 1 
(6.58)

a,i1  0

  
x i1  x i    a,i   1
2 
x

x
 i1 i   a,i1  0
1
Variable Grid Spacing, Winds
Solve matrix equation to obtain coefficients
 xi 1  xi 
 a,i1 
xi  x i1 xi 1  xi1 
x i1  x i   x i  x i1 
 a,i 
x i1  xi x i  xi 1 
xi  x i1
 a,i1 
xi1  x i xi 1  xi1 
(6.59)
Variable Grid Spacing, Diffusion
Expand analytical diffusion term
(6.60)
  N  K N
2 N
K  
K 2
x  x  x x
x
Second-order central-difference approx. to terms
(6.61)
K
  a,i1 Ki 1   a,i Ki   a,i 1 Ki1
x
N
  a,i1 Ni1   a,i Ni   a,i1 Ni 1
x
K
 2N
x

2  Ki  d,i1 Ni 1   d,i Ni   d,i 1 Ni1

Variable Grid Spacing, Diffusion
Solve matrix equation to obtain coefficients
2
 d,i1 
x i  x i1 x i1  x i1 
2
 d,i 
xi 1  x i x i  x i1 
2
 d,i1 
x i1  xi x i1  x i1 
(6.63)
Variable Grid Spacing Solution
Crank-Nicolson form (c=0.5--> 2nd order time, space) (6.66)
Ni,t  Ni,th
 c
h

 au  K Ni 1   au   K N i   au  K Ni1t


 


 1 c   a u   K N i 1   a u   K N i   a u   K N i1
th
Coefficients for diffusion term
(6.65)


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,i Ki   a,i 1Ki1 a,i1  Ki  d,i 1
K,i1   a,i1Ki 1   a,i Ki   a,i 1Ki1  a,i1  Ki  d,i1
Write in tridiagonal form
Ai Ni1,t  Bi Ni,t  Di Ni1,t  Ei Ni1,t h  Fi Ni,t h  Gi Ni1,t h
Two Dimensional Solution
Advection-diffusion equation in two dimensions
(6.67)
N uN  vN  
N   
N 



Kh,xx

Kh,yy
  0
t
x
y
x 
x  y 
y 
Central difference approximation
(6.68)
Ni, j,t  Ni,j,t h uN i 1, j  uNi 1, j vNi, j1  vNi,j 1 
 


h
2Dx
2Dy



t

Ni1, j  2N i, j  Ni1, j
N i, j 1  2Ni, j  Ni, j 1 
 K h,xx
 K h,yy
  0
2
2
Dx
Dy

t
Solve
Ai, j Ni 1, j,t  Bi, j Ni, j,t  Di, j Ni1,j,t  Ei, j Ni, j1,t  Fi,j Ni, j 1,t  Ni, j,t h
Semi-Lagrangian Method
Concentration at current time t and existing node x
(6.69)
Nx,t  Nx  uh,t h
Values at time x-uh, t-h interpolated from existing nodes
Finite Element Method
Advection equation at node i
(6.70)
Ni uNi

0
t
x
Trial function = series expansion approximation to N (6.71)
= linear combination of basis functions
N i  Ni x  
 N j e j x
j
ej(x) = basis function
j
= trial space
Finite Element Method
Residual in advection equation
(6.73)
Ni x 
N i x   Ni
Ni  N i x 
N i x 
Ri x   
u
 
u
 
u
0



x   t
x   t
x 
 t
Minimize residual
Force its weighted average to zero over domain
x Ri xei xdx  0
ei(x) = weight function
ei(x) = ej(x) --> Galerkin method of weighted residuals
ei(x) ≠ ej(x) --> Petrov-Galerkin technique
(6.72)
Finite Element Method
Substitute
Ni x 
N i x 
Ri x  
u
t
x
N i x  
 N je j x
j
x Ri xei xdx  0
into
to obtain

(6.74)
N i x 
Ni x 
 t  u x ei x dx
x 

 



 
 

e x dx
   N j e j x   u
N
e

x

j j
 i
x 
x t


 j

  j





j

N j

e

x

e

x

dx
 t
j
i
  u
x



de j x 


N
e

x

dx
0
 j
i

x dx


 
j
Finite Element Method
Take time difference of (6.74) over three nodes
(6.75)
Ni1,t  Ni1,t h xi
Ni,t  Ni,t h xi 1
 xi 1 e i1 x e i x dx 
 xi 1 e i x e i x dx
h
h
Ni1,t  Ni1,t h xi 1

xi ei 1x e i x dx
h
xi de x 
xi 1 de x 


i
1
i
e i x dx  Ni,t
ei x dx
Ni 1,t
dx
xi 1
xi 1 dx


u
0

x i1 de x 
i1



N
e i x dx
 i1,t

dx
xi





Finite Element Method
Define basis functions as chapeau functions
 x  xi 1
x i  xi1

 xi 1  x
e i x   
x i1  xi
0


Solve each integral

(6.76)
xi 1  x  x i
xi  x  xi 1
all o ther cases
(6.77)
x i  x  x  x  x

x  x i1
i
i
1
e i1 x e i x dx 


dx 
6
xi 1
x i1 x i  x i1 x i  xi1 
xi

Finite Element Method
Substitute integral solutions back into (6.75)
(6.78)
Ni1,t  Ni1,t hDxi  Ni,t  Ni,t h 2 Dxi1  Dxi  Ni1,t  Ni1,t hDxi 1
6h
Ni1,t  Ni1,t
u
0
2
Solve with tridiagonal matrix solution -->
4th-order in space, 2nd order in time
Tests with a Finite Element Method
Concentration
Concentration (generic)
Preservation of a Gaussian peak during finite element transport after
eight revolutions around a circular grid when uh/Dx= 0.02
1200
1000
800
600
400
200
0
-200
0
5
10 15 20 25
Grid cell number
30
Fig. 6.8
Tests with a Finite Element Method
Concentration
Concentration (generic)
Preservation of a Gaussian peak during finite element transport after
eight revolutions around a circular grid when uh/Dx= 0.6
1200
1000
800
600
400
200
0
-200
-400
0
5
10 15 20 25 30
Grid cell number
Fig. 6.8
Pseudospectral Method
Advection equation
(6.87)
N
N
u
0
t
x
Represent solution with infinite Fourier series

Nx,t  

ak te
(6.88)
ik2x L
k 0
For t=0, integrate both sides of (6.88) from 0≤x≤L
1 L
ik 2x L
ak 0  
N x, 0e
dx
L 0

(6.89)
Pseudospectral Method
Truncate infinite series
(6.90)
Nx,t  
K

ak te
ik2x L
k 0
Central time-difference approximation of (6.90)
(6.91)
K
 K

N
1 

ak,t e ik2x L 
ak,t 2h eik2x L 
t
2h 

k0

k0
Partial derivative of (6.90) with respect to space
(6.92)

N

x

K

k0
ik2ak,t h ik 2x L
e
L
Pseudospectral Method
Substitute (6.91) and (6.92) into (6.87)
1
2h
K
ak,t  ak,t 2h e
(6.93)
K
ik2x L
k 0
 u

k0
ik2ak,t h ik2x L
e
L
Separate into K equations --> solve
ak ,t  ak,t 2h
uik2ak,t h

2h
L
(6.94)
Traits of a Good Advection Scheme
Fig
6.9
Bounded
Nonoscillatory
Monotonic
Final shape after six rotations around a 2-D grid. Walcek (2000)
Download