Exercise 11: Diffusion in 2D Adi, Thomas Algorithm, Openmp
Exercise 11: Diffusion in 2D Adi, Thomas Algorithm, Openmp
Diffusion in 2D
ADI, Thomas algorithm, OpenMP
• Examples:
In this exercise we consider heat flow in a 2D medium Examples:
• distribution of heat in given region
that can be described by the diffusion equation
• distribution of the
of heat in given region
• drop of ink in the glass of water
The movement of molecules from an area of high
form: • drop of ink in the glass of water
concentration to an area of low concentration
• teabag diffusion
• teabag diffusion until the concentration on both sides is equal.
@⇢ (r, t) 2
= Dr ⇢ (r, t)
@t
(n+1) (n)
" (n+1) (n+1) (n+1) (n+1) (n+1) (n+1)
#
• Implicit Euler: ⇢i,j ⇢i,j ⇢i 1,j 2⇢i,j + ⇢i+1,j ⇢i,j 1 2⇢i,j + ⇢i,j+1
=D +
t x2 y2
• Always stable.
• Drawback: must solve a system of linear equations with sparse matrix.
Tridiagonal systems
step 1:
(n+1/2) (n)
" (n+1/2) (n+1/2) (n+1/2) (n) (n) (n)
#
⇢i,j ⇢i,j ⇢i 1,j 2⇢i,j + ⇢i+1,j ⇢i,j 1 2⇢i,j + ⇢i,j+1
=D +
t/2 x2 y2
(n+1/2) (n+1)
step 2: ⇢ ⇢
(n+1) (n+1/2)
" (n+1/2) (n+1/2) (n+1/2) (n+1) (n+1) (n+1)
#
⇢i,j ⇢i,j ⇢i 1,j 2⇢i,j + ⇢i+1,j ⇢i,j 1 2⇢i,j + ⇢i,j+1
=D +
t/2 x2 y2
Tridiagonal systems
…solve tridiagonal systems with Thomas algorithm