Académique Documents
Professionnel Documents
Culture Documents
Topic 9
KFUPM
(Term 101)
Section 04
Read 29.1-29.2 & 30.1-30.4
CISE301_Topic9
Lecture 37
Partial Differential
Equations
CISE301_Topic9
Partial Differential
Equations
A partial differential equation (PDE) is an
equation that involves an unknown function
and its partial derivatives.
Example :
2 u ( x, t ) u ( x, t )
2
t
x
PDE involves two or more independent variables
(in the example x and t are independent variables)
CISE301_Topic9
Notation
2 u ( x, t )
u xx
x 2
2 u ( x, t )
u xt
x t
Order of the PDE order of the highest order derivative.
CISE301_Topic9
Linear PDE
Classification
Three Independent
main ways to represent
the solution
(Two
Variables)
CISE301_Topic9
T ( x1 , t1 )
T=5.2
t1
T=3.5
x1
Three dimensional
plot of the function
T(x,t)
Heat Equation
ice
ice
x
Thin metal rod insulated
everywhere except at the
edges. At t =0 the rod is
placed in ice
2 T ( x, t ) T ( x, t )
0
2
x
t
T (0, t ) T (1, t ) 0
T ( x,0) sin( x)
CISE301_Topic9
Temperature
Different curve is
used for each value
of t
Temperature at
different x at t=0
Position x
Temperature at
different x at t=h
Examples of PDEs
PDEs are used to model many systems in
many different fields of science and
engineering.
Important Examples:
Laplace Equation
Heat Equation
Wave Equation
CISE301_Topic9
Laplace Equation
2u ( x , y , z ) 2u ( x , y , z ) 2u ( x , y , z )
0
2
2
2
x
y
z
Used to describe the steady state distribution of
heat in a body.
Also used to describe the steady state
distribution of electrical charge in a body.
CISE301_Topic9
Heat Equation
2u 2u 2u
u( x, y , z, t )
2 2
2
t
y
z
x
10
T ( x, t ) T ( x, t )
t
x 2
CISE301_Topic9
11
Wave Equation
2
2
2
2u ( x , y , z , t )
u
2
c
2 2
2
2
t
y
z
x
12
Classification of PDEs
Linear Second order PDEs are important
sets of equations that are used to model
many systems in many different fields of
science and engineering.
CISE301_Topic9
13
CISE301_Topic9
B 2 4 AC 0
Elliptic
B 2 4 AC 0
Parabolic
B 2 4 AC 0
Hyperbolic
14
2u ( x , y ) 2u ( x , y )
0
2
2
x
y
A 1, B 0, C 1 B 2 4 AC 0
Laplace Equation is Elliptic
One possible solution : u( x, y ) e x sin y
u x e x sin y , u xx e x sin y
u y e x cos y , u yy e x sin y
u xx u yy 0
CISE301_Topic9
15
0
2
t
x
A , B 0, C 0 B 2 4 AC 0
Heat Equation is Parabolic
______________________________________
2
2
u
(
x
,
t
)
u ( x, t )
2
Wave Equation c
0
2
2
x
t
A c 2 0, B 0, C 1 B 2 4 AC 0
Wave Equation is Hyperbolic
CISE301_Topic9
16
2u( x, t ) u ( x, t )
Heat Equation :
0
2
t
x
u(0, t ) 0
u(1, t ) 0
u( x,0) sin( x )
CISE301_Topic9
region of
interest
17
CISE301_Topic9
18
Lecture 38
Parabolic
Equations
CISE301_Topic9
Parabolic Equations
Heat Conduction Equation
Explicit Method
Implicit Method
Cranks Nicolson Method
19
Parabolic Equations
A second order linear PDE (2 - independent variables x , y )
A u xx B u xy C u yy D 0,
A, B, and C are functions of x and y
D is a function of x, y, u, u x , and u y
is parabolic if
CISE301_Topic9
B 2 4 AC 0
20
Parabolic Problems
Heat Equation :
T (0, t ) T (1, t ) 0
T ( x,0) sin( x )
T ( x, t ) 2 T ( x, t )
t
x 2
ice
ice
x
* Parabolic problem ( B 2 4 AC 0)
* Boundary conditions are needed to uniquely specify a solution.
CISE301_Topic9
21
Finite Difference
Methods
CISE301_Topic9
x
22
2
2
x
( x )
h2
T
Forward Difference Formula for
:
t
T ( x, t ) Ti , j 1 Ti , j Ti , j 1 Ti , j
t
t
k
CISE301_Topic9
23
CISE301_Topic9
24
Explicit Method
T ( x, t ) 2T ( x, t )
t
x 2
T ( x, t k ) T ( x, t ) T ( x h, t ) 2T ( x, t ) T ( x h, t )
k
h2
k
T ( x, t k ) T ( x, t ) 2 T ( x h, t ) 2T ( x, t ) T ( x h, t )
h
k
Define 2
h
T ( x, t k ) T ( x h, t ) (1 2 ) T ( x, t ) T ( x h, t )
CISE301_Topic9
25
Explicit Method
How Do We Compute?
T ( x, t k ) T ( x h, t ) (1 2 ) T ( x, t ) T ( x h, t )
means
T(x,t+k)
T(x-h,t)
CISE301_Topic9
T(x,t)
T(x+h,t)
26
Convergence and
Stability
CISE301_Topic9
27
Convergence
The solutions converge means that the
solution obtained using the finite difference
method approaches the true solution as the
steps x and t approach zero.
Stability:
An algorithm is stable if the errors at each
stage of the computation are not magnified
as the computation progresses.
CISE301_Topic9
28
Example 1: Heat
Equation
Solve the PDE :
2u(x,t) u(x,t)
0
2
t
x
u(0, t ) u(1, t ) 0
u( x,0) sin( x )
ice
ice
x
29
Example 1
2 u( x, t ) u ( x, t )
0
2
t
x
u ( x h , t ) 2u ( x , t ) u ( x h , t ) u ( x , t k ) u ( x , t )
0
2
k
h
16 u( x h, t ) 2u( x, t ) u( x h, t ) 4 u( x, t k ) u( x, t ) 0
u ( x , t k ) 4 u ( x h , t ) 7 u ( x , t ) 4 u ( x h, t )
CISE301_Topic9
30
Example 1
u ( x , t k ) 4 u ( x h, t ) 7 u ( x , t ) 4 u ( x h, t )
t=1.0
t=0.75
t=0.5
t=0.25
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
31
Example 1
u(0.25,0.25) 4 u(0,0) 7 u(0.25,0) 4 u(0.5,0)
0 7 sin( / 4) 4 sin( / 2) 0.9497
t=1.0
t=0.75
t=0.5
t=0.25
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
32
Example 1
u(0.5,0.25) 4 u(0.25,0) 7 u(0.5,0) 4 u(0.75,0)
4 sin( / 4) 7 sin( / 2) 4 sin(3 / 4) 0.1716
t=1.0
t=0.75
t=0.5
t=0.25
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
33
Remarks on Example 1
The obtained results are probably not accurate
because :
1 2 7
0.03125
2
2
k
For example, choose k 0.025, then 2 0.4
h
CISE301_Topic9
34
Example 1 contd
u( x, t k ) 0.4 u( x h, t ) 0.2 u( x, t ) 0.4 u( x h, t )
t=0.10
t=0.075
t=0.05
t=0.025
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
35
Example 1 contd
u(0.25,0.025) 0.4 u(0,0) 0.2 u(0.25,0) 0.4 u(0.5,0)
0 0.2 sin( / 4) 0.4 sin( / 2) 0.5414
t=0.10
t=0.075
t=0.05
t=0.025
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
36
Example 1 contd
u (0.5,0.025) 0.4 u(0.25,0) 0.2 u (0.5,0) 0.4 u(0.75,0)
0.4 sin( / 4) 0.2 sin( / 2) 0.4 sin(3 / 4) 0.7657
t=0.10
t=0.075
t=0.05
t=0.025
t=0
x=0.0
CISE301_Topic9
x=0.5
x=0.75
x=1.0
37
Crank-Nicolson Method
The method involves solving a Tridiagona l system of linear equations.
The method is stable (No magnification of error).
We can use larger h, k (compared to the Explicit Method).
CISE301_Topic9
38
Crank-Nicolson Method
Based on the finite difference method
1. Divide the interval x into subintervals of width h
2. Divide the interval t into subintervals of width k
3. Replace the first and second partial derivatives with their
backward and central difference formulas respectively :
u( x, t ) u ( x, t ) u ( x, t k )
t
k
2 u ( x , t ) u ( x h , t ) 2u ( x , t ) u ( x h , t )
2
x
h2
CISE301_Topic9
39
Crank-Nicolson Method
2 u( x, t ) u ( x, t )
Heat Equation :
becomes
2
t
x
u ( x h , t ) 2u ( x , t ) u ( x h , t ) u ( x , t ) u ( x , t k )
2
k
h
k
u ( x h , t ) 2u ( x , t ) u ( x h , t ) u ( x , t ) u ( x , t k )
2
h
k
k
k
2 u ( x h, t ) (1 2 2 ) u ( x, t ) 2 u( x h, t ) u ( x, t k )
h
h
h
CISE301_Topic9
40
Crank-Nicolson Method
k
Define 2 then Heat equation becomes :
h
u( x h, t ) (1 2 ) u( x, t ) u( x h, t ) u( x, t k )
u(x-h,t)
u(x,t)
u(x+h,t)
u(x,t - k)
CISE301_Topic9
41
Crank-Nicolson Method
The equation :
u( x h, t ) (1 2 ) u( x, t ) u( x h, t ) u( x, t k )
can be rewritten as :
ui 1, j (1 2 ) ui , j ui 1, j ui , j 1
and can be expanded as a system of equations (fix j 1) :
u0,1 (1 2 ) u1,1 u2,1 u1,0
u1,1 (1 2 ) u2,1 u3,1 u2,0
u2,1 (1 2 ) u3,1 u4,1 u3,0
u3,1 (1 2 ) u4,1 u5,1 u4,0
CISE301_Topic9
42
Crank-Nicolson Method
u( x h, t ) (1 2 ) u( x, t ) u( x h, t ) u( x, t k )
can be expressed as a Tridiagona l system of equations :
u1,1 u1,0 u0,1
u
u
2,0
2,1
u3,0
u3,1
u
u
u
5,1
4,1 4,0
where u1,0 , u2,0 , u3,0 , and u4,0 are the initial temperature values
1 2
1 2
1 2
43
Crank-Nicolson Method
The solution of the tridiagonal system produces :
The temperature values u1,1 , u2,1, u3,1 , and u4,1 at t t0 k
To compute the temperature values at t t0 2k
Solve a second tridiagonal system of equations ( j 2)
1 2
1 2
1 2
u
2 ,1
2, 2
u3,1
u3,2
u
u
u
5, 2
4,2 4,1
44
Example 2
Solve the PDE :
2u( x, t ) u( x, t )
0
2
t
x
u(0, t ) u(1, t ) 0
u( x,0) sin( x )
Solve using Crank - Nicolson method
Use h 0.25, k 0.25 to find u( x, t ) for x [0,1], t [0,1]
CISE301_Topic9
45
Example 2
Crank-Nicolson Method
2 u( x, t ) u( x, t )
0
2
t
x
u ( x h , t ) 2u ( x , t ) u ( x h , t ) u ( x , t ) u ( x , t k )
2
k
h
16 u( x h, t ) 2u( x, t ) u( x h, t ) 4 u( x, t ) u( x, t k ) 0
k
Define 2 4
h
4 u ( x h, t ) 9 u ( x , t ) 4 u ( x h, t ) u ( x , t k )
4 ui 1, j 9 ui , j 4 ui 1, j ui , j 1
CISE301_Topic9
46
Example 2
sin( / 4)
t3=0.75
t2=0.5
t1=0.25
t0=0
CISE301_Topic9
x0=0.0
u1,4
u2,4
u3,4
u1,3
u2,3
u3,3
u1,2
u2,2
u3,2
u1,1
u2,1
0
0
0
u3,1
x2=0.5
x3=0.75
x4=1.0
47
Example 2
Solution of Row 1 at t1=0.25 sec
The Solution of the PDE at t1 0.25 sec is the solution
of the following tridiagonal system of equations :
9 4
u1,1 sin(0.25 )
4 9 4 u sin(0.5 )
2,1
4 9 u3,1 sin(0.75 )
u1,1 0.21151
u2,1 0.29912
u3,1 0.21151
CISE301_Topic9
48
Example 2:
0.21151
t3=0.75
t2=0.5
t1=0.25
t0=0
CISE301_Topic9
x0=0.0
u1,4
u2,4
u3,4
u1,3
u2,3
u3,3
u1,2
u2,2
u3,2
u1,1
u2,1
0
0
0
u3,1
x2=0.5
x3=0.75
x4=1.0
49
Example 2
Solution of Row 2 at t2=0.5 sec
The Solution of the PDE at t2 0.5 sec is the solution
of the following tridiagonal system of equations :
9 4
u1, 2 u1,1 0.21151
4 9 4 u u 0.29912
2, 2 2,1
u1, 2
u2, 2
u3, 2
CISE301_Topic9
0.063267
0.089473
0.063267
50
Example 2
Solution of Row 3 at t3=0.75 sec
The Solution of the PDE at t3 0.75 sec is the solution
of the following tridiagonal system of equations :
9 4
u1,3 u1, 2 0.063267
4 9 4 u u 0.089473
2,3 2, 2
u1,3 0.018924
u2,3 0.026763
u3,3 0.018924
CISE301_Topic9
51
Example 2
Solution of Row 4 at t4=1 sec
The Solution of the PDE at t4 1 sec is the solution
of the following tridiagonal system of equations :
9 4
u1, 4 u1,3 0.018924
4 9 4 u u 0.026763
2, 4 2, 3
u1, 4
u2,4
u3, 4
CISE301_Topic9
0.0056606
0.0080053
0.0056606
52
Remarks
The Explicit Method:
One needs to select small k to ensure stability.
Computation per point is very simple but many
points are needed.
Cranks Nicolson:
CISE301_Topic9
53
Lecture 39
Elliptic
Equations
CISE301_Topic9
Elliptic Equations
Laplace Equation
Solution
54
Elliptic Equations
A second order linear PDE (2 - independent variables x , y )
A u xx B u xy C u yy D 0,
A, B, and C are functions of x and y
D is a function of x, y , u, u x , and u y
is Elliptic if
CISE301_Topic9
B 2 4 AC 0
55
Laplace Equation
Laplace equation appears in several
engineering problems such as:
T ( x, y ) T ( x, y )
f ( x, y )
2
2
x
y
T : steady state temperature at point (x, y)
f ( x, y ) : heat source (or heat sink)
CISE301_Topic9
56
Laplace Equation
2 T ( x, y ) 2 T ( x , y )
f ( x, y )
2
2
x
y
A 1, B 0, C 1
B 2 4 AC 4 0 Elliptic
CISE301_Topic9
57
Solution Technique
A grid is used to divide the region of
interest.
Since the PDE is satisfied at each point in
the area, it must be satisfied at each point
of the grid.
A finite difference approximation is
obtained at each grid point.
2 T ( x, y ) Ti 1, j 2Ti , j Ti 1, j
,
2
2
x
x
CISE301_Topic9
2 T ( x, y ) Ti , j 1 2Ti , j Ti , j 1
2
y
y 2
58
Solution Technique
2 T ( x, y ) Ti 1, j 2Ti , j Ti 1, j
,
2
2
x
x
2 T ( x, y ) Ti , j 1 2Ti , j Ti , j 1
2
2
y
y
2 T ( x, y ) 2 T ( x, y )
0
2
2
x
y
is approximated by :
Ti 1, j 2Ti , j Ti 1, j Ti , j 1 2Ti , j Ti , j 1
0
2
2
x
y
CISE301_Topic9
59
Solution Technique
Ti 1, j 2Ti , j Ti 1, j
Ti , j 1 2Ti , j Ti , j 1
60
Solution Technique
Ti , j 1
Ti 1, j
Ti , j
Ti 1, j
Ti , j 1
Ti 1, j Ti 1, j Ti , j 1 Ti , j 1 4Ti , j 0
CISE301_Topic9
61
Example
It is required to determine the steady
state temperature at all points of a heated
sheet of metal. The edges of the sheet are
kept at a constant temperature: 100, 50,
0, and 75 degrees.
100
75
50
0
62
Known
Example
T1, 4 100
T0,3 75
T0, 2 75
T0,1 75
T2, 4 100
T3, 4 100
T1,3
T2,3
T3,3
T4,3 50
T1, 2
T2, 2
T3, 2
T4, 2 50
T1,1
T2,1
T3,1
T4,1 50
T1, 0 0
CISE301_Topic9
To be determined
T2, 0 0
T3, 0 0
63
Known
First Equation
T1, 4 100
T1,3
T0,3 75
T0, 2 75
T1, 2
To be determined
T2, 4 100
T2,3
T2, 2
64
Known
Another Equation
T1, 4 100
T2, 4 100
To be determined
T3, 4 100
T1,3
T2,3
T3,3
T1, 2
T2, 2
T3, 2
65
Solution
The Rest of the Equations
4 1 0 1
1 4 1 0 1
0 1 4
0
0 1
0
4 1 0 1
1 0
1 0 1 4 1 0 1
1 0 1 4
0
0 1
1
0
0
4
1
0
1 0 1 4 1
1
0
1
4
CISE301_Topic9
T1,1
T2,1
T
3,1
T1, 2
T
2, 2
T3,2
T
1,3
T2,3
T3,3
75
0
50
75
0
50
175
100
150
66