0% found this document useful (0 votes)
10 views

Finite difference method

Computational physics
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
10 views

Finite difference method

Computational physics
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
Chapter 1 Basics of Finite Difference Method 1.1 Finite Difference In numerical analysis finite difference is used to approximate derivative. Let us consider three points on the x-axis separated by a distance h as shown in the figure 1.1. We labelled this points as i —1, i and i +1 successively. Now consider some function at these points be denoted by u—1, ui and uj41 respectively. Let us expand function u(x, y). Let the value of the a1 and t41 in Taylor series about point i as follows Figure 1.1: Finite difference eee te ay tes (1.2) From Eqn 1.2, solving 2 we get ou war eens ‘ul 2 dtu! ho az|, ~ h 2 -B a art], Ou 1-4 : ml, = on 1M (13) Summing all the terms with factors hand higher. It is clubbed within O(h). This is a two point forward difference approrimation of 2 of order h. It is evident that as the step size decreases, the error term is reduced proportionally CHAPTER 1. BASICS OF FINITE DIFFERENCE ME THOT From Ba wre Mae Ey] a solving 8 we get ml HH 4 oy wo als + Oh) (az) or h (@) 8] = SH +00). a a S Figure 1.2: Mlustrations of finite differences: (a) Two point forward difference approximation (b) Two point backward difference approximation (c) Three point central difference approximation. Subtracting Equ 1.1 from Eqn 1.2, we get er - (c) Three point central difference approximation. Subtracting Eqn 1.1 from Eqn 1.2, we get (8) (1.9) (1.10) du orl, ui 41 Went 4 O(42) 2h ‘This is the 2nd order accurate FD approximation of a| Adding Eqn 1.1 and Eqn 1.2, we get upg + ina = uy + ‘Therefore 2nd order derivative can be written as Pu at 3z ml Fa + hot . Pul | ul he 2\,* aA|,1 thet siya — Df tint ie + O(1?) Ful _ wig =u Ewa Su) _ wna This is the 2nd order accurate FD approximation of 223) . This is also called the three point central difference. Chapter 2 Laplace’s Equation in Two Dimension 2.1 Laplace’s Equation Let us consider the two dimensional Laplace's equation FU(eu) , FU(ey) ‘Ox? ee ae Second order derivatives are represented by central difference approximation as PU (xy) _ Ulet dr,y) ~ 2U(e.y) +U = bx, y) an? a? : 2.1 Laplace’s Equation Let us consider the two dimensional Laplace’s equation PU, ) Ute vy 2) Second order derivatives are represented by central difference approxiniation as PU (x,y) _ Ule + 62,y) - (x,y) + U(@ — 42,9) (2) Oz? Gz) , ’ BU (x.y) _ Ula.y + by) ~ 2U (x,y) + U (ay ~ dy) (23) oy? (ou)? 7 . Therefore U(e + br,y) ~ U(w.y) + Ue bzw) , Oley + dy) ~ 20 (ay) + Ua ~ by) en ne (Gu)? ~ We first consider the problem in a rectangular grid with dimension Z,. and Ly, with U specified on the boundaries (Dirichlet Boundary Conditions), We construct a grid on which we will determine U, at positions Bene Consider the problem in a rectangular grid with dimension Lz and Ly, with U specified on the boundaries (Dirichlet Boundary Conditions). We construct a grid on which we will determine U, at positions m= ibe, uy = J8y, (25) (2.6) with 62 = Le/(Nz +1) and 8y = Ly/(Ny +1). We choose dy = é and Uley) = Us Ule + bz,y) = Vier s, Ule 62,9) = Vins, Ulery dy) = Uy, Ule,y +69) = Vise tra] aa] tne » 2 are oo ” ta] tea] tas I Figure 2.1: Finite difference grid and solution domain Therefore 2.4 becomes, Uiarg + Vieng + Viger + Uist — Wis = 0, § t+ Uinng + Ui gna + Uiga) (2.7) S Vag = GUints Unig PUbsas +0) - (28) Me, yo Ne =I afidj = 1,-++ Ny — 1. We solve the finite difference Eqn. 2.7 at Here, we compute for the interior points i xetized rectangular domain. ‘The discrete boundary conditions (Dirichlet type) every interior points iteratively on the are given by Uyj=a “and” Ux; =6 for 0 convergence criterion). Otherwise go to NEXT step. Step 3: Up, — UH, ii(temp) Step 4: Go to Step 2 for another sweep.

You might also like