FINITE DIFFERENCE METHODS



Similar documents
Verifying Numerical Convergence Rates

In other words the graph of the polynomial should pass through the points

Derivatives Math 120 Calculus I D Joyce, Fall 2013

Instantaneous Rate of Change:

OPTIMAL DISCONTINUOUS GALERKIN METHODS FOR THE ACOUSTIC WAVE EQUATION IN HIGHER DIMENSIONS

SAT Subject Math Level 1 Facts & Formulas

Part II: Finite Difference/Volume Discretisation for CFD

Lecture 10: What is a Function, definition, piecewise defined functions, difference quotient, domain of a function

Math 113 HW #5 Solutions

Høgskolen i Narvik Sivilingeniørutdanningen STE6237 ELEMENTMETODER. Oppgaver

A Multigrid Tutorial part two

Geometric Stratification of Accounting Data

Tangent Lines and Rates of Change

Solutions by: KARATUĞ OZAN BiRCAN. PROBLEM 1 (20 points): Let D be a region, i.e., an open connected set in

1.6. Analyse Optimum Volume and Surface Area. Maximum Volume for a Given Surface Area. Example 1. Solution

Projective Geometry. Projective Geometry

Chapter 7 Numerical Differentiation and Integration

The EOQ Inventory Formula

Section 3.3. Differentiation of Polynomials and Rational Functions. Difference Equations to Differential Equations

ACT Math Facts & Formulas

Research on the Anti-perspective Correction Algorithm of QR Barcode

Introduction to the Finite Element Method

CHAPTER 7. Di erentiation

Determine the perimeter of a triangle using algebra Find the area of a triangle using the formula

Inner product. Definition of inner product

6. Differentiating the exponential and logarithm functions

Can a Lump-Sum Transfer Make Everyone Enjoy the Gains. from Free Trade?

New Vocabulary volume

Optimized Data Indexing Algorithms for OLAP Systems

CHAPTER 8: DIFFERENTIAL CALCULUS

Sections 3.1/3.2: Introducing the Derivative/Rules of Differentiation

13 PERIMETER AND AREA OF 2D SHAPES

2 Limits and Derivatives

POISSON AND LAPLACE EQUATIONS. Charles R. O Neill. School of Mechanical and Aerospace Engineering. Oklahoma State University. Stillwater, OK 74078

Note nine: Linear programming CSE Linear constraints and objective functions. 1.1 Introductory example. Copyright c Sanjoy Dasgupta 1

Continued Fractions and the Euclidean Algorithm

The finite element immersed boundary method: model, stability, and numerical results

5 Numerical Differentiation

Chapter 10: Refrigeration Cycles

Theoretical calculation of the heat capacity

A New Cement to Glue Nonconforming Grids with Robin Interface Conditions: The Finite Element Case

Writing Mathematics Papers

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

MATHEMATICS FOR ENGINEERING DIFFERENTIATION TUTORIAL 1 - BASIC DIFFERENTIATION

TRADING AWAY WIDE BRANDS FOR CHEAP BRANDS. Swati Dhingra London School of Economics and CEP. Online Appendix

Moving Least Squares Approximation

An inquiry into the multiplier process in IS-LM model

Elasticity Theory Basics

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Average and Instantaneous Rates of Change: The Derivative

Numerical methods for American options

- 1 - Handout #22 May 23, 2012 Huffman Encoding and Data Compression. CS106B Spring Handout by Julie Zelenski with minor edits by Keith Schwarz

f(x + h) f(x) h as representing the slope of a secant line. As h goes to 0, the slope of the secant line approaches the slope of the tangent line.

The Derivative as a Function

Inner Product Spaces

Notes: Most of the material in this chapter is taken from Young and Freedman, Chap. 12.

1 The Collocation Method

2.1: The Derivative and the Tangent Line Problem

MATH 425, PRACTICE FINAL EXAM SOLUTIONS.

Distances in random graphs with infinite mean degrees

Training Robust Support Vector Regression via D. C. Program


1 Introduction to Matrices

SAT Math Facts & Formulas

Schedulability Analysis under Graph Routing in WirelessHART Networks

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

Fourth-Order Compact Schemes of a Heat Conduction Problem with Neumann Boundary Conditions

The Heat Equation. Lectures INF2320 p. 1/88

SOLVING LINEAR SYSTEMS

Cyber Epidemic Models with Dependences

How To Ensure That An Eac Edge Program Is Successful

Solution of Linear Systems

COMBINATORIAL PROPERTIES OF THE HIGMAN-SIMS GRAPH. 1. Introduction

Scientic Computing 2013 Computer Classes: Worksheet 11: 1D FEM and boundary conditions

Metric Spaces. Chapter Metrics

Reference: Introduction to Partial Differential Equations by G. Folland, 1995, Chap. 3.

Linköping University Electronic Press

No: Bilkent University. Monotonic Extension. Farhad Husseinov. Discussion Papers. Department of Economics

NOTES ON LINEAR TRANSFORMATIONS

The modelling of business rules for dashboard reporting using mutual information

Classification of Cartan matrices

How To Prove The Dirichlet Unit Theorem

M(0) = 1 M(1) = 2 M(h) = M(h 1) + M(h 2) + 1 (h > 1)

Catalogue no XIE. Survey Methodology. December 2004

Notes on Determinant

Solving partial differential equations (PDEs)

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 3: Wednesday, Feb 8

Piecewise Cubic Splines

17. Inner product spaces Definition Let V be a real vector space. An inner product on V is a function

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh

Pressure. Pressure. Atmospheric pressure. Conceptual example 1: Blood pressure. Pressure is force per unit area:

Mean Value Coordinates


An Additive Neumann-Neumann Method for Mortar Finite Element for 4th Order Problems

Shell and Tube Heat Exchanger

Derivative Approximation by Finite Differences

Transcription:

FINITE DIFFERENCE METHODS LONG CHEN Te best known metods, finite difference, consists of replacing eac derivative by a difference quotient in te classic formulation. It is simple to code and economic to compute. In a sense, a finite difference formulation offers a more direct approac to te numerical solution of partial differential equations tan does a metod based on oter formulations. Te drawback of te finite difference metods is accuracy and flexibility. Standard finite difference metods requires more regularity of te solution (e.g. u C 2 (Ω)) and te triangulation (e.g. uniform grids). Difficulties also arises in imposing boundary conditions. 1. FINITE DIFFERENCE FORMULA In tis section, for simplicity, we discuss Poisson equation posed on te unit square Ω = (0, 1) (0, 1). Variable coefficients and more complex domains will be discussed in finite element metods. Furtermore we assume u is smoot enoug to enable us use Taylor expansion freely. Given two integer m, n 2, we construct a rectangular grids T by te tensor product of two grids of (0, 1): {x i = (i 1) x, i = 1, m, x = 1/(m 1)} and {y j = (j 1) y, j = 1, n, y = 1/(n 1)}. Let = max{ x, y } denote te size of T. We denote Ω = {(x i, y j ) Ω} and boundary Γ = {(x i, y j ) Ω}. We consider te discrete function space given by V = {u (x i, y j ), 1 i m, 1 j n} wic is isomorpism to R N wit N = m n. It is more convenient to use sub-index (i, j) for te discrete function: u i,j := u (x i, y j ). For a continuous function u C(Ω), te interpolation operator I : C(Ω) V maps u to a discrete function and will be denoted by u I. By te definition (u I ) i,j = u(x i, y j ). Note tat te value of a discrete function is only defined at grid points. Values inside eac cell can be obtained by interpolation of values at grid points. Similar definitions can be applied to one dimensional case. Coose a mes size and u V (0, 1). Popular difference formulas at an interior node x j for a discrete function u V include: Te backward difference: (D u) j = u j u j 1 ; Te forward difference: (D + u) j = u j+1 u j ; Te centered difference: (D ± u) j = u j+1 u j 1 ; 2 Te centered second difference: (D 2 u) j = u j+1 2u j + u j 1 2. It is easy to prove by Talyor expansion tat (D u) j u (x j ) = O(), (D + u) j u (x j ) = O(), (D ± u) j u (x j ) = O( 2 ), (D 2 u) j u (x j ) = O( 2 ). Date: Updated October 12, 2013. 1

2 LONG CHEN We sall use tese difference formulation, especially te centered second difference to approximate te Laplace operator at an interior node (x i, y j ): ( u) i,j = (D 2 xxu) i,j + (D 2 yyu) i,j = u i+1,j 2u i,j + u i 1,i 2 x + u i,j+1 2u i,j + u i,j 1 2. y It is called five point stencil since only five points are involved. Wen x = y, it is simplified to (1) ( u) i,j = 4u i,j u i+1,j u i 1,i u i,j+1 u i,j 1 2 and can be denoted by te following stencil symbol 1 1 4 1. 1 For te rigt and side, we simply take node values i.e. f i,j = (f I ) i,j = f(x i, y j ). Te finite difference metods for solving Poisson equation is simply (2) ( u) i,j = f i,j, 1 i m, 1 j n, wit appropriate processing of boundary conditions. Here in (2), we also use (1) for boundary points but drop terms involving grid points outside of te domain. Let us give an ordering of N = m n grids and use a single index k = 1 to N for u k = u i(k),j(k). For example, te index map k (i(k), j(k)) can be easily written out for te lexicograpical ordering. Wit any coosing ordering, (2) can be written as a linear algebraic equation: (3) Au = f, were A R N N, u R N and f R N. Remark 1.1. Tere exist different orderings for te grid points. Altoug tey give equivalent matrixes up to permutations, different ordering does matter wen solving linear algebraic equations. 2. BOUNDARY CONDITIONS We sall discuss ow to deal wit boundary conditions in finite difference metods. Te Diriclet boundary condition is relatively easy and te Neumann boundary condition requires te gost points. Diriclet boundary condition. For te Poisson equation wit Diriclet boundary condition (4) u = f in Ω, u = g on Γ = Ω, te value on te boundary is given by te boundary conditions. Namely u i,j = g(x i, y j ) for (x i, y j ) Ω and tus not unknowns in te equation. Tere are several ways to impose te Diriclet boundary condition. One approac is to let a ii = 1, a ij = 0, j i and f i = g(x i ) for nodes x i Γ. Note tat tis will destroy te symmetry of te corresponding matrix. Anoter approac is to modify te rigt and side at interior nodes and solve only equations at interior nodes. Let

FINITE DIFFERENCE METHODS 3 us consider a simple example wit 9 nodes. Te only unknowns is u 5 wit te lexicograpical ordering. By te formula of discrete Laplace operator at tat node, we obtain te adjusted equation 4 2 u 5 = f 5 + 1 2 (u 2 + u 4 + u 6 + u 8 ). We use te following Matlab code to illustrate te implementation of Diriclet boundary condition. Let bdnode be a logic array representing boundary nodes: bdnode(k)=1 if (x k, y k ) Ω and bdnode(k)=0 oterwise. 1 freenode = bdnode; 2 u = zeros(n,1); 3 u(bdnode) = g(node(bdnode,:)); 4 f = f-a*u; 5 u(freenode) = A(freeNode,freeNode)\f(freeNode); Te matrix A(freeNode,freeNode) is symmetric and positive definite (SPD) (see Exercise 1) and tus ensure te existence of te solution. Neumann boundary condition. For te Poisson equation wit Neumann boundary condition u = f in Ω, = g on Γ, n tere is a compatible condition for f and g: (5) f dx = u dx = n ds = g ds. Ω Ω Ω A natural approximation to te normal derivative is a one sided difference, for example: Ω n (x 1, y j ) = u 1,j u 2,j + O(). But tis is only a first order approximation. To treat Neumann boundary condition more accurately, we introduce te gost points outside of te domain and next to te boundary. We extend te lattice by allowing te index 0 i, j n + 1. Ten we can use center difference sceme: n (x 1, y j ) = u 0,j u 2,j + O( 2 ). 2 Te value u 0,j is not well defined. We need to eliminate it from te equation. Tis is possible since on te boundary point (x 1, y j ), we ave two equations: (6) (7) 4u 1,j u 2,j u 0,j u 1,j+1 u 1,j 1 = 2 f 1,j u 0,j u 2,j = 2 g 1,j. From (7), we get u 0,j = 2 g 1,j + u 2,j. Substituting it into (6) and scaling by a factor 1/2, we get an equation at point (x 1, y j ): 2u 1,j u 2,j 0.5 u 1,j+1 0.5 u j 1 = 0.5 2 f 1,j + g 1,j. Te scaling is to preserve te symmetry of te matrix. We can deal wit oter boundary points by te same tecnique except te four corner points. At corner points, even te

4 LONG CHEN norm vector is not well defined. We will use average of two directional derivatives to get an approximation. Taking (0, 0) as an example, we ave (8) (9) (10) 4u 1,1 u 2,1 u 0,1 u 1,1 u 1,0 = 2 f 1,1, u 0,1 u 2,1 = 2 g 1,1, u 1,0 u 1,2 = 2 g 1,1. So we can solve u 0,1 and u 1,0 from (9) and (10), and substitute tem into (8). Again to maintain te symmetric of te matrix, we multiply (8) by 1/4. Tis gives an equation for te corner point (x 1, y 1 ) u 1,1 0.5 u 2,1 0.5 u 1,1 = 0.25 2 f 1,1 + g 1,1. Similar tecnique will be used to deal wit oter corner points. We ten end wit a linear algebraic equation Au = f. It can be sown tat te corresponding matrix A is still symmetric but only semi-definite (see Exercise 2). Te kernel of A consists of constant vectors i.e. Au = 0 if and only if u = c. Tis requires a discrete version of te compatible condition (5): N (11) f i = 0 i=1 and can be satisfied by te modification f = f - mean(f). 3. ERROR ESTIMATE In order to analyze te error, we need to put te problem into a norm space. A natural norm for te finite linear space V is te maximum norm: for v V, v,ω = max 1 i n+1, 1 j m+1 { v i,j }. Te subscript indicates tis norm depends on te triangulation since for different, we ave different numbers of v i,j. Note tat tis is te l norm for R N. We sall prove 1 : (V,,Ω ) (V,,Ω ) is stable uniform to. Te proof will use te discrete maximal principal and barrier functions. Teorem 3.1 (Discrete Maximum Principle). Let v V satisfy v 0. Ten max v max v, Ω Γ and te equality olds if and only if v is constant. Proof. Suppose max Ω v > max Γ v. Ten we can take an interior node x 0 were te maximum is acieved. Let x 1, x 2, x 3, and x 4 be te four neigbors used in te stencil. Ten 4 4 4v(x 0 ) = v(x i ) 2 v(x 0 ) v(x i ) 4v(x 0 ). i=1 Tus equality olds trougout and v acieves its maximum at all te nearest neigbors of x 0 as well. Applying te same argument to te neigbors in te interior, and ten to teir neigbors, etc, we conclude tat v is constant wic contradicts to te assumption i=1

FINITE DIFFERENCE METHODS 5 max Ω v > max Γ v. Te second statement can be proved easily by a similar argument. Teorem 3.2. Let u be te equation of (12) u = f I at Ω \Γ, u = g I at Γ. Ten (13) u,ω 1 8 f I,Ω \Γ + g I Γ,. Proof. We introduce te comparison function φ = 1 [ (x 1 4 2 )2 + (y 1 2 )2], wic satisfies φ I = 1 at Ω \Γ and 0 φ 1/8. Set M = f I,Ω \Γ. Ten so max Ω u max Ω (u + Mφ I ) = u + M 0, (u + Mφ I ) max(u + Mφ I ) max g I + 1 Γ 8 M. Γ Tus u is bounded above by te rigt-and side of (13). A similar argument applies to u giving te teorem. Corollary 3.3. Let u be te solution of te Diriclet problem (4) and u te solution of te discrete problem (12). Ten u I u,ω 1 8 u I ( u) I,Ω \Γ. Te next step is to study te consistence error u I ( u) I,. Te following Lemma can be easily proved by Taylor expansion. Lemma 3.4. If u C 4 (Ω), ten u I ( u) I,Ω \Γ 2 6 max{ 4 u x 4,Ω \Γ, 4 u y 4,Ω \Γ }. We summarize te convergence results on te finite difference metods in te following teorem. Teorem 3.5. Let u be te solution of te Diriclet problem (4) and u te solution of te discrete problem (12). If u C 4 (Ω), ten wit constant u I u,ω C 2, C = 1 48 max{ 4 u x 4, 4 u y 4 }. In practice, te second order of convergence can be observed even te solution u is less smoot tan C 4 (Ω), i.e. te requirement u C 4 (Ω). Tis restriction comes from te point-wise estimate. In finite element metod, we sall use integral norms to find te rigt setting of function spaces.

~u =0 on @ were ~u =(u, v) t, and ~ f =(f 1,f 2 ) t. 2. MAC DISCRETIZATION 6 LONG CHEN j j j i i i (A) index for p FIGURE 1. A cell centered uniform grid 4. CELL CENTERED FINITE DIFFERENCE METHODS (B) index for u FIGURE 1. Index for p, u, v. (C) index for v 2.1. MAC Sceme. Suppose we ave a rectangular decomposition, for eac cell, gree of freedoms for u and v are located on te vertical edge centers and orizont centers, respectively, and te degree of freedoms for pressure p are located at cell c Te MAC sceme is written as (µ =1) In some applications, notable te computational fluid dynamics (CFD), te Poisson equation is solved on sligtly different grids. In tis section, we consider FDM for te Poisson equation at cell centers; see Fig 4. At interior nodes, te standard (4, 1, 1, 1, 1) but boundary conditions will be treated differently. Te distance in axis direction between interior nodes is still but te near boundary nodes (centers of te cells toucing boundary) is /2 away from te boundary. One can ten easily verify tat for Neumann boundary condition, te stencil for near boundary nodes is (3, 1, 1, 1) and for corner cells (2, 1, 1). Of course te boundary condition g sould be evaluated and moved to te rigt and side. Te Diriclet boundary condition is more subtle for cell centered difference. We can still introduce te gost grid points and use standard (4, 1, 1, 1) stencil for near boundary nodes. But no grid points are on te boundary. Te gost value can be eliminated by linear extrapolation, i.e, requiring (u 0,j + u 1,j )/2 = g(0, y j ) := g 1/2,j. (14) (2.1) 4u i,j u i 1,j u i+1,j u i,j 1 u i,j+1 2 + pi,j p i,j 1 (2.2) 4v i,j v i 1,j v i+1,j v i,j 1 v i,j+1 2 + pi 1,j p i,j (2.3) u i,j+1 u i,j + vi,j v i+1,j =0 It s easy to see tat te above sceme as second order truncation error. 5u 1,j u 2,j u 1,j 1 u 1,j+1 2 = f 1,j + 2g 1/2,j 2. Te stencil will be (5, 1, 1, 1, 2) for near boundary nodes and (6, 1, 1, 2, 2) for corner nodes. Te symmetry of te corresponding matrix is still preserved. However, tis treatment is of low order (see Exercise 3). To obtain a better truncation error, we can use te quadratic extrapolation, tat is, use u 1/2,j, u 1,j, u 2,j to fit a quadratic function and evaluate at u 0,j, we get u 0,j = 2u 1,j + 1 3 u 2,j + 8 3 u 1/2,j, and obtain te modified boundary sceme sould be: (15) 6u 1,j 4 3 u 2,j u 1,j 1 u 1,j+1 2 = f 1,j + 8 3 g 1/2,j 2. We denote te near boundary stencil by (6, 4 3, 1, 1, 8 3 ). Te quadratic extrapolation will lead to a better rate of convergence since te truncation error is improved. Te disadvantage of tis treatment is tat te symmetry of te matrix is destroyed. For te Poisson equation, tere is anoter way to keep te second order truncation error and symmetry. For simplicity, let us consider te omogenous Diriclet boundary condition, i.e., u Ω = 0. Ten te tangential derivatives along te boundary is vanised, in particular, 2 t u = 0. Assume te equation u = f olds also on te boundary condition. Note tat on te boundary, te operator can be written as 2 t + 2 n. We ten get 2 nu = ±f on Ω. Te sign is determined by if te norm direction is te same as te axis direction. Ten we can use u 1, u 1/2 = 0 and 2 nu = f to fit a quadratic function and 1 = f i,j 1 = f i,j 2

FINITE DIFFERENCE METHODS 7 extrapolate to get an equation for te gost point u 1,j + u 0,j = 2 4 f 1/2,j and modify te boundary stencil as 5u 1,j u 2,j u 1,j 1 u 1,j+1 (16) 2 = f 1,j + 1 4 f 1/2,j. 5. EXERCISES (1) Prove te following properties of te matrix A formed in te finite difference metods for Poisson equation wit Diriclet boundary condition: (a) it is symmetric: a ij = a ji ; (b) it is diagonally dominant: a ii N j=1,j i a ij; (c) it is positive definite: u t Au 0 for any u R N and u t Au = 0 if and only if u = 0. (2) Let us consider te finite difference discritization of Poisson equation wit Neumann boundary condition. (a) Write out te 9 9 matrix A for = 1/2. (b) Prove tat in general te matrix corresponding to Neumann boundary condition is only semi-positive definite. (c) Sow tat te kernel of A consists of constant vectors: Au = 0 if and only if u = c. (3) Ceck te truncation error of scemes (14), (15) and (16) for different treatments of Diriclet boundary condition in te cell centered finite difference metods.