0% found this document useful (0 votes)
121 views10 pages

Chapter Seven: Solution of Pdes. by Using Finite Difference Method 7.1 Partial Differential Equations

This document discusses solving partial differential equations (PDEs) using the finite difference method. It begins by classifying PDEs as elliptic, parabolic, or hyperbolic based on certain criteria. Finite difference approximations are then introduced to replace derivatives in PDEs with difference quotients. The Laplace equation and heat equation are provided as examples of how to derive finite difference equations for elliptic and parabolic PDEs. Iterative methods like Jacobi and Gauss-Seidel are presented as ways to solve the resulting finite difference equations numerically.

Uploaded by

Mohamed Muayid
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)
121 views10 pages

Chapter Seven: Solution of Pdes. by Using Finite Difference Method 7.1 Partial Differential Equations

This document discusses solving partial differential equations (PDEs) using the finite difference method. It begins by classifying PDEs as elliptic, parabolic, or hyperbolic based on certain criteria. Finite difference approximations are then introduced to replace derivatives in PDEs with difference quotients. The Laplace equation and heat equation are provided as examples of how to derive finite difference equations for elliptic and parabolic PDEs. Iterative methods like Jacobi and Gauss-Seidel are presented as ways to solve the resulting finite difference equations numerically.

Uploaded by

Mohamed Muayid
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/ 10

Chapter Seven Solution of PDEs.

by Using Finite Difference Method


Chapter Seven: Solution of PDEs. By Using Finite Difference Method

7.1 Partial differential equations:


Here we discuss the solution of linear second order partial differential equation in two
variables. These equation can be written in the form
𝐴 𝑢𝑥𝑥 + 𝐵 𝑢𝑥𝑦 + 𝐶 𝑢𝑦𝑦 + 𝐷 𝑢𝑥 + 𝐸 𝑢𝑦 + 𝐹 𝑢 + 𝐺 = 0 … … … … … … … … … … … (7.1)
Where 𝐴, 𝐵, 𝐶, 𝐷, 𝐸, 𝐹, and 𝐺 are all functions of the independent variables 𝑥 and 𝑦 and
subscripts denote partial derivatives; for instance
𝜕2𝑦
𝑢𝑥𝑦 =
𝜕𝑥 𝜕𝑦
Equation (7.1) is classified as elliptic, parabolic, or hyperbolic at all points of a region R as
follows:
1. 𝐵2 − 4𝐴𝐶 < 0 (elliptic equation) … … … … … … … … … … … … … … … … (7.2)
2. 𝐵2 − 4𝐴𝐶 = 0 (parabolic equation) … … … … … … … … … … … … … … … (7.3)
3. 𝐵2 − 4𝐴𝐶 > 0 (hyperbolic equation) … … … … … … … … … … … … … … . (7.4)

7.1.1 Elliptic Equation:


The Poisson’s equation
𝜕2𝑢 𝜕2𝑢
+ = 𝑓(𝑥, 𝑦) … … … … … … … … … … … … … … … … … … … … … … … … … … … . (7.5)
𝜕𝑥 2 𝜕𝑦 2
And the Laplace equation
𝜕2𝑢 𝜕2𝑢
+ = 0 … … . . … … … … … … … … … … … … … … … … … … … … … … … … … … … (7.6)
𝜕𝑥 2 𝜕𝑦 2
Are examples of two dimensional elliptic equations.

7.1.2 Parabolic Equation:


The one dimensional diffusion equation (heat equation)
𝜕𝑢 2
𝜕2𝑢
=𝛼 . . … … . . … … … … … … … … … … … … … … … … … … … … … … … … … … … (7.7)
𝜕𝑡 𝜕𝑥 2
-1-
Chapter Seven Solution of PDEs. by Using Finite Difference Method

Where
𝑘
𝛼2 =
𝜌𝜎
𝑘 = Conductivity
𝜎 = The specific heat
𝜌 = (Density) or mass per unit length (Kg/m)
Is a well-known example of the parabolic equation.
7.1.3 Hyperbolic Equation:
The one dimensional wave equation
𝜕2𝑢 2
𝜕2𝑢
=𝛼 . . … … . . … … … … … … … … … … … … … … … … … … … … … … … … … … … (7.8)
𝜕𝑡 2 𝜕𝑥 2
Where
𝑇
𝛼2 =
𝜇
𝑇 = Tension Force (N)
𝜇 = Mass per unit length (kg/m)

7.2 Finite Difference Approximations to Derivatives:


Let the two space (𝑥, 𝑦) domain in a Cartesian coordinates be divided into a network of
rectangular grid of sizes ∆𝑥 = ℎ and ∆𝑦 = 𝑘 as shown in figure (7.1).

𝑖, 𝑗 + 1
𝑥 = 𝑖ℎ, 𝑖 = 1, 2, 3, … …
𝑘 ℎ
𝑦 = 𝑗𝑘, 𝑗 = 1, 2, 3, … …
The points of intersections of these lines as grid points, 𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗

Mesh points, lattices or nodal points. The first partial


𝑖, 𝑗 − 1
derivative of 𝑢 with respect to 𝑥 is approximated in terms
of differences as

-2-
Chapter Seven Solution of PDEs. by Using Finite Difference Method
𝜕𝑢 𝑢𝑖+1,𝑗 − 𝑢𝑖,𝑗
= 𝑢𝑥 = ⟹ {𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛}
𝜕𝑥 ℎ
𝜕𝑢 𝑢𝑖,𝑗 − 𝑢𝑖−1,𝑗
= 𝑢𝑥 = ⟹ {𝐵𝑎𝑐𝑘𝑤𝑎𝑟𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛}
𝜕𝑥 ℎ
𝜕𝑢 𝑢𝑖+1,𝑗 − 𝑢𝑖−1,𝑗
= 𝑢𝑥 = ⟹ {𝐶𝑒𝑛𝑡𝑟𝑎𝑙 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛}
𝜕𝑥 2ℎ
Where 𝑢𝑖,𝑗 = 𝑢𝑥,𝑦 = 𝑢𝑖ℎ,𝑗𝑘
The central difference approximations for the second derivative of 𝑢 are given by
𝜕2𝑢 𝑢𝑖+1,𝑗 − 2 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗
= 𝑢𝑥𝑥 =
𝜕𝑥 2 ℎ2
𝜕2𝑢 𝑢𝑖,𝑗+1 − 2 𝑢𝑖,𝑗 + 𝑢𝑖,𝑗−1
= 𝑢𝑦𝑦 =
𝜕𝑦 2 𝑘2

7.3 Laplace Equation:


We study the solution of Laplace’s equation
𝜕2𝑢 𝜕2𝑢
+ =0
𝜕𝑥 2 𝜕𝑦 2
Assume the region to be rectangle so that it can be divided into a network of a rectangular of
mesh lengths ℎ and 𝑘. Replacing the Laplace’s equation in terms of difference equation, we get
𝑢𝑖+1,𝑗 − 2 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 𝑢𝑖,𝑗+1 − 2 𝑢𝑖,𝑗 + 𝑢𝑖,𝑗−1
+ =0
ℎ2 𝑘2
For values of ℎ = 𝑘, i.e., for a square grid of mesh size ℎ, the above equation can be written as
1
𝑢𝑖,𝑗 = (𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 ) … … … … … … … … … … … … … … … … … … (7.9)
4
Equation (7.9) shows that the values of 𝑢𝑖,𝑗 is the average of its four neighbors to the west, east,
north, and south. The formula (7.9) is called the standard five point formula.
The finite difference analogue of this formula is shown in figure (7.1)

A formula similar to the formula (7.9) is sometimes used with convenience. It is given by

-3-
Chapter Seven Solution of PDEs. by Using Finite Difference Method
1
𝑢𝑖,𝑗 = (𝑢𝑖+1,𝑗+1 + 𝑢𝑖+1,𝑗−1 + 𝑢𝑖−1,𝑗+1 + 𝑢𝑖−1,𝑗−1 ) … … … … … … … … . … … … … … (7.10)
4
This is known as diagonal five point formula and expresses the value of the function at the
diagonal points. It may be remarked here that although formula (7.10) is less accurate than
formula (7.9), it serves as a reasonably good approximation for obtaining grid values which are
needed as starting values in the iteration procedure. The finite difference analogue of this
formula is shown in figure (7.2) given below


𝑖 − 1, 𝑗 + 1 𝑖 + 1, 𝑗 + 1

𝑖, 𝑗

𝑖 − 1, 𝑗 − 1 𝑖 + 1, 𝑗 − 1

It is now required to determine the values 𝑢𝑖 of 𝑢 at the internal mesh points when it is values 𝑏𝑗
on the boundary are known; see figure (7.3).
𝑏13 𝑏12 𝑏11 𝑏10 𝑏9
The initial value of 𝑢5 at the Centre is obtained by the
𝑢7 𝑢8 𝑢9
diagonal five point formula as 𝑏14 𝑏8

1 𝑏15 𝑢4 𝑢5 𝑢6
𝑢5 = (𝑏1 + 𝑏5 + 𝑏9 + 𝑏13 ) 𝑏7
4
𝑏16 𝑢1 𝑢2 𝑢3
With 𝑢5 known, 𝑢1 , 𝑢3 , 𝑢7 , and 𝑢9 are similarly calculated by 𝑏6

The diagonal five point formula. The remaining function values 𝑏1 𝑏2 𝑏3 𝑏4 𝑏5


𝑢2 , 𝑢4 , 𝑢6 , and 𝑢8 are obtained by the use of standard five point
formula.
Having determined all the values of 𝑢𝑖 , (𝑖 = 1, 2, … … . , 9) once, their accuracy can be
improved by the application of either Jacobi’s iteration formula or Gauss-Seidel iteration
formula.

-4-
Chapter Seven Solution of PDEs. by Using Finite Difference Method
Example 1: Solve the Laplace equation
𝜕2𝑢 𝜕2𝑢
+ =0
𝜕𝑥 2 𝜕𝑦 2
With the boundary conditions 𝑢(0, 𝑦) = 0, 𝑢(𝑥, 0) = 0, 𝑢(𝑥, 1) = 100𝑥, 𝑢(1, 𝑦) = 100𝑦.
Taking ℎ = (1⁄3).
Solution: 𝑦
1 100(1⁄3) 100(2⁄3)
𝑢22 = (𝑢32 + 𝑢12 + 𝑢23 + 𝑢21 )
4 𝑢24 𝑢34
𝑢44 100
0 𝑢14
1
= (𝑢32 + 0 + 𝑢23 + 0) … … … … . (1) 0 𝑢13 𝑢23 𝑢33
4 𝑢43 100(2⁄3)
1 0 𝑢12 𝑢22 𝑢32
𝑢42 100(1⁄3)
𝑢32 = (𝑢42 + 𝑢22 + 𝑢33 + 𝑢31 )
4
𝑥
1 100 𝑢11 𝑢21 𝑢31 𝑢41
= ( + 𝑢22 + 𝑢33 + 0) … … … . (2)
4 3 0 0 0 0
1
𝑢23 = (𝑢33 + 𝑢13 + 𝑢24 + 𝑢22 )
4
1 100
= (𝑢33 + 0 + + 𝑢22 ) … … … . (3)
4 3
1
𝑢33 = (𝑢43 + 𝑢23 + 𝑢34 + 𝑢32 )
4
1 2 × 100 2 × 100
= ( + 𝑢23 + + 𝑢32 ) … … … … (4)
4 3 3
Using Gauss-Seidel Iteration method
Iteration 1 2 3 4 5
𝑢22 0 4.167 Conti.
𝑢32 8.334 17.708
𝑢23 8.334 17.708
𝑢33 33.334 42.187

-5-
Chapter Seven Solution of PDEs. by Using Finite Difference Method

7.4 Parabolic Equation:


Let us consider the heat conduction equation
𝜕𝑢 𝜕 2 𝑢
= … … … … … … … … . … … … … … … … … … … … … … … … … … … … … … … . . … … … (7.11)
𝜕𝑡 𝜕𝑥 2
Consider a rectangular grid in the 𝑥 − 𝑡 plane. i.e., the space time domain. Divided this area
into small rectangles by set of lines.
𝑥 = 𝑖ℎ, 𝑖 = 1, 2, 3, … …
𝑦 = 𝑗𝑘, 𝑗 = 1, 2, 3, … …
Where ℎ and 𝑘 are grid lengths in space and time respectively. Using central difference
operator in space coordinate and forward difference operator in time coordinate. The finite
difference analogue of equation (7.11) is given by
𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗 𝑢𝑖+1,𝑗 − 2 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗
=
𝑘 ℎ2
Or
𝑢𝑖,𝑗+1 = 𝛼(𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 ) + (1 − 2𝛼)𝑢𝑖,𝑗 … … … … … … … … … … … … … … … … . . … … … (7.12)
Where
𝑘
𝛼=
ℎ2
Equation (7.12) is an explicit scheme allow us to determine the value of 𝑢 at (𝑖, 𝑗 + 1)𝑡ℎ mesh
point. i.e., the value of one unknown quantity 𝑢𝑖,𝑗+1 in terms of the known function values at
the points 𝑥𝑖+1 , 𝑥𝑖−1 and 𝑥𝑖 at the instant 𝑡𝑗 , i.e. , the 𝑗th time step as shown in figure (7.4). The
formula (7.12) is known as an explicit formula.
𝑢𝑖,𝑗+1

-6-
𝑘
𝑢𝑖−1,𝑗 𝑢𝑖+1,𝑗
𝑢𝑖,𝑗

Chapter Seven Solution of PDEs. by Using Finite Difference Method
The solution obtained from equation (7.12) is stable when
1 1
𝛼 < . For a particular case when 𝛼 = , equation (7.12)
2 2

gets simplified and is represented by


𝑢𝑖,𝑗+1 = (𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 ) … … … … … . . (7.13)
1
Equation (7.13) shows that for the value of 𝛼 = ,
2

the value of 𝑢 at the (𝑗 + 1)th time step is the mean


of the values of 𝑢 at the two neighboring points 𝑥𝑖+1 and 𝑥𝑖−1 at the previous 𝑗th time row. i.e.
, at the time 𝑡𝑗 .

𝜕2 𝑢
In the implicit scheme the space derivative of the parabolic equation, i.e. was replaced by
𝜕𝑥 2
arithmetic mean of its central difference approximation along the 𝑗th and (𝑗 + 1)th time row as
shown in figure (7.5). With this assumption the give parabolic equation is reduced to
𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗 (𝑢𝑖+1,𝑗 − 2 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 ) + (𝑢𝑖+1,𝑗+1 − 2 𝑢𝑖,𝑗+1 + 𝑢𝑖−1,𝑗+1 )
=
𝑘 2ℎ2
Rearrangement above equation gives
Unknown values of 𝑢
−𝛼 𝑢𝑖+1,𝑗+1 + (2 + 2𝛼)𝑢𝑖,𝑗+1 − 𝛼 𝑢𝑖−1,𝑗+1 𝑢𝑖,𝑗+1 𝑢𝑖+1,𝑗+1
𝑢𝑖−1,𝑗+1
= 𝛼(𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 ) + (2 − 2𝛼) 𝑢𝑖,𝑗 … . . (7.14) Known values of 𝑢
𝑘
Where 𝑢𝑖−1,𝑗 𝑢𝑖+1,𝑗
𝑢𝑖,𝑗
𝑘 ℎ
𝛼=
ℎ2

It is obvious from equation (7.14) that the left side contains three unknown values of 𝑢 along
the (𝑗 + 1)th time row while the values on the right side are all known along the 𝑗th time row.
Equation (7.14) which is an implicit relation is known as Crank-Nicolson formula and is
convergent for all finite values of .

Example 2: Obtain the numerical solution of the differential equation

-7-
Chapter Seven Solution of PDEs. by Using Finite Difference Method
2
𝜕𝑢 𝜕 𝑢
= , 0 ≤ 𝑥 ≤ 1, 𝑡 ≥ 0 … … … . . (1)
𝜕𝑡 𝜕𝑥 2
Under the condition that
𝑢(0, 𝑡) = 𝑢(1, 𝑡) = 0
1
𝑢(𝑥, 0) = 2𝑥 𝑓𝑜𝑟 0 ≤ 𝑥 ≤ … … … . . (2)
2

1
𝑢(𝑥, 0) = 2(1 − 𝑥) 𝑓𝑜𝑟 ≤𝑥≤1
2
Solve the above problem by using (a) an explicit method (b) Crank-Nicolson method
Solution:
(a) An explicit method
The finite difference analogue of equation (1) is given by
𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗 𝑢𝑖+1,𝑗 − 2 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗
= … … … … … … (3)
𝑘 ℎ2
Where
𝑥 = 𝑖ℎ, 𝑖 = 1, 2, 3, … …
𝑦 = 𝑗𝑘, 𝑗 = 1, 2, 3, … …
Equation (3) can be written as
𝑢𝑖,𝑗+1 = 𝛼(𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 ) + (1 − 2𝛼)𝑢𝑖,𝑗 … … … . . (4)
Where
𝑘
𝛼=
ℎ2
The schematic representation of equation (4) is shown in figure (7.6)

-8-
Chapter Seven Solution of PDEs. by Using Finite Difference Method

Let ℎ = 0.1 , 𝑘 = 0.001 so that 𝛼 = 0.1. It is clear that the problem is symmetric with respect
to the line 𝑥 = 0.5. The values of equidistant from this line on the either side of it is are equal
1
and so we need the solution only for 0 ≤ 𝑥 ≤ .
2

Taking = 0.1 , the formula (4) can be written as

1
𝑢𝑖,𝑗+1 = (𝑢 + 8 𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 ) … … … . . (5)
10 𝑖+1,𝑗

For 𝑗 = 1
1 1
(a) Sub. 𝑖 = 2 in Eqn(5) 𝑢2,2 =
10
(𝑢3,1 + 8 𝑢2,1 + 𝑢1,1 ) = 10 (0.4 + 8 × 0.2 + 0) = 0.2
1 1
(b) Sub. 𝑖 = 3 in Eqn(5) 𝑢3,2 =
10
(𝑢4,1 + 8 𝑢3,1 + 𝑢2,1 ) = 10 (0.6 + 8 × 0.4 + 0.2) = 0.4
1 1
(c) Sub. 𝑖 = 4 in Eqn(5) 𝑢4,2 =
10
(𝑢5,1 + 8 𝑢4,1 + 𝑢3,1 ) = 10 (0.8 + 8 × 0.6 + 0.4) = 0.6
1 1
(d) Sub. 𝑖 = 5 in Eqn(5) 𝑢5,2 =
10
(𝑢6,1 + 8 𝑢5,1 + 𝑢4,1 ) = 10 (1 + 8 × 0.8 + 0.6) = 0.8
1 1
(e) Sub. 𝑖 = 6 in Eqn(5) 𝑢6,2 =
10
(𝑢7,1 + 8 𝑢6,1 + 𝑢5,1 ) = 10 (0.8 + 8 × 1 + 0.8) = 0.96

-9-
Chapter Seven Solution of PDEs. by Using Finite Difference Method
From symmetry can be find

𝑢7,2 = 𝑢5,2 = 0.8

𝑢8,2 = 𝑢4,2 = 0.6

𝑢9,2 = 𝑢3,2 = 0.4

𝑢10,2 = 𝑢2,2 = 0.2

𝑢11,2 = 𝑢1,2 = 0

Can repeat the same calculations method for 𝑗 = 2 and 𝑖 = 2,3, … … . ,10 etc.

The table (7.1) gives the values of 𝑢 for values of 𝑥 = [0, (0.1), 1 and various values of 𝑡.

Table (7.1)

- 10 -

You might also like