Finite Difference Schemes for Elliptic Partial Differential Equations requiring a Non-Uniform Mesh by Sarah Huber B.Sc., The University of British Columbia, 2013 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in The Faculty of Graduate and Postdoctoral Studies (Computer Science) THE UNIVERSITY OF BRITISH COLUMBIA (Vancouver) November 2015 c Sarah Huber 2015 Abstract A variety of finite difference schemes are explored for the numerical solution of elliptic partial differential equations, specifically the Poisson and convection-diffusion equations. Problems are investigated that require the use of a non-uniform or non-square mesh. This may be due to a non-square domain or a problem with a singularity. We explore the properties of the linear operators in the resulting systems of linear equations. In particular, we investigate the conditioning and eigenvalues of these operators, both numerically and in search of an approximation of these eigenvalues. We also investigate the choice of finite difference scheme with respect to accuracy and cost. ii Preface This thesis is the result of work done by Chen Greif and myself. I was responsible for the numerical results, analysis and writeup, with input from my coauthor. iii Table of Contents Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv List of Tables vi Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Mathematical Tools . . . . . . . . . . . . . . . . . . . . . . . 1 2 2 Centered Differences for a Singularly Perturbed BVP 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Matrix Structure . . . . . . . . . . . . . . . . . . . . . . 2.3 Discrete Solution for Uniform Mesh . . . . . . . . . . . 2.4 Discrete Solution for Non-Uniform Mesh . . . . . . . . . . . . . 3 3 5 7 8 3 On the Eigenvalues of a Finite Difference Operator on Non-Uniform Mesh . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Matrix Transformation . . . . . . . . . . . . . . . . . . . . 3.2 Finding the Secular Equation . . . . . . . . . . . . . . . . . 3.2.1 Approximating the Roots of the Secular Equation . a . . . . 12 12 14 15 4 Finite Differences on a Non-Square Domain 4.1 Convection-Diffusion on Non-Square Domain 4.2 Motivating Problems . . . . . . . . . . . . . 4.3 Computational Schemes . . . . . . . . . . . . 4.4 Domain with a Curved Boundary . . . . . . 4.5 Reentrant Corner . . . . . . . . . . . . . . . . . . . . . 19 19 20 21 23 27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv Table of Contents 4.6 5 Cell 5.1 5.2 5.3 5.4 Alternative Discretizations . . . . . . . . . . . . . . . . . . . . . . . . . . 39 39 40 41 42 45 46 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.5 Centered Finite Differences . . . . . . . . . . . . . . A Symmetric Scheme . . . . . . . . . . . . . . . . . . . . Data Structure . . . . . . . . . . . . . . . . . . . . . . . . Domain Definition and Refinement Strategies . . . . . . . The Discretization Scheme . . . . . . . . . . . . . . . . . 5.4.1 Boundary Conditions and Operator Modifications Numerical Results . . . . . . . . . . . . . . . . . . . . . . 6 Conclusions . . . . . . . 31 v List of Tables 4.1 4.2 5.1 5.2 5.3 Convergence of FD scheme for (4.1) on (4.6) σ = 2, τ = 0, r = 0.25, s = 1. E2 = ||U − uexact ||2 and E∞ = ||U − uexact ||∞ . 27 Convergence of FD scheme for (5.2) on (4.12). E2 = ||U − uexact ||2 and E∞ = ||U − uexact ||∞ . . . . . . . . . . . . . . . . 32 Convergence of FD scheme for (5.2) with (5.14) on circle shaped domain (5.9). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. . . . . . . . . . . Convergence of FD scheme for (5.2) with (5.14) on L-shaped domain (5.10). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. . . . . . . . . . . . . . . Convergence of FD scheme for (5.2) with (5.14) on L-shaped domain (5.10). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. . . . . . . . . . . . . . . 48 48 51 vi List of Figures 2.1 2.2 2.3 2.4 2.5 3.1 3.2 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 Exact solution to (2.1) . . . . . . . . . . . . . . . . . . . . . . Uniform mesh with N + 1 points. . . . . . . . . . . . . . . . . Non-uniform mesh with N +1 mesh points, two distinct spacings h1 , h2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discrete solution for uniform and non-uniform mesh of (2.1) with = .01, N = 22, σ = 1. . . . . . . . . . . . . . . . . . . . Size of coefficients a, e in discrete solution for = .03, N = 10, 5 β1 = 35 , β2 = 12 . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5 6 10 11 Eigenvalues of finite difference operator for (2.1) with uniform and non-uniform mesh. A1 and A3 are the submatrices of A defined in (3.3). . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Graph of f (λ) and h(λ) for N = 20, = 0.1, σ = 1 and k = 4. 18 FD solution values on a uniform mesh. . . . . . . . . . . . . . Lexicographic labelling of a uniform mesh. . . . . . . . . . . . Lexicographic indices for a locally refined grid. Spaces corresponding to a missing index are in yellow, and grid points affected by the missing indices are in green. . . . . . . . . . . Row and column indices for a locally refined grid. Spaces corresponding to a missing index are in yellow, and grid points affected by the missing indices are in green. . . . . . . . . . . Grid points on (4.6) with h = 0.0625, N = 176. Grid points lying on a uniform mesh are shown in blue, and additional grid points on the boundary of the domain shown as red circles. Modified FD scheme for a curved boundary with Dirichlet boundary conditions. . . . . . . . . . . . . . . . . . . . . . . . FD solution of (4.1) on the domain (4.6) with σ = 2, τ = 0, r = 0.25, s = 1. . . . . . . . . . . . . . . . . . . . . . . . . . . Error in FD solution of (4.1) on the domain (4.6) with σ = 2, τ = 0, r = 0.25, s = 1. . . . . . . . . . . . . . . . . . . . . . . FD solution of (5.2) on L-shaped domain. . . . . . . . . . . . 21 22 23 24 25 26 28 29 30 vii List of Figures 4.10 Error in FD solution for (5.2) on L-shaped domain with a uniform grid, h = 0.0156, N = 2945. . . . . . . . . . . . . . . 4.11 FD solution of Poisson problem on L-shaped mesh with Dirichlet boundary conditions. . . . . . . . . . . . . . . . . . . . . . 4.12 Locally refined grid for (4.12), hmax = 0.0625, k = 64. . . . . 4.13 Locally refined grid for (4.12), hmax = 0.03125, k = 256. . . . 4.14 FD solution values on non-uniform mesh, non-uniform mesh size. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.15 FD solution values on non-uniform mesh, grid point missing northern neighbour. . . . . . . . . . . . . . . . . . . . . . . . 4.16 FD operator for (5.2) on L-shaped domain with locally refined grid, N = 205. Grid points are labelled lexicographically. . . 5.1 5.2 Coordinates of grid points in cell centred grid. . . . . . . . . . Entries in the Depth Map array before and after the cell in left hand corner is refined. Cells undergoing refinement are in yellow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Quadtree refinement according to (5.1). . . . . . . . . . . . . 5.4 Grid point and side labelling of quadtree grid. . . . . . . . . . 5.5 Flux across sides of quadtree grid. . . . . . . . . . . . . . . . 5.6 Domains considered in Section 5.5. Boundary points for the domain are red circles, and point inside the domain green diamonds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7 Error U2h − Uh on cross shaped domain (5.7). . . . . . . . . 5.8 L-shaped domain refinement for Div-Grad scheme. . . . . . . 5.9 Condition numbers for operator R in Div-Grad and FD scheme vs. finest mesh size. . . . . . . . . . . . . . . . . . . . . . . . 5.10 Operator for Div-Grad scheme, hmax = 0.25, k = 2, N = 208. 31 32 33 34 35 36 37 40 41 42 43 44 47 49 50 51 52 viii Acknowledgements My thanks to my supervisor, Chen Greif, who has given good advice and much encouragement throughout my program. I am particularly thankful for his well timed and practical feedback, which was often able to set me back on the right track without feeling disheartened about having gone down the wrong one. This work was supported financially by the Natural Sciences and Engineering Research Council of Canada as well as the University of British Columbia Affiliated Fellowships program. I am also grateful for my undergraduate supervisors, Noham Weinberg and Manfred Trummer, who gave me the chance to learn about the research process and who encouraged me in my efforts. I am thankful for the support, encouragement and graciousness of my friends, family, and church family. In particular, my husband Liam has been patient and supportive throughout this process. His curiosity and daring are an inspiration for my own research. Finally, I am grateful to all those who have taught me that the best way to learn is to teach. ix Chapter 1 Introduction Elliptic partial differential equations (PDEs), [20] such as the convectiondiffusion [16] and Poisson [20] equations, describe physical phenomena such as the movement of a pollutant in a stream or electrostatic charge. Since the analytical solution to these problems may be difficult or impossible to find, they are generally solved numerically. A wide range of different solution techniques exist, both in the discretization scheme for the differential equation and the solution technique for the resulting system of linear equations. Our focus in this work will be on the choice of discretization scheme, and on finite difference schemes [20] in particular. These solution techniques are usually introduced in the context of an idealized problem or domain, usually a square domain and a uniform mesh. We are interested in the choice and complexity of the necessary changes in the discretization scheme when the situation changes to a more complex domain or mesh. We are also interested in the resulting changes in the system of linear equations, and whether we can still perform analysis on the operator as in the simplest of cases. As most real-world applications are for non-trivial domains, this is an important topic. We consider starting from a standard second order centred finite difference scheme [16] with a uniform mesh on a square domain, and consider various adaptations. In 1D, we investigate problems with boundary layers, which require an area of fine resolution near the boundary for good resolution. In 2D, we explore domains that are non-polymoino [8], that is, not made up of some combination of squares. We also investigate solving an elliptic PDE on a domain for which the exact solution contains a singularity; e.g., the Poisson equation on an L-shaped domain. These problems all require the use of a non-uniform grid. We explore the use of bi-trees and quadtrees [7] (the reduction of an Octree to 1D and 2D respectively) for these problems and for those with non-trivial domains. These meshes have all mesh sizes as a factor of a power of 2 of the smallest mesh size. This allows for ease when performing adaptive mesh refinement, as well as in storage and labelling. When a grid in two dimensions or higher is non-uniform, the neighbour1 1.1. Mathematical Tools ing points for a given finite difference scheme may not be present. In this case, modifications must be made to the scheme, or a different scheme must be chosen. We discuss the use of several discretization schemes with respect to accuracy, ease of implementation, and the properties of the operator in the resulting system of linear equations. In particular, one property of the operator we are interested in is symmetry; we will investigate how to choose a scheme to maintain this feature. Symmetry is a desirable attribute for a matrix, as the solvers available for a symmetric matrix are generally computationally stable, less computationally costly, and require less storage than those for nonsymmetric matrices. Furthermore, we are also interested in eigenvalue estimates, which may be easier to obtain for a symmetric matrix. 1.1 Mathematical Tools Code was developed and run using Matlab [14] in Chapters 2 3, and 4. In Chapter 5, much of the code used was adapted for use in Julia [2] from a quadtree implementation in Matlab by Eldad Haber [10]. 2 Chapter 2 Centered Differences for a Singularly Perturbed BVP 2.1 Introduction Consider, for 0 < 1, the convection-diffusion problem in 1D −u00 + σu0 = S u ∈ (0, 1), u(0) = 0, u(1) = 1. (2.1) Problem (2.1) has an exact solution in the homogeneous case of S = 0, as shown in 2.1, eσx/ − 1 . eσ/ − 1 For as above and σ = O(1), this problem has a boundary layer near 1. Since this boundary layer is dependant on a potentially small value of , it is called a singularly perturbed boundary value problem (BVP). A uniform mesh with N + 1 points and origin x0 , as shown in Figure 2.2, includes the uniformly spaced points xj = x0 + jh, where h = N1 . We define Uj as our numerical approximation to u(xj ) on this grid. The standard centred difference approximation to (2.1) is then: LUj := − Uj+1 − 2Uj + Uj−1 Uj+1 − Uj−1 +σ = Sj , h2 2h j = 1, ..., N − 1 (2.2) with U0 = 0, UN = 1. As −→ 0, the boundary layer grows thinner and more difficult to resolve, and a fine mesh is increasingly necessary for the stability of the discrete solution. A measure of the fineness of the mesh relative to the problem is the Péclet number, defined as β = σh 2 . We require β < 1 for stability [15]. Without this constraint, non-physical oscillations appear and grow large as the Péclet number increases. However, in the area away from the boundary layer, the solution is smooth and a fine mesh is not so necessary. For this reason, we consider 3 2.1. Introduction Figure 2.1: Exact solution to (2.1) discretizing the problem with a piecewise uniform mesh, with all mesh sizes 2−k × h1 , where h1 is the largest mesh size and k some non-negative integer. We call this discretization a “bi-tree”, in relation to the quadtree in 2D and the octree in 3D. Specifically, we consider a mesh with two different mesh sizes; a coarse mesh with spacing h1 outside of the boundary layer and a fine mesh with spacing h2 = 2−k × h1 in the boundary layer. Each of the fine mesh and coarse mesh contain N/2 grid points; we define the index of the N/2th gridpoint as M . We must also consider the choice of size for the two regions. Segal [19] suggests dividing the interval into [0, 1−8], [1−8, 1], with an equal number of points in each region. For the values of h1 ∈ [0.1, 0.001], ∈ [0.1, 0.01] and σ ≈ 1 considered, however, this does not appear to be a large enough region. In practice, oscillations were observable outside the boundary region with this division. Heuristically we find the division [0, .9], [.9, 1] to work well for the values of , σ and h1 considered. In order to accommodate the mesh size restrictions of the bi-tree, we allow the size of the two regions to 4 2.2. Matrix Structure Figure 2.2: Uniform mesh with N + 1 points. vary slightly. 2.2 Matrix Structure Consider a mesh with two distinct mesh spacings, as in Figure 2.3. Given the previous definition of β, we have β1 = σh1 , 2 β2 = σh2 . 2 Since there are two distinct mesh spacings, we have three different components in the centered difference approximation. Below, (2.3) and (2.5) correspond to the fine and coarse mesh spacings, and (2.4) to the grid point 5 2.2. Matrix Structure Figure 2.3: Non-uniform mesh with N +1 mesh points, two distinct spacings h1 , h2 . with a different left and right mesh spacing. As before, U0 = 0, UN = 1 and (β1 − 1) Uj+1 + 2Uj − (β1 + 1) Uj−1 = β1 − 1 h2 Uj+1 + β2 + 1 h1 − β1 − 1 h2 h2 1 ! Sj , Uj − β2 + 1 h1 Uj−1 = h1 + h2 j = 1, 2, ..., M − 1; (2.3) j = M; (2.4) Sj , ! 2 (β2 − 1) Uj+1 + 2Uj − (β2 + 1) Uj−1 = h2 j = M + 1, ..., N − 1. (2.5) Sj , Therefore, our operator A is 2 −1 + β1 A= −1 + β1 2 .. . −1 + β1 −1 − β1 .. . 2 −1+β2 h1 .. . −1 − β1 β2 +1 − β1h−1 h1 2 −1 + β2 −β2 −1 h1 2 .. . −1 − β2 .. . −1 + β2 .. . (2.6) 2 6 2.3. Discrete Solution for Uniform Mesh When β1 , β2 < 1 this is a diagonally dominant M-matrix. This means that its eigenvalues will be positive and real. The conclusions drawn in Section 3.1 for the eigenvalues of A will therefore focus on systems where β1 , β2 < 1 to ensure real eigenvalues. However, we also wish to consider non-uniform meshes in order to avoid limiting β outside of the boundary layer. Many of the possible cases considered in Section 2.4, therefore, will have operators that are not M-matrices, meaning that their eigenvalues may be complex. 2.3 Discrete Solution for Uniform Mesh Consider the one-dimensional convection-diffusion problem (2.1). Following the example of [15, p. 11], for a uniform mesh with N + 1 points, we have the centered difference approximation for (2.1) as given in (2.2). We can write (2.2) as 2 h (β − 1) Uj+1 + 2Uj − (β + 1) Uj−1 = Sj , j = 1, 2, ..., N − 1. (2.7) We assume that the solution is of the form Uj = ξ j , which allows us to write (2.7) as (β − 1) ξ j+1 + 2ξ j − (β + 1) ξ j−1 = 0. This gives us the resulting characteristic equation (β − 1) ξ 2 + 2ξ − (β + 1) = 0, by which we find ξ− = 1, ξ+ = 1+β . 1−β (2.8) This means our solution is j j Uj = aξ− + bξ+ . where a, b are determined by our boundary conditions. For U0 = 0, UN = 1, Uj = j j ξ− + bξ+ . N −1 ξ+ 7 2.4. Discrete Solution for Non-Uniform Mesh j By the definition in (2.8), when β > 1, ξ+ < 0, and terms of the form ξ+ will be oscillatory. These non-physical oscillations in the discrete solution may be large and lead to a poor approximation of the exact solution. When β ≤ 1 we have no such difficulties. If non-physical oscillations do occur, by decreasing h we may decrease β to a value ≤ 1 and restore accuracy to the numerical solution. 2.4 Discrete Solution for Non-Uniform Mesh Consider now a mesh divided into two distinct mesh spacings, as in Figure 2.3. Assuming again that our solution is of the form Uj = ξ j , from the centered difference approximation in (2.3), (2.4), (2.5) we get the following set of characteristic equations (β1 − 2) ξ12 + 2ξ1 − (β1 + 2) = 0, β1 − 2 h2 2 ξM + β1 − 2 β2 + 2 − h1 h2 j = 1, 2, ..., M − 1; ξM − β2 + 2 h1 (2.9) = 0, (β2 − 2) ξ22 + 2ξ2 − (β2 + 2) = 0, j = M; (2.10) j = M + 1, ..., N − 1, (2.11) with solution ξ1− = 1, ξ1+ = ξM − = 1, ξM + = 1 + β1 , 1 − β1 h2 (1 + β2 ) , h1 (1 − β1 ) ξ2− = 1, ξ2+ = 1 + β2 , 1 − β2 j = 1, 2, ..., M − 1; j = M; j = M + 1, ..., N − 1. Thus, our solution is j j Uj = aξ1+ + bξ1− , j j Uj = cξM + + dξM − , j j Uj = eξ2+ + f ξ2− , j = 1, .., M − 1; j = M; j = M + 1, .., N − 1. When continuity of the solution is enforced at the transition point, the equation for j = M is unnecessary and we have j j Uj = aξ1+ + bξ1− , j = 1, .., M ; (2.12) j j Uj = eξ2+ + f ξ2− , j = M + 1, .., N − 1. (2.13) 8 2.4. Discrete Solution for Non-Uniform Mesh We now need to find a, b, e, f . If we have boundary conditions U0 = 0, UN = 1, then the following two equations must be satisfied: 0 0 aξ1+ + bξ1− = 0, N N eξ2+ + f ξ2− = 1. By enforcing continuity at M we obtain the equation M M M M aξ1+ + bξ1− = eξ2+ + f ξ2− . We may also specify a continuous first derivative. We enforce this by requiring the equality of a first order finite difference (FD) at M : M −1 M −1 M aξ1+ (ξ1+ − 1) + bξ1− (ξ1− − 1) eξ M (ξ2+ − 1) + f ξ2− (ξ2− − 1) = 2+ . h1 h2 We now have four equations and four unknowns; a solvable system of equations. Therefore our solution is (2.12), (2.13) with coefficients a= M α(ξ1+ b=− e= α ; M + ξN − 1) − ξ2+ 2+ M α(ξ1+ M α(ξ1+ f =1− α ; M + ξN − 1) − ξ2+ 2+ 1 ; M + ξN − 1) − ξ2+ 2+ N ξ2+ ; M − 1) − ξ M + ξ N α(ξ1+ 2+ 2+ defined in terms of a parameter α α= M (ξ ξ2+ 2+ − 1) h1 M −1 ξ1+ (ξ1+ − 1) h2 . As in the case of the uniform mesh, a value of βi > 1 on any area of the mesh means that ξi+ < 0. This corresponds to a solution where the terms j ξi+ give rise to non-physical oscillations. We now consider again the case of a piecewise uniform mesh with two distinct mesh sizes, as in Figure 2.3. Suppose that β2 < 1, meaning that no oscillations are present inside the boundary layer. We would hope that oscillations outside of the boundary layer would be reduced even if β1 > 1. 9 2.4. Discrete Solution for Non-Uniform Mesh Figure 2.4: Discrete solution for uniform and non-uniform mesh of (2.1) with = .01, N = 22, σ = 1. Farrell et. al. [6] investigate a similar situation using a piecewise-uniform mesh with N/2 points in each of the fine and coarse regions, though without the restriction that the mesh must be a bi-tree. They find that non-physical oscillations outside of the boundary layer are bounded, and greatly reduced in comparison with the unbounded oscillations of the uniform mesh. In particular, if the solution inside of the boundary layer is oscillation free, numerical oscillations in the coarse region will decrease in magnitude further from the fine mesh. Though it is impossible to remove these oscillations when β1 > 1, they may be small to the point of invisibility. We observe a similar effect, as shown in Figure 2.4. Here, for the non-uniform coarse mesh β1 ≈ 4 and for the uniform mesh β ≈ 2. However, although the Péclet number is larger for the coarse mesh, the oscillations are not visible as they are for the uniform mesh. This is due to the oscillation free solution in the boundary layer on the non-uniform mesh. We consider the effect on the coefficients of varying the location of the transition point t as shown in Figure 2.5. Note that t is chosen such that t ∈ [0.5, 1]. The fine and coarse mesh sizes are kept constant, so as the transition 10 2.4. Discrete Solution for Non-Uniform Mesh point moves right, less of the overall mesh is finely resolved. It follows that a transition point of t = 1 corresponds to a uniform coarse mesh. The coefficients a and e generally decrease as more and more of the mesh is finely resolved. In particular, e will always decrease, since as the transition point M +ξ N , both increase. t −→ 0.5, the two terms in the denominator, α and −ξ2+ 2+ The coefficient a may increase or decrease. As t −→ 1, −ξ2M + ξ2N −→ 0 and a −→ α(ξMα −1) . Whether a increases or decreases depends on whether the 1+ M − 1) − ξ M + ξ N is approaching 0 numerator α or the denominator α(ξ1+ 2+ 2+ more quickly. Regardless of its change in size, however, a will be very small for the choices of N and we investigate. For some choices of M , N , and , the coefficients a and e are below machine precision, visually removing the oscillatory part of the solution. In summary, the small values of the coefficients a and e such as those shown in Figure 2.5 will control the size of non-physical oscillations arising from large powers of ξ+ < 0 in the solution. Figure 2.5: Size of coefficients a, e in discrete solution for = .03, N = 10, 5 β1 = 53 , β2 = 12 . 11 Chapter 3 On the Eigenvalues of a Finite Difference Operator on a Non-Uniform Mesh 3.1 Matrix Transformation Consider the (N − 1) × (N − 1) operator A corresponding to the centred difference approximation on a uniform mesh in (2.2). A is a tridiagonal Toepliz matrix so its eigenvalues are known analytically. A general tridiagonal Toeplitz matrix with entries [b, a, c] will have eigenvalues as shown in [4]: √ λj = a + sign(c)2 bc cos πj , j = 1, ...N − 1. N (3.1) The matrix A defined on the uniform mesh will have eigenvalues p 2 − sign(β + 1)2 (β − 1)(−1 − β) cos πj , j = 1, ...N − 1. N (3.2) We show the eigenvalues calculated experimentally in Matlab for a uniform and non-uniform mesh in Figure 3.1. We also show the eigenvalues of the two Toeplitz principal sub-matrices of the non-uniform mesh. We now turn our attention to investigating the analytical form for the eigenvalues of the operator for a non-uniform mesh. With the loss of a constant mesh size, the Toeplitz structure of the matrix disappears. An operator A corresponding to a non-uniform mesh has the structure 12 3.1. Matrix Transformation a1 b1 A= c1 a1 .. . c1 .. . b1 .. . a1 b2 c1 a2 b3 c2 a3 .. . c3 .. . b3 .. . a3 c3 b3 a3 . The entries b2 and c2 limit this from being a block diagonal matrix with Toeplitz submatrices, for which a closed form solution for the eigenvalues exists. We attempt to regain a closed form solution. This matrix can be transformed by the orthogonal similarity transformation shown in [4] into a symmetric matrix. α1 γ1,1 γ1,1 α1 γ1,1 .. .. .. . . . γ α γ2,1 1,1 1 γ2,1 α2 γ3,2 à = γ3,2 α3 γ3,3 .. .. . . γ3,3 where γi,j = à has form .. . α3 γ3,3 γ3,3 α3 . p bi cj and αi = ai . Ã1 γ2,1 0 à = γ2,1 α2 γ3,2 , 0 γ3,2 Ã3 (3.3) where Ã1 , Ã3 are symmetric tridiagonal Toeplitz matrices. We follow the algorithm shown in [9] for approximating the eigenvalues of Ã. Since the matrices are related by a similarity transformation, this equates to approximating the eigenvalues of A. 13 3.2. Finding the Secular Equation 3.2 Finding the Secular Equation The algorithm shown in [9] involves a recursive division of a symmetric tridiagonal matrix into submatrices. However, since each Ãi is a tridiagonal Toeplitz matrix, we can find its spectral decomposition as in [4] and only require one such recursive step, the proceedings of which are detailed below. Suppose that Qi Di QTi is such a decomposition of Ãi . We can then transform à through an orthogonal similarity transformation as Q1 D1 QT1 γ2,1 ek 0 α2 γ3,2 eT1 , à = γ2,1 eTk 0 γ3,2 e1 Q3 D3 QT3 0 Q1 0 α2 γ2,1 l1T γ3,2 f2T 0 0 γ2,1 l1 D1 0 QT1 = 1 0 0 0 Q2 γ3,2 f2 0 D3 0 1 0 0 0 , 0 QT3 = QHQT , where l1T is the last row of Q1 and f2T is the first row of Q2 . Since they are related by an orthogonal similarity transformation, H has the same eigenvalues as Ã. H is a symmetric arrowhead matrix (SAM). A closed form solution for irreducible symmetric arrowhead matrices exists [17]; that is, a SAM where all elements of the first column z = [γ2,1 l1 , γ3,2 f2 ]T are non-zero, and the diagonal elements di obey d2 >, . . . , > dN −1 . A symmetric arrowhead matrix may also be transformed into an irreducible symmetric arrowhead matrix. Suppose an entry zi = 0. Since the column corresponding to di is a scalar multiple of the unit vector ei , (di , ei ) is an eigenvalue eigenvector pair for H. We can therefore remove row and column i of H and solve the reduced problem to find the remaining eigenvalues of H. Furthermore, we know that the diagonal entries di are the distinct eigenvalues of Ã1 , Ã3 given by (3.1). If the entries are not ordered d2 >, . . . , > dN −1 , the matrix may be symmetrically permuted to order them without affecting the spectral decomposition. By the Cauchy interlacing theorem, [22], we know that the sorted eigenvalues of H, λi interlace the sorted di : λ1 ≥ d2 ≥ λ2 ≥ d3 ≥ · · · ≥ λN −2 ≥ dN −1 ≥ λN −1 . (3.4) 14 3.2. Finding the Secular Equation H is now a irreducible symmetric arrowhead matrix, and we can isolate the remaining eigenvalues of H as the roots of the secular equation [17] f (λ) = λ − α2 + N −1 X j=2 zj2 = 0, dj − λ (3.5) which may be solved by a root-finding method such as bisection. 3.2.1 Approximating the Roots of the Secular Equation Equation (3.5) above gives us the roots of the secular equation. When N > 5 the exact roots are impossible to find. We therefore consider approximate root finding methods to find the eigenvalues λk . We use a modification of Newton’s method in the fashion of Demmel [3]. We approximate f (λ) by a simple function with easily computable roots. We call our approximate function h(λ). Since f (λ) has poles at di and di+1 for i = 2, ..., N − 2, when seeking the root in (di , di+1 ) we choose to have h(λ) have these poles as well: h(λ) = c1 c2 + + λ + c3 . di − λ di+1 − λ If c1 , c2 and c3 are known, we can solve h(λ) = 0 for λ by solving the cubic equation c1 (di+1 − λ) + c2 (di − λ) + (λ + c3 )(di − λ)(di+1 − λ) = 0. We now consider how to compute c1 , c2 , and c3 so that h(λ) ≈ f (λ) near λ = λk : N −1 X zj2 c1 c2 + + c3 = h(λ) ≈ f (λ) = λ − α2 + . di − λ di+1 − λ dj − λ j=2 We consider f (λ) = λ − α2 + i X j=2 N −1 X zj2 zj2 + , dj − λ dj − λ j=i+1 = λ − α2 + φ1 (λ) + φ2 (λ). 15 3.2. Finding the Secular Equation (a) N = 20, = .1, σ = 1. (b) N = 120, = .01, σ = 1. Figure 3.1: Eigenvalues of finite difference operator for (2.1) with uniform and non-uniform mesh. A1 and A3 are the submatrices of A defined in (3.3). 16 3.2. Finding the Secular Equation For λ ∈ (di , di+1 ), φ1 (λ) is a sum of positive terms, and φ2 (λ) a sum of negative terms. Each of φ1 (λ), φ2 (λ) can therefore be computed without fear of cancellation error. We choose c1 , ĉ1 to satisfy h1 (λk ) = φ1 (λk ), h01 (λk ) = φ01 (λk ), where h1 (λ) = ĉ1 + c1 . di − λ These conditions are the same as in Newton’s method, except that we specify a hyperbolic approximation to the graph of φ1 (λ) at λ = λk instead of a tangent line approximation. This specification gives us c1 = φ01 (λk )(di − λk )2 and ĉ1 = φ1 (λk ) − φ01 (λk )(di − λk ). We similarly choose c2 , ĉ2 to satisfy h2 (λk ) = φ2 (λk ), h02 (λk ) = φ02 (λk ), where h2 (λ) = ĉ2 + c2 . di − λ This gives us c2 = φ02 (λk )(di+1 −λk )2 and ĉ2 = φ2 (λk )−φ01 (λk )(di+1 −λk ). We then set h(λ) = λ − α2 + h1 (λ) + h2 (λ), c1 c2 + , di − λ di+1 − λ c1 c2 = λ + c3 + + , di − λ di+1 − λ = λ − (ĉ1 + ĉ2 − α2 ) + Example 3.2.1. We consider using h(λ) to approximate f (λ) in as in Figure 3.2. We are solving for λ4 inside the range (d3 , d4 ) = (0.4708, 0.6678), and we observe that the approximation, shown as a solid blue line, is very good between these two poles, shown as vertical black lines. It is between these two poles that λ4 lies, and so our approximation need only be be accurate 4 in this region. We use an initial approximation of λ̄0 = d3 +d 2 , to construct 0.0371 0.1659 h(λ) = −0.7499 + λ + 0.4708−λ + 0.6678−λ = 0, which we solve to obtain λ̄1 = 0.6348. This is within 10−2 of the exact value of λ4 , 0.6438181494679. 0.1690 At the next iteration, we use λ̄1 to construct h(λ) = −0.4349+λ+ 0.4708−λ + 0.0186 0.6678−λ = 0, and solve the equation for a value of λ̄2 = 0.6436, which has error |λ̄2 − λ4 | < 10−3 . A third iteration has error |λ̄3 − λ4 | < 10−6 . We now have both a secular equation for the eigenvalues of a non-uniform mesh as well as an efficient method for determining the roots of that equa17 3.2. Finding the Secular Equation Figure 3.2: Graph of f (λ) and h(λ) for N = 20, = 0.1, σ = 1 and k = 4. tion. This is a promising step towards approximating the eigenvalues of a non-uniform mesh in a higher dimension. 18 Chapter 4 Finite Differences on a Non-Square Domain 4.1 Convection-Diffusion on Non-Square Domain Consider the convection-diffusion equation in two dimensions on some domain Ω with Dirichlet boundary conditions: −uxx − uyy + σux + τ uy = f u ∈ Ω, (4.1) u=g u ∈ δΩ. The problem, for small values of σ and τ , is well posed. The simplest case to consider is when Ω is a polyomino [8], that is, made up of a combination of orthogonal squares. This property implies that (4.1) can be solved numerically using the second order centered finite difference (FD) method illus1 and origin trated below with a uniform grid. A grid with mesh size h = n+1 (x0 , y0 ) is made up of the uniformly spaced points (xi , yj ) = (x0 +ih, y0 +jh) for 1 ≤ i, j, ≤ n. We will define Ui,j as our numerical approximation to u(xi , yj ). Similar notation may be used to refer to other functions defined on the grid, such as f or u. A representation of a subset of the grid is shown in Figure 4.1. We also assume that our grid points are labelled lexicographically, which for Figure 4.1 would result in the labelling shown in Figure 4.2. Given a uniform grid with mesh size h and points as shown in Figure 4.1, we will use the following centred finite difference discretizations in our finite difference scheme. Dx0 Ui,j = 0 Dxx Ui,j = Ui+1,j − Ui−1,j , 2h (4.2) Ui+1,j − 2Ui,j + Ui−1,j , h2 (4.3) 0 . These definitions give us the following with analogous definitions of Dy0 , Dyy 19 4.2. Motivating Problems finite difference scheme to approximate (4.1) at the point (xi , yj ) ∈ Ω. 0 0 −Dxx Ui,j − Dyy Ui,j + σDx0 Ui,j + τ Dy0 Ui,j ≈ fi,j . (4.4) We use Dirichlet boundary conditions, meaning that Ui,j = gi,j (xi , yj ) ∈ δΩ. (4.5) The linear system resulting from this scheme is of the form Ax = b, where A is a block tridiagonal Toeplitz matrix. If the problem is reduced to the Poisson problem (σ, τ = 0), then A is also a symmetric positive definite matrix. These properties allow for the linear system to be solved efficiently, and also allow further analysis of the matrix A. For instance, the eigenvalues of A are known analytically. }h If either of σ or τ increase such that the Péclet number, max{σ,τ is 2 greater than 1, then large non-physical oscillations may arise in the numerical solution, as in the 1D case examined previously. Furthermore the matrix A is no longer an M-matrix and the system no longer has real eigenvalues. In this situation, a scheme such as upwinding [16] is advised to restore stability }h to the numerical solution. We consider situations where max{σ,τ < 1. Our 2 focus will be on overcoming the difficulties in using finite difference methods to solve (4.1) with a non-square domain. 4.2 Motivating Problems There are several problems which we have chosen to motivate the study of the non-uniform mesh in 2D. A domain that is not a polyomino may require a refinement strategy other than a non-uniform grid. We have chosen two distinct non-square problems to highlight the different techniques involved in using FD methods on a non-square domain. The first case is that of a square grid with an ellipse removed. A practical example where this may occur is the case of a square plate with a round hole in it, as discussed by Morton and Meyers [16]. In the initial situation where this domain is discretized with a square uniform grid, there are various difficulties. Mathematically, the grid points may not fall on the curved boundary. Computationally, the labelling of grid points is more complicated. Another situation that we will consider is the numerical solution of the Poisson problem on an L-shaped domain. Here, the singular nature of the solution at the origin forces a highly refined mesh in the neighbourhood of the origin. This non-uniform mesh presents difficulties when finite differences are used. 20 4.3. Computational Schemes Figure 4.1: FD solution values on a uniform mesh. 4.3 Computational Schemes We will first discuss the various computational difficulties associated with using a FD scheme on a non-uniform mesh. In order to construct the finite difference operator, coefficients must be assigned for the finite difference scheme at each grid point. This requires having a list of the neighbours for each grid point. For a uniform grid, orthogonal points are required for a centred FD scheme. Consider the lth grid point at the location (xi , yj ) in a uniform mesh with total number of grid points N = n2 . If the grid is labelled lexicographically, the orthogonal neighbours required for the centred FD scheme given in (4.4) will be located at the grid points labelled l ± n and 21 4.3. Computational Schemes Figure 4.2: Lexicographic labelling of a uniform mesh. l ± 1. When the grid is non-uniform and non square, the adjacent grid points are no longer labelled ±n or ±1. An example of this can be seen in Figure 4.3. Since we no longer have consistent spacing of labels, we must use an alternate scheme to find the neighbours of each grid point. We find the row and column index, i, j of each grid point, then add or subtract 1 from these indices to find the respective neighbour. For example, to find the northern neighbour of the point 15 in Figure 4.3, we find its row and column indices of (3, 3) , as shown in Figure 4.4. We then find the lexicographic label (14) of the grid point with row and column indices of (2, 3). The lexicographic labels are stored in an array to allow the described indexing. 22 4.4. Domain with a Curved Boundary However, the situation is complicated when the grid is refined locally. This creates extra row and column indices, and “missing” row and column indices. Following the method above, when we try to find the western neighbour of the point 27 by subtracting 1 from the column index, we find that there is no point at (6, 4). These “missing indices” are represented by the points in yellow with dashed borders in Figures 4.4 and 4.3. The grid points affected are coloured green in these figures. To avoid repeated and extensive searches, we instead add to our array additional points at the missing indices, with the lexicographic label of the next neighbour in the missing direction. Multiple arrays may be required for the case of multiple possible labels, as represented by the multiple labelings for the yellow “missing indices” in Figure 4.3. We use the array associated with the direction we are searching for a neighbour in order to find the correct index. Figure 4.3: Lexicographic indices for a locally refined grid. Spaces corresponding to a missing index are in yellow, and grid points affected by the missing indices are in green. 4.4 Domain with a Curved Boundary Consider the domain of a square with an ellipse-shaped hole at its center. The radius and eccentricity of the ellipse are defined by the factors r, s and 23 4.4. Domain with a Curved Boundary Figure 4.4: Row and column indices for a locally refined grid. Spaces corresponding to a missing index are in yellow, and grid points affected by the missing indices are in green. the domain has form (y − 0.5)2 > r}. (4.6) s This domain is no longer rectangular, meaning that the grid points of a rectangular uniform grid may not lie inside the domain. In particular, the boundary of the domain may lie between grid points. We will instead use a modified finite difference scheme, as in [16]. This scheme is shown in Figure 4.6. Here, h is the mesh size of the grid. Due to the non-square domain, additional grid points have been defined on the boundary of the domain, at (xA , yj ) and (xi , yB ). These points are shown as red circles in Figure 4.5. We must use a modified discretization in order to construct an approximations of uxx , uyy , ux and uy at (xi , yj ). We will begin by discussing FD schemes for for the partial derivatives with respect to x. We find |xA − xi | = αh for some α. Then we find the following Taylor expansions for u(xA , yj ) and u(xi−1 , yj ): Ω = {(x, y) ∈ [0, 1] × [0, 1]} ∪ {(x, y)|s(x − 0.5)2 + 1 u(xA , yj ) = u(xi , yj ) + αhux (xi , yj ) + (αh)2 uxx (xi , yj ) + O(h3 ), 2 1 u(xi−1 , yj ) = u(xi , yj ) − hux (xi , yj ) + h2 uxx (xi , yj ) − O(h3 ). 2 24 4.4. Domain with a Curved Boundary Figure 4.5: Grid points on (4.6) with h = 0.0625, N = 176. Grid points lying on a uniform mesh are shown in blue, and additional grid points on the boundary of the domain shown as red circles. From these we obtain ux (xi , yj ) = u(xA , yj ) − α2 u(xi−1 , yj ) − (1 − α2 )u(xi , yj ) + O(h), α(1 + α)h uxx (xi , yj ) = u(xA , yj ) + αu(xi−1 , yj ) − (1 + α)u(xi , yj ) + O(h). 1 2 2 α(1 + α)h From this we get the finite difference approximations of ux , uxx (respectively): Dxα Ui,j = UA,j − α2 Ui−1,j − (1 − α2 )Ui,j , α(1 + α)h (4.7) UA,j + αUi−1,j − (1 + α)Ui,j . 1 2 2 α(1 + α)h (4.8) α Dxx Ui,j = Since the value of u(xA , yj ) = g(xA , yj ) is known from our boundary conditions, this is a valid scheme. We can obtain in a similar way the finite 25 4.4. Domain with a Curved Boundary Figure 4.6: Modified FD scheme for a curved boundary with Dirichlet boundary conditions. difference approximations for uyy and uy : Dyβ Ui,j = Ui,B − β 2 Ui,j−1 − (1 − β 2 )Ui,j , β(1 + β)h (4.9) Ui,B + βUi,j−1 − (1 + β)Ui,j . 1 2 2 β(1 + β)h (4.10) β Dyy Ui,j Now that we have finite difference equations for all grid points, we can construct and solve the full linear system Ax = b for the discretized problem. We do so for the problem with exact solution: 26 4.5. Reentrant Corner Table 4.1: Convergence of FD scheme for (4.1) on (4.6) σ = 2, τ = 0, r = 0.25, s = 1. E2 = ||U − uexact ||2 and E∞ = ||U − uexact ||∞ . N 176 764 3172 12920 52172 209688 840668 h 6.250 × 10−2 3.125 × 10−2 1.563 × 10−2 7.813 × 10−3 3.906 × 10−3 1.953 × 10−3 9.766 × 10−4 ||U − uexact ||2 3.999969 × 10−5 8.849087 × 10−6 2.109649 × 10−6 5.115872 × 10−7 1.258631 × 10−7 3.055653 × 10−8 6.371100 × 10−9 ||U − uexact ||∞ 9.326048 × 10−5 2.193087 × 10−5 5.402625 × 10−6 1.332949 × 10−6 3.311233 × 10−7 8.164156 × 10−8 1.858327 × 10−8 uexact (x, y) = exy y(1 − y)x(1 − x)(s(x − 0.5)2 + E22h /E2h 4.52 4.19 4.12 4.06 4.12 4.80 − 1 (y − 0.5)2 − r2 ) + 1. s 2h /E h E∞ ∞ 4.25 4.06 4.05 4.03 4.06 4.39 − (4.11) By definition, this function will have boundary value g = 1. It can easily be seen that A will lose the symmetry it had on a uniform mesh in a square domain, even when σ and τ are zero. Even if the i, j th entry of A, ai,j is nonzero, it is possible that aj,i = 0. This lack of structural symmetry means that this matrix is not symmetrizable. It may also be observed that the FD equation for the points on the interior boundary is only O(h), since it results from a combination of (4.7), (4.8), (4.9), (4.10). However, this does not appear to affect the global second order accuracy, as seen in Table 4.1. As discussed in [16, p. 172], this gain in accuracy at the boundary is to be expected. By performing error analysis using the maximum principle, it can be shown that the second order accuracy of the finite difference scheme for the interior mesh will be retained even with a first order scheme at the boundary. 4.5 Reentrant Corner We now consider a second example of where a non-uniform mesh may be required, as introduced in Section 4.2. Consider the L-shaped domain: Ω = [−0.5, 0.5] × [−0.5, 0.5]\{(0, 0.5) × (−0.5, 0)}. (4.12) The 90◦ angle formed by this domain at the origin is called a “reentrant corner”. 27 4.5. Reentrant Corner Figure 4.7: FD solution of (4.1) on the domain (4.6) with σ = 2, τ = 0, r = 0.25, s = 1. We consider solving Poisson’s equation on Ω with Dirichlet boundary conditions: −uxx − uyy = f u ∈ Ω, (4.13) u=g u ∈ δΩ. In the case of the homogeneous boundary conditions g = 0 and a smooth right hand side f , (5.2) has solution: [20] y p 2 1/3 2 2 uexact (x, y) = ( x + y ) sin arctan . (4.14) 3 x The solution and its first derivative are in L2 (Ω), but since the second derivative near the origin is unbounded, the second derivative is singular and an accurate discrete solution will prove difficult to find numerically. An initial plan is to discretize Ω with a uniform grid. Since Ω is a polyomino a finite difference method with a uniform discretization will lead to a valid discrete solution. 28 4.5. Reentrant Corner Figure 4.8: Error in FD solution of (4.1) on the domain (4.6) with σ = 2, τ = 0, r = 0.25, s = 1. Specifically, we can discretize (5.2) on a uniform grid as in Figure 4.1. We can then use the second order centered finite difference scheme: 0 0 −Dxx Ui,j − Dyy Ui,j ≈ fi,j . (4.15) A plot of the approximate solution U resulting from this scheme is shown in Figure 4.9. We also observe the error in U for a uniform grid in Figure 4.10. Note in particular that the error at the origin is very large. In fact, at a fixed distance from the singularity, we expect convergence of O(h4/3 ), and near the singularity we expect the even worse convergence behaviour of O(h2/3 ) [1, 13]. Here, the singularity in the reentrant corner leads to an increase of the discretization error in all of Ω. This effect is known as pollution. It follows, especially considering Figure 4.10, that refinement of the mesh is not needed everywhere to improve the accuracy of solution; but concentrated refinement is needed at the reentrant corner. 29 4.5. Reentrant Corner Figure 4.9: FD solution of (5.2) on L-shaped domain. In fact, an “optimal” general formula for returning to second order accuracy is given in [1] which references [12]. The scheme, which we follow, is at each refinement step to refine each mesh size by a factor of 2 and then add two additional layers of refinement near the singularity. Each refined region is also an L-shape and has half the side length of the next largest locally refined segment. For example, given the mesh in Figure 4.12, the next refinement step would produce the mesh in Figure 4.13. The resulting mesh will have mesh sizes hmax , hmax /2, hmax /4, ..., hmax /k, where k is the largest factor of refinement. k will grow by a factor of 22 each time the mesh is refined. This scheme follows from an understanding that, near the singularity, we see convergence of O(h2/3 ). Therefore, in order to see the 2 error decrease by a factor of 4 when we halve h, that is 12 = 41 , we must 2 refine the grid by a factor of 21 2/3 = 81 at the origin. By adding two layers of refinement in addition to halving h, we maintain a graded grid while achieving the required refinement near the singularity. This restores second order accuracy, as shown in Table 5.3. As can be seen in Figure 4.12, some mesh points do not have the four or- 30 4.6. Alternative Discretizations Figure 4.10: Error in FD solution for (5.2) on L-shaped domain with a uniform grid, h = 0.0156, N = 2945. thogonal neighbours required for the centred finite difference scheme (4.16). Even if a grid point does have all four neighbors, they may not be uniformly distanced from the central point. We will now discuss the necessary alterations to the finite difference scheme to accommodate these difficulties. 4.6 Alternative Discretizations The first situation we must deal with is when not all mesh sizes are equal; i.e., when some neighbours of Ui,j are closer than others. A visual example is given in Figure 4.14. Note that h1 is half the size of h2 . With this discretization, we must use alternative finite difference schemes to approximate uxx , uyy . The following is a second order centered finite difference approximation of uxx : bUi−1,j + aUi,j + cUi+1,j , h2 (4.16) 31 4.6. Alternative Discretizations Table 4.2: Convergence of FD scheme for (5.2) on (4.12). E2 = ||U −uexact ||2 and E∞ = ||U − uexact ||∞ . N 205 945 4161 16583 67205 281489 hmax 6.250 × 10−2 3.125 × 10−2 1.563 × 10−2 7.813 × 10−3 3.906 × 10−3 1.953 × 10−3 k 16 64 256 1024 4096 16384 ||U − uexact ||2 2.469249 × 10−4 4.488844 × 10−5 1.010690 × 10−5 2.771935 × 10−6 7.428256 × 10−7 1.862977 × 10−7 ||U − uexact ||∞ 1.690082 × 10−3 4.337456 × 10−4 1.088949 × 10−4 2.726217 × 10−5 6.820151 × 10−6 1.705491 × 10−6 E22h /E2h 5.50 4.44 3.65 3.73 3.99 - Figure 4.11: FD solution of Poisson problem on L-shaped mesh with Dirichlet boundary conditions. where a=− 2 2 − , h1 (h1 + h2 ) h2 (h1 + h2 ) b= 2 , h1 (h1 + h2 ) c= 2 . h2 (h1 + h2 ) 32 2h /E h E∞ ∞ 3.90 3.98 3.99 4.00 4.00 - 4.6. Alternative Discretizations Figure 4.12: Locally refined grid for (4.12), hmax = 0.0625, k = 64. Given a situation where one or more neighbours is missing, we must use an alternate finite difference scheme to approximate uxx or uyy . Suppose that we are searching for an alternative discretization for uyy where there is no northern neighbour, Ui,j+1 , in the mesh. An example of this situation is given in Figure 4.15. Given the missing grid point, we wish to develop a scheme of the form t Dyy Ui,j = aUi,j + bUi+1,j+1 + cUi−1,j+1 + dUi−1,j + eUi+1,j + f Ui,j−1 . t u(x , y ) is A Taylor expansion of Dyy j j t Dyy u ≈au + b(u + h2 ux + h3 uy + + c(u + h1 ux − h3 uy + h22 h2 uxx + h2 h3 uxy + 3 uyy ) 2 2 h21 h2 uxx − h1 h3 uxy + 3 uyy ) 2 2 + d(u − h1 ux + h21 h2 uxx ) + e(u + h2 ux + 2 uxx ) 2 2 + f (u − h4 uy + h24 uyy ) 2 33 4.6. Alternative Discretizations Figure 4.13: Locally refined grid for (4.12), hmax = 0.03125, k = 256. t u = u 2 We solve the system of equations so that Dyy yy + O(h ). This means that we must find coefficients to satisfy (a + b + c + d + e + f )u = 0; (h2 b − h1 c)ux = 0; (h3 b + h3 c − h4 f )uy = 0; (h22 b + h21 c + h21 d + h22 e)uxx = 0; (h23 b + h23 c + h24 f )uyy = uyy ; (h2 h3 b + h1 h3 c)uxy = 0. We have six equations and six unknowns. We solve the resulting system 34 4.6. Alternative Discretizations Figure 4.14: FD solution values on non-uniform mesh, non-uniform mesh size. of linear equations to obtain −2 2 2 a= − + ; h3 (h3 + h4 ) h4 (h3 + h4 ) h3 (h3 + h4 ) b= 2h2 ; h3 (h3 + h4 )(h1 + h2 ) c= 2h1 ; h3 (h3 + h4 )(h1 + h2 ) d= −2 h2 h1 ; h3 (h3 + h4 ) h1 (h2 + h1 ) e= −2 h2 h1 ; h3 (h3 + h4 ) h2 (h2 + h1 ) 2 f= . h4 (h3 + h4 ) 35 4.6. Alternative Discretizations Figure 4.15: FD solution values on non-uniform mesh, grid point missing northern neighbour. We can obtain a similar operator for a point missing a southern neighbour, or to approximate uxx when an eastern or western neighbour is missing. We also wish to expand our methods to solve (4.1). For this, we require similar FD operators to approximate ux , uy . We can use a similar method to derive these. For example, we obtain the following approximation for uy : Dyt Ui,j = aUi,j + bUi+1,j+1 + cUi−1,j+1 + dUi−1,j + eUi+1,j + f Ui,j−1 . (4.17) 36 4.6. Alternative Discretizations Figure 4.16: FD operator for (5.2) on L-shaped domain with locally refined grid, N = 205. Grid points are labelled lexicographically. where a= h24 h3 ; + h3 h4 b= h1 h4 ; h3 (h1 + h2 )(h3 + h4 ) c= h2 h4 ; h3 (h1 + h2 )(h3 + h4 ) d=− h2 h4 ; h3 (h1 + h2 )(h3 + h4 ) e=− h1 h4 ; h3 (h1 + h2 )(h3 + h4 ) f =− h3 . h24 + h3 h4 37 4.6. Alternative Discretizations The resulting linear operator, shown in Figure 4.16, has a distinctive sparsity pattern, due to the necessary modified FD schemes. The form of this operator is also dependant on the ordering scheme used; as discussed previously, lexicographic ordering is used here. Again, the lack of symmetry in the location of non-zeros makes this matrix unsymmetrizable. 38 Chapter 5 Cell Centered Finite Differences 5.1 A Symmetric Scheme The finite difference discretization scheme in Chapter 4 resulted in an unsymmetrizable operator. There are many reasons to pursue a scheme resulting in a symmetric operator including the fast solvers, such as the conjugate gradient method [18], only available for symmetric positive definite matrices and the relative ease of analysis for symmetric matrices. Furthermore we are interested in extending the eigenvalue analysis of Chapter 3 to higher dimensions, and a symmetric matrix is at least helpful, if not essential for this. This pursuit of a symmetric scheme for differentiating elliptic equations has led us to the finite difference (FD) scheme based on a finite volume (FV) writing of the Poisson equation as in Ewing et. al. [5] and Haber and Heldman [10] which results in a symmetric operator. We will now discuss this scheme and its use for the Poisson problem on a quadtree grid in a non-regular domain. In order to use the approach of [5, 10], we use a cell centred grid, as shown in Figure 5.1, as opposed to the vertex centred grids used previously. This is an important component in considering the differential equation from a FV framework, since a FV scheme involves integrating over a cell’s volume to find the discrete solution at the center. We also continue to use a quadtree grid, with all mesh sizes restricted to 2k h0 , where h0 is the finest mesh size. We stipulate that the mesh must be graded ; that is, the mesh size of a cell must be at most a factor of two of the mesh size of all neighbouring cells. Furthermore, we are interested in non-regular domains. In order to continue in a true quadtree style while solving on non square domains, we use a full, square grid with an immersed boundary method as in Rycroft et. al. [21]. 39 5.2. Data Structure Figure 5.1: Coordinates of grid points in cell centred grid. 5.2 Data Structure A critical component of a quadtree is its capacity for adaptive refinement. For this reason, we require a data structure to store information about the grid that is cheap to store and to update. We adopt the strategy of [10] of storing grid information in a large, sparse array, which we will call a Depth Map. This array will be of size N × 2M L−1 , where M L is specified as the maximum number times the grid can be refined. Each cell in the grid is represented by a value in the upper left hand corner of its corresponding location in the Depth Map, as shown in Figure 5.2. This value represents the refinement level of the cell, with 1 being the finest possible and M L being the coarsest possible. The smallest cells are therefore represented by one entry in the Depth Map array, and the largest by a sparse square of size 2M L−1 × 2M L−1 . When a cell in the grid is refined, its value in the Depth Map is reduced by 1, and new entries in the three new child cells are introduced, as shown in Figure 5.2b. 40 5.3. Domain Definition and Refinement Strategies (a) Before refinement. (b) After refinement. Figure 5.2: Entries in the Depth Map array before and after the cell in left hand corner is refined. Cells undergoing refinement are in yellow. 5.3 Domain Definition and Refinement Strategies We continue to be interested in solving problems on non-square domains. Maintaining a quadtree style grid requires a square grid by definition in order for each parent cell to be divided into four child cells. We maintain this convention in order to use a quadtree style grid. In order to solve problems on non-square domains, we will use a modified version of the level set method shown in [21]. These methods allows us to describe our domain in terms of a levelset function, φ(x, y). A true level set method requires this function to be Lipschitz continuous in order to characterize the change in the location of the boundary of the domain through time. Since our boundary will not move, we can remove the restriction of Lipschitz continuity from φ. We define our domain such that a square grid, say Ω = [−1, 1] × [−1, 1], is divided into two subsets by the sign of φ(x, y). The domain of our problem is then specified by Ω+ , defined where φ(x, y) > 0. The boundary of the domain, which we will call δΩ+ , is defined where φ(x, y) = 0. We define all areas where φ(x, y) <= 0 as Ω− . Note that this includes the boundary of the domain, δΩ+ . As in Rycroft [21] we refine in a uniform band along the boundary, refining a cell c if: min v∈vertices(c) |φ(v)| ≤ √ 2hc , (5.1) 41 5.4. The Discretization Scheme (a) Before refinement. (b) After one refinement. (c) After two refinements. (d) After three refinements. Figure 5.3: Quadtree refinement according to (5.1). where hc is the mesh size of cell c. The implementation in [21] also includes a term related to the Lipschitz constant of φ; this means that a domain that has more curves will be refined in a larger uniform band. However, some of the domains investigated are not Lipschitz continuous and we therefore ignore this term. We also refine cells as necessary to maintain a graded grid. The refinement process is shown in Figure 5.3. 5.4 The Discretization Scheme Consider again the Poisson equation, as shown in previous chapters, for a generic domain Ω: 42 5.4. The Discretization Scheme −uxx − uyy = f u ∈ Ω, (5.2) u=g u ∈ δΩ. Figure 5.4: Grid point and side labelling of quadtree grid. We can rewrite this equation as the divergence of the gradient of u: ∇ · ∇u = f, u=g u∈Ω (5.3) u ∈ δΩ (5.4) We now turn our attention to the discretized problem. Our grid is made up of square cells but is not necessarily uniform; these cells may be of different sizes. Recall, however, that the grid is graded; a cell’s size must be at most a factor of 2 different from any adjacent neighbour. x+ x− As in [5], we define wi,j , wi,j as approximations of the flux across the y+ y− x+ x− sides of the cell si,j and si,j respectively. Similarly, we define wi,j , wi,j as y+ y− approximations of the flux across si,j and si,j . 43 5.4. The Discretization Scheme Figure 5.5: Flux across sides of quadtree grid. Consider a cell, ci,j , with volume vi,j , as shown in Figure 5.4. By a mass balance approach, we get the divergence equation, as in [10, 11], 1 1 y+ y− x+ x− (wi,j − wi,j + wi,j − wi,j )= vi,j vi,j ZZ f (x, y)dxdy (5.5) ci,j We need to define the fluxes wi,j in terms of Ui,j , the discrete solution value at the cell center. We define the gradient operator on the cell faces. For regular cells, the simple difference: x− wi,j = 1 (Ui,j − Ui−1,j ) hi,j (5.6) is a second order approximation. A similar definition exists for the three other cell faces. At non-regular points, many different possible discretizations exist. As stated previously, we wish to use a symmetric discretization. As proposed 44 5.4. The Discretization Scheme in [5] and implemented in [10, 11], we use the same two point difference as in the regular cell case, (5.6). This scheme has the advantage of being symmetric. More accurate schemes exist, but they are more expensive with respect to the number of neighbouring points required, and may not be symmetric. Mass conservation gives us that x+ x− x− wi,j = wi+1,j+1 + wi+1,j−1 , and therefore, we have the resulting equality, which we substitute in (5.5) x+ wi,j = x+ wi,j = 1 hi+1,j+1 (Ui+1,j+l − Ui,j ) + 1 hi+1,j−1 (Ui+1,j−1 − Ui,j ), 2 2 (Ui+1,j+l − Ui,j ) + (Ui+1,j−1 − Ui,j ). hi,j hi,j A similar result follows for irregular grid points in the y direction. Note that this irregular gradient discretization scheme has the lowered discretization error of O(h). This result is shown in Horesh and Haber [11]. The scaled transpose of the divergence (Div) operator arising from (5.5) is the gradient (Grad) operator, from (5.6). When multiplied together, these two operators are a discrete Laplacian operator for (5.2). We therefore will refer to this discretization scheme as the Div-Grad scheme. RR 1 Observe also that we approximate vi,j f (x, y)dxdy with a midpoint ci,j quadrature rule; this equates to approximating the integral by multiplying the value of f at the cell center, (xi , yj ), by the volume of the cell vi,j , and 1 scaling by the factor of vi,j . However, in order to construct a symmetric operator, we multiply both sides of each linear equation by a factor of vi,j . In constructing the system of linear equations, our right hand side values are therefore multiplied by a diagonal matrix with entries corresponding to the volume of each cell. 5.4.1 Boundary Conditions and Operator Modifications To allow for the non-polyomino [8] domains defined below, we use a levelset function, as discussed in Section 5.3 to separate Ω+ , the true domain of our problem, from its enclosing square, Ω = [−1, 1] × [−1, 1]. We define Ui,j = u(xi , yj ), the exact solution, for cells ci,j on the boundary of the domain. Recall that the boundary is defined where φ(x, y) = 0 at some 45 5.5. Numerical Results point inside ci,j . Note that the boundary of the domain might not pass exactly through the center of a cell; we extend the value of u(xi , yj ) at the boundary over the cell. Cells in the domain where φ(x, y) < 0 are set to have a solution value of 0. Then, since all points in Ω− have a defined value, we can remove equations corresponding to these points from the system of linear equations. We modify the rows corresponding to points inside the operator that contain boundary terms such that the matrix entry is replaced by subtracting the boundary value at that point from the right hand side of the equation. Therefore, our operator contains equations corresponding only to points inside Ω+ . To summarize, we have found a symmetric scheme that allows for adaptive domain refinement. This scheme may be used for non-polyomino domains and for non-uniform (graded) quadtree meshes. However, it should be noted that the price we have paid for symmetry is a less accurate operator; O(h) instead of the O(h2 ) accurate scheme considered in Chapter 4. 5.5 Numerical Results Numerical results for this section were generated using the Julia Language [2]. Much of the code used was adapted from a quadtree implementation in Matlab by Eldad Haber [10]. We now look at the results of solving the Poisson equation with the Div-Grad discretization introduced on one of the domains discussed below. We consider solving (5.2) on the following domain shapes: • A cross shape, Ω+ = {(x, y) ∈ [−0.5, 0.5] × [−1, 1]} (5.7) ∪{(x, y) ∈ [−1, 1] × [−0.5, 0.5]}, (5.8) • a circle, Ω+ = {x2 + y 2 < 0.5}, (5.9) Ω+ = [−1, 1] × [−1, 1]\{(0, 1) × (−1, 0)}, (5.10) • an L-shape, 46 5.5. Numerical Results (a) Circle, (5.9). (b) Star, (5.11). (c) Cross, (5.7). (d) L-shape (5.10). Figure 5.6: Domains considered in Section 5.5. Boundary points for the domain are red circles, and point inside the domain green diamonds. • a star, Ω+ = {(x, y) ∈ [−0.5, 0.5] × [−0.5, 0.5]} (5.11) ∪{(x, y)||y| < (2|x| − 1), |x| > 0.5} (5.12) ∪{(x, y)||x| < (2|y| − 1), |y| > 0.5}. (5.13) These domains are depicted in Figure 5.6. We consider solving (5.2) with the following right hand side and homogeneous Dirichlet boundary conditions: 47 5.5. Numerical Results Table 5.1: Convergence of FD scheme for (5.2) with (5.14) on circle shaped domain (5.9). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. N 2748 11364 46108 186044 747140 hmax 0.0625 0.0313 0.0156 0.0078 0.0039 k 2 2 2 2 2 ||U2h − Uh ||2 0.004168 0.002116 0.000968 0.000539 0.000256 ||U2h − Uh ||∞ 0.0112 0.0056 0.0027 0.0014 0.0007 E22h /E2h 1.97 2.19 1.80 2.11 − 2h /E h E∞ ∞ 2.01 2.07 1.88 2.04 − Table 5.2: Convergence of FD scheme for (5.2) with (5.14) on L-shaped domain (5.10). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. N 4448 18804 77252 313092 1260548 hmax 0.1250 0.0625 0.0313 0.0156 0.0078 k 2 2 2 2 2 ||U2h − Uh ||2 0.006323 0.003135 0.001559 0.000777 0.000388 f (x, y) = 1 u(x, y) = 0 ||U2h − Uh ||∞ 0.0292 0.0187 0.0119 0.0075 0.0048 E22h /E2h 2.02 2.01 2.01 2.00 − 2h /E h E∞ ∞ 1.56 1.57 1.58 1.58 − (x, y) ∈ Ω+ (5.14) (x, y) ∈ δΩ+ (5.15) We first analyze the error when Ω+ is refined uniformly. One initial refinement is performed according to (5.1), resulting in a uniform band of refinement around the boundary of the domain. All following refinements are a uniform halving of the mesh size in each cell in Ω+ . Note that Ω− is not refined, except to maintain a graded grid. As stated in Section 5.4, the discretization scheme for the gradient at irregular points (5.6) has a discretization error of O(h). Upon uniform refinement as described, we observe this expected accuracy in Table 5.1. We investigate the accuracy of the Div-Grad scheme on an L-shaped domain (5.10) when the mesh is uniformly refined, again after one initial refinement along the boundary alone. Since the domain contains a reentrant 4 corner, we expect the accuracy to drop from O(h2 ) to O(h 3 ) in the L2 norm 2 and O(h 3 ) in the inf norm. This convergence can be observed in Table 5.2. 48 5.5. Numerical Results Note that we observe the lowered O(h) convergence in the L2 norm. We observe similar reentrant corners upon uniform refinement for the cross shaped domain (5.7) as shown in Figure 5.7. For this domain, the effect of four reentrant corners is observable. Figure 5.7: Error U2h − Uh on cross shaped domain (5.7). We expect that we can return to the first order accuracy of the DivGrad scheme by refining near a reentrant corner, as in Chapter 4. We wish to refine in such a way that when the mesh size is halved everywhere, the error is reduced by a factor of 2. In Chapter 4, an additional two layers of refinement were necessary to regain O(h2 ) accuracy; here one layer should 2 be sufficient to return to O(h) accuracy. Since we expect O(h 3 ) accuracty near the origin, an additional layer of refinement will mean that the mesh size is reduced by a factor of 4 there. We would then expect the error to be 2 reduced by a factor of ( 14 ) 3 < 12 . This error reduction is sufficient for O(h) accuracy. This refinement scheme is shown in Figure 5.8 for the L-shaped domain (5.10). We see that the error converges at the expected rate. We consider the conditioning of the operators for the two different discretization schemes that have been used in Chapters 4 and 5 to solve (5.2) on an L-shaped mesh (5.10). In both schemes, the mesh is refined strategically near the origin. Recall that for the FD scheme of Chapter 4, we add two additional refinement layers near the origin to return to O(h2 ) accuracy, and for the Div-Grad scheme, only one layer to return to O(h) accuracy. In Figure 5.9, we observe the condition numbers of the operators in the two different schemes. We see that κ(R) grows approximately at a rate κ(R) ∝ h0−2.0019 49 5.5. Numerical Results Figure 5.8: L-shaped domain refinement for Div-Grad scheme. for the for the Finite Difference scheme, and at a rate κ(R) ∝ h−1.1775 0 Div-Grad scheme. We can currently only observe these values; drawing extensive conclusions may be unwise as the discretization schemes they are the product of have different orders of accuracy. We also consider the structure of the Div-Grad operator, as shown in Figure 5.10. In comparison with the FD operator of Chapter 4, this operator is much more compact. In particular, we note that the long trains of connectivity of the FD operator are not present here; instead we have only the occasional entry outside of a roughly banded operator. However, the operator is still far from being perfectly banded. This relative lack of structure would make an extension of the eigenvalue decomposition scheme in Chapter 3 quite difficult. In 1D, an operator for a piecewise uniform mesh remains symmetric, though it may no longer be Toeplitz as in the case of the uniform mesh. However, the loss of a uniform mesh results in no loss of structure in 1D; the operator is still tridiagonal and structurally symmetric, 50 5.5. Numerical Results Table 5.3: Convergence of FD scheme for (5.2) with (5.14) on L-shaped domain (5.10). E2 = ||U2h − Uh ||2 and E∞ = ||U2h − Uh ||∞ . k is the largest factor of refinement. N 154 850 4178 19458 hmax 0.1250 0.0625 0.0313 0.0156 k 2 4 8 16 ||U2h − Uh ||2 0.041941 0.017956 0.007911 0.003551 ||U2h − Uh ||∞ 0.1066 0.0564 0.0242 0.0099 E22h /E2h 2.34 2.27 2.23 − 2h /E h E∞ ∞ 1.89 2.33 2.44 − Figure 5.9: Condition numbers for operator R in Div-Grad and FD scheme vs. finest mesh size. and therefore symmetrizable. In 2D, the loss of a uniform mesh means the resulting operator is no longer pentadiagonal, and may no longer be even structurally symmetric. This is the case for the operator shown in Chapter 4. Structural symmetry may be regained, as shown here, but the matrix is still not banded. As the banded nature of the operator was critical in finding the secular equation in Chapter 3, the lack of structure in these operators is troubling. Approximation of the eigenvalues may still be possible, for example based on a decomposition of the operator approximated by its closest 51 5.5. Numerical Results banded counterpart, but these experiments have not yet proved fruitful. Figure 5.10: Operator for Div-Grad scheme, hmax = 0.25, k = 2, N = 208. 52 Chapter 6 Conclusions We have discussed and compared various discretization schemes for the solution of elliptic equations on a non-square domain. We explored two strategies for dealing with boundaries that did not pass through grid points. A modified discretization scheme can be used, as in Chapter 4, or the value at the boundary can be extended to the grid point, as in Chapter 5. In the former case, a suitable choice of discretization may not affect the overall accuracy of the scheme, even if the truncation error appears to suggest lower accuracy, as discussed in Chapter 4. We also encounter potential accuracy loss for the case of a reentrant corner. Here, the loss in accuracy is due to the problem itself and not the discretization scheme. We can restore the scheme to its expected accuracy by refining strategically near the reentrant corner. Alongside our pursuit of accuracy we have sought symmetry for our operator. In 1D, a non-uniform mesh still results in an operator that is at least structurally symmetric and thus symmetrizable. However, in 2D the two goals of accuracy and symmetry seem somewhat at odds with one another. For a given “cost” for example, the number of points in a given scheme, one can “purchase” either a symmetric and less accurate or nonsymmetric and more accurate scheme. We have considered both a first order accurate, symmetric scheme and a second order accurate nonsymmetric scheme. Future work could include pursuing a second order symmetric scheme. A significant reason for pursuing a symmetric, or at least symmetrizable scheme is the goal of finding a generalized form or approximation for the eigenvalues of the operator in the system of linear equations. In 1D, this has proven achievable, as discussed in Chapter 3. A significant feature of the 1D operator in finding an approximation of its eigenvalues is its banded structure, even for a non-uniform mesh. This banded structure allows us to decompose our matrix and obtain the secular equation. In higher dimensions however the loss of a uniform, square mesh also means the loss of structure in our matrix. Approximation of the eigenvalues may still be possible, but has not yet been successfully attempted. We also consider the different finite difference schemes from a computa53 Chapter 6. Conclusions tional point of view. We found implementing adaptivity in Matlab with the finite difference scheme in Chapter 4 to be expensive as it required searching for neighbours and updating list entries as well as storage of several large dense arrays. The large sparse array of the second scheme was much more capable for the purposes of adaptivity. We also found Julia a useful tool for this work, though its true capabilities would likely have been more evident for larger problems. The use of a quadtree or bitree mesh, while restraining mesh size, proved very helpful in an efficient implementation, especially with an adaptive mesh. With the added restriction in 2D of a graded mash, adapting and searching for possible neighbours was also made more efficient. This graded restriction may also be important in maintaining the form of resulting operator; with a graded mesh a grid point can have no more than eight neighbours. Without this restriction, some rows in the matrix could have many more entries and the operator would have even less structure. If there is to be hope of finding or approximating eigenvalues in two or greater dimensions, a highly structured operator is likely to be a requirement. 54 Bibliography [1] [2] J. Bezanson, S. Karpinski, V. B. Shah, and A. Edelman. Julia: A fast dynamic language for technical computing. CoRR, http://arxiv. org/abs/1209.5145, 2012. [3] J. W. Demmel. Applied numerical linear algebra. Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 1997. [4] H. C. Elman and G. H. Golub. Iterative methods for cyclically reduced non-self-adjoint linear systems. Mathematics of Computation, 54(190):671–700, 1990. [5] R. E. Ewing, R. Lazarov, and P. Vassilevski. Local refinement techniques for elliptic problems on cell-centered grids. i. error analysis. Mathematics of Computation, 56(194):437–461, 1991. [6] P. Farrell, A. Hegarty, J. M. Miller, E. O’Riordan, and G. I. Shishkin. Robust Computational Techniques for Boundary Layers. CRC Press, 2000. [7] R. A. Finkel and J. L. Bentley. Quad trees a data structure for retrieval on composite keys. Acta informatica, 4(1):1–9, 1974. [8] S. W. Golomb. Polyominoes: Puzzles, Patterns, Problems, and Packings. Princeton University Press, 1996. [9] M. Gu and S. C. Eisenstat. A divide-and-conquer algorithm for the symmetric tridiagonal eigenproblem. SIAM J. Matrix Anal. Appl., 16(1):172–191, Jan. 1995. [10] E. Haber and S. Heldmann. An octree multigrid method for quasi-static maxwells equations with highly discontinuous coefficients. Journal of Computational Physics, 223(2):783–796, 2007. 55 Bibliography [11] L. Horesh and E. Haber. A second order discretization of maxwell’s equations in the quasi-static regime on octree grids. SIAM Journal on Scientific Computing, 33(5):2805–2822, 2011. [12] W. Kaspar and R. Remke. Die numerische behandlung der poissongleichung auf einem gebiet mit einspringenden ecken. Computing, 22(2):141–151, 1979. [13] P. Laasonen. On the discretization error of the Dirichlet problem in a plane region with corners. Annales AcademiæScientiarum Fennicæ, 408:16, 1967. [14] MATLAB. version 8.3 (R2014a). The MathWorks Inc., Natick, Massachusetts, 2014. [15] K. W. Morton. Numerical Solution of Convection-Diffusion Problems. Chapman and Hall, Oxford, UK, 1996. [16] K. W. Morton and D. F. Mayers. Numerical Solution of Partial Differential Equations: An Introduction. Cambridge University Press, New York, NY, USA, 2005. [17] D. P. O’Leary and G. W. Stewart. Computing the eigenvalues and eigenvectors of symmetric arrowhead matrices. J. Comput. Phys., 90(2):497–505, Sept. 1990. [18] Y. Saad. Iterative methods for sparse linear systems. Siam, 2003. [19] A. Segal. Aspects of numerical methods for elliptic singular perturbation problems. SIAM Journal on Scientific and Statistical Computing, 3(3):327–349, 1982. [20] J. Strikwerda. Finite Difference Schemes and Partial Differential Equations, Second Edition. Society for Industrial and Applied Mathematics, 2004. [21] M. Theillard, C. Rycroft, and F. Gibou. A multigrid method on nongraded adaptive octree and quadtree cartesian grids. Journal of Scientific Computing, 55(1):1–15, 2013. [22] J. H. Wilkinson, editor. The Algebraic Eigenvalue Problem. Oxford University Press, Inc., New York, NY, USA, 1988. 56