cise301_topic91 cise301: numerical methods topic 9 partial differential equations (pdes) lectures...
TRANSCRIPT
CISE301_Topic9 1
CISE301: Numerical Methods
Topic 9 Partial Differential Equations
(PDEs)Lectures 37-39
KFUPM(Term 101)Section 04
Read 29.1-29.2 & 30.1-30.4
CISE301_Topic9 2
Lecture 37Partial Differential
Equations
Partial Differential Equations (PDEs). What is a PDE? Examples of Important PDEs. Classification of PDEs.
CISE301_Topic9 3
Partial Differential Equations
s)t variableindependen are and example the(in
st variableindependen moreor twoinvolves PDE
),(),(
:Example
2
2
tx
t
txu
x
txu
A partial differential equation (PDE) is an equation that involves an unknown function and its partial derivatives.
CISE301_Topic9 4
Notation
.derivativeorder highest theoforder PDE theofOrder
),(
),(
2
2
2
tx
txuu
x
txuu
xt
xx
CISE301_Topic9 5
Linear PDEClassification
0322
032
032
PDENonlinear of Examples
0432
0)2cos(4312
:linear PDE of Example
sderivative its and function
unknown theinlinear isit iflinear is PDEA
2
ttxtxx
txtxx
ttxtxx
xtxx
xttxtxx
uuuu
uuu
uuu
uuu
tuuuu
CISE301_Topic9 6
Representing the Solution of a PDE(Two Independent Variables) Three main ways to represent the solution
Different curves are used for different values of one of the independent variable
x1
t1
),( 11 txT
Three dimensional plot of the function T(x,t)
The axis represent the independent variables. The value of the function is displayed at grid points
T=3.5
T=5.2
CISE301_Topic9 7
Heat Equation
)sin()0,(
0),1(),0(
0),(),(
2
2
xxT
tTtTt
txT
x
txT
x
ice iceTemperature at different x at t=0
Temperature at different x at t=h
Temperature
Position x
Thin metal rod insulated everywhere except at the edges. At t =0 the rod is placed in ice
Different curve is used for each value
of t
CISE301_Topic9 8
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 9
Laplace Equation
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.
0),,(),,(),,(
2
2
2
2
2
2
z
zyxu
y
zyxu
x
zyxu
CISE301_Topic9 10
Heat Equation
2
2
2
2
2
2
),,,(
z
u
y
u
x
u
t
tzyxu
The function u(x,y,z,t) is used to represent the temperature at time t in a physical body at a point with coordinates (x,y,z)
is the thermal diffusivity. It is sufficient to consider the case = 1.
CISE301_Topic9 11
Simpler Heat Equation
2
2 ),(),(
x
txT
t
txT
T(x,t) is used to represent the temperature at time t at the point x of the thin rod.
x
CISE301_Topic9 12
Wave Equation
2
2
2
2
2
22
2
2
),,,(
z
u
y
u
x
uc
t
tzyxu
The function u(x,y,z,t) is used to represent the displacement at time t of a particle whose position at rest is (x,y,z) .
The constant c represents the propagation speed of the wave.
CISE301_Topic9 13
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.
Classification is important because: Each category relates to specific engineering
problems. Different approaches are used to solve these
categories.
CISE301_Topic9 14
Linear Second Order PDEsClassification
Hyperbolic04
Parabolic04
Elliptic04
:follows as 4 on based classified is
and ,, ,, of functiona is D
and of functions are C and B,A,
,0
s)t variableindependen-(2 Elinear PDorder second A
2
2
2
2
ACB
ACB
ACB
AC)(B
uuuyx
yx
DuCuBuA
yx
yyxyxx
CISE301_Topic9 15
Linear Second Order PDEExamples (Classification)
0
sin ,cos
sin ,sin
sin),( :solution possible One
EquationLaplace
041,0,1
0),(),(
EquationLaplace
2
2
2
2
2
yyxx
xyy
xy
xxx
xx
x
uu
yeuyeu
yeuyeu
yeyxu
Ellipticis
ACBCBA
y
yxu
x
yxu
CISE301_Topic9 16
Linear Second Order PDEExamples (Classification)
Hyperbolicis
ACBCBcA
t
txu
x
txuc
Parabolicis
ACBCBA
t
txu
x
txu
Equation Wave
041 ,0 ,0
0),(),(
Equation Wave
______________________________________
EquationHeat
040 ,0 ,
0),(),(
EquationHeat
22
2
2
2
22
2
2
2
CISE301_Topic9 17
Boundary Conditions for PDEs To uniquely specify a solution to the PDE,
a set of boundary conditions are needed. Both regular and irregular boundaries are
possible.
)sin()0,(
0),1(
0),0(
0),(),(
:EquationHeat 2
2
xxu
tu
tut
txu
x
txu
region of interest
x1
t
CISE301_Topic9 18
The Solution Methods for PDEs Analytic solutions are possible for simple
and special (idealized) cases only.
To make use of the nature of the equations, different methods are used to solve different classes of PDEs.
The methods discussed here are based on the finite difference technique.
CISE301_Topic9 19
Lecture 38Parabolic Equations
Parabolic Equations Heat Conduction Equation Explicit Method Implicit Method Cranks Nicolson Method
CISE301_Topic9 20
Parabolic Equations
04 if parabolic is
and ,, y,x, of functiona is D
yandx of functions are C and B,A,
,0
) , st variableindependen-(2 linear PDEorder second A
2
ACB
uuu
DuCuBuA
yx
yx
yyxyxx
CISE301_Topic9 21
Parabolic Problems
solution.a specify uniquely toneeded are conditionsBoundary *
)04( problem lic Parabo*
)sin()0,(
0),1(),0(
),(),(:EquationHeat
2
2
2
ACB
xxT
tTtTx
txT
t
txT
x
ice ice
CISE301_Topic9 22
Finite Difference Methods
t
x
Divide the interval x into sub-intervals, each of width h
Divide the interval t into sub-intervals, each of width k
A grid of points is used forthe finite difference solution
Ti,j represents T(xi, tj) Replace the derivates by
finite-difference formulas
CISE301_Topic9 23
Finite Difference Methods
k
TT
t
TT
t
txT
t
T
h
TTT
x
TTT
x
txT
x
T
jijijiji
jijijijijiji
,1,,1,
2,1,,1
2,1,,1
2
2
2
2
),(
:for Formula DifferenceForward
2
)(
2),(
:for Formula DifferenceCentral
formulas difference finiteby sderivative theReplace
CISE301_Topic9 24
Solution of the Heat Equation
• Two solutions to the Parabolic Equation (Heat Equation) will be presented:
1. Explicit Method:
Simple, Stability Problems.
2. Crank-Nicolson Method:
Involves the solution of a Tridiagonal system of equations, Stable.
CISE301_Topic9 25
Explicit Method
),(),()21(),(),(
),(),(2),(),(),(
),(),(2),(),(),(
),(),(
2
2
2
2
2
thxTtxTthxTktxTh
kDefine
thxTtxTthxTh
ktxTktxT
h
thxTtxTthxT
k
txTktxTx
txT
t
txT
CISE301_Topic9 26
Explicit MethodHow Do We Compute?
means
thxTtxTthxTktxT ),(),()21(),(),(
T(x-h,t) T(x,t) T(x+h,t)
T(x,t+k)
CISE301_Topic9 27
Convergence and Stability
.slowit makes This
ansmaller th much is that means This2
2
10)21( stability, guarantee To
magnified are errors unstable be Can
),(),()21(),(),(
:usingdirectly computed be can),(
2
hk
hk
thxTtxTthxTktxT
ktxT
CISE301_Topic9 28
Convergence and Stability of the Solution Convergence
The solutions converge means that the solution obtained using the finite difference method approaches the true solution as the steps approach zero.
Stability: An algorithm is stable if the errors at each
stage of the computation are not magnified as the computation progresses.
tx and
CISE301_Topic9 29
Example 1: Heat Equation
4
]1,0[],1,0[for ),( find to25.0,25.0
)sin()0,(
0),1(),0(
0
: PDE theSolve
2
2
2
h
k
txtxukhUse
xxu
tutut
u(x,t)
x
u(x,t)
x
ice ice
CISE301_Topic9 30
Example 1
),(4),(7),(4),(
0),(),(4),(),(2),(16
0),(),(),(),(2),(
0),(),(
2
2
2
thxutxuthxuktxu
txuktxuthxutxuthxuk
txuktxu
h
thxutxuthxut
txu
x
txu
CISE301_Topic9 31
Example 1),(4),(7),(4),( thxutxuthxuktxu
t=0
t=0.25
t=0.5
t=0.75
t=1.0
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
CISE301_Topic9 32
Example 1
9497.0)2/sin(4)4/sin(70
)0,5.0(4)0,25.0(7)0,0(4)25.0,25.0(
uuuu
t=0
t=0.25
t=0.5
t=0.75
t=1.0
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
CISE301_Topic9 33
Example 1
1716.0)4/3sin(4)2/sin(7)4/sin(4
)0,75.0(4)0,5.0(7)0,25.0(4)25.0,5.0(
uuuu
t=0
t=0.25
t=0.5
t=0.75
t=1.0
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
CISE301_Topic9 34
Remarks on Example 1
4.0 then0.025,choose example,For
0.031252
(0.25)
2select toneeds One
021 :results accurateFor
721 :because
accuratenot probably are results obtained The
2
22
h
kk
hk
CISE301_Topic9 35
Example 1 – cont’d),(4.0),(2.0),(4.0),( thxutxuthxuktxu
t=0
t=0.025
t=0.05
t=0.075
t=0.10
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
CISE301_Topic9 36
Example 1 – cont’d
t=0
t=0.025
t=0.05
t=0.075
t=0.10
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
0.5414)2/sin(4.0)4/sin(2.00
)0,5.0(4.0)0,25.0(2.0)0,0(4.0)025.0,25.0(
uuuu
CISE301_Topic9 37
Example 1 – cont’d
t=0
t=0.025
t=0.05
t=0.075
t=0.10
x=0.25 x=0.5x=0.0 x=0.75 x=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
0.7657)4/3sin(4.0)2/sin(2.0)4/sin(4.0
)0,75.0(4.0)0,5.0(2.0)0,25.0(4.0)025.0,5.0(
uuuu
CISE301_Topic9 38
Crank-Nicolson Method
Method). Explicit the to(compared ,larger use can We
error). of ionmagnificat (No stable is method The
equations.linear of system lTridiagonaa solving involves method The
kh
CISE301_Topic9 39
Crank-Nicolson Method
22
2 ),(),(2),(),(
),(),(),(
:lyrespective formulas and
their withsderivative partial second andfirst the Replace3.
widthof lssubinterva into interval the Divide2.
widthof lssubinterva into interval the Divide1.
method difference finite theon Based
h
thxutxuthxu
x
txu
k
ktxutxu
t
txu
fferencecentral dibackward
kt
hx
CISE301_Topic9 40
Crank-Nicolson Method
),(),(),( )21(),(
),(),(),(),(2),(
),(),(),(),(2),(
becomes ),(),(
:ionHeat Equat
222
2
2
2
2
ktxuthxuh
ktxu
h
kthxu
h
k
ktxutxuthxutxuthxuh
kk
ktxutxu
h
thxutxuthxu
t
txu
x
txu
CISE301_Topic9 41
Crank-Nicolson Method
),(),(),()21(),(
:becomes equation Heat then Define 2
ktxuthxutxuthxuh
k
u(x-h,t) u(x,t) u(x+h,t)
u(x,t - k)
CISE301_Topic9 42
Crank-Nicolson Method
0,41,51,41,3
0,31,41,31,2
0,21,31,21,1
0,11,21,11,0
1,,1,,1
)21(
)21(
)21(
)21(
:)1(fix equations of systema as expanded be can and
)21(
:as rewritten be can
),(),(),()21(),(
:equation The
uuuu
uuuu
uuuu
uuuu
j
uuuu
ktxuthxutxuthxu
jijijiji
CISE301_Topic9 43
Crank-Nicolson Method
hxxxuu
hxhxhxhxx
uuuu
uu
u
u
uu
u
u
u
u
ktxuthxutxuthxu
5 and at aluesboundary v theare and
4 and ,3 ,2 ,at
valuesre temperatuinitial theare and , , , where
21
21
21
21
:equations of system lTridiagonaa as expressed be can
),(),(),()21(),(
001,51,0
0000
0,40,30,20,1
1,50,4
0,3
0,2
1,00,1
1,4
1,3
1,2
1,1
CISE301_Topic9 44
Crank-Nicolson Method
etc. ,3at valuesre temperatucompute tostep above Repeat the
and , , , compute To
21
21
21
21
)2( equations of system al tridiagonseconda Solve
2at valuesre temperatu thecompute To
at and , , , valuesre temperatuThe
:produces system al tridiagon theof solution The
0
2,42,32,22,1
2,51,4
1,3
1,2
2,01,1
2,4
2,3
2,2
2,1
0
01,41,31,21,1
kt
uuuu
uu
u
u
uu
u
u
u
u
j
ktt
kttuuuu
CISE301_Topic9 45
Example 2
]1,0[],1,0[for ),( find to25.0,25.0
method Nicolson-Crank using Solve
)sin()0,(
0),1(),0(
0),(),(
: PDE theSolve
2
2
txtxukhUse
xxu
tutut
txu
x
txu
CISE301_Topic9 46
Example 2Crank-Nicolson Method
1,,1,,1
2
2
2
2
4 9 4
),(),( 4),( 9),( 4
4
0),(),(4),(),(2),(16
),(),(),(),(2),(
0),(),(
jijijiji uuuu
ktxuthxutxuthxuh
kDefine
ktxutxuthxutxuthxuk
ktxutxu
h
thxutxuthxut
txu
x
txu
CISE301_Topic9 47
Example 2
)4/3sin(94 494
)2/sin(494494
)4/sin( 49 494
1,31,20,31,41,31,2
1,31,21,10,21,31,21,1
1,21,10,11,21,11,0
uuuuuu
uuuuuuu
uuuuuu
u1,1 u2,1 u3,1
t0=0
t1=0.25
t2=0.5
t3=0.75
t4=1.0
x1=0.25 x2=0.5x0=0.0 x3=0.75 x4=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
u1,4 u2,4 u3,4
u1,3 u2,3 u3,3
u1,2 u2,2 u3,2
CISE301_Topic9 48
Example 2Solution of Row 1 at t1=0.25 sec
21151.0
29912.0
21151.0
)75.0sin(
)5.0sin(
)25.0sin(
94
494
49
:equations of system al tridiagonfollowing theof
solution theis sec 25.0at PDE theof Solution The
1,3
1,2
1,1
1,3
1,2
1,1
1
u
u
u
u
u
u
t
CISE301_Topic9 49
Example 2: Second Row at t2=0.5 sec
21151.094 494
29912.0494494
21151.0 49 494
2,32,21,32,42,32,2
2,32,22,11,22,32,22,1
2,22,11,12,22,12,0
uuuuuu
uuuuuuu
uuuuuu
u1,1 u2,1 u3,1
t0=0
t1=0.25
t2=0.5
t3=0.75
t4=1.0
x1=0.25 x2=0.5x0=0.0 x3=0.75 x4=1.0
0
0
0
0
0
0
0
0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
u1,4 u2,4 u3,4
u1,3 u2,3 u3,3
u1,2 u2,2 u3,2
CISE301_Topic9 50
Example 2Solution of Row 2 at t2=0.5 sec
063267.0
089473.0
063267.0
21151.0
29912.0
21151.0
94
494
49
:equations of system al tridiagonfollowing theof
solution theis sec 5.0at PDE theof Solution The
2,3
2,2
2,1
1,3
1,2
1,1
2,3
2,2
2,1
2
u
u
u
u
u
u
u
u
u
t
CISE301_Topic9 51
Example 2Solution of Row 3 at t3=0.75 sec
018924.0
026763.0
018924.0
063267.0
089473.0
063267.0
94
494
49
:equations of system al tridiagonfollowing theof
solution theis sec 75.0at PDE theof Solution The
3,3
3,2
3,1
2,3
2,2
2,1
3,3
3,2
3,1
3
u
u
u
u
u
u
u
u
u
t
CISE301_Topic9 52
Example 2Solution of Row 4 at t4=1 sec
0056606.0
0080053.0
0056606.0
018924.0
026763.0
018924.0
94
494
49
:equations of system al tridiagonfollowing theof
solution theis sec 1at PDE theof Solution The
4,3
4,2
4,1
3,3
3,2
3,1
4,3
4,2
4,1
4
u
u
u
u
u
u
u
u
u
t
CISE301_Topic9 53
RemarksThe Explicit Method:
•One needs to select small k to ensure stability.
•Computation per point is very simple but many points are needed.
Cranks Nicolson:
• Requires the solution of a Tridiagonal system.
• Stable (Larger k can be used).
CISE301_Topic9 54
Lecture 39Elliptic
Equations Elliptic Equations Laplace Equation Solution
CISE301_Topic9 55
Elliptic Equations
04 if Ellipticis
and ,, ,, of functiona is D
and of functions are C and B,A,
,0
) , st variableindependen-(2 linear PDEorder second A
2
ACB
uuuyx
yx
DuCuBuA
yx
yx
yyxyxx
CISE301_Topic9 56
Laplace Equation Laplace equation appears in several
engineering problems such as: Studying the steady state distribution of heat in a
body. Studying the steady state distribution of electrical
charge in a body.
sink)heat (or sourceheat :),(
y)(x,point at re temperatustatesteady :
),(),(),(
2
2
2
2
yxf
T
yxfy
yxT
x
yxT
CISE301_Topic9 57
Laplace Equation
EllipticACB
CBA
yxfy
yxT
x
yxT
044
1,0,1
),(),(),(
2
2
2
2
2
Temperature is a function of the position (x and y)
When no heat source is available f(x,y)=0
CISE301_Topic9 58
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
1,,1,
2
2
2
,1,,1
2
2 2),(,
2),(
y
TTT
y
yxT
x
TTT
x
yxT jijijijijiji
CISE301_Topic9 59
Solution Technique
0
22
:by edapproximat is
0),(),(
2),(
,2),(
2
1,,1,
2
,1,,1
2
2
2
2
2
1,,1,
2
2
2
,1,,1
2
2
y
TTT
x
TTT
y
yxT
x
yxT
y
TTT
y
yxT
x
TTT
x
yxT
jijijijijiji
jijiji
jijiji
CISE301_Topic9 60
Solution Technique
04
:
) (
022
,1,1,,1,1
2
1,,1,
2
,1,,1
jijijijiji
jijijijijiji
TTTTT
hyxAssume
EquationDifferenceLaplacian
y
TTT
x
TTT
CISE301_Topic9 61
Solution Technique
jiT ,1jiT ,jiT ,1
1, jiT
1, jiT
04 ,1,1,,1,1 jijijijiji TTTTT
CISE301_Topic9 62
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.
50
0
100
75
The sheet is divided to 5X5 grids.
CISE301_Topic9 63
Example1004,1 T 1004,2 T 1004,3 T
503,4 T
502,4 T
501,4 T
753,0 T
752,0 T
751,0 T
00,1 T 00,2 T 00,3 T
Known
To be determined
3,1T
2,1T
1,1T
3,2T
2,2T
1,2T
3,3T
2,3T
1,3T
CISE301_Topic9 64
First Equation1004,1 T 1004,2 T
753,0 T
752,0 T
Known
To be determined
3,1T
2,1T
3,2T
2,2T
0410075
04
3,13,22,1
3,13,22,14,13,0
TTT
TTTTT
CISE301_Topic9 65
Another Equation1004,1 T 1004,2 T 1004,3 T
Known
To be determined
3,1T
2,1T
3,2T
2,2T
3,3T
2,3T
04100
04
3,22,23,33,1
3,22,23,34,23,1
TTTT
TTTTT
CISE301_Topic9 66
Solution The Rest of the Equations
150
100
175
50
0
75
50
0
75
4101
14101
014001
1004101
1014101
1014001
100410
10141
1014
3,3
3,2
3,1
2,3
2,2
2,1
1,3
1,2
1,1
T
T
T
T
T
T
T
T
T