scientific computing partial differential equations introduction and finite difference formulas

31
Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Upload: lynette-cunningham

Post on 16-Jan-2016

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Scientific Computing

Partial Differential EquationsIntroduction and

Finite Difference Formulas

Page 2: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Partial Differential Equations

• A partial differential equation (PDE) is an equation involving partial derivatives of an unknown function of two or more independent variables

• The following are examples. Note: u may depend on spatial variables and possibly a time variable.

Page 3: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Partial Differential Equations

yuy

ux

yx

u

t

u

yx

u

x

u

uy

uxy

x

u

58

6

12

22

22

2

33

2

2

2

2

2

2

Page 4: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Partial Differential Equations

• Because of their widespread application in engineering, our study of PDE will focus on linear, second-order equations

• The following general form will be evaluated for B2 - 4AC (Variables – x and y/t)

Au

xB

u

x yC

u

yD

2

2

2 2

2 0

Page 5: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Partial Differential Equations

B2-4AC Category Example

< 0 Elliptic Laplace equation (steady state with 2 spatial dimensions)

= 0 Parabolic Heat conduction equation (time variablewith one spatial dimension)

>0 Hyperbolic Wave equation (time-variable with onespatial dimension)

2

2

22

2 1

t

y

cx

y

2

2

2

20

T

x

T

y

t

T

x

T

2

2

Page 6: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• One of the classical partial differential equation of mathematical physics is the equation describing the conduction of heat in a solid body (Originated in the 18th century).

• Consider a straight bar with uniform cross-section and homogeneous material. We wish to develop a model for heat flow through the bar.

Page 7: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Let u(x,t) be the temperature on a cross section located at x and at time t. We shall follow some basic principles:– A. Fourier’s Law: The amount of heat energy per

unit time flowing through a unit of cross-sectional area is proportional to with constant of proportionality k(x) called the thermal conductivity of the material.

xu /

Page 8: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

– B. Heat flow is always from points of higher temperature to points of lower temperature.

– C. The amount of heat energy necessary to raise the temperature of an object of mass “m” by an amount u is a “c(x) m(x) u”, where c(x) is the specific heat capacity of the material.

Page 9: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• By Fourier’s Law the amount of heat H(x) flowing from left to right through the surface A of a cross section at x during the time interval t can be approximated by:

),()()( txx

utxkxH

A

x

Page 10: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Likewise, the amount of heat H(x+ x) flowing from left to right through a cross section at (x + x) during the time interval t is about:

B

x + x

).,(u

t)()( txxx

xxkxxH

Page 11: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Then, on the interval [x, x+x], during time t , the total change in heat is approximately:

B

x + x

A

x

t),(u

)(

-t),(u

)()()(

txx

xk

txxx

xxkxHxxH

Page 12: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Dividing by t x we get:

• From Item C above for a change in x ofx :H = c.m.u=c(x) .((x)x).u

where (x) is the linear mass density function.

),(u

)(

-),(u

)(1)()(

txx

xk

txxx

xxkxxt

xHxxH

Page 13: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Thus:

• Substituting this into the formula from the previous slide gives:

xt

uxxxc

xt

xHxxH

)()()()(

),(u

)(

-),(u

)(1)()(

txx

xk

txxx

xxkxxt

uxxxc

Page 14: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• Canceling x on the left we get:

• If we take the limits as t, x 0, we get:

),(u

)(

-),(u

)(1)()(

txx

xk

txxx

xxkxt

uxxc

),()(),()()( txx

uxk

xtx

t

uxxc

Page 15: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Heat Equation

• If we assume k, c, are constants, then the eq. becomes:

( ) where • This is the Heat Equation in one (space)

dimension.

2

22

x

u

t

u

c

k

2

Page 16: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Boundary and Initial conditions

• We need to designate what the initial temperature distribution is in the rod: u(x,0)

• We also need to designate what the temperature function is at the ends of the rod: u(0,t) and u(L,t) where L = length of rod.

• For example, if the ends of the rod are kept at constant temps T1 and T2 ,then

u(0,t) = T1 and u(L,t) = T2

Page 17: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

.0 , )()0,(

, 0 , (t)),(

, 0 ),(),0(

, 0 ,0 , ),(),(

1

0

2

22

Lxxfxu

tgtLu

ttgtu

tLxtxx

utx

t

u

One Dimensional Heat Equation

Page 18: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Multi-dimensional space

• Now consider an object in which the temperature is a function of more than just the x-direction. Then the heat conduction equation can then be written:– 2-D:

– 3-D:

tyyxx uuu )(2

tzzyyxx uuuu )(2

Page 19: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Solving the Heat Equation

• A solution u(x,t) for the heat equation is a function that satisfies the PDE and all initial conditions.

• Solution methods:

– Method of Finite Differences (MFD)

– Method of Finite Elements (MFE)

Page 20: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Finite Differences

• The method of finite differences approximates the value of the derivatives of u(x,t) at a point (x0,t0) in its domain, say

by using a combination of function values at

nearby points. Method is due to Newton.• Start with simpler case of f(x)

),(),( 002

2

00 txx

uortx

t

u

Page 21: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Differentiation

• The mathematical definition of a derivative begins with a difference approximation:

and as x is allowed to approach zero, the difference becomes a derivative:

yx

f xi x f xi

x

dy

dxlim

x 0

f xi x f xi x

Page 22: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Differentiation Formulas

• Taylor series expansion can be used to generate high-accuracy formulas for derivatives by using the expansion around several points around a given point xi.

• Three categories for the formula include – forward finite-difference– backward finite-difference– centered finite-difference

Page 23: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Differentiation Formulas

• Forward difference

• Backward difference

• Centered difference

Page 24: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Forward Difference

xi1 xi xi+1

xh

ApproximationTrue

derivative

Page 25: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Backward Difference

xi1 xi xi+1

xh

True

derivative

Approxi

mat

ion

Page 26: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Centered Difference

xi1 xi xi+1

x2h

True

derivative

Approximatio

n

Page 27: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

First Derivatives)x(f

i-2 i-1 i i+1 i+2x

• Forward difference

• Backward difference

• Central difference1i1i

1i1i

1i1i

1i1i

1ii

1ii

1ii

1ii

i1i

i1i

i1i

i1i

xx

yy

xx

)x(f)x(f)x(f

xx

yy

xx

)x(f)x(f)x(f

xx

yy

xx

)x(f)x(f)x(f

Page 28: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Second Derivatives

• Using the Taylor series expansion about xi we get:

where Thus,

And,

)(!4

)(!3

)(!2

)()()(

)(!4

)(!3

)(!2

)()()(

2

432

1

1

432

1

fh

xfh

xfh

xfhxfxf

fh

xfh

xfh

xfhxfxf

iiiii

iiiii

)]()([

!4)(

!2)(2)()( 21

42

11 ffh

xfh

xfxfxf iiii

iiii xhxandhxx 21

)(!4

)()(2)()(

2

211 f

h

h

xfxfxfxf iiii

Page 29: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Centered Finite-Difference

Page 30: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Forward Finite-Difference

Page 31: Scientific Computing Partial Differential Equations Introduction and Finite Difference Formulas

Backward Finite-Difference