Vous êtes sur la page 1sur 26

I.

Popescu:Numerical Methods I 1/25/2012


1
Hydroinformatics y
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
I.Popescu:Numerical Methods I 1/25/2012
2
PDEs
parabolic
PDEs
hyperbolic
eliptic
1 + n
x A
n
t
) 1 , ( + n j
1/25/2012 Numerical Methods 3
eliptic
1 n
1 j
0
j
1 + j
0
j
t A
) , ( n j
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
I.Popescu:Numerical Methods I 1/25/2012
3
PDEs - Examples
The 1D advection-diffusion equation:
2
2
x
u
d
x
u
a
t
u
c
c
=
c
c
+
c
c
This PDE is first order in time and second order in space.
Simplify further (drop the second order diffusion or
dissipation term):
0 =
c
c
+
c
c
x
u
a
t
u
x x t c c c
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 =
c
c
+
c
c
x
u
a
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
I.Popescu:Numerical Methods I 1/25/2012
4
Necessary Information to Solve the IBVP
The Initial, Boundary Value Problem
represented by the PDE
c c
requires extra information in order to to be
solvable.
What do we need?
0 =
c
c
+
c
c
x
u
a
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
x
Need to specify the solution at t=0
x=a x=b
I.Popescu:Numerical Methods I 1/25/2012
5
Analytical solution of Hyperbolic PDEs
1

=
c
c
+
c
c
) ( ) 0 (
0
f IC
x
u
a
t
u
Advection equation:
it describes the time dependent shifting
of the function u(x,0) along x with a velocity a

t
u
u

= ) ( ) 0 , ( : x f x u IC

x
u
1/25/2012 Numerical Methods 9
t
The solution at any time t > t
0
can be described as a function of the state at time t
0
:
) 0 , ( ) , ( x u t at x u = +
This is a so-called initial value problem in which the state at any time t > t
0
can be uniquely
found when the state at time t = t
0
is fully given.
Analytical solution of Hyperbolic PDEs
2

t
u
u
u
t
u
t
t
1
t
2
t
3
t
4
t
5
1/25/2012 Numerical Methods 10
x
I.Popescu:Numerical Methods I 1/25/2012
6
Analytical solution of Hyperbolic PDEs
3

=
c
c
+
c
c
) ( ) 0 (
0
f IC
x
u
a
t
u
Advection equation:
u

= ) ( ) 0 , ( : x f x u IC
) 0 , ( ) , ( at x u t x u =
1. This is a so-called initial value problem in which the state at any time t > t
0
can be
uniquely found when the state at time t = t
0
is fully given.
1/25/2012 Numerical Methods 11
2. The initial value problem is quite trivial, yet, as we will see below, this problem
stands at the basis of numerical methods of hydrodynamics and is numerically surprisingly
challenging 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 PDE
2) 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
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
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 PDEs problem (IVP) for general first order PDEs
by transforming them in ODEs.
Consider the first order linear equation :
(5 1)
0 ) , ( ) , ( ) , ( ) , ( = +
c
c
+
c
c
t x u t x c
t
u
t x b
u
t x a
1/25/2012 Numerical Methods 15
(5.1)
With initial condition
c c t x
) ( ) 0 , ( x f x u =
Goal
Change coordinates from (x,t) to new coordinate
system (x
o
,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
x
0
will be constant along the characteristics. The
1/25/2012 Numerical Methods 16
variable x
0
will change along the initial curve in
the x-t plane (along the line t=0).
How do we find the characteristic curves?
I.Popescu:Numerical Methods I 1/25/2012
9
Finding characteristic curves
Notice that if we choose
(5.2)
) , ( and ) , ( t x b
d
dt
t x a
d
dx
= =
Then
t
u
ds
dt
x
u
ds
dx
ds
du
c
c
+
c
c
=
) ( ) (
ds ds
1/25/2012 Numerical Methods 17
And along the characteristic curves
(5.3) -ODE
0 ) ( ) , ( = + s u t x c
ds
du
Application steps
Solve the two characteristic equations, (5.2).
Find the constants of integration by setting x(0)=x
0
(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 (x
0
,s), x=x(x
0
,s) and t=t(x
0
,s)
x
o x
t
Characteristic curve
1/25/2012 Numerical Methods 18
Solve the ODE (5.3) with initial condition u(0)=f(x
0
), where x
0
are
the initial points on the characteristic curves along the t=0 axis in the
x-t plane.
We now have a solution u(x
0
,s) . Solve for s and x
0
in terms of x and t
(using the results of step 1) and substitute these values in u(x
0
,s) to
get the solution to the original PDE as u(x,t)
I.Popescu:Numerical Methods I 1/25/2012
10
The MoC summary
0 ) , ( ) , ( ) , ( ) , ( = +
c
c
+
c
c
t x u t x c
t
u
t x b
x
u
t x a
) ( ) 0 , ( x f x u =
) , ( and ) , ( t x b
ds
dt
t x a
ds
dx
= =
t
u
ds
dt
x
u
ds
dx
ds
du
c
c
+
c
c
=
For the selection :
and
) ( t d
1/25/2012 Numerical Methods 19
0 ) ( ) , ( = + s u t x c
ds
du
holds along the characteristic curves
) , (
) , (
t x b
t x a
dt
dx
=
Cases
Depending 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 , ( x f x u =
I.Popescu:Numerical Methods I 1/25/2012
11
Case 1: c(x,t)=0 and b(x,t)=1
0 =
ds
du
) , (
) , (
t x a
t x a dx
= =
const t x u = ) , (
) , ( t x a
dx
=
along
) ( ) 0 , ( x f x u =
) , (
) , (
t x a
t x b dt
) , (
dt
) ( ) 0 , ( x f x u =

=
c
c
+
c
c
0
x
u
a
t
u
Constant coefficient advection equation
t
Characteristic curve
1/25/2012 Numerical Methods 21

= ) ( ) 0 , ( x f x u I.C.
Application steps:
dx/dt =a =>x=x
0
+at
du/dt =0 =>u(t) =f(x
0
)
u(t)=f(x-at)
x
o
x
Characteristics of first-order PDEs
u = f(s ) along the characteristic direction u =constant
Characteristic
t
t = t
1
t = t
2
t = t
3
line
s= s
1
s = s
2
s = s
3
d 0
t
1/25/2012 I.Popescu: Numerical Methods 22
a dx
dt
slope
1
= =
t = t
0
du = 0
x
I.Popescu:Numerical Methods I 1/25/2012
12
Characteristics of first-order PDEs
Along the characteristic direction:
du =0, u =constant
u = f(s ) = constant
h l i i h
Non-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 movesfaster or slower than
t t
t = t
2
t = t
3
Characteristic line
line
t
1/25/2012 I.Popescu: Numerical Methods 23
observer moves faster or slower than
the characteristic line
t = t
0
t = t
1
x
Case 2: Variable coefficient advection equation
Application steps:
dx/dt =a =>x=G(a)
du/dt =0 =>u(t) =f(x
0
)
U(t)

=
=
c
c
+
c
c
) , (
0
t x g a
x
u
a
t
u
U(t)

= ) ( ) 0 , ( : x f x u IC
t
h
1/25/2012 I.Popescu: Numerical Methods 24
x
o
x
Characteristic curve
I.Popescu:Numerical Methods I 1/25/2012
13
Case 2 Application: Saint Venant equations
Characteristic form of Saint Venant eq

=
c
+ c
+ +
c
+ c
0
) 2 (
) (
) 2 ( c u
c u
t
c u

=
c
c
+
c
c
c c
0
) 2 (
) (
) 2 (
x
c u
c u
t
c u
x t

+ =
+
) (
dx
C c u
dt
dx
1/25/2012 I.Popescu: Numerical Methods 25

=
+ =

) 2 (
) 2 (
) (
c u J
c u J
C c u
dt
dx
Characteristic directions
A B
P
unique
solution
1/25/2012 I.Popescu: Numerical Methods 26
A B
I.Popescu:Numerical Methods I 1/25/2012
14
Characteristic directions
P
P
P
Flow characteristics: Fr number
A B
Sub critical flow Super critical flow
A B
1/25/2012 I.Popescu: Numerical Methods 27
Physical Plane
Hyperbolic 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
x
Dependence
Initial conditions
I.Popescu:Numerical Methods I 1/25/2012
15
Characteristics - Propagation
Domain of Dependence
P
3
: t = t
3
B d
P
2
: t = t
2
Boundary
Conditions
Boundary
Conditions
E
F
1/25/2012 I.Popescu: Numerical Methods 29
P
1
: t = t
1
Initial conditions C
D
A
B
Characteristics - Propagation
Domain of Influence
P
B d
P
2
: t = t
2
P
3
: t = t
3
Boundary
Conditions
Boundary
Conditions
E
F
1/25/2012 I.Popescu: Numerical Methods 30
P
1
: t = t
1
Initial conditions C
D
A
B
I.Popescu:Numerical Methods I 1/25/2012
16
Characteristics: Boundary conditions
1/25/2012 I.Popescu: Numerical Methods 31
Summary
The 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
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
I.Popescu:Numerical Methods I 1/25/2012
18
FDM-Hyperbolic PDE-Explicit schemes
FTBS
0 =
c
c
+
c
c
x
U
a
t
U
t
U U
t
U
n
j
n
j
A

~
c
c
+1
x
U U
x
U
n
j
n
j
A

~
c
c 1
x A
1 + n
t
t A
) , ( n j
) 1 , ( + n j
n
FT:
BS:
1/25/2012 I.Popescu: Numerical Methods 35
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
1
x
t a
Cr
n
j
A
A
=
1 j
0
j
1 + j
0
j
Courant number
FDM-Hyperbolic PDE-Explicit schemes
FTBS- boundary and initial conditions
0 =
c
c
+
c
c
x
U
a
t
U
( )
1
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
1
x A
1 + n
t
t A
) 1 , ( + n j
Boundary
1/25/2012 I.Popescu: Numerical Methods 36
1 j
0
j
1 + j
0
j
t A
) , ( n j
n
conditions
Initial conditions
I.Popescu:Numerical Methods I 1/25/2012
19
FDM-Hyperbolic PDE-Explicit schemes
FTBS- boundary and initial conditions
0 =
c
c
+
c
c
x
U
a
t
U
( )
n n n
U C C U U +
+
1
1
( )
n
j
n
j
n
j
U Cr CrU U + =

+
1
1
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
BTBS
0 =
c
c
+
c
c
x
U
a
t
U
( )
1 1
( ) 0 ) 1 (
1 1
1
= + + +
+ +

n
j
n
j
n
j
U Cr U Cr CrU
x
t a
Cr
n
j
A
A
=
x A
1 + n
t
t A
) 1 , ( + n j
1/25/2012 I.Popescu: Numerical Methods 38
1 j
0
j
1 + j
0
j
t A
) , ( n j
n
I.Popescu:Numerical Methods I 1/25/2012
20
FDM-Hyperbolic PDE-Implicit schemes
BTBS- boundary and initial conditions
0 =
c
c
+
c
c
x
U
a
t
U
( ) 0 ) 1 (
1 1 + + n n n
U C U C C U
x A
1 + n
t
t A
) 1 , ( + n j
Boundary
( ) 0 ) 1 (
1 1
1
= + + +
+ +

n
j
n
j
n
j
U Cr U Cr CrU
1/25/2012 I.Popescu: Numerical Methods 39
1 j
0
j
1 + j
0
j
t A
) , ( n j
n
conditions
Initial conditions
FDM-Hyperbolic PDE (Explicit)Schemes
FTCS
0 =
c
c
+
c
c
x
U
a
t
U
x A
1 + n
t
t A
) , ( n j
) 1 , ( + n j
n
FT: CS:
t
U U
n
j
n
j
A

+1
x
U U
n
j
n
j
A

+
2
1 1
0
2
1 1
1
=
A

+
A

+
+
x
U U
a
t
U U
n
j
n
j
n
j
n
j
1/25/2012 I.Popescu: Numerical Methods 40
1 j
0
j
1 + j
0
j
( )
n
j
n
j
n
j
n
j
U U Cr U U
1 1
1
2
1
+
+
=
unconditionally unstable
used to compute very first time steps
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
c c U U
0 =
c
c
+
c
c
x
U
a
t
U
x A
1 + n
t
t A
0
2 2
1 1
1 1
=
A

+
A

+
+
x
U U
a
t
U U
n
j
n
j
n
j
n
j
( )
n n n n
U U
t a
U U
1 1 +
A
1/25/2012 I.Popescu: Numerical Methods 41
1 j
0
j
1 + j
0
j
t A
n
( )
n
j
n
j
n
j
n
j
U U
x
U U
1 1 +

A
=
two solutions for special BC
Other schemes
Lax-Wendorf
Cranck Nicholson
1/25/2012 I.Popescu: Numerical Methods 42
I.Popescu:Numerical Methods I 1/25/2012
22
FD Schemes for hyperbolic system of equations
Saint Venant equations: Unsteady, nearly
horizontal flow
c c
A Q
Where:
0
q
2
2
= +
c
c
+
c
|
|
.
|

\
|
c
+
c
c
=
c
c
+
c
c
AR C
Q gQ
x
h
gA
x
A
Q
t
Q
t
A
x
Q
o
Q - discharge, m
3
s
-1
A - flow area, m
2
q - lateral flow, m
2
s
-1
h - depth above datum, m
C - Chezy resistance coefficient, m
1/2
s
-1
R - hydraulic radius, m
o - 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 dynamic
Diffusive wave no inertia
FD Schemes for hyperbolic system of equations
Kinematic wave- pure convective
1/25/2012 I.Popescu: Numerical Methods 44
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
I.Popescu:Numerical Methods I 1/25/2012
24
Abbott Ionescu scheme
( ) 0
2
=
c
c
+
c
c

c
c
x
u
u gh
t
u
u
t
h
g ( ) 0
2
=
c
c
+
c
c

c
c
x
h
u gh
t
h
u
t
u
h
t
h h
t
h
n
j
n
j
A

~
c
c
+1
|
|
.
|

\
|
A

+
A

~
c
c +
+
+
+

t
u u
t
u u
t
u
n
j
n
j
n
j
n
j 1
1
1 1
1
1
2
1
|
|

|
c +
+ +
+
u u u u
u
n
j
n
j
n
j
n
j 1 1 1
1
1
1
1
t
u u
t
u
n
j
n
j
A

~
c
c +
+
+ 1
1
1
|
|
.
|

\
|
A

+
A

~
c
c +
+
+
+
t
u u
t
u u
t
h
n
j
n
j
n
j
n
j 2
1
2
1
2
1
|
|

|
c +
+ +
+
u u u u
h
n
j
n
j
n
j
n
j 1 2
1 1
2
1/25/2012 I.Popescu: Numerical Methods 47
|
|
.

\
A
+
A
~
c
c + +
x
u u
x
u u
x
u j j j j
2 2 2
1 1 1 1 1
|
|
.

\
A
+
A
~
c
c + +
x x x
h j j j j
2 2 2
1 2 2
Transformation into linear equations
j
n
j j
n
j j
n
j j
D Q C h B Q A 1 1 1 1
1
1
1 1
1
= + +
+

+ +

(mass)
Abbot Ionescu scheme
j
n
j j
n
j j
n
j j
D h C Q B1 h A 1 1 1
1
1
1 1
1
= + +
+

+ +

j
n
j j
n
j j
n
j j
D C B A 1 1 1 1
1
1
1 1
1
= + +
+

+ +

| | |
Tri-diagonal matrix form of equation
A B C | D
n+1 n
(momentum)
1/25/2012 I.Popescu: Numerical Methods 48
A
0
B
0
C
0
A
1
B
1
C
1
A
2
B
2
C
2
. . .
. . .
A
jj
B
jj
C
jj
|
0
|
1
|
2
.
.
|
jj
D
0
D
1
D
2
.
.
D
jj
=
.
all
zeros
all
zeros
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
j
n
j j
n
j
F E
+ =
+ +
+
1 1
1
| |
1/25/2012 I.Popescu: Numerical Methods 49
j j j
j j j
j
j j j
j
j
B E A
C A D
F
B E A
C
E
+

=
+

1
1
4-points stencil (2 points in space, 2 levels in time)
t
|
.
|
c
c
x
f
Preismann scheme
0 =
c
c
+
c
c
x
f
a
t
f
f(x,t) can be either u, either h
n+1
1-u
u
1 +
.
c
n
x
( )
n n
x
f
x
f
x
f
|
.
|
c
c
+ |
.
|
c
c
~
c
c
+
u u 1
1
with
1/25/2012 I.Popescu: Numerical Methods 50
x
n
n
x
f
|
.
|
c
c
x
f f
x
f
n
j
n
j
n
A

~ |
.
|
c
c
1
with
j-1 j
I.Popescu:Numerical Methods I 1/25/2012
26
4-points stencil (2 points in space, 2 levels in time)
Preismann scheme
0 =
c
c
+
c
c
x
f
a
t
f
f(x,t) can be either u, either h
t
( ) 1 |
.
|
c
c
+ |
.
|
c
c
~
c
c
t
f
t
f
t
f

t
n+1
1-
j
t
f
|
.
|
c
c
1
|
.
|
c
c
j
t
f
1
.
c
.
c c
j j
t t t
x
f f
t
f
n
j
n
j
j
A

~ |
.
|
c
c
+1
with
1/25/2012 I.Popescu: Numerical Methods 51
x
n
j-1 j

t
n+1
1
t
U
c
c
( )
f f f f
f
n
j
n
j
n
j
n
j

+

~
c
c

+

+
1
1
1
1
1
FDM-Hyperbolic PDE-Preismann scheme
0 =
c
c
+
c
c
x
f
a
t
f
x
n
j-1 j

t
n+1
u
1u
U c
( )
t t t A A c

( )
x
f f
x
f f
x
f
n
j
n
j
n
j
n
j
A

+
A

=
c
c

+

+
1
1
1
1
1 u u
1/25/2012 I.Popescu: Numerical Methods 52
x
n
j-1 j
u
x c
x x x A A c
u < 0.5 - fully unstable
u = 0, the scheme is explicit,
u = 1, the scheme is fully implicit

Vous aimerez peut-être aussi