Numerical Analysis of Differential Equations 188 5 Numerical Solution of Elliptic Boundary Value Problems 5 Numerical Solution of Elliptic Boundary Value Problems TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 189 5.1 Laplace s Equation on a Square 5.1.1 The Dirichlet Problem We consider the following boundary value problem (BVP) for Laplace s equation: u = u xx + u yy = 0 on Ω := (0, 1) 2, (5.1a) u = g along Γ := Ω. (5.1b) with a given boundary function g = g(x, y) defined on Γ. Just as in our discretization of ordinary differential equations, we shall apply finite difference methods to seek approximations to the solution u = u(x, y) of (5.1) not at all points of Ω, but rather at a finite number of grid points.
Numerical Analysis of Differential Equations 190 Consider each coordinate separately: introducing the partitions 0 = x 0 < x 1 < x 2 < < x nx < x nx +1 = 1, 0 = y 0 < y 1 < y 2 < < y ny < y ny +1 = 1 of [0, 1], we define the grid (tensor product grid) or mesh Ω h := { (x i, y j ) : 0 i n x + 1, 0 j n y + 1 } consisting of (n x + 2)(n y + 2) points. A grid which is equidistant (in both directions) is one in which the grid spacing in each direction is constant: x i = i x, i = 0, 1,..., n x + 1, x = 1/(n x + 1), y j = j y, j = 0, 1,..., n y + 1, y = 1/(n y + 1). For equal spacing in both directions (uniform grid) we set we set h := x = y.
Numerical Analysis of Differential Equations 191 1 1 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0.2 0 0 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 tensor product grid equidistant grid
Numerical Analysis of Differential Equations 192 1 0.8 0.6 0.4 In the following we consider the uniform case x = y = h. 0.2 0 0 0.2 0.4 0.6 0.8 1 uniformes Gitter
Numerical Analysis of Differential Equations 193 Notation: u i,j := u(x i, y j ) function value of exact solution at point (x i, y j ) U i,j u i,j approximation of u(x i, y j ). Taylor-expansion at (x i, y j ): ( ) u i+1,j = u i,j + hu x + h2 2 u xx + h3 6 u xxx + h4 24 u xxxx ) u i 1,j = u i,j + ( hu x + h2 2 u xx h3 6 u xxx + h4 24 u xxxx i,j i,j + O(h 5 ), + O(h 5 ), Summing yields (the terms with h 5 also cancel) ) u i+1,j + u i 1,j = 2u i,j + (h 2 u xx + h4 12 u xxxx i,j + O(h 6 ).
Numerical Analysis of Differential Equations 194 Analogously, in the y-direction, u i,j+1 + u i,j 1 = 2u i,j + ) (h 2 u yy + h4 12 u yyyy i,j and, summing all 4 expansions and dividing by h 2, u i+1,j + u i 1,j + u i,j+1 + u i,j 1 4u i,j } h {{ 2 } =:( h u) i,j = + O(h 6 ) ) ( u + h2 12 (u xxxx + u yyyy ) i,j +O(h 4 ). The difference formula h is called the 5-point-stencil or 5-point discrete Laplacian. Summary: In each grid point (x i, y j ), h approximates the Laplace operator with a local discretisation error of order O(h 2 ) as h 0, i.e., ( h u) i,j = ( u) i.j + O(h 2 ). Note: This requires sufficient smoothness of the solution, in this case u C 4 (Ω).
Numerical Analysis of Differential Equations 195 In analogy with the differential equation (5.1a) we now require that the approximate solution U i,j satisfy the discrete Laplace equation h U i,j := ( h U) i,j = 0, 1 i n x, 1 j n y. (5.2a) (5.2a) represents n x n y equations in (n x + 2)(n y + 2) unknowns, since the 5-point stencil is not applicable in the boundary points. But there, the boundary conditions supply the missing equations: Written out in detail, (5.2b) reads U i,j = g(x i, y j ) if (x i, y j ) Ω. (5.2b) U 0,j = g(0, y j ), U nx +1,j = g(1, y j ), 0 j n y + 1, U i,0 = g(x i, 0), U i,ny +1 = g(x i, 1), 0 i n x + 1.
Numerical Analysis of Differential Equations 196 Taken together, equations (5.2) represent a linear system of equations Au = f (5.3) to determine the (unknown) approximate values U i,j at the interior grid points. The entries of the coefficient matrix A and right hand side f depend on our enumeration of the unknowns. A common one is the lexicographic order: u = [U 1,1, U 2,1,..., U nx,1, U 1,2,..., U nx,2,..., U 1,ny,..., U nx,ny ] or u = u 1 u 2. u ny, where u j = U 1,j U 2,j. U nx,j, j = 1, 2,..., n y.
Numerical Analysis of Differential Equations 197 Die Matrix A possesses the block structure T I A = 1 I T I. h 2 I........ I I T R n xn y n x n y, in which I denotes the n x n x identity matrix and T is the tridiagonl matrix 4 1 1 4 1 T =. 1..... R n x n x.... 1 1 4
Numerical Analysis of Differential Equations 198 For unknowns U i,j near the boundary, i.e., i = 1, n x or j = 1, n y, the 5-point stencil (5.2a) contains neighboring approximation values already specified by the Dirichlet boundary condition (5.2b). Moving these to the right hand side of each corresponding equation, we obtain for the (nonzero) entries of the vector f in (5.3) for the example shown respectively. f 3,3 = 1 h 2 ( g(x3, y 4 ) + g(x 4, y 3 ) ) or f 2,1 = 1 h 2 g(x 2, y 0 ),
Numerical Analysis of Differential Equations 199 Due to the simple geometry of Ω, the simple structure of the Laplacian and the same type of boundary conditions on all boundaries, the block tridiagonal matrix A possesses additional structure: it can be built up from discretisation matrices arising in the simpler one-dimensional BVP. We therefore consider the discretization of the (ordinary) one-dimensional BVP u (x) = 0, u(0) = g 0, u(1) = g 1 using central differences with uniform mesh width h = 1/(n + 1).
Numerical Analysis of Differential Equations 200 Its discrete approximation leads to the linear system of equations A 1 u = f, A R n n, f R n, where A 1 = 1 h 2 tridiag(1, 2, 1) := 1 h 2 2 1. 1........ 1 1 2, f = 1 h 2 g 0 0. 0 g 1 and vector of unknowns u = [U 1, U 2,..., U n ], U i u(x i ), i = 1, 2,..., n.
Numerical Analysis of Differential Equations 201 The discretization of the two-dimensional Laplace operator can now be expressed as A = T 1 I + I T 1 (5.4) with T 1 = 1 h 2 tridiag( 1, 2, 1). In equation (5.4), the Kronecker product (or tensor product) M N of two matrices M R p q and N R r s is defined by M N = and I is the identity matrix in R n. m 1,1 N... m 1,q N.. Rpr qs m p,1 N... m p,q N
Numerical Analysis of Differential Equations 202 5.1.2 The Neumann Problem We now consider a BVP for the Laplace operator in which the Dirichlet BC are replaced by the Neumann BC u n = h(x), x Γ (5.5) Since in our model problem the four segments of the boundary Γ of the domain Ω lie parallel to the coordinate axes, the discretization of (5.5) is easy. In the boundary points (x 0, y j ), for example, one may use either U 0,j U 1,j h = h(x 0, y j ), (backward difference), (5.6a) U 1,j U 1,j 2h = h(x 0, y j ) (central difference) (5.6b) with analogous formulas at the remaining boundaries.
Numerical Analysis of Differential Equations 203 Note: The central difference formula (5.6b) introduced so-called ghost points U 1,j, which, strictly speaking, lie outside the domain Ω. These can, however, immediately be eliminated from the equations by solving (5.6b) for U 1,j and inserting this expression into the 5-point stencil centered at (x 0, y j ). In contrast to the discretized Dirichlet problem with the same mesh width h, for the Neumann problem the unknowns U i,j on the domain boundary Γ are not fixed by the boundary conditions alone, but must also be determined, along with the interior unknowns, by solving the coupled linear systyem of equations. In this case the system has (n x + 2) (n y + 2) unknowns.
Numerical Analysis of Differential Equations 204 The discretization matrix (same ordering) is now obtained as the Kronecker product A = T 1 I + I T 1 with T 1 = 1 h 2 1 1 1 2.......... 2 1 1 1
Numerical Analysis of Differential Equations 205 5.1.3 Eigenvalues and Eigenvectors One of the reasons why (5.1) is often chosen as a model problem is that the spectral decomposition of the discretization matrix is available in closed form. Beginning with the n n matrix T 1 = 1 h 2 tridiag(1, 2, 1), we have with eigenvalues T 1 v j = λ j v j, j = 1, 2,..., n, λ j = 2 h 2 [cos(jπh) 1] = 4 jπh sin2, j = 1, 2,..., n, (5.7) h2 2 and (orthonormal) eigenvectors [v j ] k = 2 n + 1 sin(jkπh), k = 1, 2,..., n; j = 1, 2,..., n.
Numerical Analysis of Differential Equations 206 Using properties of the Kronecker product of matrices, the eigenvalues and eigenvectors of the 2D problem can also be inferred from those of the 1D problem. More precisely: the eigenvalues λ i,j of A in (5.4) are given by with associated eigenvectors λ i,j = λ i + λ j, 1 i, j n, (5.8) v i,j = v i v j, 1 i, j n.
Numerical Analysis of Differential Equations 207 5.1.4 Stability and Convergence As we have already shown in the derivation of the 5-point approximation h of the Laplace operator, there holds Setting h u i,j = u i,j + h2 12 (u xxxx + u yyyy ) i,j + O(h 4 ). [d h ] i,j := h u i,j u i,j (local discretization error) [e h ] i,j := u i,j U i,j (global discretization error) we conclude that, due to u = 0 for the exact solution u of the BVP, e h solves the linear system of equations with A h = A the matrix in (5.4). A h e h = d h = O(h 2 )
Numerical Analysis of Differential Equations 208 We therefore have e h = A 1 h d h and, because of e h = A 1 h d h A 1 h d h the O(h 2 ) behavior as h 0 is transferred from the local to the global discretization error if A 1 h remains uniformly bounded for all sufficiently small values of h > 0. Fixing the norm to be the Euclidean norm = 2, we have A 1 h = 1 λ min (A h ). The uniform boundedness property can now be inferred from (5.7) and (5.8), since λ min (A h ) = 4 πh 2 sin2 h2 2 = 2π2 + O(h 2 ), (h 0).
Numerical Analysis of Differential Equations 209 Summary: The (global) discretization error of the approximate solution of the model problem (5.1) obtained by finite difference approximation using central differences with uniform mesh size h satisfies e h = O(h 2 ) as h 0, assuming the solution u is four times continuously differentiable. The uniform boundedness of A 1 h as h 0 is a stability property of the difference scheme.
Numerical Analysis of Differential Equations 210 5.1.5 The Poisson Equation Replacing the Laplace equation (5.1a) in the BVP (5.1) by the inhomogeneous equation u = f (Poisson equation), (5.9) with a given function f = f(x, y) defined on Ω, applying the central finite difference discretization leads to the discrete problem in which (5.2a) is modified to h U i,j = f i,j, with f i,j = f(x i, y j ), 1 i n x, 1 j n y. For the Dirichlet problem, the right hand side f of the resulting linear system of equations (5.3) consists of the sum of the Dirichlet boundary values and the corresponding function values f i,j.
Numerical Analysis of Differential Equations 211 5.1.6 The 9-Point Stencil Since the formulas for difference schemes such as h u can become cumbersome, particularly in 2 or more space dimensions, the following notation, in which the weights defining the scheme are given in a table corresponding to their spatial arrangement, is sometimes practical: h 1 0 1 0 h 2 1 4 1. 0 1 0 Using this notation, the approximation (9) h 1 1 4 1 6h 2 4 20 4 1 4 1 of the Laplace operator is known as the 9-point stencil.
Numerical Analysis of Differential Equations 212 Using the same analysis based on Taylor series expansion reveals that (9) h h2 u = u + 12 (u xxxx + 2u xxyy + u yyyy ) + O(h 4 ). As an approximation of, the 9-point stencil (9) h order of consistency as the 5-pont stencil h. therefore has the same However, it can still be used to construct a higher order approximation as follows: The leading error term is observed to contain the biharmonic operator applied to u: u xxxx + 2u xxyy + u yyyy = (u xx + u yy ) = ( u) = 2 u.
Numerical Analysis of Differential Equations 213 Since the exact solution u of the Poisson equation satisfies u = f, we can conclude that the local discretization error of the approximate equation (9) h U i,j = f i,j, 1 i n x, 1 j n y, with the modified right-hand side has order O(h 4 ) as h 0. f i,j := f(x i, y j ) + h2 f(x, y) 12
Numerical Analysis of Differential Equations 214 Example: We consider (cf. Section 11.4) the Poisson equation u = 1 on Ω = ( 1, 1) 2 with homogeneous Dirichlet BCs. We discretize the problem using both h and (9) h and compare the absolute value of the error in the point (0, 0) for different values of the mesh size h. n n h (9) h 7 7 3.6e 03 1.8e 05 15 15 9.0e 04 1.1e 06 31 31 2.3e 04 7.0e 08 63 63 5.7e 05 4.3e 09 127 127 1.4e 05 2.7e 10 255 255 3.5e 06 1.7e 11 Error in (0,0) 10 511 511 8.9e 07 1.4e 12 12 10 0 10 1 10 2 10 3 10 2 10 4 10 6 10 8 10 10 Number of grid points in each direction 5 point stencil 9 point stencil Note: The last problem requires solving a linear system of dimension 261,121 and takes 5s on a 3 year old laptop.