Chapter 5 FINITE DIFFERENCE METHOD (FDM)

Similar documents
NUMERICAL DIFFERENTIATION

Lecture 21. Numerical differentiation. f ( x+h) f ( x) h h

How to Find the Derivative of a Function: Calculus 1

Consider a function f we ll specify which assumptions we need to make about it in a minute. Let us reformulate the integral. 1 f(x) dx.

Finite Difference Method

Exercise 19 - OLD EXAM, FDTD

The Verlet Algorithm for Molecular Dynamics Simulations

Numerical Differentiation

232 Calculus and Structures

LECTURE 14 NUMERICAL INTEGRATION. Find

A = h w (1) Error Analysis Physics 141

Introduction to Derivatives

Order of Accuracy. ũ h u Ch p, (1)

Finite Difference Methods Assignments

A h u h = f h. 4.1 The CoarseGrid SystemandtheResidual Equation

158 Calculus and Structures

HOMEWORK HELP 2 FOR MATH 151

1 The concept of limits (p.217 p.229, p.242 p.249, p.255 p.256) 1.1 Limits Consider the function determined by the formula 3. x since at this point

The Laplace equation, cylindrically or spherically symmetric case

Combining functions: algebraic methods

MVT and Rolle s Theorem

Quantum Numbers and Rules

1 Calculus. 1.1 Gradients and the Derivative. Q f(x+h) f(x)

Polynomial Interpolation

Solutions to the Multivariable Calculus and Linear Algebra problems on the Comprehensive Examination of January 31, 2014

LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION

GRID CONVERGENCE ERROR ANALYSIS FOR MIXED-ORDER NUMERICAL SCHEMES

MATH745 Fall MATH745 Fall

Calculus I - Spring 2014

Section 15.6 Directional Derivatives and the Gradient Vector

5 Ordinary Differential Equations: Finite Difference Methods for Boundary Problems

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

Chapter 4: Numerical Methods for Common Mathematical Problems

2.8 The Derivative as a Function

7.1 Using Antiderivatives to find Area

b 1 A = bh h r V = pr

New Streamfunction Approach for Magnetohydrodynamics

Polynomial Interpolation

Finding and Using Derivative The shortcuts

Differentiation in higher dimensions

Lecture 15. Interpolation II. 2 Piecewise polynomial interpolation Hermite splines

lecture 26: Richardson extrapolation

Differential Calculus (The basics) Prepared by Mr. C. Hull

arxiv: v1 [math.na] 3 Nov 2011

5.1 We will begin this section with the definition of a rational expression. We

The derivative function

2.11 That s So Derivative

Math 161 (33) - Final exam

3 Parabolic Differential Equations

Calculus I Practice Exam 1A

1 Upwind scheme for advection equation with variable. 2 Modified equations: numerical dissipation and dispersion

SECTION 3.2: DERIVATIVE FUNCTIONS and DIFFERENTIABILITY

CHAPTER (A) When x = 2, y = 6, so f( 2) = 6. (B) When y = 4, x can equal 6, 2, or 4.

Higher Derivatives. Differentiable Functions

Math 34A Practice Final Solutions Fall 2007

LIMITS AND DERIVATIVES CONDITIONS FOR THE EXISTENCE OF A LIMIT

3.4 Worksheet: Proof of the Chain Rule NAME

Definition of the Derivative

(a) At what number x = a does f have a removable discontinuity? What value f(a) should be assigned to f at x = a in order to make f continuous at a?

Section 2.7 Derivatives and Rates of Change Part II Section 2.8 The Derivative as a Function. at the point a, to be. = at time t = a is

NUMERICAL DIFFERENTIATION. James T. Smith San Francisco State University. In calculus classes, you compute derivatives algebraically: for example,

Continuity and Differentiability Worksheet

These errors are made from replacing an infinite process by finite one.

Solution. Solution. f (x) = (cos x)2 cos(2x) 2 sin(2x) 2 cos x ( sin x) (cos x) 4. f (π/4) = ( 2/2) ( 2/2) ( 2/2) ( 2/2) 4.

Numerical Solution to Parabolic PDE Using Implicit Finite Difference Approach

Poisson Equation in Sobolev Spaces

Chapter 2 Limits and Continuity

Exam 1 Review Solutions

Math 1241 Calculus Test 1

FEM solution of the ψ-ω equations with explicit viscous diffusion 1

1watt=1W=1kg m 2 /s 3

Analytic Functions. Differentiable Functions of a Complex Variable

Mathematics 5 Worksheet 11 Geometry, Tangency, and the Derivative

Flavius Guiaş. X(t + h) = X(t) + F (X(s)) ds.

Name: Answer Key No calculators. Show your work! 1. (21 points) All answers should either be,, a (finite) real number, or DNE ( does not exist ).

Derivatives of Exponentials

4.2 - Richardson Extrapolation

SECTION 1.10: DIFFERENCE QUOTIENTS LEARNING OBJECTIVES

2.3 Algebraic approach to limits

Convexity and Smoothness

f a h f a h h lim lim

Logarithmic functions

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 2. Predictor-Corrector Methods

UNIVERSITY OF MANITOBA DEPARTMENT OF MATHEMATICS MATH 1510 Applied Calculus I FIRST TERM EXAMINATION - Version A October 12, :30 am

(4.2) -Richardson Extrapolation

Symmetry Labeling of Molecular Energies

1. Introduction. Consider a semilinear parabolic equation in the form

CHAPTER 2 MODELING OF THREE-TANK SYSTEM

Chapter 1D - Rational Expressions

lecture 35: Linear Multistep Mehods: Truncation Error

Excursions in Computing Science: Week v Milli-micro-nano-..math Part II

Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals. Gary D. Simpson. rev 01 Aug 08, 2016.

1.5 Functions and Their Rates of Change

Math Test No Calculator

Arbitrary order exactly divergence-free central discontinuous Galerkin methods for ideal MHD equations

SFU UBC UNBC Uvic Calculus Challenge Examination June 5, 2008, 12:00 15:00

A.P. CALCULUS (AB) Outline Chapter 3 (Derivatives)

1.72, Groundwater Hydrology Prof. Charles Harvey Lecture Packet #9: Numerical Modeling of Groundwater Flow

EXTENSION OF A POSTPROCESSING TECHNIQUE FOR THE DISCONTINUOUS GALERKIN METHOD FOR HYPERBOLIC EQUATIONS WITH APPLICATION TO AN AEROACOUSTIC PROBLEM

Bob Brown Math 251 Calculus 1 Chapter 3, Section 1 Completed 1 CCBC Dundalk

Transcription:

MEE7 Computer Modeling Tecniques in Engineering Capter 5 FINITE DIFFERENCE METHOD (FDM) 5. Introduction to FDM Te finite difference tecniques are based upon approximations wic permit replacing differential equations by finite difference equations. Tese finite difference approximations are algebraic in form; tey relate te value of te dependent variable at a point in te solution region to te values at some neigboring points. Tus a finite difference solution basically involves tree steps: Dividing te solution region into a grid of nodes. Approximating te given differential equation by finite difference equivalent tat relates te dependent variable at a point in te solution region to its values at te neigboring points. Solving te difference equations subject to te prescribed boundary conditions and/or initial conditions. Te course of action taken in tree steps is dictated by te nature of te problem being solved, te solution region, and te boundary conditions. Te most commonly used grid patterns for two-dimensional problems are sown in Fig. 5.. (a) (b) (c) (d) Fig. 5. Common grid patterns (a) Rectangular grid, (b) skew grid, (c) triangular grid, and (d) circular grid. Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering 5. Finite Element Scemes Before finding te finite difference solutions to specific PDEs, we will look at ow one constructs finite difference approximations from a given differential equation. Tis essentially involves estimating derivatives numerically. Consider a function f(x) sown in Fig.5., we can approximate its derivative, slope or te tangent at P by te slop of te arc PB, given te forward-difference formula, x x x x + x x Fig.5. Estimates for te derivative of f(x) at P using forward, backward, and central differences. f '( x ) f ( x + x) f ( x x ) (5.) or te slop of te arc AP, yielding te backward-difference formula, f ( x) f ( x x) f '( x ) x or te slop of arc AB, resulting in te central-difference formula, f ( x + x) f ( x x) f '( x ) x We can also estimate te second derivative of f(x) at P as (5.) (5.) f ''( x ) f ( x + x) f ( x ) + f ( x x) ( x) (5.) Any approximation of a derivative in terms of values at a discrete set of points is called finite difference approximation. A more general approac is using Taylor s series. According to te well-known expansion, Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering f ( x x) f ( x ) xf '( x ) x f x x f x! ( ) ''( )! ( ) '''( ) + + + + + L (5.5) and f ( x x) f ( x ) xf '( x ) x f x x f x! ( ) ''( )! ( ) '''( ) + + L (5.6) upon adding tese expansions, f ( x + x) + f ( x x) f ( x ) + ( x) f ''( x ) + O( x) (5.7) were O ( x) is te error introduced by truncating te series. Assuming tat tese terms are negligible, we can obtain f ''( x ) f ( x + x) f ( x) + f ( x x) x wic is Eq. (5.). Subtracting Eq. (5.6) from Eq. (5.5) and neglecting terms of te order ( x) yields f '( x ) f ( x + x) f ( x x) x wic is Eq.(5.). Tis sows tat te leading errors in Eqs. (5.) and (5.) are of te order ( x). Higer order finite difference approximations can be obtained by taking more terms in Taylor series expansion. Example 5.. To apply te difference metod to find te solution of a function (x,t), we divide te solution region in te x-t plane into equal rectangles or meses of sides x and t as in Fig.5.. We let te coordinates (x,t) of a typical grid point or node be xi x, i,,,... tj t, j,,,... and te value if at P be P ( i x, j t) ( i, j) (5.) Wit tis notation, te central difference approximations of te derivatives of at te (i,j)t node are Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering x / i, j ( i+, j) ( i, j), x (5.9a) t / i, j (, i j+ ) (, i j), t (5.9b) xx tt / / i, j i, j ( i+, j) ( i, j) + ( i, j), (5.9c) ( x) (, i j+ ) (, i j) + (, i j ), (5.9d) ( t) Fig.5. FD mes for two independent variables x and t. Example 5. Laplace s equation in two dimensions may ten be expressed as + + + + x y (5.) Eq. (5.) is known as te five-point equal arm difference equation using Fig. 5.. Te FD solution procedure of Poisson s or Laplace s equations may ten be summarized as follows: Divide te domain of interest (in wic te potential is to be determined) into suitable fine grid. Instead of a solution for (x,y), wic provides its continuous variation for a given carge distribution ρ(x,y), te FD solution will provide discrete values of at te nodes of te establised grid. Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering Apply te difference equation at eac node of te grid to obtain, for example, N equations in te N unknown node potentials. Solve te resulting system of equations, eiter iteratively or using one of te direct metods. Fig. 5. Geometry of te five-point star used in -D difference equations. 5. Difference Equation at Interface between Two Dielectric Media In many engineering applications, interfaces between two different dielectric media are encountered. For tis, we will derive a special case difference equation tat sould be satisfied at nodes on te interface between two dielectrics. Fig. 5.5 illustrates te geometry of an interface, and te difference equation in tis case may be obtained from Gauss s law for te electric field, Fig. 5.5 Geometry of grid nodes at te interface between medium of ε and medium of ε. Capter 5 Page 5

MEE7 Computer Modeling Tecniques in Engineering E ds q s ε (5.) q in eq. (5.) because tere is no free carge enclosed by te surface s. Substituting E, we obtain ε ε ε ds dc n dc s c c (5.) Te surface integration on te left-and side of equation (5.) was replaced by a contour integration, because in Fig. 5.5 we are dealing wit a two-dimensional case, and te solution of is independent of te axial independent variable z. / n denotes te normal derivative of on te contour c. Carrying out detailed integration of / n along c, we obtain ( εdc) ε + ε + ( ε) n c + ε + ε + ( ε) (5.) Rearranging te terms in equation (5.), we obtain ε + ε + ( ε + ε ) + ( ε + ε ) ( ε + ε ) (5.) Te equation (5.) may be used at interfaces between two dielectrics. Its use in engineering problems will be illustrated by following examples. 5. FDM for PDEs 5.. FD of Diffusion PDEs k (5.5) t x were k is a constant. Te equivalent FD approximation is ( i, j+ ) ( i, j) ( i+, j) ( i, j) + ( i, j) k, (5.6) t ( x) were x i x, i,,,..., n, t j t, j,,,... In Eq. (5.6), we ave used te forward difference formula for te derivative wit respect to t and central difference formula for tat wit respect to x. If we let Capter 5 Page 6

MEE7 Computer Modeling Tecniques in Engineering r t k( x) (5.7) ten Eq. (5.6) can be written as (, i j+ ) r( i+, j) + ( r) (, i j) + r( i, j) (5.) Tis explicit formula can be used to compute ( xt, + t) explicitly in terms of (x,t). Tus te values of along te first time row (see Fig. 5.), t t, can be calculated in terms of te boundary and initial conditions, ten te values of along te second time row, t t, are calculated in terms of te first time row, and so on. In order to ensure a stable solution or reduce errors, care must be exercised in selecting te value of r in Eq. (5.7) and Eq.(5.) is valid only if te coefficient (-r) in Eq.(5.) is nonnegative or o < r /. If we coose r /, Eq. (5.) becomes (, i j+ ) [ ( i+, j) + ( i, j)] (5.9) 5.. FD of Helmoltz Equation + k (5.) were E z for TM modes or H z for TE modes in waveguide problems, wile k is te wave number given by k ω µε β. To apply te FD metod, we discretize te cross section of te wave guide by a suitable mes. Applying central difference approximation for partial derivatives to Eq. (5.) gives ( i +, j) + ( i, j) + ( i, j + ) + ( i, j ) ( k ) ( i, j) (5.) 5.. FD of Wave Equation u (5.) x t were u is te speed of te wave. An equivalent FD formula is u ( i+, j) ( i, j) + ( i, j) (, i j+ ) (, i j) + (, i j), ( x) ( t) were x i x, i,,,..., n, t j t, j,,,... Tis equation can be written as Capter 5 Page 7

MEE7 Computer Modeling Tecniques in Engineering ( i, j + ) ( r) ( i, j) + r[ ( i +, j) + ( i, j)] ( i, j ) (5.) were (i,j+) is an approximation to (x,t) and r is te aspect ratio given by u t r x (5.) Equation (5.) is an explicit formula for te wave equation. For te solution algoritm in Eq.(5.) to be stable, te aspect ratio r < will be cosen. If we coose r, Eq. (5.) becomes (, i j+ ) ( i+, j) + ( i, j) (, i j ) (5.5) Unlike te single-step scemes of Eqs.(5.), te two-step scemes of Eqs. (5.) and (5.5) require tat te values of at times j and j- be known to get at time j+. Tus, we must derive a separate algoritm to start te solution of Eq. (5.) or (5.5); tat is, we must compute (i,) and (i,). To do tis, we utilize te prescribed initial condition. For example, suppose te initial condition on te FDE in Eq. (5.) is t t We use te backward-difference formula ( x, ) ( i, ) ( i, ) t t or (,) i (, i ) (5.6) Substituting Eq. (5.6) into Eq. (5.) and taking j (i.e.,at t ), we can obtain r (,) i ( r) (,) i + [ ( i,) + ( i+,) (5.7) Using te starting formula Eq. (5.7) togeter wit te prescribed boundary and initial conditions, te value of at any grid point (i,j) can be obtained directly from Eq. (5.). Accuracy and Stability of FD Solutions Tere are tree sources of errors tat are nearly unavoidable in numerical solution of pysical problems: () modeling errors, () truncation (or discretization) errors, () round-off errors. Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering Eac of tese error types will affect accuracy and terefore degrade te solution. Fig. 5.6 sows us te error as a function of te mes size. Fig. 5.6 Error as a function of te mes size 5.5 Example of D FDM Consider te rectangular region sown in Fig. 5.7a. Te electric potential is specified on te conducting boundaries. Use te finite difference representation to solve for te potential distribution witin tis region. Fig. 5.7a Rectangular geometry and boundary condition for te electric potential problem. Capter 5 Page 9

MEE7 Computer Modeling Tecniques in Engineering Fig.5.7b Geometry of x finite difference mes. Solution Te electric potential everywere in te rectangular region sould satisfy Laplace s equation. Using a numerical solution means we will define in te rectangular region of interest by calculating its values at discrete points, te nodes of a mes. Te step-by-step solution procedure includes te following: () Layout a coarse square mes and identify te nodes at wic te electric potential is t be calculated. Te geometry of a mes is sown in Fig. 5.7b. Te value of (mes size) in tis case is 5cm. () Replace Laplace s equation by its finite difference representation. i+, j + i, j + i, j+ + i, j i, j (5.) i,j are te discrete values of te potential at points (nodes) witin te domain of interest. () Apply te difference equation in step at eac node. At node, or + + + (. 5) (5.9) At node, + + + (. 5) Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering or (5.) + At node, 5 + (. ) or (5.) () Eqs. (5.9) to (5.) are tree equations in te tree unknowns,, and. Tese tree equations may be solved using one of te metods described in calculus courses. Te results are.79, 7., 6.79 (5) Wit te coarse mes we used, we do not expect to get accurate final results. Redoing te problem wit a smaller value of sould improve te accuracy of te solution. Fig.5.7c sows te mes geometry for.5cm, wic is alf te mes size used in te previous calculations. In tis case, owever, we ave twenty-one unknown values of te potential at te various nodes. (6) Once again, applying te difference equation of step at te various nodes results in te following x matrix: 9 7 6 5 9 7 6 5 Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering Fig.5.7c Geometry of.5-cm mes wit twenty-one potential nodes. Table 5. Comparison between Finite Difference and Analytical Results Potential values Percentage error Potential values Percentage error Analytical solution ( 5 cm ) (.5 cm ) 9.76 6.9 7..9 7. 6.9 9.7 5.9 6.76.7 6.9.75 6.9 Table 5. compares te results for 5cm, and.5cm. from tis comparison, it is clear tat te.5cm results agree better wit te analytical solution available for tis simple geometry. As expected, te accuracy of te FD results improves wit te reduction in size. Clearly, any furter reduction in results in a larger-size matrix; ence, a compromise sould be made between te desired accuracy and te computational time and effort required. Te solution for te electric potential at te various nodes is given by.5.99 5.5.9 9.9 6.9.. 7..96 6.9.96 5 9.5.65 9 9.5 6 9.66 6.9 9.66 7. 5.77. Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering EXAMPLE In te 6 m rectangular region sown in Figure.(a), te electric potential is zero on te boundaries. Te carge distribution, owever, is uniform and given by p v ε. Solve Poisson s equation to determine te potential distribution in te rectangular region. Solution To determine te potential distribution in te rectangular region, we use Poisson s equation. + x y ρ ε v wit zero potential on te boundaries. Figure. Geometry of te 6 m rectangular region and te m mes. By establising te rectangular grid sown in Figure.(b), we realize tat we ave six nodes and, ence, six unknown potentials for wic to solve. Replacing by its finite difference representation, we obtain (, +, +, +,, ) + i+ j i j i j+ i j i j Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering It sould be noted tat altoug te altoug te mes size was not explicitly used in solving Laplace s equation in te previous example, is included as a part of te matrix formation in solving Poisson s equation. In SI system of units, sould be in meters. By applying te preceding difference equation at te various nodes in Figure.(b), we obtain te following matrix equation: 6 5 Instead of solving te resulting six equations, we may note some symmetry considerations in Figure.(b). It is clear tat 6 5 and tat Taking tese symmetry considerations into account, te number of equations reduces to two, and we obtain te following solution:.56, 5.7 To improve te accuracy of te potential distribution, finer mes suc as te one sown in Figure. is required. Because of te large number of nodes in tis case, symmetry sould be used, and a solution for only one-quarter of te rectangular geometry is desired. Te application of te difference equation at nodes,,, and 5 sould proceed routinely, wereas special care sould be exercised at te boundary nodes, 6, 9,, and, and also at te corner node. For example, applying te difference equation at node 6 yields ) ( 6 5 9 + + + + a Or ) ( 6 5 9 + + + Capter 5 Page

MEE7 Computer Modeling Tecniques in Engineering In equation + ( + + + ), symmetry was used to x y complete te five-point star difference equation. Specifically te potential at node a to te rigt of 6 was taken equal to. Similarly at te corner node, we obtain 5 ( + 9 + + ) + b c Because of symmetry, b and 9 c, ence, ( + 9 ) + Fig.. Te finer mes solution and symmetry consideration of example. Te matrix equation for te twelve nodes sown in Figure. is ten Capter 5 Page 5

MEE7 Computer Modeling Tecniques in Engineering 9 7 6 5 Te coefficient in te coefficient matrix (to te left) of equation appears wenever symmetry consideration is used at boundary and corner nodes. It sould be noted tat te coefficient matrix in equation is te same for bot Laplace s and Poissons equations. Te constant vector on te rigt-and side of equation, owever, depends on te carge distribution witin and te potential at te boundaries of te region of interest. Furtermore, if instead of a uniform carge distribution we ave a given carge distribution ), ( y x v ρ, te constants vector on te rigt-and side of equation sould reflect te value of ), ( y x v ρ calculated at eac node. Solution of equation gives 6.65 5.96. 6. 5.69.66 5..79..5.5., 9 7 6 5 Capter 5 Page 6