Exercise 11 Diffusion in 2D ADI, Thomas algorithm, OpenMP HPCSE I, Fall 2018
Diffusion Di ff usion Process that describes the spreading of a quantity of • interest driven by its concentration gradient towards regions with lower density. In this exercise we consider heat flow in a 2D medium • that can be described by the diffusion equation of the egion The movement of molecules from an area of high form: concentration to an area of low concentration until the concentration on both sides is equal. ∂ρ ( r , t ) = D r 2 ρ ( r , t ) ∂ t ρ ( r , t ) r = ( x, y ) is a measure for the amount of heat at position • and time t is a constant diffusion coefficient • D y ρ ( x, y, t ) = 0 ∀ t ≥ 0 and ( x, y ) / ∈ Ω Boundary Condition: • ρ = 1 ρ = 0 ⇢ 1 | x, y | < 1 / 2 ρ ( x, y, 0) = Initial Condition: • 0 otherwise ρ = 0 x
Numerical Integration ρ ( n +1) − ρ ( n ) ρ ( n ) i − 1 ,j − 2 ρ ( n ) i,j + ρ ( n ) ρ ( n ) i,j − 1 − 2 ρ ( n ) i,j + ρ ( n ) " # • Explicit Euler: i +1 ,j i,j +1 i,j i,j = D + ∆ x 2 ∆ y 2 ∆ t Easy to implement • Requires few computations and often has acceptable accuracy. • Drawback: INSTABILITY. Local errors are small but numerical solution will diverge exponentially over time. • ∆ t ∼ O ( h 2 ) ∆ x ≈ ∆ y ≈ h Condition on step size for stability is very small for 2D: for we get ρ ( n +1) − ρ ( n ) ρ ( n +1) i − 1 ,j − 2 ρ ( n +1) + ρ ( n +1) ρ ( n +1) i,j − 1 − 2 ρ ( n +1) + ρ ( n +1) • Implicit Euler: " # i +1 ,j i,j +1 i,j i,j i,j i,j = D + ∆ x 2 ∆ y 2 ∆ t Always stable. • Drawback: must solve a system of linear equations with sparse matrix. • • Alternating Direction Implicit (ADI): Split one time iteration in two steps to separate “implicitness” in the x- and y- directions. • Stable method, 2 nd order of accuracy in time. • Easy to solve: Instead of solving one large set of equations with a sparse matrix, solve multiple • independent 1D systems with tridiagonal matrices.
Alternating Direction Implicit ρ ( n ) ρ ( n +1 / 2) Tridiagonal systems step 1: ρ ( n +1 / 2) − ρ ( n ) ρ ( n +1 / 2) − 2 ρ ( n +1 / 2) + ρ ( n +1 / 2) ρ ( n ) i,j − 1 − 2 ρ ( n ) i,j + ρ ( n ) " # i,j i,j i − 1 ,j i,j i +1 ,j i,j +1 = D + ∆ x 2 ∆ y 2 ∆ t/ 2 ρ ( n +1 / 2) ρ ( n +1) step 2: ρ ( n +1) − ρ ( n +1 / 2) ρ ( n +1 / 2) − 2 ρ ( n +1 / 2) + ρ ( n +1 / 2) ρ ( n +1) i,j − 1 − 2 ρ ( n +1) + ρ ( n +1) " # i,j i,j i − 1 ,j i,j i +1 ,j i,j i,j +1 = D + ∆ x 2 ∆ y 2 ∆ t/ 2 Tridiagonal systems …solve tridiagonal systems with Thomas algorithm
Recommend
More recommend