0% found this document useful (0 votes)
23 views6 pages

Chapter 4

Finite Difference Methods

Uploaded by

murad.ridwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

Chapter 4

Finite Difference Methods

Uploaded by

murad.ridwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 4

Finite Difference Methods

4.1 Introduction
Many of the basic numerical solution schemes for partial differential equa-
tions can be fit into two broad themes. The first, to be developed in the
present chapter, are the finite difference methods, and the second category
are the finite element methods, which will be the topic of the next chapter.

The finite-difference methods (FDM) are numerical methods for approximat-


ing the solutions to differential equations using finite difference equations to
approximate derivatives.

The finite difference approximations for derivatives are one of the simplest
and of the oldest methods to solve differential equations. It was already
known by L. Euler (1707-1783), in one dimension of space and was probably
extended to dimension two by C. Runge (1856-1927). The FDM was first
developed by A. Thom in the 1920s under the title “the method of square”
to solve nonlinear hydrodynamic equations.

The finite difference techniques are based upon the approximations that
permit replacing differential equations by finite difference equations. These
finite difference approximations are algebraic in form, and the solutions are
related to grid points (Fig. 4.1). Thus, a finite difference solution basically
involves three steps:

1. Dividing the solution into grids of nodes.

2. Approximating the given differential equation by finite difference equiv-


alence that relates the solutions to grid points.

3. Solving the difference equations subject to the prescribed boundary


conditions and/or initial conditions.

1
Class Notes on ECEG-6201
4.2. FINITE DIFFERENCE SCHEMES Analytical & Comp. Methods

Figure 4.1: Common two-dimensional grids: (a) rectangular, (b) skew, (c)
triangular, and (d ) circular grids.

4.2 Finite Difference Schemes


Given a function f (x) shown in Fig. 4.2, we can approximate its derivative,
slope or tangent at P by the slope of the arcs PB, PA, or AB, for obtaining
the forward-difference, backward-difference, and central-difference formulas
respectively.

• Forward-difference formula:
f (xo + ∆x) − f (xo )
f 0 (xo ) ≈ (4.1)
∆x

• Backward-difference formula:
f (xo ) − f (xo − ∆x)
f 0 (xo ) ≈ (4.2)
∆x

• Central-difference formula:
f (xo + ∆x) − f (xo − ∆x)
f 0 (xo ) ≈ (4.3)
2∆x

The approach used for obtaining the above finite difference equations is
Taylor’s series:

(∆x)2 00 (∆x)3 000


f (xo + ∆x) = f (xo ) + ∆xf 0 (xo ) + f (xo ) + f (xo ) + O(∆x)4
2! 3!
(4.4)
(∆x)2 00 (∆x)3 000
f (xo − ∆x) = f (xo ) − ∆xf 0 (xo ) + f (xo ) − f (xo ) + O(∆x)4
2! 3!
(4.5)

where O(∆x)4 is the error introduced by truncating the series.

Murad Ridwan, PhD 2


School of Electrical & Computer Engineering
AAiT, Addis Ababa University.
Class Notes on ECEG-6201
4.2. FINITE DIFFERENCE SCHEMES Analytical & Comp. Methods

Figure 4.2: Estimates for the derivative of f (x) at P using forward, back-
ward, and central differences.

Subtracting (4.5) from (4.4), we obtain

f (xo + ∆x) − f (xo − ∆x) = 2∆xf 0 (xo ) + O(∆x)3

which could be re-written as


f (xo + ∆x) − f (xo − ∆x)
f 0 (xo ) = + O(∆x)2
2∆x
which is the central-difference formula. Note that the truncation error is is
of order two for the central-difference.

The forward-difference and backward-difference formulas could be obtained


by re-arranging (4.4) and (4.5) respectively, and we have
f (xo + ∆x) − f (xo )
f 0 (xo ) = + O(∆x)
∆x
for forward-difference, and
f (xo ) − f (xo − ∆x)
f 0 (xo ) = + O(∆x)
∆x
for backward-difference. The truncation errors for forward- and backward-
differences is of order one.

Upon adding (4.4) and (4.5)

f (xo + ∆x) + f (xo − ∆x) = 2f (xo ) + (∆x)2 f 00 (x0 ) + O(∆x)4

and rearranging, we obtain


f (xo + ∆x) − 2f (xo ) + f (xo − ∆x)
f 00 (xo ) = + O(∆x)2 (4.6)
(∆x)2

Murad Ridwan, PhD 3


School of Electrical & Computer Engineering
AAiT, Addis Ababa University.
Class Notes on ECEG-6201
4.2. FINITE DIFFERENCE SCHEMES Analytical & Comp. Methods

Higher order finite difference approximations can be obtained by taking more


terms in Taylor series expansion.

To apply the difference method to find the solution of a function Φ(x, t),
we divide the solution region in x − t plane into equal rectangles or meshes
of sides ∆x and ∆t. We let the coordinates (x, t) of a typical grid point or
node be

x = i∆x, i = 0, 1, 2, . . .
t = j∆t, j = 0, 1, 2, . . .

and the value of Φ at P be

ΦP = Φ(i∆x, j∆t) = Φ(i, j)

With this notation, the central difference approximations of the derivatives


of Φ at the (i, j)th node are (Fig. 4.3)

Φ(i + 1, j) − Φ(i − 1, j)
Φx |i,j ≈ (4.7)
2∆x
Φ(i, j + 1) − Φ(i, j − 1)
Φt |i,j ≈ (4.8)
2∆t
Φ(i + 1, j) − 2Φ(i, j) + Φ(i − 1, j)
Φxx |i,j ≈ (4.9)
(∆x)2
Φ(i, j + 1) − 2Φ(i, j) + Φ(i, j − 1)
Φtt |i,j ≈ (4.10)
(∆t)2

Figure 4.3: Finite difference mesh for two independent variable x and t.

Murad Ridwan, PhD 4


School of Electrical & Computer Engineering
AAiT, Addis Ababa University.
Class Notes on ECEG-6201
4.2. FINITE DIFFERENCE SCHEMES Analytical & Comp. Methods

Exercise 4.1 Verify the following finite difference approximations for Φx and
Φxx in the table shown below, where FD =Forward Difference, BD = Backward
Difference, and CD = Central Difference.

Derivative FD Approximation Type Error

Φi+1 − Φi
Φx FD O(∆x)
∆x
Φi − Φi−1
BD O(∆x)
∆x
Φi+1 − Φi−1
CD O(∆x)2
∆x
−Φi+2 + 4Φi+1 − 3Φi
FD O(∆x)2
2∆x
3Φi − 4Φi−1 + Φi−2
BD O(∆x)2
2∆x
−Φi+2 + 8Φi+1 − 8Φi−1 + Φi−2
CD O(∆x)4
12∆x

Φi+2 − 2Φi+1 + Φi
Φxx FD O(∆x)2
(∆x)2

Φi − 2Φi−1 + Φi−2
BD O(∆x)2
(∆x)2

Φi+1 − 2Φi + Φi−1


CD O(∆x)2
(∆x)2

−Φi+2 + 16Φi+1 − 30Φi + 16Φi−1 − Φi−2


CD O(∆x)4
(∆x)2

Example 4.1 Elliptic type: Using the grid shown in the figure, compute the
potentials at the four interior points for the following boundary conditions. (Note
that the electrostatic potential satisfies Laplace’s equation, ∇2 V = 0)
1. V (1, 0) = −80, V (2, 0) = 400 and V = 0 on the three edges of the boundary.
2. V (x, 0) = x4 , V (3, y) = 81 − 54y 2 + y 4 , V (x, 3) = x4 − 54x2 + 81, V (0, y) = y 4 .
Exercise 4.2 Parabolic type: Solve the diffusion equation

Φxx = Φt , 0≤x≤1

Murad Ridwan, PhD 5


School of Electrical & Computer Engineering
AAiT, Addis Ababa University.
Class Notes on ECEG-6201
4.2. FINITE DIFFERENCE SCHEMES Analytical & Comp. Methods

subject to the boundary conditions

Φ(0, t) = 0 = Φ(1, t), t>0

and initial condition


Φ(x, 0) = 100
using the explicit and implicit (Crank and Nicholson) methods. Compare your
results with the analytic solution at some selected points.

Exercise 4.3 Hyperbolic type: Solve the wave equation

Φtt = Φxx , 0 < x < 1, t ≥ 1

subject to the boundary conditions

Φ(0, t) = 0 = Φ(1, t), t>0

and initial conditions

Φ(x, 0) = sin πx, 0<x<1


Φt (x, 0) = 0, 0<x<1

Compare your result with the analytic solution at some selected points.

Exercise 4.4 The wave equation

u2 Φxx = Φtt

can be finite differenced as

Φi,j+1 = 2(1 − r)Φi,j + r[Φi+1,j + Φi−1,j ] − Φi,j−1

where r is the aspect ratio given by


 2
u∆t
r=
∆x

Use the von Neumann approach to determine the stability condition.

Murad Ridwan, PhD 6


School of Electrical & Computer Engineering
AAiT, Addis Ababa University.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy