26
I.Popescu:Numerical Methods I 1/25/2012 1 Hydroinformatics Module 4: Numerical Methods I Lecture 3 and 4: PDE, Hyperbolic PDE, Stability, Accuracy 1/25/2012 Numerical Methods 1 I.Popescu 5-Partial Differential Equations 1/25/2012 Numerical Methods 2

NM Ln3 4 PDE-2slides Page

Embed Size (px)

Citation preview

Page 1: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

1

Hydroinformatics yModule 4: Numerical Methods I

Lecture 3 and 4: PDE, Hyperbolic PDE, Stability, Accuracy

1/25/2012 Numerical Methods 1

I.Popescu

5-Partial Differential Equations

1/25/2012 Numerical Methods 2

Page 2: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

2

PDEsparabolic

PDEs hyperbolic

eliptic

1n

x

n

t

)1,( nj

1/25/2012 Numerical Methods 3

eliptic1n

1j0 j 1j0 j

t),( nj

Solving PDEs

Method of characteristics Finite Difference method Explicit schemes Implicit schemes Upwind, forward/backward space/time

– FTCS– CTCS

1/25/2012 Numerical Methods 4

Other schemes– MoC ( 1-st and 2-nd order)– Preissmann scheme– Abbott-Ionescu scheme

Page 3: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

3

PDEs - Examples

The 1D advection-diffusion equation:

2

2

x

ud

x

ua

t

u

This PDE is first order in time and second order in space.

Simplify further (drop the second order diffusion or dissipation term):

0

x

ua

t

u

xxt

1/25/2012 Numerical Methods 5

This PDE is first order in time and first order in space It describes the time dependent shifting of the function u(x) along x with

a velocity a

Volunteer to solve this equation analytically?

Simple wave equation/ Advection equation

0

x

ua

t

u

Represents Kinematic wave

– u – water depth (m)– a –(celerity (m/s)

Transport of a polutant in a river

1/25/2012 Numerical Methods 6

Transport of a polutant in a river– u – concentration ( mg/l)– a –flow velocity (m/s)

Saint Venant equation – a system of two advection equations

Page 4: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

4

Necessary Information to Solve the IBVP

The Initial, Boundary Value Problem represented by the PDE

requires extra information in order to to be solvable.

What do we need?

0

x

ua

t

u

1/25/2012 Numerical Methods 7

What do we need?

IBVP Because of the hyperbolic nature of the PDE (solution travels

from right to left with increasing time), we need to supply:• Extent of solution domain• What is the solution at start of the solution process: u(x,0)• Boundary data: u(b,t), or u(a,t)

Final integration time• Final integration time.

t

we need to specify boundary ( e.g. inflow)data

1/25/2012 Numerical Methods 8

xNeed to specify the solution at t=0

x=a x=b

Page 5: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

5

Analytical solution of Hyperbolic PDEs 1

)()0(

0

fIC

x

ua

t

u Advection equation: • it describes the time dependent shiftingof the function u(x,0) along x with a velocity a

t

u

u

)()0,(: xfxuIC

x

u

1/25/2012 Numerical Methods 9

t

The solution at any time t > t0 can be described as a function of the state at time t0:

)0,(),( xutatxu This is a so-called initial value problem in which the state at any time t > t0 can be uniquelyfound when the state at time t = t0 is fully given.

Analytical solution of Hyperbolic PDEs 2

t

u

u

u

t

u

tt1 t2 t3 t4 t5

1/25/2012 Numerical Methods 10

x

Page 6: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

6

Analytical solution of Hyperbolic PDEs 3

)()0(

0

fIC

x

ua

t

u Advection equation: u

)()0,(: xfxuIC

)0,(),( atxutxu 1. This is a so-called initial value problem in which the state at any time t > t0 can be

uniquely found when the state at time t = t0 is fully given.

1/25/2012 Numerical Methods 11

2. The initial value problem is quite trivial, yet, as we will see below, this problemstands at the basis of numerical methods of hydrodynamics and is numerically surprisinglychallenging to solve!

Brief Summary

There is a checklist of conditions we will need to consider to obtain a unique solution of a PDE:solution of a PDE:

1) The PDE2) Boundary values (also known as boundary conditions)3) Initial values (if there is a time-like variable)4) Solution domain

1/25/2012 Numerical Methods 12

Page 7: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

7

(A)Hyperbolic PDEs

1/25/2012 Numerical Methods 13

(A)Hyperbolic PDEs

Method of Characteristics

1/25/2012 Numerical Methods 14

Page 8: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

8

The method of characteristics

The method of characteristics is a method which can be used to solve the initial value problem (IVP) for general first order PDEsproblem (IVP) for general first order PDEsby transforming them in ODEs.Consider the first order linear equation :

(5 1)0),(),(),(),(

txutxct

utxb

utxa

1/25/2012 Numerical Methods 15

(5.1)

With initial condition

tx

)()0,( xfxu

GoalChange coordinates from (x,t) to new coordinate

system (xo,s) so that PDE becomes ODE along certain curves in (x,t) plane.Such curves, along which the solution of the PDE

reduces to an ODE, are called the characteristic curves or just the characteristics. The new variable s will vary, and the new variable

x0 will be constant along the characteristics. The

1/25/2012 Numerical Methods 16

variable x0 will change along the initial curve in the x-t plane (along the line t=0). How do we find the characteristic curves?

Page 9: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

9

Finding characteristic curves

Notice that if we choose (5.2)

),(and),( txbd

dttxa

d

dx

Then

t

u

ds

dt

x

u

ds

dx

ds

du

)()(dsds

1/25/2012 Numerical Methods 17

And along the characteristic curves

(5.3) -ODE0)(),( sutxcds

du

Application steps Solve the two characteristic equations, (5.2). Find the constants of integration by setting x(0)=x0 (these will be

points along the t=0 axis in the x-t plane) and t(0)=0. We now have the transformation from (x,t) to (x0,s), x=x(x0,s) and t=t(x0,s)

xo x

t

Characteristic curve

1/25/2012 Numerical Methods 18

Solve the ODE (5.3) with initial condition u(0)=f(x0), where x0 are the initial points on the characteristic curves along the t=0 axis in the x-t plane.

We now have a solution u(x0,s) . Solve for s and x0 in terms of x and t (using the results of step 1) and substitute these values in u(x0,s) to get the solution to the original PDE as u(x,t)

Page 10: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

10

The MoC summary

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

txutxct

utxb

x

utxa

)()0,( xfxu

),(and),( txbds

dttxa

ds

dx

t

u

ds

dt

x

u

ds

dx

ds

du

For the selection :

and

)( td

1/25/2012 Numerical Methods 19

0)(),( sutxcds

du holds along the characteristic curves),(

),(

txb

txa

dt

dx

CasesDepending on values of a(x,t), b(x,t) and c(x,t)

there are 3 different PDEs: the constant coefficient advection equation,the constant coefficient advection equation, the variable coefficient advection equation,

inviscid Burgers' equation.

For all three examples, the initial conditions are specified as

)()0( f

1/25/2012 Numerical Methods 20

)()0,( xfxu

Page 11: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

11

Case 1: c(x,t)=0 and b(x,t)=1

0ds

du

),(),(

txatxadx

consttxu ),(

),( txadx

along

)()0,( xfxu

),(),(

txatxbdt

),(dt

)()0,( xfxu

0x

ua

t

u

Constant coefficient advection equation

tCharacteristic curve

1/25/2012 Numerical Methods 21

)()0,( xfxu I.C. Application steps:

dx/dt =a =>x=x0+at du/dt =0 =>u(t) =f(x0) u(t)=f(x-at) xo x

Characteristics of first-order PDEs

u = f(s ) along the characteristic direction u =constant

Characteristic t

t = t1

t = t2

t = t3lines= s1 s = s2 s = s3

d 0

t

1/25/2012 I.Popescu: Numerical Methods 22

adx

dtslope

1

t = t0

du = 0

x

Page 12: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

12

Characteristics of first-order PDEs• Along the characteristic direction:

du = 0, u = constantu = f(s ) = constant

h l i i hNon-characteristic

•The solution remains the same along the characteristic direction•An observer moving with

s = constant sees no changes the form of u •The profile will change if the observer moves faster or slower than t t

t = t2

t = t3

Characteristic linelinet

1/25/2012 I.Popescu: Numerical Methods 23

observer moves faster or slower than the characteristic line

t = t0

t = t1

x

Case 2: Variable coefficient advection equationApplication steps:

dx/dt =a =>x=G(a) du/dt =0 =>u(t) =f(x0)

U(t)

),(

0

txgax

ua

t

u

U(t)

)()0,(: xfxuIC

t

h

1/25/2012 I.Popescu: Numerical Methods 24

xo x

Characteristic curve

Page 13: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

13

Case 2 Application: Saint Venant equations

Characteristic form of Saint Venant eq

0)2(

)()2( cu

cut

cu

0)2(

)()2(

x

cucu

t

cuxt

)(

dx

Ccudt

dx

1/25/2012 I.Popescu: Numerical Methods 25

)2(

)2(

)(

cuJ

cuJ

Ccudt

dx

Characteristic directions

A B

P

unique solution

1/25/2012 I.Popescu: Numerical Methods 26

A B

Page 14: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

14

Characteristic directions

P PP

Flow characteristics: Fr number

A BSub critical flow Super critical flow

A B

1/25/2012 I.Popescu: Numerical Methods 27

Physical PlaneHyperbolic equation – propagation problem with no dissipation

t

C- = x ct C+ = x + ct

Domain of D d

Domain of Influence

P(x,t)

1/25/2012 I.Popescu: Numerical Methods 28

xDependence

Initial conditions

Page 15: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

15

Characteristics - PropagationDomain of Dependence

P3 : t = t3

B d

P2 : t = t2

Boundary Conditions

Boundary Conditions

E

F

1/25/2012 I.Popescu: Numerical Methods 29

P1 : t = t1

Initial conditionsC

D

A B

Characteristics - PropagationDomain of Influence

PB d

P2 : t = t2

P3 : t = t3Boundary Conditions

Boundary Conditions

E

F

1/25/2012 I.Popescu: Numerical Methods 30

P1 : t = t1

Initial conditionsC

D

A B

Page 16: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

16

Characteristics: Boundary conditions

1/25/2012 I.Popescu: Numerical Methods 31

SummaryThe conditions derived along characteristics enable us to

compute solutions from known conditions at an earlier point in time

Example If state of fluid in A is U=1m/s and h=5m, in B

u=1.2m/s and h=4.8 m, compute u and h in P

t

1/25/2012 I.Popescu: Numerical Methods 32

x

t

C- = x ct C+ = x + ct

P(x,t)

A B

Page 17: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

17

(A)Hyperbolic PDEs

Finite difference method

1/25/2012 I.Popescu: Numerical Methods 33

FDM to hyperbolic PDE

Notations F- forward

B b d B- bacward T-time S –space

Schemes FTBS – explicit

1/25/2012 I.Popescu: Numerical Methods 34

FTBS explicit BTBS – implicit FTCS in n CTCS in n

Page 18: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

18

FDM-Hyperbolic PDE-Explicit schemes

FTBS

0

x

Ua

t

U

t

UU

t

Unj

nj

1

x

UU

x

Unj

nj

1

x

1n

t

t),( nj

)1,( nj

n

FT:

BS:

1/25/2012 I.Popescu: Numerical Methods 35

nj

nj

nj UCrCrUU 11

1

x

taCr n

j

1j0 j 1j0 j

Courant number

FDM-Hyperbolic PDE-Explicit schemes

FTBS- boundary and initial conditions0

x

Ua

t

U

1 nj

nj

nj UCrCrUU 11

1

x

1n

t

t)1,( nj

Boundary

1/25/2012 I.Popescu: Numerical Methods 36

1j0 j 1j0 j

t),( njnconditions

Initial conditions

Page 19: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

19

FDM-Hyperbolic PDE-Explicit schemes

FTBS- boundary and initial conditions0

x

Ua

t

U

nnn UCC UU 11 nj

nj

nj UCrCrUU 11

1

For a given point, a stencil is a fixed subset of nearest neighbors

A stencil code updates every point in a regular grid by “applying a stencil”

1/25/2012 I.Popescu: Numerical Methods 37

FDM-Hyperbolic PDE-Implicit schemes

BTBS0

x

Ua

t

U

11 0)1( 111

nj

nj

nj UCrUCrCrU

x

taCr n

j

x

1n

t

t)1,( nj

1/25/2012 I.Popescu: Numerical Methods 38

1j0 j 1j0 j

t),( njn

Page 20: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

20

FDM-Hyperbolic PDE-Implicit schemes

BTBS- boundary and initial conditions0

x

Ua

t

U

0)1( 11 nnn UCUCC U

x

1n

t

t)1,( nj

Boundary

0)1( 111

nj

nj

nj UCrUCrCrU

1/25/2012 I.Popescu: Numerical Methods 39

1j0 j 1j0 j

t),( njnconditions

Initial conditions

FDM-Hyperbolic PDE – (Explicit)Schemes

FTCS0

x

Ua

t

U

x

1n

t

t),( nj

)1,( nj

n

FT: CS:t

UU nj

nj

1

x

UU nj

nj

211

02

111

x

UUa

t

UU nj

nj

nj

nj

1/25/2012 I.Popescu: Numerical Methods 40

1j0 j 1j0 j n

jnj

nj

nj UUCrUU 11

1

2

1

• unconditionally unstable

• used to compute very first time steps

Page 21: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

21

FDM-Hyperbolic PDE-Upwind schemes Any BS scheme is also called upwind schemes, because

information comes from the upstream Similarly the CS schemes are called centered schemes The CTCS scheme

UU0

x

Ua

t

U

x

1n

t

t

022

1111

x

UUa

t

UU nj

nj

nj

nj

nnnn UUta

UU 11

1/25/2012 I.Popescu: Numerical Methods 41

1j0 j 1j0 j

tn

nj

nj

nj

nj UU

xUU 11

• two solutions for special BC

Other schemes

Lax-WendorfCranck Nicholson

1/25/2012 I.Popescu: Numerical Methods 42

Page 22: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

22

FD Schemes for hyperbolic system of equations

Saint Venant equations: Unsteady, nearly horizontal flow

AQWhere:

0

q

2

2

ARC

QgQ

x

hgA

x

AQ

t

Q

t

A

x

Q

Q - discharge, m3 s-1

A - flow area, m2

q - lateral flow, m2s-1

h - depth above datum, mC - Chezy resistance coefficient, m1/2s-1

R - hydraulic radius, m- momentum distribution coefficient

Variables Conditions for solution

1/25/2012 I.Popescu: Numerical Methods 43

• two independent (x, t)

• two dependent (Q, h)

• 2 point initial (Q, h)

• 1 point up/downstream

– h

– Q

– Q=f(h)

Fully dynamicDiffusive wave – no inertia

FD Schemes for hyperbolic system of equations

Kinematic wave- pure convective

1/25/2012 I.Popescu: Numerical Methods 44

Page 23: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

23

FD Schemes for hyperbolic system of equations

1/25/2012 I.Popescu: Numerical Methods 45

Abbot – Ionescu scheme

Structured, cartesian grid Implicit scheme (Abbott-Ionescu)

C ti it ti h t d• Continuity equation - h centered

• Momentum equation - Q centered

1/25/2012 I.Popescu: Numerical Methods 46

Example discretization

Page 24: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

24

Abbott Ionescu scheme

02

x

uugh

t

uu

t

hg 02

x

hugh

t

hu

t

uh

t

hh

t

h nj

nj

1

t

uu

t

uu

t

unj

nj

nj

nj 1

111

11

2

1

uuuuu

nj

nj

nj

nj1 11

11

11

t

uu

t

unj

nj

1

11

t

uu

t

uu

t

hnj

nj

nj

nj 2

12

1

2

1

uuuuh n

jnj

nj

nj1 2

112

1/25/2012 I.Popescu: Numerical Methods 47

x

uu

x

uu

x

u jjjj

222

1 1111

xxx

h jjjj

222

1 22

Transformation into linear equations

jnjj

njj

njj DQChBQA 1111 1

111

1

(mass)

Abbot – Ionescu scheme

jnjj

njj

njj DhCQB1hA 111 1

111

1

jnjj

njj

njj DCBA 1111 1

111

1

Tri-diagonal matrix form of equation

A B C Dn+1 n

(momentum)

1/25/2012 I.Popescu: Numerical Methods 48

A0 B0 C0

A1 B1 C1

A2 B2 C2

. . . . . .

Ajj Bjj Cjj

0

1

2

.

. jj

D0

D1

D2

.

. Djj

=.all zeros

all zeros

Page 25: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

25

Less equation than unknowns Use of suitable boundary conditions I d i ddi i l i bl

Abbot – Ionescu scheme

Introducing additional variables

Substitution of into the linear equations

Derivation of recurrence relations

jnjj

nj FE

111

1/25/2012 I.Popescu: Numerical Methods 49

jjj

jjjj

jjj

jj

BEA

CADF

BEA

CE

1

1

4-points stencil (2 points in space, 2 levels in time)

t

x

f

Preismann scheme 0

x

fa

t

f

f(x,t) can be either u, either h

n+11-

1 nx

nn x

f

x

f

x

f

11

with

1/25/2012 I.Popescu: Numerical Methods 50

xn

nx

f

x

ff

x

fnj

nj

n

1

with

j-1 j

Page 26: NM Ln3 4 PDE-2slides Page

I.Popescu:Numerical Methods I 1/25/2012

26

4-points stencil (2 points in space, 2 levels in time)

Preismann scheme 0

x

fa

t

f

f(x,t) can be either u, either h

t 1

t

f

t

f

t

f tn+1

1-jt

f

1

jt

f

1 jj ttt

x

ff

t

fnj

nj

j

1

with

1/25/2012 I.Popescu: Numerical Methods 51

xn

j-1 j

t

n+1

t

U

fffffnj

nj

nj

nj

1

11

1

1

FDM-Hyperbolic PDE-Preismann scheme

0

x

fa

t

f

x n

j-1 j

t

n+1

U

ttt

x

ff

x

ff

x

fnj

nj

nj

nj

1

11

1

1

1/25/2012 I.Popescu: Numerical Methods 52

x n

j-1 j

x xxx

< 0.5 - fully unstable

= 0, the scheme is explicit, = 1, the scheme is fully implicit