Docsity

Lecture Slides on The Alternating Direction Implicit Method | MATH 693B, Study notes of Mathematics

Partial preview of the text

Download Lecture Slides on The Alternating Direction Implicit Method | MATH 693B and more Study notes Mathematics in PDF only on Docsity!

Numerical Solutions to PDEs

Lecture Notes # — Systems of PDEs in Higher Dimensions — The Alternating Direction Implicit Method

Peter Blomgren, 〈[email protected]〉 Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center San Diego State University San Diego, CA 92182- http://terminus.sdsu.edu/

Spring 2010

Outline

1 Recap Previously... (^2) The Alternating Direction Implicit Method Introduction Crank-Nicolson / ADI on a 2D Square (^3) ADI Algorithms Peaceman-Rachford D’Yakonov Boundary Conditions for ADI Schemes 4 Implementing ADI Methods Peaceman-Rachford The Mitchell-Fairweather Scheme Mixed (uxy ) Derivative Terms

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms^ Introduction^ Crank-Nicolson / ADI on a 2D Square

The Alternating Direction Implicit Method

The Alternating Direction Implicit (ADI) method is particularly useful for solving parabolic equations on rectangular domains, but can be generalized to other situations. Given a parabolic equation, ut = ∇ ◦ (B∇u),

ut = [∂x ∂y ]

[

b 11 b 12 b 12 b 22

] [

∂x ∂y

]

u = b 11 uxx + 2b 12 uxy + b 22 uyy

for which b 11 , b 22 > 0 and b 122 < b 11 · b 22 (for parabolicity). Initially, we will consider the case b 12 = 0 (no mixed derivative), on a square domain...

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms^ Introduction^ Crank-Nicolson / ADI on a 2D Square

Crank-Nicolson on a Square

If we use the Crank-Nicolson schemes (for 2 spatial dimensions), we end up having to invert a penta-diagonal matrix in each iteration:

0 10 20 30

0 5 10 15 20 25 30 35 nz = 156^0 10 20

0 5 10 15 20 25 30 35 nz = 221^0 10 20

0 5 10 15 20 25 30 35 nz = 221 Figure: [Left] The matrix which must be inverted in each Crank-Nicolson iteration. If we trade storage of the LU-factorization [Center, Right] for speed, then here with 6 × 6 interior points, we end up needing more than 4 times the storage. For 100 × 100 interior points, the requirement jumps from 49,600 matrix entries, to just over 2,000,000 (a factor of 40). The band-width grows linearly in n, and the LU-factorization fills in the whole bandwidth. In 3D the story gets even worse — with n × n × n interior points, the bandwidth is n^2 ...

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms^ Introduction^ Crank-Nicolson / ADI on a 2D Square

The ADI Method on a Square 2 of 4

The ADI method will give us a way to solve the combined equation

ut = A 1 u + A 2 u,

using the available 1D-solvers as building blocks. Crank-Nicolson applied to the combined equation gives us

un+1^ − un k

[

A 1 un+1^ + A 1 un

]

[

A 2 un+1^ + A 2 un

]

+ O

k^2

Which, with some rearrangement can be written [ I −

k 2

A 1 −

k 2

A 2

]

un+1^ =

[

I +

k 2

A 1 +

k 2

A 2

]

un^ + O

k^3

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms^ Introduction^ Crank-Nicolson / ADI on a 2D Square

The ADI Method on a Square 3 of 4

Now, we notice that

(1 ± a 1 )(1 ± a 2 ) = 1 ± a 1 ± a 2 + a 1 a 2.

By adding and subtracting k^2 A 1 A 2 u∗^ on both sides of the Crank-Nicolson expression we get [ I − k 2

A 1 −

k 2

A 2 +

k^2 4

A 1 A 2

]

un+

[

I +

k 2

A 1 +

k 2

A 2 +

k^2 4

A 1 A 2

]

un

k^2 4

A 1 A 2

[

un+1^ − un

]

+ O

k^3

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms

Peaceman-Rachford D’YakonovBoundary Conditions for ADI Schemes

ADI Algorithms: Peaceman-Rachford 1 of 2

There are several approaches to solving the ADI scheme, one commonly used approach is the Peaceman-Rachford algorithm, which also explain the origin of the name alternating direction implicit method: [ I −

k 2 A 1 ,h

]

v n+1/^2 =

[

I +

k 2 A 2 ,h

]

v n [ I −

k 2 A 2 ,h

]

v n+1^ =

[

I +

k 2 A 1 ,h

]

v n+1/^2.

In the first half-step, the x-direction is implicit, and the y -direction explicit, and in the second half-step the roles are reversed. Is this scheme equivalent to the ADI scheme we derived?!? — It looks quite different!

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms

Peaceman-Rachford D’YakonovBoundary Conditions for ADI Schemes

ADI Algorithms: Peaceman-Rachford 2 of 2

We have, [ I − k 2

A 1 ,h

]

v n+1/^2 =

[

I +

k 2

A 2 ,h

]

v n [ I − k 2

A 2 ,h

]

v n+1^ =

[

I +

k 2

A 1 ,h

]

v n+1/^2.

Hence, [ I − k 2

A 1 ,h

] [

I −

k 2

A 2 ,h

]

v n+1^ =

[

I −

k 2

A 1 ,h

] [

I +

k 2

A 1 ,h

]

v n+1/^2

[

I +

k 2

A 1 ,h

] [

I −

k 2

A 1 ,h

]

v n+1/^2 =

[

I +

k 2

A 1 ,h

] [

I +

k 2

A 2 ,h

]

v n.

Note that we do not need A 1 ,hA 2 ,h = A 2 ,hA 1 ,h for this to hold.

The Alternating Direction Implicit Method Implementing ADI Methods^ ADI Algorithms

Peaceman-Rachford D’Yakonov Boundary Conditions for ADI Schemes

Boundary Conditions for ADI Schemes

Here, we consider Dirichlet boundary conditions u = β(t, x, y ) specified at the boundary, in the context of the Peaceman-Rachford scheme [ I − k 2 A 1 ,h

] v n+1/^2 =

[ I + k 2 A 2 ,h

] v n [ I − k 2 A 2 ,h

] v n+1^ =

[ I + k 2 A 1 ,h

] v n+1/^2

The correct boundary conditions for the half-step quantity is given by

v n+1/^2 = 1 2

[ I + k 2 A 2 ,h

] βn^ + 1 2

[ I − k 2 A 2 ,h

] βn+

Where did that come from?!? — Flip the second equation in the scheme, add the two, and solve for v n+1/^2 ... And it makes sense, “half” the condition comes from the past, and “half” from the future.

The Alternating Direction Implicit Method Implementing ADI MethodsADI Algorithms

Peaceman-Rachford The Mitchell-Fairweather SchemeMixed (u xy ) Derivative Terms

Implementing ADI Methods 1 of 6

We consider Peaceman-Rachford on a grid, where (xℓ, ym) = (ℓ∆x, m∆y ), ℓ = 0,... , L, m = 0,... , M. We let μx = k/∆x^2 , μy = k/∆y 2. Further, we let vℓ,m denote the full-step quantity, and wℓ,m denote the half-step quantity; if we are not interested in saving the results for all t = kn, we can overwrite these quantities... We get, the first half-stage

−

[ b 1 μx 2

] wℓ− 1 ,m +

[ 1 + b 1 μx

] wℓ,m −

[ b 1 μx 2

] wℓ+1,m

=

[ b 2 μy 2

] vℓ− 1 ,m +

[ 1 − b 2 μx

] vℓ,m +

[ b 2 μy 2

] − vℓ+1,m

for ℓ = 1,... , L − 1, and m = 1,... , M − 1.

The Alternating Direction Implicit Method Implementing ADI MethodsADI Algorithms

Peaceman-Rachford The Mitchell-Fairweather SchemeMixed (u xy ) Derivative Terms

Implementing ADI Methods 3 of 6

If we enumerate our grid-points in the following way

then we get (M − 1) tridiagonal systems (one for each “row”), with (L − 1) unknowns.

The Alternating Direction Implicit Method Implementing ADI MethodsADI Algorithms

Peaceman-Rachford The Mitchell-Fairweather SchemeMixed (u xy ) Derivative Terms

Implementing ADI Methods 4 of 6

We also need the missing boundary conditions for w

w 0 ,m =

[ b 2 μy 4

] β 0 n,m− 1 +

[ 1 − b 2 μy 2

] β 0 n,m +

[ b 2 μy 4

] β 0 n,m+

−

[ b 2 μy 4

] βn 0 +1,m− 1 +

[ 1 + b 2 μy 2

] βn 0 +1,m −

[ b 2 μy 4

] βn 0 ,+1m+1.

wL,m =

[ b 2 μy 4

] βnL,m− 1 +

[ 1 − b 2 μy 2

] βnL,m +

[ b 2 μy 4

] βLn,m+

−

[ b 2 μy 4

] β Ln,+1m− 1 +

[ 1 + b 2 μy 2

] βn L+1,m −

[ b 2 μy 4

] β Ln,+1m+1.

For m = 1,... , M − 1 (m = 0, and m = M are not needed).

The Alternating Direction Implicit Method Implementing ADI MethodsADI Algorithms

Peaceman-Rachford The Mitchell-Fairweather SchemeMixed (u xy ) Derivative Terms

Implementing ADI Methods 6 of 6

Figure: “Active” points in the second half-step [left], and the appropriate enumer- ation order of the grid-points [right].

The Alternating Direction Implicit Method Implementing ADI MethodsADI Algorithms

Peaceman-Rachford The Mitchell-Fairweather Scheme Mixed (u xy ) Derivative Terms

The Mitchell-Fairweather Scheme

In Strikwerda (pp. 180–181), there is a discussion of the Mitchell-Fairweather scheme, which is an ADI scheme which is second order in time, and fourth order accurate in space: [ 1 − 1 2

( b 1 μx − 1 6

) h^2 δ^2 x

] v n+1/^2 =

[ 1 +^1 2

( b 2 μy +^1 6

) h^2 δ y^2

] v n, [ 1 − 1 2

( b 2 μy − 1 6

) h^2 δ^2 y

] v n+1^ =

[ 1 + 1 2

( b 1 μx + 1 6

) h^2 δ x^2

] v n+1/^2

with Dirichlet boundary conditions for v n+1/^2

v n+1/^2 = 1 2 b 1 μx

{ ( b 1 μx + 1 6

) [ 1 + 1 2

( b 2 μy + 1 6

) h^2 δ y^2

] βn

( b 1 μx − 1 6

) [ 1 − 1 2

( b 2 μy − 1 6

) h^2 δ y^2

] βn+

}