Numerical Hydraulics
Block 4 – Numerical solution
of open channel flow
Markus Holzner
1
Contents of the course
Block 1 – The equations
Block 2 – Computation of pressure surges
Block 3 – Open channel flow (flow in rivers)
Block 4 – Numerical solution of open channel flow
Block 5 – Transport of solutes in rivers
Block 6 – Heat transport in rivers
2
- Finite Volume discretization
- Finite differences method
- Characteristics method
3
Numerical solution of
open channel flow
Basic equations of open channel flow in
variables h and v for rectangular channel
Continuity („Flux-conservative form“)
Momentum equation
4
0)v(
x
h
t
h
2 4/3
v (v)v
v v
2
S E
e hy
st hy
hg gI gI
t x x
hbI r
k r h b
𝜕v
𝜕𝑥
Basic equations of open channel flow in
variables h and q for rectangular channel
Continuity
Momentum equation
5
0h q
t x
2
2 4/3 2
( / )( )
2
S E
e hy
st hy
q q h hgh gh I I
t x x
q q hbI r
k r h h b
Basic equations of open channel flow for
general cross-section in variables A and Q
Continuity
Momentum equation
6
Q0
A
t x
2
0
2 4/3 2
( / )1 1 (Q / )
Q Q
wsp
e
e hy
st hy u
A bQ Ag gI gI
A t A x x
AI r
k r A L
Boundary conditions
• At inflow boundary usually the inflow
hydrograph should be given
• At the outflow boundary we can use
– water level (also time variable e.g. for tide)
– water level-flow rate relation (e.g. weir formula)
– slope of water level or energy
• In supercritical flow two boundary conditions are
necessary for one boundary (for both v and h)
7
Boundary conditions
• Number of boundary conditions from number
of characteristics
In 1D: subcritical flow: IB: 1, OB: 1
superciritical flow: IB: 2, OB: 0
IB = Inflow boundary, OB = Outflow boundary
t t
8
Discretized basic equations in variables h
and v for rectangular channels
Momentum equation
Explicit method
i = 2,…, Nx
i = 2,…, Nx
Which differences to chose in
order to be able to build in lower
and upper boundary
conditions?
Continuity („Flux-conservative form“)
9
1 1( v v ) /new old old old old old
i i i i i ih h t h h x
2 2
1 10
1
2 4/3
1
v v ( )v v
2
v v
2
old old old oldnew old i i i ii i e
old old oldi i i
e hy old
st hy i
h ht g t t gI t gI
x x
h bI r
k r h b
Discretized basic equations in variables h
and v for rectangular channels
Boundary conditions (i = Nx+1) example
Explicit method
Boundary conditions (i = 1) example
10
1( ) . . v ( )q f h i e f h
h or weir formula
1 1 2 2 1 1 1 1( v v ) / v /( )new old old old old old new new new
inh h t h h x q b h
1
1
( )
v v
new
Nx 0
new new
Nx i
h = h weir
computation as i 1,...,Nx
Discretized basic equations in variables h
and v for rectangular channels
Explicit method
11
Explicit method requires stability condition
Courant-Friedrichs-Levy (CFL) criterium must be fulfilled:
c is the relative wave velocity with respect to average flow
/( v )t x c
( ) / ( )c gh gA h b h
Non-conservative form:
vv 0
h hh
t x x
v vv S E
hg I I g
t x x
v0
hh
t x
21
2S E
q qg I I g h
t h x h x
0h q
t x
2 2
2S E
q q ghgh I I
t x h
q = vh
12
Conservative form:
Matrix formulation of the last form of
the equations
13
Assignment
Determine the wave propagation (water surface profile,
maximum water depth, outflow hydrograph) for a rectangular
channel with the following data:
width b = 10 m, kstr = 20 m-1/3/s
length L = 10‘000 m, bottom slope IS=0.002
Inflow before wave, base flow Q0 = 20 m3/s
Boundary condition downstream: Weir with water depth 2.2 m
Boundary condition upstream: Inflow hydrograph
Inflow hydrograph Q (is added to base flow Q0):
Time (h) 0 0.5 1.0 1.5 2.0 2.5
Q (m3/s) 0 50 37.5 25 12.5 0
14
Inflow/Outflow hydrographs
time steps in 10s
Q (m3/s)
about 4 h
15
1D Shallow water equations
- The total differential for v=v(x,t)
and h=h(x,t) is:
16
0h h v
v ht x x
S E
v v hv g I I g
t x x
Dv v v x
Dt t x t
Dv h h x
Dt t x t
Characteristic equations
• We multiply the first of the original equations
with a multiplier l and add the two equations up:
• To obtain total differentials in the brackets we
have to choose
17
S E
v v h g hv h v g I I
t x t xl l
l
1,2
g gB
h Al
• Thus we obtain the characteristic equations:
along
18
along
S E
Dv g Dhg I I
Dt c Dt
S E
Dv g Dhg I I
Dt c Dt
dxv c
dt
dxv c
dt
• Positive and negative characteristics for
sub-critical, critical and super-critical flow:
Types of characteristics
t t tPP P
C+ C+C+
C-
C-C-
EE EW W Wx x x
Terminology: P, W (West) und E (East) instead of i, i-1, i+1
19
Integration of the characteristic
equations
• Multiplication with dt and integration
– along characteristic line
– and along characteristic line
– yields:20
P
W
ES
P
W
P
W
dtIIgdhc
gdv
P
E
ES
P
E
P
E
dtIIgdhc
gdv
dxv c
dt
dxv c
dt
WPWESWP
W
WP ttIIghhc
gvv
EPEESEP
E
EP ttIIghhc
gvv
PWpP hCCv
P n E Pv C C h
WPWESW
W
Wp ttIIghc
gvC
EPEESE
E
En ttIIghc
gvC
( / ) ( / )E E W WC g c C g c
or
This implies a linearisation. The wave
velocity becomes constant in the element. 21
Integration of the characteristic
equations
Grid for subcritical flow (1)
Zeit
x
j
j+1P
W E
Characteristics start on grid points
Terminology C (Center), W (West) und E (East) instead of i, i-1, i+1
C
Problem: Characteristics
intersect between grid points
in points P at time levels
which do not coincide with
the time levels of the grid.
Results have to be
interpolated.
22
Grid for subcritical flow (2)
Zeit
x
j
j+1
P
W E
Characteristic lines end at point P, starting points do not coincide with
grid points. Values at starting points are obtained by interpolation
from grid point values
C
We choose this
variant!
23
Terminology C (Center), W (West) und E (East) instead of i, i-1, i+1
Interpolation (left)
24
x
tcv
xx
xx
xx
xx
vv
vv LL
WC
LP
WC
LC
WC
LC
L LC L
C W
v c tc c
c c x
Interpolation (right)
25
R RC R C R P R
C E C E C E
v c tv v x x x x
v v x x x x x
R RC R
C E
v c tc c
c c x
Starting point L
• Solution for vL and cL yields:
Inrerpolating analogously for h:
26
WCWC
WCCWC
L
ccvvx
t
vcvcx
tv
v
1
WC
WCLC
L
ccx
t
ccx
tvc
c
1
WCLLCL hhcvx
thh
Starting point R for subcritical flow
• In analogy to point L, variables for point R
vR and cR
The method is an explicit method. The CFL-criterium is automatically fulfilled.27
1
C E C C E
R
C E C E
tv c v c v
xvt
v v c cx
1
C R C E
R
C E
tc v c c
xct
c cx
R C R R C E
th h v c h h
x
Starting point for supercritical flow
• Starting point of characteristic between W
and C
• Using velocity v-c we obtain
28
WCWC
WCCWC
R
ccvvx
t
vcvcx
tv
v
1
CW
WCRC
R
ccx
t
ccx
tvc
c
1
WCRRCR hhcvx
thh
Final explicit working equations
tIIghc
gvC
LESL
L
Lp
tIIghc
gvC
RESR
R
Rn
P p L Pv C C h P n R Pv C C h
with
and
( / ) ( / )L L R RC g c C g c
Integration from L to P and from R to P
2 equations with
2 unknowns
Boundary conditions
are required as discussed
in FD method
29
Classical dam break problem:
Solution with method of
characteristics
Propagation velocity of fronts slightly too high
30
Matrix form of the St. Venant
equations (1D)
31
Finite volume method
• For simplicity we consider a system withoutsource term. Integrating in space we obtain:
𝑑
𝑑𝑡න
𝑥𝑖−12
𝑥𝑖+12
𝑢 𝑥, 𝑡 𝑑𝑥 = Ԧ𝑓 𝑢 𝑥𝑖−1/2, 𝑡 − Ԧ𝑓 𝑢 𝑥𝑖+1/2, 𝑡
cell boundaries
Ԧ𝑓 Ԧ𝑓
32
• Additionally, we integrate in time between tn
and tn+1 :
This is the integral form of the equations.
න
𝑥𝑖−12
𝑥𝑖+12
𝑢 𝑥, 𝑡𝑛+1 𝑑𝑥 = න
𝑥𝑖−12
𝑥𝑖+12
𝑢 𝑥, 𝑡𝑛+1 𝑑𝑥 +
න
𝑡𝑛
𝑡𝑛+1
Ԧ𝑓 𝑢 𝑥𝑖−1/2, 𝑡 𝑑𝑡 − න
𝑡𝑛
𝑡𝑛+1
Ԧ𝑓 𝑢 𝑥𝑖+1/2, 𝑡 dt
33
• Defining:
and
we can write:
𝑢𝑖𝑛 =
1
∆𝑡න
𝑥𝑖−12
𝑥𝑖+12
𝑢 𝑥, 𝑡𝑛 𝑑𝑥
Ԧ𝑓𝑖±1/2 =1
∆𝑥න
𝑡𝑛
𝑡𝑛+1
Ԧ𝑓 𝑢 𝑥𝑖±1/2, 𝑡 𝑑𝑡
𝑢𝑖𝑛+1 = 𝑢𝑖
𝑛 +∆𝑡
∆𝑥( Ԧ𝑓𝑖−1/2 − Ԧ𝑓𝑖+1/2)
34
• Different schemes can be devised according tothe apporach to express fluxes at the cellboundaries
• We distinguish:
- Centered schemes, which give equal weight toneighboring cells and do not need informationon direction of wave propagation. They are easy to implement but lead to strong numericaldiffusion;
- Upwind schemes, which use wave propagationto express fluxes. More difficult to implementbut much more accurate.
Numerical schemes:
Ԧ𝑓𝑖±1/2
35
• Fluxes are expressed as
• Method is first order accurate and very simple toimplement. However, it leads to numericaldiffusion that is too strong for practicalapplications.
• CFL criterion:
Centered scheme: Lax-Friedrichs
Ԧ𝑓𝑖+1/2 =1
2Ԧ𝑓(𝑢𝑖+1
𝑛 + Ԧ𝑓(𝑢𝑖𝑛 −
1
2
∆𝑥
∆𝑡(𝑢𝑖+1
𝑛 −𝑢𝑖𝑛)
Ԧ𝑓𝑖−1/2 =1
2Ԧ𝑓(𝑢𝑖
𝑛 + Ԧ𝑓(𝑢𝑖−1𝑛 −
1
2
∆𝑥
∆𝑡(𝑢𝑖
𝑛−𝑢𝑖−1𝑛 )
and
/( v )t x c 36
• i+1/2 becomes i and i-1/2 becomes i-1 if thewave propagates in positive x-direction
• Method is more robust in the presence of shocksbut numerical diffusion is still considerable.
• CFL criterion:
Simplest upwind scheme: explicit
upwinding
Ԧ𝑓𝑖+1/2 = Ԧ𝑓(𝑢𝑖𝑛) and
/( v )t x c
Ԧ𝑓𝑖−1/2 = Ԧ𝑓(𝑢𝑖−1𝑛 )
37
𝑡2 𝑡2 𝑡2 𝑡2
𝑡2 𝑡2 𝑡2 𝑡2
38
Simplest upwind scheme: explicit
upwinding (2)
State of the art upwind scheme:
Godunov
• Method requires the solution of the Riemann problem at every cell
boundary and on each time level.
• This amounts to calculating the solution in the regions that form
behind the non-linear waves developing in the Riemann problem as
well as the wave speeds necessary for deriving the complete wave
structure of the solution.
Idea: solve local Riemann
problems forward in time
39
Riemann problem
• Waves are either shocks
(solution is discontinuous)
or rarefactions (solution is
continuous)
• To find the exact solution
in the “star” region, we
need to establish
appropriate jump
conditions
40
Example: HHLE(*) solver
(*) Method is an approximate Riemann solver developed by Harten, Lax and van Leer (1983) and improved by
Einfeldt (1988)
It is assumed that two waves propagate in
opposite directions with velocities SL and SR,
generating a single state in between them:
How to compute UHLLE?
We start from the integral form of the equations (slide 33).
41
HHLE (2)
Control volume for calculation
of HLLE flux
Integral form of equations:
which gives on the right hand side:
where and
The left hand side can be split into 3 integrals:
(*)
(**)
42
HHLE (3)
Combining (*) and (**) gives:
Dividing by the length we finally obtain:
Using this expression with the Rankine Hugoniot conditions (see e.g. Guinot p. 150)
we get the expression for the HHLE flux to be used in the Godunov scheme:
43
2D Shallow water equations
The 2D shallow water equations can be written
in matrix forms as:
44
Difference to 1D
• Additional variable (spec. flow in y-direction) and additional momentum equation.
• Fluxes in x-direction are formulated equal to the fluxes in 1D.
• Fluxes in y-direction are formulated in analgoy to fluxes in x-direction. In addition to e(est) and w(west) the indices n(north) und s(south) are introduced. The direction of upwinding is determined independently from the upwind direction in the x-coordinate.
• The conservation is over the whole element. I.e. source terms and fluxes over east/west and north/south boundaries enter the same balance. 45
Specialties of 2D modelling
• The 2D computational grid is always a projection on the
horizontal plane. Different position of nodes in z-direction
influence the source term (gravity).
• 2D elements are more general, i.e. only in the case of
rectangular elements the 2D problem can be divided into two 1D
problems.
• In the case of general elements (e.g. triangular elements) the
fluxes orthogonal to the element sides must be used. They are
decomposed into components along the orthogonal x/y-
directions.
• Approximately rectangular elements improve computational
accuracy.
• If element sizes vary strongly the numerical error increases fast.
In that case higher order schemes have to be used. 46
Flows with free water surface(Navier-Stokes approach, vertically 2D or 3D)
• For the solution of the partial differential equations the
domain has to be discretized. This is not immediately
possible as the position of the surface is not a priori known.
An iterative procedures is necessary.
• There are different ways to tackle the problem:
– Surface Tracking: the grid follows the free surface.
– Solution of an additional advection equation i.e. on a fixed
grid information is transported with the advective flow. The
information is the water contents of a cell (Fraction of volume
- FOV) or the distance from a datum to the surface (LS).
– On a fixed grid particles are moved convectively with the flow
(Marker in cell - MAC).
47
48
Comments on the
Navier-Stokes approach
• Additional non-linearity means additional computational effort and the danger of non-convergence.
• The discretisation is considerably more difficult and requires efficient grid generators. Inappropriate discretisation may lead to wrong solutions.
• Numerical diffusion can smooth out the position of the surface.
• The solution of the flow is considerable better if vertically curved streamlines exist.
• The Navier-Stokes approach is more for local phenomena, shallow equation approach for global flow phenomena.
49
HEC-RAS
50
Conceptual model of HEC
channel
floodplain
Storage
(without flow)
1D but still taking into account channel and floodplains
51
How to stay 1D in energy, momentum,
and piezometric head?
z = elevation of water surface
is the same for channel and
flood plains
= hp in our nomenclature
52
Some definitions
Conveyance K for each subdivision:
• If there is no foodplain, the model describes what we did so far
• If there is a floodplain, the channel is subdivided into several
sections with the same water level but possibly different friction
coefficients
Total flow:
subdivision
53
3/2
,
1ihyi
i
iEii rAn
KwithIKQ
N
i
iQQ1
Equations for channel and floodplain
lc
f
f
f
fc
c
c
qqt
S
t
A
x
Q
qt
A
x
Q
Indices: f = floodplain, c = channel
cfE
f
f
f
fff
fcE
c
c
c
ccc
MIx
zgA
x
Qv
t
Q
MIx
zgA
x
Qv
t
Q
,
,
)(
)(
Continuity equations:
Momentum equations:
z = elevation of the water surface, ql=lateral inflow, S area of non-conveying cross-sec.
qf = flow from floodplain to channel (per length),
qc = flow from channel to floodplain (per length) ,
Mf, Mc corresponding momentum fluxes (per length)
The right hand sides are eliminated by adding the equations for channel
and floodplain54
Equations combined in 1D
Final 1D equations
The unknowns are Q and z (= hp)
Ac, Af and S are known functions of z
IE,c and IE,f are known functions of z and Q
55
0)/)1(()/(
0))1(()(
,,
2222
fE
f
fcE
c
c
f
f
c
c
fc
Ix
zgAI
x
zgA
x
AQ
x
AQ
t
Q
x
Q
x
Q
t
A
)/(
)1(
fcc
fc
fc
KKK
withQQQQQ
SAAA
)( workpreviousourinx
hI
x
z
hzz
S
bottom
Equations in difference form
Momentum equation
with
Continuity equation
velocity coefficient
equivalent x-coordinate
56
Qv
QvQvAAA
xIAxIAxAI
ffcc
fc
ffEfccEcEE
,,
0.
fE
EEE
ffccI
x
zgA
x
vQ
xt
xQxQ
0
lff
f
cc Qx
t
Sx
t
Ax
t
AQ
)()()1(
5.0
11
11,
1
1
1
1
,
j
i
j
i
j
i
j
ispacei
j
i
j
i
j
i
j
itimei
FFFFF
FFFFF
Solution method
Implicit, linearized Finite Difference scheme
Linearization method: Example: term v2, a more complicated term
would be Q2/Ac
122221
1
22
j
i
j
ii
j
i
j
iii
j
i
j
i
j
i
i
j
i
j
i
vvvvvvvvvv
vvv
Implicit scheme:
All spatial derivatives are taken as a weighted
average between old and new time, weight θ
All time derivatives are taken in the middle of
The spatial discretization interval
Solution of big equation system for 2Nx unknowns per time step,
where Nx is the number of nodes
As the equation system is sparse, techniques for sparse
matrices are used
x
t
ji+1
j+1
ix
t θ
0.5
57