Numerical Solution of PDE
Numerical Solution of PDE
( ∂t + μ ( t , x ) ∂x +σ ( t , x ) ∂2x −r ( t , x ) ) U =0 , (1)
nx
space domain with the space grid { x }
j j=1
, where x 1=x and x nx =x . Note that we allow non-uniform grids.
−1
Now, call x 1 the lower boundary, x n the upper boundary, and the set of points { x j }nj=2
x
x
the interior region. For
k k k k
any time point t k , U j ≝ U ( t k , x j ), μ j ≝ μ ( t k , x j ), σ j ≝ σ ( t k , x j ) and r j ≝ r ( t k , x j ), where j=1 ,… , n x and
k =1 , … ,n t .
To approximate Equation (1), it is necessary to approximate the first-order and second-order partial derivatives
through discretization. Let Δ x j ≝ x j+ 1−x j , where j=1 ,… , n x −1. For j=2 , … ,n x −1, the first-order
partial derivative at x j is approximated by
where
2
β j−1∧¿ ,
Δ x j−1 ( Δ x j−1+ Δ x j )
2
β j +1∧¿ ,
Δ x j ( Δ x j−1+ Δ x j )
β j∧¿−( β j−1+ β j+1 ) .
Note that α j ’s and β j ’s depend only on j but not time.
Substitute the approximated partial derivatives into the PDE and obtain the following discretization equation
2
∂t U j∧¿−μ j δ x U j−σ j δ x U j +r j U j
¿=−μ j ( α j−1 U j −1 +α j U j+ α j+1 U j +1 )−σ j ( β j−1 U j−1 + β j U j + β j+1 U j +1 )+ r j U j
¿=−( μ j α j−1+ σ j β j−1 ) U j−1−( μ j α j +σ j β j−r j ) U j −( μ j α j +1+ σ j β j +1 ) U j+1 ,
for j=2 , … ,n x −1. For convenience, let
1
c j∧≝ μ j α j−1+ σ j β j−1 ,
a j∧ ≝ μ j α j + σ j β j−r j ,
b j∧ ≝ μ j α j+1 +σ j β j+1 ,
which results in
∂t U j=−c j U j−1−a j U j−b j U j+ 1 . (4)
The time index will be specified later as it depends on the time discretization scheme used.
Next, we consider the boundary conditions.
Again, on the upper boundary x=x , the Null gamma condition is given by
2
δ U n −1∧¿ 0 x
β n −1 β n −2
U n ∧¿− U n −1−
x
U n −2 . x
x
βn x
βn x
x
x
Given that the solution at the current time point t k+1 is known, we are ready to calculate the solution at the
previous point t k . We could proceed with either the explicit scheme or the implicit scheme. First, we consider
the explicit scheme.
Explicit scheme
After discretization in time domain, the explicit scheme for Equation (4) is given by
k+1 k
U j −U j k +1 k +1 k+1 k+1 k+ 1 k +1
=−c j U j−1−a j U j −b j U j+1 ,
Δtk
for j=2 , … ,n x −1, where Δ t k =t k +1−t k .
k +1 k +1
Since U 1 and U n x could be calculated by the boundary conditions as in Equations (5) and (6) above,
j + Δ t k ( c j U j−1 +a j U j +b j U j +1 ) ,
U kj =U k+ 1 k+1 k+1 k+1 k+1 k+1 k+1
(7)
2
Next, we consider the implicit scheme.
Implicit scheme
After discretization in time domain, the implicit scheme for Equation (4) is given by
k+1 k
U j −U j k k k k k k
=−c j U j−1−a j U j −b j U j +1 .
Δtk
Now, Equation (7) could no longer be applied because
k k k
U 1∧¿ λ 2 U 2 + λ3 U 3 ,
U n ∧¿ λn −1 U kn −1 + λ n −2 U nk −2 ,
k
x x x x x
are not known at the current time point t k . However, we can use these two equations to modify the
coefficients on the boundaries and arrive at a solvable system of linear equations.
Set j=2 and apply Equation (5). The discretized PDE becomes
k+1 k
U 2 −U 2 k k k k
∧¿−c 2 U 1−a 2 U 2 −b2 U 3
Δtk
¿=−( a2 + λ 2 c 2 ) U 2 −( b 2+ λ3 c 2 ) U 3 .
k k k k k k
~k
b 2∧ ≝ b2k + λ3 c k2 .
Set j=n x −1 and apply Equation (6). The discretized PDE becomes
k +1 k
U n −1−U n −1 k k k k k k
x
∧¿−cn −1 U n −2−an −1 U n −1−b n −1 U n
x
Δ tk x x x x x x
¿=−( cn −1 + λ n −2 bn −1 ) U n −2 + ( an −1 + λ n −1 b n −1 ) U n −1 .
k k k k k k
x x x x x x x x
~
a n −1∧≝ an −1 + λ n −1 b kn −1 .
k k
x x x x
[ ][ ]
k k+1
U2 U2
k k+1
[ ])
U3 U3
(
~ak ~ k
¿ ¿c
k k k
¿ ~k
2 b2 3 a 3 b 3
I n −2− Δ t k k k
an −1 ¿ ⋮ = ⋮ , (8)
x
⋱ ⋱ ⋱ ¿c a ¿ ¿ x
k k +1
n x −2 n x −2
U nx −2 U nx −2
k k +1
U nx −1 U nx −1
k ~k
a 2, b 2 , ~
I n −2 is the identity matrix of order n x −2. Note the modified coefficients ~ c n −1 and ~
k k
where x
a n −1. The x x
key observation is that the matrix in the bracket on the left-hand side is tri-diagonal. Hence, the above system
of equations could be easily solved by standard tri-diagonal matrix solver.
3
k k
U 1 ∧¿ g ,
U kn ∧¿ hk ,
x
k k
where g ’s and h ’s are known for all k ’s.
Explicit scheme
Since the solution values on the boundaries are known at the current time point t k+1, the explicit scheme
k +1 k +1 k +1 k+1
proceeds as in Equation (7) , where U 1 =g and U n x =h .
Implicit scheme
The implicit scheme for Equation (4) is given by
k+1 k
U j −U j k k k k k k
=−c j U j−1−a j U j −b j U j +1 ,
Δtk
for j=2 , … ,n x −1.
Δtk x x x x x x
k k k k k k
¿=−c nx −1 U nx −2 −a nx −1 U nx −1 −b n x −1 h .
Now, the discretized PDE could be written in matrix form
[ ][ ] [ ]
k k+1
U2 U2 c2 g
k k
U k3 U 3k+1
( [ ])
ak2 b k2 ¿ ¿ ck3 ak3 bk3 ¿ k 0
I n −2− Δ t k an −1 ¿ ⋮ = ⋮ + Δtk ⋮ . (9)
x
⋱ ⋱ ⋱ ¿ ckn −2 akn −2 ¿ ¿ x
k k +1
0
x x
U nx −2 U nx −2
k
U k
U k +1 b nx −1 hk
nx −1 nx −1
k k k k
Note that the coefficients of the matrix near boundaries (that is, a 2, b 2, c nx −1 and a nx −1) need not be modified
but a source term matrix is added to the left-hand side. Similar to the case of Null-gamma condition, the
resulting system of equations could be easily solved by standard tri-diagonal matrix solver.
1.3 θ-scheme
For convenience, let
[] [ ]
U k2 k
c2 g
k
U k3
[ ]
ak2 bk2 ¿ ¿ c k3 a3k b3k ¿ k 0
k k k
U = ⋮ ,L = k k
an −1 ¿ and F = ⋮ .
k ⋱ ⋱ ⋱ ¿ c n −2 a n −2 ¿ ¿ x
0
U n x −2
x x
U k b kn −1 hk
n x −1 x
4
where the matrices F k is the source term matrix added for Dirichlet conditions (if applicable).
Now, the explicit scheme could be written as
U k =U k+ 1+ Δ t k ( Lk +1 U k+1 + F k+1 ) ,
while the implicit scheme could be written as
( I n −2 −Δ t k Lk ) U k =U k+1 + Δ t k F k .
x
The θ -scheme is a mixture of explicit scheme and implicit scheme, and is given by
k+1 k
U −U
=−( 1−θ ) ( L U + F )−θ ( L U + F ) ,
k+1 k+1 k+1 k k k
Δtk
where the matrices F k and F k+1 are the source term matrices added for Dirichlet conditions (if applicable).
After rearrangement,
( I −θ Δ t k Lk ) U k −θ Δ t k F k =U k+1 + ( 1−θ ) Δ tk ( Lk +1 U k +1 + Fk +1 ) .
The above problem could be solved by using first the explicit scheme and then the implicit scheme.
In the first step, the right-hand side is equivalent to solving the following explicit scheme:
~k
U =U k+1 + ( 1−θ ) Δ t k ( Lk +1 U k+1 + F k+1 ) ,
where the size of the time step is scaled by ( 1−θ ).
In the second step, the left-hand side is equivalent to solving the following implicit scheme:
( I n −2 −θ Δ t k Lk ) U k −θ Δ t k F k =~
x
Uk ,
where the size of the time step is scaled by θ .
5
2. Numerical solution of 2D PDE
( ∂t + μ x ( t , x , y ) ∂ x +σ x ( t , x , y ) ∂ 2x + μ y ( t , x , y ) ∂ y +σ y ( t , x , y ) ∂ 2y + ρ ( t , x , y ) ∂x ∂ y −r ( t , x , y ) ) U=0
(10) ,
nx ny
space domains with the x -grid { x } where x 1=x and x n =x , and y -grid { y }
j j=1
, where y 1= y and
x l l =1
,
y n = y . Note that we allow non-uniform grids. Now, call x 1 the lower boundary of x -grid, x n the upper
y x
boundary of x -grid, y 1 the lower boundary of y -grid, y n , the upper boundary of y -grid, and the set of points
y
( x j , y l ), where j=2 , … ,n x −1 and l=2 , … , n y −1 , the interior region. For any time point t k ,
k x, k x x ,k x y,k y y ,k y
U j ,l ≝ U ( t k , x j , y l ), μ j ,l ≝ μ ( t k , x j , y l ), σ j ,l ≝ σ ( t k , x j , y l ), μ j ,l ≝ μ ( t k , x j , y l ), σ j ,l ≝ σ ( t k , x j , y l ),
k k
ρ j ,l ≝ ρ ( t k , x j , y l ) and r j ,l ≝ r ( t k , x j , y l ), where j=1 ,… , n x , l=1 , … , n y and k =1 , … ,n t .
Similar to the case of 1D PDE, to approximate Equation (10), it is necessary to approximate the first-order and
second-order partial derivatives through discretization. Let Δ x j ≝ x j+ 1−x j for j=1 ,… , n x −1, and
Δ yl ≝ y l+1− yl for l=1 , … , n y −1. For j=2 , … ,n x −1 and l=2 , … , n y −1 , the approximated first-
order partial derivative at x j is given by
x x x
δ x U j , l=α j−1 U j−1 , l+ α j U j ,l +α j +1 U j+1 , l , (11)
where
x Δ xj
α j−1∧¿− ,
Δ x j−1 ( Δ x j −1 + Δ x j )
x Δ x j−1
α j +1∧¿ ,
Δ x j ( Δ x j −1 + Δ x j )
α j ∧¿−( α j−1+ α j+1 ) ,
x x x
where
x 2
β j−1∧¿ ,
Δ x j−1 ( Δ x j−1+ Δ x j )
2
β xj +1∧¿ ,
Δ x j ( Δ x j−1+ Δ x j )
β xj ∧¿−( β xj−1 + β xj+1 ) ,
the approximated first-order partial derivative at y l is given by
y y y
δ y U j ,l =α l−1 U j ,l−1 +α l U j ,l +α l+1 U j ,l+1 , (13)
6
where
y Δ yl
α l−1∧¿− ,
Δ y l−1 ( Δ y l−1+ Δ y l )
y Δ y l −1
α l+1∧¿ ,
Δ y l ( Δ y l−1+ Δ y l )
α l ∧¿−( α l−1 +α l+1 ) ,
y y y
where
y 2
β l−1∧¿ ,
Δ y l−1 ( Δ y l−1 + Δ y l )
y 2
β l+1∧¿ ,
Δ x j ( Δ y l−1+ Δ y l )
β l ∧¿−( βl −1 + β l+1 ) .
y y y
δ x δ y U j ,l=¿ δ x ( α l−1
y
U j , l−1 + α ly U j , l+ α ly+1 U j ,l +1 )
[ ] ( [ ] [ ] [ ])
x '
α j−1 U j−1 ,l −1 U j−1 ,l U j−1 ,l+1
x y y y
¿∧ α j
α l−1 U j ,l−1 + α l U j , l +α l+1 U j ,l +1
x
(15)
α j+1
U j+1 , l−1 U j+1 ,l U j +1 ,l +1
j+1 l+1
¿∧
'
∑ ∑ '
x
α j α l U j ,l .
'
y
' ' '
j = j−1 l =l −1
With the approximated partial derivatives above, for j=2 , … ,n x −1 and l=2 , … , n y −1 , re-write Equation
(10) at point ( x j , y l ) as
( ∂t + μ xj ,l δ x + σ xj ,l δ2x + μ yj , l δ y +σ yj ,l δ 2y + ρ j , l δ x δ y −r j ,l ) U=0.
Substitute (11), (12), (13), (14) and (15) into the above equation and re-arrange the resulting equation in
vector
([ ] [ ]) [ ]
xy '
lc j ,l 0 U j−1 , l−1
∂t U j ,l =−¿ mc xy
j ,l
+ c yj ,l U j ,l−1
uc
xy
j ,l
0 U j+ 1, l−1
([ ] [ ] [ ]) [ ]
xy x '
la j ,l 0 c j ,l U j−1 ,l
xy
−¿ ma j,l
+ a j ,l + a xj ,l
y
U j ,l (16)
xy x
ua j,l
0 b j ,l U j+1 , l
([ ] [ ]) [ ]
'
lb xyj ,l 0 U j−1 ,l+1
−¿ mb xy
j ,l
+ b yj , l U j , l+1 ,
ub xy
j ,l
0 U j+1 ,l +1
7
where, for clarity, we have separated the coefficients into those terms involving derivatives of x only, those
terms involving derivatives of y only, and those terms involving cross-derivatives. Specifically, the terms
involving derivatives of x only are
x x x x x
c j ,l =¿ α j−1 μ j ,l + β j−1 σ j ,l ,
a xj ,l =¿ α xj μ xj ,l + β xj σ xj ,l−r j , l ,
x x x x x
b j ,l=¿ α j+1 μ j ,l + β j+1 σ j ,l .
The terms involving derivatives of y only are
y y y y y
c j ,l=¿ α l−1 μ j ,l + β l−1 σ j , l ,
a yj ,l=¿ α ly μ yj ,l + β ly σ yj ,l ,
y y y y y
b j , l=¿ α l+1 μ j , l+ βl +1 σ j , l .
The terms involving cross-derivatives are
xy x y
lc j ,l∧¿ ρ j ,l α j−1 α l−1 ,
mcxyj , l∧¿ ρ j ,l α xj α l−1
y
,
xy x y
uc j , l∧¿ ρ j ,l α j+1 α l −1 ,
la xyj ,l∧¿ ρ j ,l α xj−1 α ly ,
xy x y
ma j , l∧¿ ρ j ,l α j α l ,
xy x y
ua j , l∧¿ ρ j ,l α j+1 α l ,
xy x y
lb j ,l∧¿ ρ j ,l α j−1 α l +1 ,
xy x y
mb j , l∧¿ ρ j ,l α j α l+ 1 ,
xy x y
ub j , l∧¿ ρ j ,l α j+1 α l +1 .
Next, consider the numerical solution at the corners and on the boundaries.
j ' =1 l ' =1
Upon solving,
−1
U 1 ,1 = x y
α1 α 1
[
α 1 ( α 2 U 1 ,2 +α 3 U 1 ,3 ) + α 2 ( α 1 U 2 ,1 +α 2 U 2 ,2 +α 3 U 2 , 3 ) +α 3 ( α 1 U 3 ,1 +α 2 U 3 , 2+ α 3 (17)
x y k y k x y y y x y y y k
]
U 3 , 3) .
j =nx −2 l =1
8
Upon solving,
−1
U n , 1=
x x y
αn α 1
x
[
α n −2 ( α 1 U n −2 , 1+ α 2 U n −2 ,2 + α 3 U n −2 ,3 )+ α n −1 ( α 1 U n −1 , 1+ α 2 U n −1 ,2 +α 3 U n(18)
y
x
y
x
y
x
x y y
x
y
−1 ,3 ) + α n ( α 2 U n ,2+ α
x
x
y
x x x x x
Upon solving,
−1
U1, n =y x y
α1 αn
x y
[
α 1 ( α n −2 U 1 ,n −2+ α n −1 U 1 ,n −1 ) +α 2 ( α n −2 U 2 ,n −2+ α n −1 U 2 ,n −1+ α n U 2 ,n ) +α(19)
y
y y
x y
y y
y y
y 3 ( α n −2 U 3 , n −2 +α n −1
x y y
y y y y y y y y
j =nx −2 l =n y −2
Upon solving,
−1
Un ,n =
x y x y
αn α n
x y
[
α n −2 ( α n −2 U n −2 ,n −2 +α n −1 U n −2 ,n −1+ α n U n −2 ,n )+ α n −1 ( α n −2 U n −1 , n −2 +α
x
y
y x y
y
y
x y
x y
y
(20)
k
y
y
n −1 U n −1 ,n −1 +α n U x y x y x y y x y y
x y
Again, for l=2 , … , n y −1 , on the upper boundary x=x , the Null-gamma condition is given by
9
2
δ x U n −1 ,l ∧¿ 0
x
x x
β n −1 β n −2
U n , l∧¿− x
x
U n −1 ,l− x
x
U n −2 ,l .
x
β nx
x
βn x
x
Explicit scheme
After discretization in time domain, the explicit scheme for x in Equation (16) is written as
[ ][ ]
x ,k+1 ' k+1
k+1c j ,l U j−1 ,l
k
U −U j,l x ,k +1 j,l
=− a j ,l U k+1
j ,l
,
Δ tk
b xj ,l,k +1 U kj+1
+1
,l
j ,l + Δ t k ( c j ,l j +1 ,l ) ,
+1
U kj ,l=U k+1 x, k+1
U kj−1 x ,k+1
, l + a j ,l U kj +1 x, k+1
,l + b j ,l U k+ 1
(23)
k +1 k +1
where U 1 ,l is calculated using Equation (21) and U n x , l is calculated using Equation (22).
Implicit scheme
Consider the lower boundary of x -grid. Set j=2 and apply Equation (21). The space-discretized 2D PDE (16)
becomes
([ ] [ ]) [ ]
xy , k ' x k x k
k+1 k lc 2 ,l 0 λ2 U 2, l−1+ λ3 U 3 , l−1
U −U
2 ,l 2 ,l
=−¿ mc2xy, l, k + c 2y ,l, k k
U 2 ,l −1
Δtk xy , k
uc 2, l 0 k
U 3 ,l −1
([ ] [ ] [ ]) [ ]
xy , k x ,k ' x k x k
la 2 ,l 0 c 2 ,l λ 2 U 2 ,l + λ3 U 3 ,l
−¿ ma2xy, l, k + a2y,,kl + ax2 ,,lk k
U 2 ,l
xy , k x,k k
ua 2, l 0 b2 ,l U 3 ,l
([ ] [ ]) [ ]
'
lb xy
2 ,l
,k
0 λ2x U k2 ,l +1+ λ3x U 3k , l+1
−¿ mb xy
2, l
,k
+ b 2y ,l,k U kj ,l+ 1 ,
ub xy ,k
2 ,l
0 U k
j+ 1, l+1
10
([ ] [ ]) [ ]
'
U k+1 k
2 ,l −U 2 ,l
xy , k x xy ,k
mc 2, l + λ2 lc 2 ,l y ,k
c 2 ,l U 2 ,l−1
k
=−¿ xy , k x xy ,k
+ k
Δtk uc 2 ,l + λ3 lc 2 , l 0 U 3 ,l−1
([ ][ ][ ]) [ ]
xy ,k x xy ,k x,k x x, k ' k
ma2 ,l + λ 2 la2 , l a y, k a + λ c U 2, l
−¿ xy ,k x xy , k
+ 2 , l + 2x ,l, k 2x 2x,,lk k (24)
ua2 , l + λ3 la2 , l 0 b 2 ,l + λ3 c 2 ,l U3,l
([ ] [ ]) [ ]
xy ,k x xy , k ' k
mb2 ,l + λ 2 lb2 , l b y ,k U j ,l+ 1
−¿ xy ,k x xy , k
+ 2, l k
,
ub2 , l + λ 3 lb2 , l 0 U j+1 , l+1
Consider the upper boundary of x -grid. Set j=n x −1 and apply Equation (22). The space-discretized 2D PDE
(16) becomes
([ ] [ ]) [ ]
xy , k ' k
k+1 k lc n −1 ,l 0 U n −2 ,l −1
U nx −1 ,l −U nx −1 ,l
x x
=¿ mc xy ,k
n −1, l
+ cny,−1
k
,l
k
U
nx −1 ,l −1
Δtk x x
xy , k
uc n −1 ,l 0 λ x
nx −1 U k
n x −1 , l−1
x
nx −2 +λ U kn −2 ,l−1
x x
([ ] [ ] [ ]) [ ]
xy , k x ,k ' k
lα n −1 ,l
x
0 c n −1 ,l x
U n −2 , l x
y ,k
+¿ mα nxy−1
,k
,l
+ a n −1 ,l + axn ,−1
x
k
,l x x
U kn −1 , l x
xy ,k
uα n −1 , l 0 x,k
b n −1 ,l
x k
λn −1 U n −1 ,l + λ n −2 U n −2 ,l
x k
x x x x x x
([ ] [ ]) [ ]
xy ,k ' k
lb n −1 ,l x
0 U n −2 ,l +1
x
+ ¿ mbxy ,k
n −1 ,l
+ b ny ,k−1 ,l x
k
U n −1 ,l +1 ,
x x
ub xy ,k
n −1 ,l
0 λnx −1 U kn −1 ,l +1+ λnx −2 U kn −2 ,l +1
x x x x x
([ ] [ ]) [ ]
'
U k+1 k
n −1 ,l −U n −1 ,l
xy , k
lc n −1 ,l + λ n −2 uc n −1 ,l
x xy , k
0
k
U n −2 , l−1
x x
=¿ x x x
+ y,k
x
Δ tk mc
xy ,k
n x −1 , l +λ
x
nx −1
xy , k
uc
n x −1, l
c n −1 , l x
U
k
n x −1 , l−1
([ ][ ][ ]) [ ]
'
xy , k x xy , k 0 x ,k x x ,k k
lα nx −1 ,l +λ nx −2 uα nx −1 ,l y ,k c nx −1 ,l +λ nx −2 b nx −1 ,l U n −2 ,l
+¿ xy ,k x xy ,k
+ a nx −1 ,l + x,k x x,k
x
(25)
mα +λ uα a +λ b U kn −1 ,l
n x −1 , l nx −1 nx −1 , l
0 nx −1 ,l nx −1 nx −1 ,l x
([ ] [ ]) [ ]
'
lb xy ,k x xy , k
n −1 ,l + λ n −2 ub n −1, l 0 U kn −2 , l+1
+¿ x
xy , k
x
x
x
xy ,k
+ y, k k
x
,
mb n x −1 , l +λ n x −1 ub nx −1 ,l
b n x −1 , l U n x −1 , l+1
Using Equations (24) and (25), the implicit scheme on x -grid is formed by rewriting Equation (33) as
[ ][ ]
U k2 , l U k+1
2, l
U k3 , l U k+1
( [ ])
~ax , k ~
b2x ,,kl ¿ ¿ c3x ,,kl a x3 ,,lk b3x ,,kl ¿ ~x , k 3 ,l
2 ,l
I n −2− Δ t k an −1 ,l ¿ ⋮ = ⋮ , (26)
x
⋱ ⋱ ⋱ ¿ c xn ,−2
k
axn ,−2
k
¿ ¿ x
k k+1
,l x ,l x
U n x −2 , l U nx −2 ,l
k k+1
U n x −1 , l U nx −1 ,l
11
~x , k
a 2 ,l , b 2 ,l , ~
where l=2 , … , n y −1 . Note the modified coefficients ~ c nx−1 , l and ~
x,k x ,k x,k
a nx −1 ,l . Similar to the case of 1D
PDE in Section 1.1, the above system of equations could be easily solved by standard tri-diagonal matrix solver.
Again, for j=2 , … ,n y −1, on the upper boundary y= y , the Null-gamma condition is given by
2
δ y U j , n −1∧¿ 0 y
y y
β n −1 β n −2
U j ,n ∧¿− y
y
U j , n −1− y
y
U j , n −2 .
y
β ny
y
βn y
y
U j ,n =λ ny −1 U j , n −1 + λ ny −2 U j , n −2 .
y y y y y
(28)
Explicit scheme
After discretization in time domain, the explicit scheme for y in Equation (16) is written as
[ ][ ] [ ][ ] [ ][ ]
+1
0
'
U k+1 0
'
U k+1 0
'
U kj−1,
U k+1
j,l −U k
j,l
j−1 ,l −1 j−1 ,l l+1
=− c yj ,,lk+1 U kj +1 − y ,k +1
a j ,l k+1
U j ,l − y, k+1
b j ,l k+1
U j ,l +1 ,
Δ tk ,l−1
0 U k+1
j+1 , l−1
0 +1
U kj+1 ,l
0 U k+1
j +1 ,l+ 1
j ,l + Δ t k ( c j ,l U j ,l+ 1) ,
y ,k+ 1 k +1
U kj ,l=U k+1 y , k+1
U k+1 y , k+1
j , l−1+ a j , l U k+1
j ,l +b j ,l
(29)
k +1 k +1
where U j ,1 is calculated using Equation (27) and U j ,n y is calculated using Equation (28).
Implicit scheme
Consider the lower boundary of y -grid. Set l=2 and apply Equation (27). The space-discretized 2D PDE (16)
becomes
12
([ ] [ ]) [ ]
xy ,k ' y k y k
k+1 k lc j ,2 0 λ 2 U j−1 ,2 + λ 3 U j−1 ,3
U j,2 −U j,2
=−¿ mcxyj , 2,k + c yj ,2,k y k
λ 2 U j ,2 + λ 2 U j ,3
y k
Δtk xy ,k
uc j , 2 0 y k
λ2 U j+1 ,2 + λ 2 U j+1 , 3
y k
([ ] [ ] [ ]) [ ]
xy ,k x, k ' k
la j ,2 0 c j ,2 U j−1 ,2
−¿ maxyj , 2, k + a j , 2 + a xj ,2,k
y,k
U j ,2
k
xy ,k x ,k k
ua j , 2 0 b j ,2 U j+1 , 2
([ ] [ ]) [ ]
'
lb xyj ,2, k 0 U kj−1 ,3
−¿ mb xyj ,2,k + b y,j ,2k U kj , 3 ,
ub xyj ,2, k 0 U kj+1 ,3
([ ][ ] [ ]) [ ]
xy , k y xy , k x, k ' k
k+1 k la j ,2 + λ2 lc j , 2 0 c j ,2 U j−1 ,2
U j,2−U j,2
=−¿ maxyj ,2, k + λ2y mc xyj ,2,k + a j ,2 + λ2 c j , 2 + a xj ,2,k
y,k y y ,k
U j ,2
k
Δtk xy , k
ua j ,2 + λ2 uc j ,2
y xy ,k
0 x ,k
b j ,2
k
U j+1 , 2
(30)
([ ][ ]) [ ]
xy , k y xy ,k ' k
lb j,2 + λ lc
3 j ,2 0 U j−1, 3
xy , k y xy , k y ,k y y,k k
−¿ mb j,2 + λ mc
3 j ,2
+ b j ,2 + λ3 c j ,2 U j ,3
.
xy , k y xy , k k
ub j,2 + λ uc
3 j ,2
0 U j +1 ,3
Consider the upper boundary of y -grid. Set l=n y −1 and apply Equation (28). The space-discretized 2D PDE
(16) becomes
([ ] [ ]) [ ]
xy , k ' k
k +1 k lc j , n −1 0 U j−1 , n −2
U j ,n y −1 −U j , ny −1
y y
uc xyj , n, k−1 0 U k
j +1 ,n y −2
y
([ ] [ ] [ ]) [ ]
xy ,k x ,k ' k
la j ,n −1y
0 c j ,n −1 y
U j−1 ,n −1 y
y,k
−¿ ma xy ,k
j , n −1
+ a j ,n −1 + a xj ,n,k −1
y y y
U kj , n −1 y
xy ,k
ua j ,n −1 0 x ,k
b j ,n −1 U
k
j +1 ,n y −1
y y
([ ] [ ]) [ ]
xy ,k ' y k y k
lb j ,n −1
y
0 λn −1 U j−1 ,n −1+ λn −2 U j−1 ,n −2
y y y y
−¿ mb xy ,k
j , n −1
+ b yj ,n, k −1 y
y
λn −1 U j ,n −1+ λn −2 U j ,n −2
k y k
,
y y y y y
13
([ ][ ]) [ ]
xy ,k y xy , k ' k
k+1 k lc j ,n −1+ λn −2 lb j , n −1 0 U j −1 , n −2
U j , ny −1 −U j , ny −1
y y y y
=−¿ mc xy ,k
j ,n y −1 +λ
y
n y −2 mb
xy ,k
j ,n y −1
+ c j , n −1 + λ ny −2 b yj ,n, k −1
y ,k
U
k
j ,n y −2
Δ tk y y y
uc xy ,k
j ,n y −1 +λ y
n y −2 ub xy , k
j ,n y −1
0 U kj +1 ,n −2 y
(31)
([ ][ ] [ ]) [ ]
xy ,k y xy , k x ,k ' k
la j , ny −1 +λ ny −1 lb j ,n y −1 0 c j ,n y −1 U j−1 ,n y −1
xy ,k y xy , k y,k y y,k x ,k k
−¿ ma j , ny −1 +λ ny −1 mb j , ny −1
+ a j , n y −1 + λ n −1 b j ,n −1 + a
y y j ,n y −1 U j , ny −1
.
ua
xy ,k
j , ny −1 +λ
y
ny −1 ub
xy ,k
j , n y −1
0 b
x ,k
j ,n y −1 U
k
j+1 ,n y −1
Using Equations (30) and (31), the implicit scheme on y -grid is given by
[ ][ ]
k k+1
U j,2 U j,2
k k+1
[ ])
U j,3 U j,3
(
~a y , k ~ y ,k
b j ,2 ¿ ¿ c j,3
y,k y,k
a j ,3
y,k
bj , 3 ¿ ~ y, k
j ,2
I n −2−Δ t k a j ,n −1¿ ⋮ = ⋮ , (32)
y
⋱ ⋱ ⋱ ¿ c yj ,,kn −2 a yj ,,kn −2 ¿ ¿ y
k k+1
y y
U j , ny −2 U j , ny −2
k k+1
U j , ny −1 U j , ny −1
y ,k ~ y ,k
a j,2, b j,2, ~
where j=2 , … ,n x −1. Note the modified coefficients ~ c j ,n y−1 and ~
y,k y ,k
a j , ny−1. Similar to the case of
1D PDE in Section 1.1, the above system of equations could be easily solved by standard tri-diagonal matrix
solver.
Explicit scheme
Since the solution values on the boundaries are known at the current time point t k+1, the explicit scheme
k +1 k +1 k +1 k+1
proceeds as in Equation (23), where U 1 ,l =gl and U n x , l =hl .
Implicit scheme
The implicit scheme is obtained by slightly modifying Equation (26) as
[ ][ ] [ ]
U k2 , l U k+1
2, l c x2 ,,lk gkl
U k3 , l U k+1
( [ ])
ax2 ,,lk b2x ,,kl ¿ ¿ c3x ,,kl a x3 ,,lk b3x ,,kl ¿ x , k 3 ,l 0
I n −2− Δ t k an −1 ,l ¿ ⋮ = ⋮ + Δ tk ⋮
(33) ,
x
⋱ ⋱ ⋱ ¿ c xn ,−2
k
axn ,−2
k
¿ ¿ x
k k+1
0
,l x ,l x
U n x −2 , l U nx −2 ,l
x ,k
U k
U k+1 b nx −1 ,l hkl
n x −1 , l nx −1 ,l
where l=2 , … , n y −1 . Similar to the case of 1D PDE in Section 1.1, the above system of equations could be
easily solved by standard tri-diagonal matrix solver.
14
2.4 Calculation of cross term
Assume the solution values on the boundaries are known at the current time point t k+1 . As shown later, in the
predictor-corrector scheme, the cross term in Equation (16) must be calculated, whose calculation is given by
[ ][ ] [ ][ ] [ ][ ]
xy ,k +1 ' k +1 xy , k+1 ' k+1 xy , k+1 ' k+1
lc j ,l U j−1, l−1 la j ,l U j−1 ,l lb j ,l U j−1 ,l +1
xy , k+1 k+1 xy , k+1 k+1 xy ,k +1
− mc j , l U j ,l −1 − ma j ,l U j , l − mb j ,l U k+ 1
j , l+1
, (34)
xy ,k+1 k+ 1 xy , k+1 k+1 xy ,k +1 k +1
uc j,l U j +1 ,l−1 ua j ,l U j+1 , l ub j ,l U j+1 ,l +1
k +1 k +1 k +1
where j=2 , … ,n x −1 and l=2 , … , n y −1 , U 1 ,l , U n , l , U kj +1
,1 and U j ,n are calculated using boundary
x y
k +1 k +1 k +1 k +1
conditions in Sections 2.2 and 2.3, and U 1 ,1 , U n , 1, U 1 , n and U n , n are calculated using Section 2.1.
x y x y
U =[ U 2 ,2 , … ,U n −1 ,2 ,U 2 ,3 ,… ,U n −1, 3 ,… , U 2 , n −1 , … ,U n −1 ,n −1 ] ,
'
x x y x y
U l =[ U 2 ,l , … ,U n −1 ,l ] ,
'
x
L=
[ A2 B2 ¿ ¿
C 3 A3 B 3 ¿
¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ ¿ ¿ Cl ¿ A l¿ Bl ¿ ¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ C n −1¿ A n −1 ¿ , y y
]
where Al , Bl and C l are tri-diagonal matrices, and F is a matrix of source terms (only applicable to Dirichlet
conditions).
It would help understand the “geometry” of the matrix if we write down explicitly the dependence of time-
derivative of U j ,l on the values of U j−1 ,l−1, U j ,l−1, U j+1 ,l −1 ,U j−1 ,l, U j ,l , U j+1 ,l ,U j−1 ,l+1 , U j ,l+ 1 and
U j+1 ,l +1, where j=3 , … , nx −2 and l=3 , … , n y −2.
Assume that Null-gamma conditions are applied on all boundaries. Consider the element U j ,l . Using Equation
(16), the matrix multiplication could be explicitly written as
[ ]
⋮
∂
U =−¿
∂ t j,l
⋮
Note that the elements
xy y xy xy
lc j ,l , c j ,l +mc j , l , uc j ,l
are in the ( l−1 ) -th block of matrix L, the elements
x xy x y xy x xy
c j ,l +la j ,l , a j ,l +a j ,l +ma j ,l , b j , l+ ua j , l
are in the l -th block of matrix L, and the elements
xy y xy xy
lb j , l , b j ,l +mb j ,l , ub j , l
are in the ( l+1 )-th block of matrix L.
15
Therefore, L could be written as
x y xy
L=L + L + L ,
where L x is given by
[ ]
x
A2 0 ¿ ¿
L x= x
x x
¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ ¿ ¿ 0 ¿ A l ¿ 0 ¿ ¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ 0 ¿ An −1 ¿ ,
0 A 0 ¿
y
3
x
with tri-diagonal matrix Al given by
[ ]
x x
a2 ,l b2 ,l ¿ ¿
Alx = x x x
x x x x x
¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ ¿ ¿ c j ,l ¿ a j , l ¿ b j ,l ¿ ¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ c n −1 ,l ¿ an −1 ,l ¿ ,
c a b ¿
x x
3, l 3 ,l 3 ,l
y
L is given by
[ ]
y y
A2 B2 ¿ ¿
L y= y y y
y y y y y
¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ ¿ ¿ C l ¿ A l ¿ Bl ¿ ¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ C n −1 ¿ An −1 ¿ ,
C A B ¿
y y
3 3 3
y y y
with diagonal matrices Al , Bl , C l
[ ]
y
y a 2, l ¿ ¿ y
Al = ¿¿ ⋱ ¿¿ an −1 , l ¿ ,
⋱ ¿ ¿ x
[ ]
y
y b2 ,l ¿ ¿ y
Bl = ¿¿ ⋱ ¿¿ b n −1 ,l ¿ ,
⋱ ¿ ¿ x
[ ]
y
y c2 , l ¿ ¿ y
Cl = ¿¿ ⋱ ¿¿ c n −1 ,l ¿ ,
⋱ ¿ ¿ x
and L xy is given by
[ ]
xy xy
A2 B2 ¿ ¿
L xy = xy xy xy
xy xy xy
¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ ¿ ¿ C l ¿ A l ¿ Bl ¿ ¿ ⋱ ¿ ⋱ ¿ ⋱ ¿ C n −1 ¿ A n −1¿
xy xy
C A B ¿
y y
3 3 3
xy xy xy
with tri-diagonal matrices Al , Bl and C l
Al ∧¿
xy
[ ⋱
la xy
j ,l
⋱
ma xy
j ,l
⋱
ua xy
j ,l
¿
¿
⋱¿ ⋱¿ ,
]
Bl ∧¿
xy
[ ⋱
lb
xy
j ,l
⋱
mb
xy
j ,l
⋱
ub
xy
j,l
¿
¿
⋱ ¿⋱¿ ,
]
C l ∧¿
xy
[ ⋱
lc
xy
j ,l
⋱
mc
xy
j,l
⋱
uc
xy
j ,l
¿
¿
⋱¿ ⋱¿ .
]
Finally, discretize the space-discretized PDE (16) in time domain with the θ -scheme as
k+1 k
U −U
=−( 1−θ ) ( L U + F )−θ ( L U + F ) ,
k+1 k+1 k+1 k k k
Δtk
where θ ∈ [ 0 , 1 ] . Re-arranging the terms products
16
where I is an identity matrix of order ( n x −2 ) ( n y −2 ). After the matrices Lk and Lk+ 1 are split, the above
equation could be written more generally as
As the last term is of order 2 in time discretization, it corresponds to the same error level as the PDE
discretization and could be ignored. Apply the same approximation on the right-hand side of Equation (35).
Therefore, Equation (35) could be approximated by
^ k =( I −θ Δ t k L y ,k )−1 ( I −θ Δ t k L x, k )−1 ( ~
U [k+1
U + Δ tk L
xy ,k+1
U ) +θ Δ t k F .
k +1 k
] (38)
^ k is an approximated value of U k .
Now, U
Corrector step
^ k . By incorporating (37), the value of U k is
Next, replace U k on the right-hand side of Equation (36) by U
calculated by
) ( I −θ Δ t k L x, k ) ((~
y ,k −1
F ).
−1
U =( I −θ Δ t k L ^ k ) +θ Δ t k(39)
k k +1 xy , k+1 k+1 xy , k k
U + ( 1−θ ) Δ t k L U +θ Δ t k L U
Step 2: Perform explicit scheme in x on the results of Step 1 according to (23)1 (by replacing Δ t k by
( 1−θ ) Δ t k) to obtain ~k +1
U in (37).
xy , k+1 k+ 1
Step 3: Perform the calculation of cross term on U k +1 at t k+1 according to (34) to obtain Δ t k L U .
~k +1 xy , k+1 k+1
Step 4: Calculate U −Δ t k L U .
1
In the discussion that follows, the actual form of F is not important because it is already taken care in
calculation discussed in Sections 2.2 and 2.2.
17
Step 5: Perform implicit scheme in x on the results of Step 4 according to (26) for Null-gamma condition or
(33) for Dirichlet condition (by replacing Δ t k by θ Δ t k ).
Step 6: Perform implicit scheme in y on the results of Step 5 according to (32) (by replacing Δ t k by θ Δ t k ) to
^ k in (38).
obtain the predictor U
Corrector step
xy ,k+ 1 k +1
Step 7: Multiply the results of Step 3 by ( 1−θ ) to obtain ( 1−θ ) Δ t k L U .
Step 11: Perform implicit scheme in y on the results of Step 10 according to (32) (by replacing Δ t k by θ Δ t k )
to obtain the solution U k in (39).
18