A Parallel Strategy Department of Mathematics and Statistics McMaster University March 31, 2010
Outline Introduction 1 Introduction Motivation Discretization Iterative Methods 2 Additive Schwarz Method 3 The Algorithm Different Domain Decompositions
Current work Introduction Motivation Discretization Iterative Methods Current research work involves solving Burgers equation: u t + uu x = νu xx, x [0, 1] (1a) u(x, 0) = φ(x), Periodic B. C. (1b) Future research will involve solution to Navier-Stokes equations: ρ(u t + u u) = P + µ u x [0, 1] 3 (2a) u = 0 (2b) u(x, 0) = φ(x), Periodic B. C. (2c)
Proposed work Introduction Motivation Discretization Iterative Methods However, solving NS equation in 3D would be a 1 year project, so I ll focus on a simpler equation: The : u = f x Ω = [0, 1] 2 (3a) u = g(x), x Ω (3b)
Space discretization Motivation Discretization Iterative Methods Assume the two space coordinates (x, y) are discretized according to: x i = ih x i = 0... 1/h x = N x (4) y j = jh y j = 0... 1/h y = N y (5) and the function u(x, y) is defined at the grid points. Let u(x i, y j, t) = u i,j (t) (6)
Space discretization Motivation Discretization Iterative Methods To discretize the spatial differential operator, we use central finite differences. Hence: u xx = ( u i 1,j 2u i,j + u i+1,j ) /h 2 x (7) u yy = ( u i,j 1 2u i,j + u i,j+1 ) /h 2 y (8) u i,j = ( 2 h 2 x + 2 h 2 y ) u i,j + 1 u hx 2 i 1,j + 1 u hx 2 i+1,j + 1 u hy 2 i,j 1 + 1 u hy 2 i,j+1 (9)
Jacobi s Method Introduction Motivation Discretization Iterative Methods To solve the linear system of equations given by: u i,j = f i,j (10) we may use an iterative method such as Jacobi s or Gauss-Seidel. Jacobi s method is based on the following idea: Assume you want to solve the linear system Ax = b. Split the matrix A in three parts as A = L + D + U, where: [L] i,j = { [A]i,j if j < i 0 otherwise (11)
Jacobi s Method Introduction Motivation Discretization Iterative Methods { [A]i,j if i < j [U] i,j = 0 otherwise { [A]i,j if j = i [D] i,j = 0 otherwise Then the equation can be written as (L + D + U)x = b Dx = b (L + U)x. The iteration is constructed then by: (12) (13) x k+1 = D 1 [ b (L + U)x k] (14)
Jacobi s Method Introduction Motivation Discretization Iterative Methods Since D is a diagonal matrix, it s easy to obtain the inverse: [D 1 ] i,i = 1 [D] i,i (15) In the context of Poisson equation, assuming h x = h y = h the iteration is given by: u k+1 i.j = 0.25[ h 2 fi,j + u k i 1,j + u k i+1,j + u k i,j 1 + uk i,j+1 ] (16) where f includes the right hand side f and the boundary terms.
Gauss-Seidel Method Motivation Discretization Iterative Methods We can improve the convergence rate of Jacobi s method by a simple change in the algorithm. Notice that by the time we are calculating u k+1 i,j for given (i, j), we have already calculated u k+1 i 1,j and u k+1 i,j 1, so it makes sense to use them. Gauss-Seidel methods is implemented by: u k+1 i.j = 0.25[ h 2 fi,j + u k+1 i 1,j + u k i+1,j + u k+1 i,j 1 + uk i,j+1 ] (17) In both Jacobi s and Gauss-Seidel we need to provide an initial guess of the solution.
Additive Schwarz Method Additive Schwarz Method When the geometry of the domain is not simple (i.e. a square or circle) or when the required accuracy implies the use of hundreds of thousands of points, it is necessary to split the domain in subdomains. Let Ω be the domain on which the PDE is defined and Ω 1 and Ω 2 the subdomains such that Ω = Ω 1 Ω 2.
Additive Schwarz Method Additive Schwarz Method Let γ = Ω and γ 1, γ 2 be pieces of Ω 1 and Ω 2 respectively, such that γ = γ 1 γ 2. Let γ 1 = Ω 1 γ 1 and γ 2 = Ω 2 γ 2.
Additive Schwarz Method Additive Schwarz Method If we want to solve: u = f in Ω (18a) u = g in γ (18b) using ASM we would need to solve the following set of problems: u 1 = f in Ω 1 (19a) u 1 = g 1 in γ 1 γ 1 (19b) u 2 = f in Ω 2 (20a) u 2 = g 2 in γ 2 γ 2 (20b)
The Algorithm Introduction The Algorithm Different Domain Decompositions To solve the complete problem the following algorithm will be used. Define the domain, the number of subdomains to be used and a tolerance: Define initial guess u 0 and calculate the residual r 0 = u 0 f. Define the boundary values for every subdomain Ω i. Set k=0.
The Algorithm Introduction The Algorithm Different Domain Decompositions while ( r k > tol) Solve u i = f for every Ω i using Gauss-Seidel method. Collect solution u k+1 and calculate residual r k+1 = Au k+1 f Update the boundary values of neighbooring domains for every Ω i. Set k = k + 1 Save to file Notice that the solution of the problem restricted to each subdomain can be implemented by different processors. This is where the parallel nature of the solution comes into play.
Horizontal Decomposition The Algorithm Different Domain Decompositions For the domain [0, 1] 2, two natural decompositions could be implemented: Horizontal decomposition
Vertical Decomposition The Algorithm Different Domain Decompositions For the domain [0, 1] 2, two natural decompositions could be implemented: Vertical decomposition
The Algorithm Different Domain Decompositions Hopefully, everything will work. Thanks!
References Introduction The Algorithm Different Domain Decompositions Barbara I. Wohlmuth Discretization Methods and Iterative Solvers based on Domain Decomposition. Springer, 2001. C.F. Gerald and P. O. Wheatley. Applied Numerical Analysis. 7th Edition. Chapter 8. Addison Wesley, 2004. K. W. Morton and D. F. Mayers. Numerical Solution of Partial Differential Equations. 2nd Edition. Chapters 2 and 3. Cambridge University Press, 2005