SE301: Numerical Methods Topic 9 Partial Differential Equations (PDEs) Lectures 37-39

Post on 10-Jan-2016

53 views 1 download

description

SE301: Numerical Methods Topic 9 Partial Differential Equations (PDEs) Lectures 37-39. KFUPM Read 29.1-29.2 & 30.1-30.4. L ecture 37 Partial Differential Equations. Partial Differential Equations (PDEs). What is a PDE? Examples of Important PDEs. Classification of PDEs. - PowerPoint PPT Presentation

transcript

CISE301_Topic9 KFUPM 1

SE301: Numerical Methods

Topic 9 Partial Differential Equations

(PDEs)Lectures 37-39

KFUPM

Read 29.1-29.2 & 30.1-30.4

CISE301_Topic9 KFUPM 2

Lecture 37Partial Differential

Equations

Partial Differential Equations (PDEs). What is a PDE? Examples of Important PDEs. Classification of PDEs.

CISE301_Topic9 KFUPM 3

Partial Differential Equations

s)t variableindependen are and example (in the

st variableindependen moreor twoinvolves PDE

),(),(

:Examples

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 KFUPM 4

Notation

.derivativeorder highest theoforder PDE theofOrder

),(

),(

2

2

2

tx

txuu

x

txuu

xt

xx

CISE301_Topic9 KFUPM 5

Linear PDEClassification

0322

032

032

PDENonlinear of Examples

0432

0)2cos(4312

:PDElinear of Example

sderivative its andfunction

unknown in thelinear isit iflinear is PDEA

2

ttxtxx

txtxx

ttxtxx

xtxx

xttxtxx

uuuu

uuu

uuu

uuu

tuuuu

CISE301_Topic9 KFUPM 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 KFUPM 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 KFUPM 8

Heat Equation

)sin()0,(

0),1(),0(

0),(),(

2

2

xxT

tTtTt

txT

x

txT

x

ice iceTime t

Temperature T(x,t)

Position xx1

t1

),( 11 txT

CISE301_Topic9 KFUPM 9

Linear Second Order PDEsClassification

Elliptic04

Hyperbolic04

Parabolic04

:follows as 4on based classfied is

and ,, y, x,offunction a is D

y and x of functions are C and B, A,

,0

s)t variableindependen-(2 PDElinear order secondA

2

2

2

2

ACB

ACB

ACB

AC)(B

uuu

DuCuBuA

yx

yyxyxx

CISE301_Topic9 KFUPM 10

Linear Second Order PDEExamples (Classification)

Hyperbolicis

ACBCBA

t

txu

x

txu

Parabolicis

ACBCBkA

t

txT

x

txTk

Equation Wave

041,0,1

0),(),(

Equation Wave

______________________________________

EquationHeat

040,0,

0),(),(

EquationHeat

2

2

2

2

2

2

2

2

CISE301_Topic9 KFUPM 11

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 KFUPM 12

Examples of PDEs PDEs are used to model many systems in

many different fields of science and engineering.

Important Examples: Wave Equation Heat Equation Laplace Equation Biharmonic Equation

CISE301_Topic9 KFUPM 13

Heat Equation

t

tzyxu

z

tzyxu

y

tzyxu

x

tzyxu

),,,(),,,(),,,(),,,(2

2

2

2

2

2

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) .

CISE301_Topic9 KFUPM 14

Simpler Heat Equation

t

txu

x

txu

),(),(2

2

u(x,t) is used to represent the temperature at time t at the point x of the thin rod.

x

CISE301_Topic9 KFUPM 15

Wave Equation

2

2

2

2

2

2

2

2 ),,,(),,,(),,,(),,,(

t

tzyxu

z

tzyxu

y

tzyxu

x

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) .

Used to model movement of 3D elastic body.

CISE301_Topic9 KFUPM 16

Laplace Equation

0),,,(),,,(),,,(

2

2

2

2

2

2

z

tzyxu

y

tzyxu

x

tzyxu

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 KFUPM 17

Biharmonic Equation

0),,(),,(

2),,(

4

4

22

4

4

4

y

tyxu

yx

tyxu

x

tyxu

Used in the study of elastic stress.

CISE301_Topic9 KFUPM 18

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),(),(

:EquationHeat2

2

xxu

tu

tut

txu

x

txu

region of interest

x1

t

CISE301_Topic9 KFUPM 19

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 KFUPM 20

Lecture 38Parabolic Equations

Parabolic Equations Heat Conduction Equation Explicit Method Implicit Method Cranks Nicolson Method

CISE301_Topic9 KFUPM 21

Parabolic Equations

04 if parabolic is

and ,, y, x,offunction a is D

y and x of functions are C and B, A,

,0

y) , x st variableindependen-(2 PDElinear order secondA

2

ACB

uuu

DuCuBuA

yx

yyxyxx

CISE301_Topic9 KFUPM 22

Parabolic Problems

solution. aspecify uniquely toneeded are conditionsBoundary *

)04( problem Parabolic *

)sin()0,(

0),1(),0(

0),(),(

:EquationHeat

2

2

2

ACB

xxT

tTtTt

txT

x

txT

x

ice ice

CISE301_Topic9 KFUPM 23

First Order Partial Derivative Finite Difference

x

TT

x

T

x

TT

x

T

x

TT

x

T jijijijijiji

,1,,,1,1,1 ,

2

ForwardDifferenceMethod

Central Difference Method

Backward Difference

Method

CISE301_Topic9 KFUPM 24

Finite Difference Methods

t

TT

t

txT

x

TT

x

txT

t

TTT

t

txu

x

TTT

x

txT

x

TT

x

txT

jijijiji

jijiji

jijiji

jiji

,1,,,1

2

1,,1,

2

2

2

,1,,1

2

2

,1,1

),(,

),(

:Formula DifferenceForward

)(

2),(

)(

2),(

2

),(

: FormulasDifferenceCentral

t]and x offunction is T [ formula difference finiteby sderivative theReplace

CISE301_Topic9 KFUPM 25

Finite Difference MethodsNew Notation

t

TT

t

txT

x

TT

x

txT

t

TTT

t

txT

x

TTT

x

txT

x

TT

x

txT

li

li

li

li

li

li

li

li

li

li

li

li

11

2

11

2

2

211

2

2

11

),(,

),(

:Formula DifferenceForward

)(

2),(

)(

2),(

2

),(

: FormulasDifferenceCentralSuperscript for t-axis

andSubscript for x-axisTil-1=Ti,j-1=T(x,t-∆t)

CISE301_Topic9 KFUPM 26

Solution of the PDEs

points. grid at the t)T(x, of value theDetermine

:meansSolution

)sin()0,(

0),1(),0(

0),(),(

EquationHeat2

2

xxT

tTtTt

txT

x

txT

t

x

CISE301_Topic9 KFUPM 27

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 KFUPM 28

Explicit Method

),(),()21(),(),(

0),(),(1

),(),(2),(1

),(),(),(),(2),(

0),(),(

2

2

2

2

2

thxutxuthxuktxuh

kDefine

txuktxuk

thxutxuthxuh

k

txuktxu

h

thxutxuthxut

txu

x

txu

CISE301_Topic9 KFUPM 29

Explicit MethodHow Do We Compute?

means

thxutxuthxuktxu ),(),()21(),(),(

u(x-h,t) u(x,t) u(x+h,t)

u(x,t+k)

CISE301_Topic9 KFUPM 30

Explicit MethodHow Do We Compute?

means

thxutxuthxuktxu ),(),()21(),(),(

CISE301_Topic9 KFUPM 31

Explicit Method

.slowit makes This

.2

0)21( stability, guarantee To

.magnified are errors unstable beCan

),(),()21(),(),(

:usingdirectly computed becan ),(

2h kor

thxutxuthxuktxu

ktxu

CISE301_Topic9 KFUPM 32

Crank-Nicolson Method

),(),(),(),(

2,

0),(),(1

),(),(2),(1

),(),(),(),(2),(

0),(),(

2

2

2

2

2

thxutxurthxuktxus

srk

hsDefine

ktxutxuk

thxutxuthxuh

k

ktxutxu

h

thxutxuthxut

txu

x

txu

CISE301_Topic9 KFUPM 33

Explicit MethodHow Do We Compute?

means

thxutxurthxuktxus ),(),(),(),(

u(x-h,t) u(x,t) u(x+h,t)

u(x,t - k)

CISE301_Topic9 KFUPM 34

Crank-Nicolson Method

4

3

2

1

4

3

2

1

1

11

11

1

:equations of system lTridiagona a as expressed becan

),(),(),(),(

:equation The

b

b

b

b

u

u

u

u

r

r

r

r

thxutxurthxuktxus

CISE301_Topic9 KFUPM 35

Crank-Nicolson Method

Method).Explicit the to(comparedk h,larger usecan We

error). ofion magnificat (No stable is method The

equations.linear of system lTridiagona a solving involves method The

CISE301_Topic9 KFUPM 36

Examples

Explicit method to solve Parabolic PDEs.

Cranks-Nicholson Method.

CISE301_Topic9 KFUPM 37

Heat Equation

solution. aspecify uniquely toneeded are conditionsAuxiliary *

)04( problem Parabolic *

)sin()0,(

0),1(),0(

0),(),(

2

2

2

ACB

xxu

tutut

txu

x

txu

x

ice ice

CISE301_Topic9 KFUPM 38

Example 1

4

]1,0[],1,0[for x)u(t, find to25.0,25.0

)sin()0,(

0),1(),0(

0

:PDE theSolve

2

2

2

h

k

txkhUse

xxu

tutut

u(x,t)

x

u(x,t)

CISE301_Topic9 KFUPM 39

Example 1 (Cont.)

),(4),(7),(4),(

0),(),(4),(),(2),(16

0),(),(),(),(2),(

0),(),(

2

2

2

thxutxuthxuktxu

txuktxuthxutxuthxu

k

txuktxu

h

thxutxuthxu

t

txu

x

txu

CISE301_Topic9 KFUPM 40

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 KFUPM 41

Example 1

9497.00)4/sin(7)2/sin(4

)0,0(4)0,25(.7)0,5(.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 KFUPM 42

Example 1

1716.0)4/sin(4)2/sin(7)4/3sin(4

)0,25.0(4)0,5.0(7)0,75.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 KFUPM 43

Remarks on Example 1

0.025kLet

0.03125kselect toneeds One

021 :results accurateFor

721 :because

accuratenot probably are results obtained The

CISE301_Topic9 KFUPM 44

Example 1),(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 KFUPM 45

Example 1

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.54140)4/sin(2.)2/sin(4.0

)0,0(4.0)0,25.0(2.0)0,5.0(4.0)025.0,25.0(

uuuu

CISE301_Topic9 KFUPM 46

Example 1

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/sin(4.0)2/sin(2.)4/3sin(4.0

)0,25.0(4.0)0,5.0(2.0)0,75.0(4.0)025.0,5.0(

uuuu

CISE301_Topic9 KFUPM 47

Example 2

]1,0[],1,0[for x)u(t, find to25.0,25.0

methodNicolson -Crank using Solve

)sin()0,(

0),1(),0(

0

:PDE theSolve

2

2

txkhUse

xxu

tutut

u(x,t)

x

u(x,t)

CISE301_Topic9 KFUPM 48

Example 2Crank-Nicolson Method

),(),(25.2),(),(25.0

25.22,25.0

0),(),(4),(),(2),(16

),(),(),(),(2),(

0),(),(

2

2

2

2

thxtxuthxuktxu

srk

hsDefine

ktxutxuthxutxuthxu

k

ktxutxu

h

thxutxuthxu

t

txu

x

txu

CISE301_Topic9 KFUPM 49

Example 2

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π)

2125.20)25.0sin(25.0

)25.0,5.0()25.0,25.0(25.2)25.0,0()25.0,0.0(25.0

uu

uuuu

u1 u2 u3

CISE301_Topic9 KFUPM 50

Example 2

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π)

321 25.2)5.0sin(25.0

)25.0,75.0()25.0,5(.25.2)25.0,25.0()5.0,0(25.0

uuu

uuuu

u1 u2 u3

CISE301_Topic9 KFUPM 51

Example 2

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π)

025.2)75.0sin(25.0

)25.0,1()25.0,75(.25.2)25.0,5.0()0,75.0(25.0

32

uu

uuuu

u1 u2 u3

CISE301_Topic9 KFUPM 52

Example 2Crank-Nicolson Method

21151.0

2912.0

21152.0

)75.0sin(25.0

)5.0sin(25.0

)25.0sin(25.0

25.21

125.21

1252

:system al tridiagonfollowing

theofsolution a toconverted is PDE theofsolution The

3

2

1

3

2

1

u

u

u

u

u

u.

CISE301_Topic9 KFUPM 53

Example 2Second Row

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π)

2125.202115.0

)5.0,5.0()5.0,25.0(25.2)5.0,0()25.0,25.0(25.0

uu

uuuu

0.2115 0.2991 0.2115

u1 u2 u3

CISE301_Topic9 KFUPM 54

Example 2The process is continued until the values of u(x,t) on the desired grid are computed.

CISE301_Topic9 KFUPM 55

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 KFUPM 56

Lecture 39Elliptic

Equations Elliptic Equations Laplace Equation Solution

CISE301_Topic9 KFUPM 57

Elliptic Equations

04 if Elliptic is

and ,, y, x,offunction a is D

y and x of functions are C and B, A,

,0

y) , x st variableindependen-(2 PDElinear order secondA

2

ACB

uuu

DuCuBuA

yx

yyxyxx

CISE301_Topic9 KFUPM 58

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)f(x,

y)(x,point at re temperatustatesteady :

),(),(),(

2

2

2

2

T

yxfy

yxT

x

yxT

CISE301_Topic9 KFUPM 59

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 KFUPM 60

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 KFUPM 61

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 KFUPM 62

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 KFUPM 63

Solution Technique

jiT ,1jiT ,jiT ,1

1, jiT

1, jiT

04 ,1,1,,1,1 jijijijiji TTTTT

CISE301_Topic9 KFUPM 64

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 KFUPM 65

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 KFUPM 66

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 KFUPM 67

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 KFUPM 68

Solution The Rest of the Equations

150

100

175

50

0

75

50

0

75

4101

14101

014001

1004101

1014101

1014001

100410

10141

1014

33

23

13

32

22

12

31

21

11

T

T

T

T

T

T

T

T

T

CISE301_Topic9 KFUPM 69

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