Mscthesis Matlab Code
Mscthesis Matlab Code
Mscthesis Matlab Code
MS C IN M ODERN A PPLICATIONS OF
M ATHEMATICS
A CADEMIC Y EAR 2002-2003
MS C P ROJECT
Melina Freitag
Supervisor: Prof. K.W. Morton
I declare that this document and the accompanying code has been composed by
myself, and describes my own work, unless otherwise acknowledged in the text.
It has not been accepted in any previous application for a degree. All sources of
information have been specifically indicated.
Acknowledgements
This project would not have been possible without the guide and support of Pro-
fessor K.W. Morton. I would like to thank him for his continued help and advice
throughout this work.
T O D ANIEL
Abstract
We investigate the Preissmann Box Scheme which is the standard numerical scheme
used by hydraulic engineers to model open channel flows or surcharged flows in
pipes.
We apply the Scheme to both subcritical and transcritical flow and analyse its
behaviour in both cases. Since the Box Scheme breaks down in the second case we
present a method, which overcomes this problem.
By adopting the work which has been done for steady transonic flows and ap-
plying it to unsteady open channel flows we develop a modified Box Scheme which
works efficiently for transcritical flows. Numerical examples supporting our results
are presented.
Analysis of the solution of nonlinear systems is used together with computa-
tional testing of new algorithms.
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Contents
1 Introduction 1
4 Model Problems 20
4.1 Steady Open Channel Test Problems . . . . . . . . . . . . . . . . . . . 20
4.2 Subcritical Problem with Small Froude Number (P1) . . . . . . . . . . 21
4.3 Near-critical Problem (P2) . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.4 Transcritical Problem Involving a Hydraulic Jump (P3) . . . . . . . . 22
4.5 Transcritical Problem with Changing Channel Width (P4) . . . . . . . 23
i
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
B MATLAB Code for Solving Non-critical Problems with the Box Scheme 60
C MATLAB Code for Solving Transcritical Problems with the Box Scheme
using Cell Residuals 62
D MATLAB Code for Solving Transcritical Problems with the Box Scheme
using Nodal Residuals 64
References 67
Index 70
ii
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
List of Figures
iii
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
iv
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
1 Introduction
The accurate computer simulation of river and pipe flows is of great importance in
the design of urban drainage networks. The St Venant equations are widely used by
Hydraulic Engineers as an accurate model for one-dimensional open channel flow
and surcharged flow in pipes. However, the analytic solution to these nonlinear
equations is only known for a limited number of special cases. Therefore we need a
reliable and accurate numerical solver.
Finite difference schemes, such as the Preissmann Box Scheme [27], are the stan-
dard schemes used in the solution of the St Venant equations. The Box Scheme, as
an implicit method, is unconditionally stable and extremely robust as it allows one
to choose the time step on the basis of accuracy rather than stability. It leads to
a nonlinear system of equations, which may be solved iteratively, using Newton’s
Method. Using its block-tridiagonal structure, the resulting system can be solved
relatively cheaply with the Thomas Algorithm. [24].
The Box Scheme can be applied to both purely subcritical and purely supercritical
flow. However, the occurrence of transcritical flow (i.e. the existence of both sub-
critical and supercritical flow regions in the considered domain) leads to problems
with the original implementation of the Box Scheme and the method breaks down.
We describe these problems and the reasons for their occurrence.
1
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Transcritical flow occurs frequently in channels with rapidly changing channel width
or on steep slopes, for example in mountainous areas. Steep slopes sometimes lead
to the formation of shocks, that is stationary or moving hydraulic jumps. Another
occurrence of transcritical flow is for dam-break waves.
There have been many attempts to overcome this limitation of the Box Scheme. One
approach is to change the underlying system of differential equations, such that
the flow remains subcritical [9, 11]. This sometimes gives reasonable results, but is
physically incorrect.
The correct approach is to keep the differential equations unmodified and switch
between the subcritical and supercritical implementation of the Box Scheme. Since
the mathematical situation is similar to that for compressible gas flow in a transonic
duct, we can use the concept of residual distribution, which was introduced in Mor-
ton et al. [25] and successfully applied to the steady-state Euler equations. We want
to adapt this technique to the unsteady St Venant equations, and show that we can
accurately model time dependent transcritical flow. Several test problems will be
carried out and we will see in the numerical results, that even transcritical prob-
lems involving shocks are modelled accurately. All computations are carried out in
M ATLAB [8]. The description of all code developed and used for this report may be
found in the appendices.
2
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In this section we will give a derivation of the Saint Venant equations and ap-
ply them to a channel with trapezoidal cross-section. We will use these equations
throughout this report as model equations for open channel flow.
The St Venant equations are generally used to provide an accurate model of one
dimensional open channel flow. They are essentially obtained from the principles
of mass and momentum conservation. In order to derive them, certain assumptions
have to be made:
• the water in the channel is an incompressible ideal fluid and has constant den-
sity,
• all forces are due to gravity and friction, i.e. forces due to wind stress, Coriolis
force, atmospheric pressure etc. are negligible,
∇ · u = ∇ · (u, v, w) = 0, (2.1)
where u is the velocity vector field. Without any assumptions on the x, y-variation
of the surface we now average over the depth h − b, by integrating over z, see Figure
3
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
D
(h(x, y, t) − z) = 0, (2.2)
Dt
i.e. particles on the surface cannot leave the surface; and similarly
D
(b(x, y) − z) = 0, (2.3)
Dt
We define the vector q to be the integral of (u, v) over the depth, i.e.
Z η=h
q u
1 = dη. (2.6)
q2 η=b v
∂t h + ∇ · q = 0, (2.7)
the flow equation in terms of the height and the velocities. In order to complete the
cross-sectional averaging, we assume the flow is parallel to the boundary and define
4
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
the discharge
Z yR (x)
Q(x, t) = q1 dy, (2.8)
yL (x)
At + Qx = 0. (2.10)
Another way to derive this equation is to consider the change of mass in a cross-
section. The principle of mass conservation states that the total change in mass
is balanced by the flow through the boundary, with no flow through the bed or
the surface. These assumptions lead to the integral form of the mass conservation,
which was derived in [9],
Z x+∆x Z t+∆t
[A]t+∆t
t dx + [Q]x+∆x
x dt = 0. (2.11)
x t
Now we can apply the same argument as in the previous section to the x-momentum.
From the basic Navier-Stokes equations (see [26]) we have
where u = (u, v, w) is the velocity vector field, p is the pressure and F represents all
external forces. We need to make assumptions about the normal momentum flux on
the boundary, the momentum, gravity and bed friction.
Again, by integrating over the cross-section in x-direction, the first term in (2.12) is
given by
Z x+∆x
[Q]t+∆t
t dx. (2.13)
x
Assuming hydrostatic pressure, i.e. p = pat + g(h − z), the second term in (2.12)
5
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
becomes x+∆x
t+∆t
βQ2
Z
+ gI1 , (2.14)
t A x
Z h Z yR
I1 (x, t) = (h − z)dydz (2.15)
b yL
is the cross-sectional moment integral. The external forces give terms from the bed
friction but also from g(h − z), arising from the change in bed cross-section with x,
and obtained from integrating g(h − z) over the bed surface area projected into the
x-direction. Hence, the external forces may be written as
Z t+∆t Z x+∆x
g(A(S0 − Sf ) + I2 )dxdt, (2.16)
t x
where S0 is the bed slope, Sf is the frictional slope from the fricitional forces and
Z h Z yR
I2 (x, t) = (h − z)σx dydz (2.17)
b yL
is the pressure force acting on the channel bed. The function σx represents the
change in channel width in the x-direction. Hence, the momentum equation (2.12)
becomes
In the (y, z)-plane the bed shape is given either by z = b(y) or equivalently by ∆y =
ς(z), where ς(z) is the channel width at height z. Then we can introduce the bed
level ξ(x) and replace z by η := z − ξ(x), a translation in the z-direction. Hence,
the channel width may be written as σ(x, η) = σ(η) − ς(z). Then, from (2.9), we can
6
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Z D
σ(x, η)dη = A(x, t); (2.19)
0
so it is really an average depth over the width of the channel, i.e, the depth does not
depend on the y-variation of the water surface. As a result we can write
Z D(x,t)
I1 (x, t) = (D(x, t) − η)σ(x, η)dη, (2.20)
0
Z D(x,t)
I2 (x, t) = (D(x, t) − η)σx (x, η)dη. (2.21)
0
Where required we define the river height as h(x, t) = D(x, t) + ξ(x); note that the
height of a river is more easily observed than its depth.
A more detailed derivation of the St Venant equations may be found in [29].
Using the derivation of the previous section a general differential form of the St
Venant equations for unsteady flow is given by
∂A ∂Q
+ = 0, (2.22)
∂t ∂x
∂ βQ2
∂Q
+ + gI1 = gI2 + gA(S0 − Sf ), (2.23)
∂t ∂x A
provided the wetted cross-sectional area A(x, t) and the discharge Q(x, t) are suffi-
ciently smooth. The distance along the channel is given by x, t is the time, S0 (x) is
the bed slope, Sf (x, A, Q) is the frictional slope, g is the gravitational acceleration
and β is the momentum coefficient. For an ideal fluid, with no boundary layers, we
usually have β = 1. Furthermore, the bed slope S0 is given by
dξ
S0 (x) = − , (2.24)
dx
where ξ(x) is the bed level, the elevation of the bed above some horizontal datum.
I1 (x, t) and I2 (x, t) are given by (2.20) and (2.21). The average fluid velocity for each
Q(x, t)
channel cross-section is given by v(x, t) = . Finally, for the frictional slope Sf
A(x, t)
7
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Q|Q|
Sf = , (2.25)
K2
A5/3
K= . (2.26)
nP 2/3
P (x, h) is the wetted perimeter and n is Manning’s coefficient, which measures the
roughness of the channel. In the following section we describe how the general St
Venant equations (2.22) and (2.23) can be written in the case of trapezoidal cross-
sections.
If the channel cross-section is trapezoidal, then the width of the channel can be de-
scribed by
σ(x, η) = B(x) + 2ST (x)η, (2.27)
where ST (x) is the side slope of the channel and B(x) is its bottom width, see Figure
3. For the special case of a rectangular channel ST (x) equals zero. We can evaluate
(2.20) and (2.21) to get
2 B(x) D(x, t)ST (x)
I1 (x, t) = D(x, t) + , (2.28)
2 3
2 1 ∂B(x) D(x, t) ∂ST (x)
I2 (x, t) = D(x, t) + . (2.29)
2 ∂x 3 ∂x
8
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Also, the wetted cross-sectional area A(x, t) depends on the depth D(x, t) of the
water:
∂A
A(x, t) = D(x, t)B(x) + D(x, t)2 ST (x) and (x, t) = B(x) + 2D(x, t)ST (x).
∂D
(2.30)
Since ST (x) ≥ 0 and B(x) > 0 we can always determine the depth of the water
D(x, t) from A(x, t):
A(x, t)
, if ST (x) = 0
sB(x)
D(x, t) = (2.31)
B(x) B(x)2 A(x, t)
− 2S (x) + 4S (x)2 + S (x) , if ST (x) > 0.
T T T
p
T (x, D) = B(x) + 2D(x, t)ST (x) and P (x, D) = B(x) + 2D(x, t) 1 + ST (x)2 ,
(2.32)
for the water surface width T and the wetted perimeter P . Therefore the system
may be written in the conservative vector form
ut + fx = s, (2.33)
where
9
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Q
where v = is the average velocity and, using (2.30) and (2.32),
A
a1 = v − c, (2.39)
a2 = v + c, (2.40)
Hence, A(u) has got 2 real eigenvalues and 2 linearly independent eigenvectors if
c 6= 0. By definition the system is hyperbolic (see [13]), and also, since in the latter
case the eigenvalues are distinct, strictly hyperbolic.
10
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
The Preissmann Box Scheme is the standard method used by hydraulic engineers to
describe one dimensional flow. It is a so-called cell-vertex scheme (Morton [21]) and,
as a four-point finite-difference implicit scheme, unconditionally stable. However,
the Box Scheme can only be used to model strictly subcritical or supercritical flow.
We will show why it breaks down for transcritical flow.
tn+1
o o
∆t
tn
o o
xj xj+1
hj
∂u un+1 n
j+1 − uj+1 + uj
n+1
− unj
≈ , (3.2)
∂t 2∆t
n+1
∂f θ(fj+1 − fjn+1 ) + (1 − θ)(fj+1
n
− fjn )
≈ , (3.3)
∂x hj
11
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
where θ ∈ [0, 1]. The grid points x0 < x1 < . . . < xN are variably spaced with
hj = xj+1 − xj for all j = 0, . . . , N − 1. The spatial derivatives are centered in
space and weighted in time according to the weighting factor θ. For θ = 0 the
scheme is fully explicit and for θ = 1 it is fully implicit. The source term s(u, x)
is approximated by a weighted average of the four points in the stencil in Figure 4
with
1 n+1 1
s(u, x) ≈ θ(sj+1 + sjn+1 ) + (1 − θ)(snj+1 + snj ), (3.4)
2 2
un+1 n
j+1 − uj+1 un+1
j − unj ∆t n+1 ∆t
+ + θ(fj+1 − fjn+1 ) + n
(1 − θ)(fj+1 − fjn )
2 2 hj hj
(3.5)
1 n+1 n+1 1 n n
− ∆t θ(s + sj ) + (1 − θ)(sj+1 + sj ) = 0.
2 j+1 2
for j = 0, . . . , N − 1.
where u = [A, Q]T , and apply the Box Scheme (3.5) in vector form, which gives
un+1 n
j+1 − uj+1 un+1
j − unj n+1
+ + λj θ(fj+1 n
− fjn+1 ) + λj (1 − θ)(fj+1 − fjn )
2 2 (3.7)
1 n+1 n+1 1 n n
− ∆t θ(s + sj ) + (1 − θ)(sj+1 + sj ) = 0,
2 j+1 2
∆t
for all j = 0, . . . , N − 1, where λj =and hj = xj+1 − xj . The vectors u, f and s are
hj
taken from (2.34)-(2.36). Therefore we may implement the Box Scheme for a general
trapezoidal channel including friction forces and variable width.
12
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
3.3 Implementation
In order to implement the Box Scheme we consider a finite domain x ∈ [0, L] and use
N + 1 grid points [x0 , . . . , xN ] which are variably spaced with distance hj . This vari-
able spacing allows us to respond to changes in channel width and bed slope and
helps to approximate the depth of the water more exactly. It might also be useful
for shock recovery. The implementation procedure is described in [9]. Since there
are two unknowns Aj and Qj at each node xj , we have a total number of 2N + 2 un-
knowns. By defining the left-hand side of (3.7) to be the cell residual Rj+ 1 of each of
2
the N cells [xj , xj+1], j = 0, . . . , N −1, we get 2N equations. Thus, we need two more
equations, which are supplied by the boundary conditions. For subcritical flow the
discharge Q is usually prescribed upstream and the height h downstream. Both Q
and h are prescribed at the upstream boundary for supercritical flow.
Since the St Venant equations are nonlinear we need a nonlinear iteration technique,
to solve
Rj+ 1 = 0, ∀j = 0, . . . , N − 1. (3.8)
2
We also need an efficient method, since within each time step we have to iterate
successively. We use Newton’s Method for systems, which is described in [2], in
order to solve (3.8). Suppose the solution is known up to time level tn and we want
to find the solution at time level tn+1 . Let u(k) be the estimate of the solution un+1
after k iterations. The residual for this estimate is
(k) (k)
(k) uj+1 − unj+1 uj − unj (k) (k) n
Rj+ 1 = + + λj θ(fj+1 − fj ) + λj (1 − θ)(fj+1 − fjn )
2 2 2 (3.9)
1 (k) (k) 1 n n
− ∆t θ(s + sj ) + (1 − θ)(sj+1 + sj ) .
2 j+1 2
13
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
∂f ∂s
where A = ,S = and j = 0, . . . , N − 1. For the Jacobian we assume that
∂u ∂u
∂B ∂ST
=0 and = 0, (3.11)
∂x ∂x
and therefore
0 1 0 0
A= and S = ,
− 2gA
p
2 2
c − v 2v g S0 + Sf 37 − 8A
3T P
1+ ST2 Q
Sf
(3.12)
where the wave celerity c and the average velocity v are given by
r
gA Q
c= and v = . (3.13)
T A
The system, we have to solve for each state u(k) , may then be written in block-
tridiagonal form. If we multiply by 2 and, just for the purpose of a simpler notation,
omit S, the system may be written in the form
MW = Z, (3.14)
where
α0 β0 0 ··· ··· ···
I − 2θλ0 A0 I + 2θλ0 A1 0 ··· ···
0 I − 2θλ1 A1 I + 2θλ1 A2 0 ···
. .
M =
··· ··· . . . . ···
··· I − 2θλN −2 AN −2 I + 2θλN −2 AN −1
0 0
··· ··· 0 I − 2θλN −1 AN −1 I + 2θλN −1 AN
··· ··· ··· 0 αN βN
(3.15)
with the Jacobian Aj evaluated at xj , j = 0, . . . , N, and
h iT
(k) (k) (k) (k)
W = ∆u0 ∆u1 · · · ∆uN −1 ∆uN , (3.16)
h iT
Z = γ0 −2R 1 −2R 3 · · · −2RN − 3 −2RN − 1 γN . (3.17)
2 2 2 2
14
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
represent the boundary conditions at inflow and outflow. The number of boundary
conditions at inflow and outflow is determined by the kind of flow present.
Once the new iterate u(k+1) is calculated using the Newton update
ku(k+1) − u(k) k1
< tol, (3.21)
ku(k) k1
is satisfied, where the tolerance tol is a small positive number or until a fixed num-
ber of iterations has been carried out.
Note, that if (3.11) is not satisfied or by omitting S in the Jacobian, we only get a
Quasi-Newton method.
15
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
where Ai , Di and Ci are 2x2 matrices and Wi = [∆Ai , ∆Qi ]T . Using the boundary
conditions at inflow and outflow we get
−2θλj−1 (c2j−1 − vj−1
2
) 1 − 4θλj−1 vj−1
A0 = 0, and Aj = , j = 1, . . . N,
0 0
(3.23)
for the subdiagonal elements,
0 0
CN = 0, and Cj = , j = 0, . . . N − 1, (3.24)
1 2θλj
and
2θλj (c2j − vj2 ) 1 + 4θλj vj
Dj = , j = 1, . . . N − 1, (3.26)
1 −2θλj
for the diagonal block entries. Direct solution gives the backwards recursion
WN = FN , (3.27)
Wj = Ej Wj+1 + Fj , j = N − 1, . . . , 0, (3.28)
and F−1 = 0, E−1 = 0. This technique is has a very similar structure to the simple
Marching Scheme, described in [25] and is a stable procedure if the inverses exist
16
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
and if
kEj k ≤ 1, ∀j. (3.31)
In section 6.4 we will show with a similar analysis as it was done in Morton [20], that
our Thomas Algorithm is well-conditioned. The described algorithm is easier and
faster than setting up and solving the whole system, since less storage is required
and only 2x2 matrices have to be inverted.
In order to implement the above algorithm, we need to set up the boundary condi-
tions as well as the initial conditions at the nodes. For the cross-sectional area Aj
and and the discharge Qj we take constant initial conditions, subject to the bound-
ary conditions. Then, for each time step, we perform the following algorithm, until
the steady state is reached:
5. check, if stopping criterion (3.21) is satisfied. If so, then move on to the next
time level, otherwise start with 1. again.
The term transcritical flow denotes the existence of both subcritical and supercritical
flow regions in an open-channel system. It is similar to transonic flow in gas dy-
17
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
namics and occurs in irrigation canals especially on steep slopes or rapidly changing
channel width.
a1 = v − c, (3.33)
a2 = v + c, (3.34)
are important. As stated in [9] the eigenvalues can be thought of as the veloci-
ties at which disturbances propagate. When the eigenvalues have opposite signs,
disturbances travel both upstream and downstream. When the eigenvalues have
the same sign, no information is carried upstream and disturbances can only travel
downstream. In the first case, the flow is said to be subcritical, in the latter case it is
supercritical. By calculating the Froude number (see [7]),
r
|v| gA
F = , with c= (3.35)
c T
similar to the Mach number in gas flow, the flow may be determined to be subcriti-
cal or supercritical as F is less or greater than unity. Some authors refer tranquil and
rapid flow instead [3]. From (3.35) we clearly see, that for a slowly flowing river
we always have subcritical flow. We also find that supercritical flow occurs, if the
velocity of the stream is increasing. This happens if the bed slope steepens, or, if
water flows through a narrow region.
A typical situation, that arises in a river is the following: The flow is subcritical
at inflow and at outflow, i.e. the bed slope is very gentle. If the velocity of the
stream increases, we will have a region of supercritical flow. Typically, flow changes
smoothly to supercritical flow at the so called sonic point and returns to subcritical
flow via a shock or hydraulic jump.
As we will explain more detailed in section 7.1, setting the cell residuals to zero
won’t work in this subcritical - supercritical - subcritical case. It turns out, that there
is too little information at the sonic point, and too much information at the shock.
18
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Hence, flows in parts of the river with steep bed slope or rapidly changing chan-
nel width cannot be resolved. We will see some examples for this limitation in the
following 2 sections.
19
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
4 Model Problems
We need to create test problems with a known analytical solution, in order to check
our algorithms. In this section we describe how to construct such test problems and
we introduce some problems to which we will later apply our algorithms.
In [15] and [16] a method is described, that allows the construction of test problems,
where in each case the exact solution for the steady St Venant equations is known.
Under steady state conditions it is assumed that the depth D = D(x) and the dis-
charge Q = Q(x). Furthermore we use a trapezoidal channel with I2 = 0, i.e. the
side slope ST and the channel width B are constant. Then equations (2.22) and (2.23)
reduce to
∂Q
= 0, (4.1)
∂x
βQ2 D 2 B D 3 ST
∂
+g + = gA(S0 − Sf ). (4.2)
∂x A 2 3
From the first equation, Q is clearly constant along the length of the channel. Differ-
entiating the momentum term in the second equation yields
Q2 T
dD
1− = S0 − Sf . (4.3)
gA3 dx
Hence, the bed slope function S0 (x) can be deduced from (4.3). The usual approach
is now an inverse one. We choose a smooth depth function D = D(x) and use (4.3)
in order to calculate the bed slope S0 . The analytic solution to this steady state prob-
lem is then given by D = D(x). Constructing test problems with a non-smooth
analytic solution is similar, but we have to take care about the hydraulic jump. The
hypothetical flow must be physically allowable. A procedure for achieving this is
described in [16].
We are going to study the unsteady case, but still, the steady solution is important.
On the one hand, if constant boundary conditions are imposed and we let t → ∞,
20
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
then the flow converges to a steady state, for which the analytical solution is known.
On the other hand steady flows are often required as initial data for unsteady simu-
lations. We therefore state some steady test problems.
The first problem, that we consider is a trapezoidal channel of length 1 km, width
B = 10 m and side slope ST = 1. We impose a discharge of Q = 20 m3 /s at inflow
and a depth of Dout = 1.112299 m. The flow is subcritical at inflow and outflow.
As Manning roughness coefficient we choose n = 0.02. Using (4.3) the slope of the
channel is then given by
4
Q2 T Q2 n2 P 3
0
S0 (x) = 1− D (x) + 10 , (4.4)
gA3 A3
where P, T and A are chosen according to (2.32) and (2.30). The depth D(x) of the
water for the steady problem is given by
31 2 !!
4 3 2 x 1
D(x) = − exp −144 − . (4.5)
g 2 5 1000 2
2
1
depth and bed slope
1.5
heigth
0.5
0
0.5
−0.5 0
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
x x
Figure 5: Depth and bed slope (P 1) Figure 6: Bed level and surface level (P 1)
21
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
We choose the same channel geometry as in the previous problem (P1), but with
depth Dout = 0.748323 m at outflow. As Manning roughness coefficient we choose
n = 0.03. The depth of the water for the steady problem is given by
31 2 !!
4 1 x 1
D(x) = 1 + exp −16 − , (4.6)
g 2 1000 2
and the slope is again calculated by (4.4). The solution for the steady state is shown
in Figures 7 and 8. We include this problem, because it is close to being transcritical
1.2 7
depth bed level
bed slope x 100 free surface level
1.1 critical depth critical level
6
5
0.9
depth and bed slope
0.8
4
heigth
0.7
3
0.6
0.5 2
0.4
1
0.3
0.2 0
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
x x
Figure 7: Depth and bed slope (P 2) Figure 8: Bed level and surface level (P 2)
As a test problem for transcritical flow we take an example from [16]. Again, we
choose a trapezoidal channel of length 1 km, width B = 10 m and side slope ST = 1.
The inlet discharge is Q = 20 m3 /s. Now, flow is subcritical at inflow and at out-
flow with depth Dout = 1.349963 m, but, due to the steepening bed slope, it changes
smoothly to supercritical flow and returns to subcritical flow via a hydraulic jump.
As Manning roughness coefficient we choose n = 0.02. Then the bed slope of the
22
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
3.5
1
3
0.8
2.5
2
0.6
1.5
0.4
0.2
0.5
0 0
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Figure 9: Depth and bed slope (P 3) Figure 10: Bed level and surface level (P 3)
This test problem is not constructed using the method described in section 4.1. In-
stead, it is taken from Skeels’ thesis [29, page 144]. We take a rectangular channel of
length 10 km, and smoothly changing width from B = 10 m to B = 5 m and back to
B = 10 m again. The width is obtained via a cubic polynomial,
2 x 3 3 x 2
B(x) = − + 10, x = 0, . . . , 5000, (4.8)
25 1000 5 1000
23
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
24
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
We solve our unsteady test problems with the algorithm described above, i.e. by
driving the cell residuals to zero using Newton’s Method. We monitor the maximum
Froude Number for each time state tn ,
|vj |
F = max , (5.1)
j=0,...,N cj
where tnT is the final time, i.e. the time when the steady state is reached. The CFL
number νjn of the system at (xj , tn ) is defined by
where ρ(.) denotes the spectral radius. By keeping the boundary conditions con-
stant, flow is allowed to approach the steady state. We will see that the Box Scheme
in its original implementation does not solve transcritical problems.
For this problem we use Newton’s Method, i.e. the full Jacobian. We use constants
for discharge Q and depth D, which match the boundary conditions, as initial val-
ues. With θ = 32 , ∆x = 10, i.e. N = 100, ∆t = 10 and a tolerance of 10−10 , the result-
ing depth for the steady state (after t = 900) may be seen in Figure 13. Initially the
maximum Froude Number is 0.5138, the maximum Froude Number for the steady
state is 0.8308. Approximations to the Froude Number for the steady state may be
seen in Figure 14. The maximum CFL number in this case is νmax = 5.1238. Conver-
gence at each time step takes about 3−5 iterations. We can increase the time step and
therefore the maximum CFL number, but we need more iterations for convergence
at each time step. If we omit the derivative of the source term S in the Jacobian, we
have to reduce the time step to about ∆t = 10, and convergence takes about 7 − 10
25
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
1.5 1.5
Computed Solution Computed Froude Number
Analytic Solution
1.4
1.3
1.2
1
Depth of the water (m)
1.1
Froude Number
1
0.9
0.5
0.8
0.7
0.6
0.5 0
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Channel length (m) Channel length (m)
Figure 13: Subcritical problem with small Figure 14: Approximations for Froude Num-
Froude Number, steady state (P 1) ber for subcritical problem (P 1)
iterations. If ∆t is chosen too large, we get no convergence after the first time step.
This behaviour, due to Newton’s Method, will be explained in a later section.
We want to use this problem to check the order of convergence for the Box Scheme.
1
On that score we set θ = 2
and assume that the error e(∆x) satisfies e(∆x) = C∆xβ
for some constant C. Then we can calculate β using
ln e(2∆x)
e(∆x)
β(∆x) = . (5.4)
ln 2
Several computations have been carried out and the error e(∆x) = kDanal − Dnum k∞
has been calculated for problem (P1). Table 1 suggests O(∆x2 ) convergence for the
1
Box Scheme. In section 6 we will see that there is very little dissipation for θ = 2
and oscillations occur, which warp the 2nd order convergence of the Box Scheme.
In order to check the robustness of the method, we can also try θ = 1, which should
almost omit time-stepping. Using N = 100 and ∆t = 900, we get indeed a very
adequate solution for the steady state, after just one time-step and 8 iterations.
26
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
1.3
1.2
Depth of the water (m)
0.9
0.8
0.8
0.7
0.6
0.5
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Channel length (m) Channel length (m)
Figure 15: Near-critical problem after one Figure 16: Near-critical problem at steady
time-step, t = 10 (P 2) state (P 2)
0.9492, the maximum Froude Number for the steady state is 0.9492, too. The max-
imum CFL number in this case is νmax = 5.1065. Convergence takes about 4 − 5
iterations for each time step. After the first time step, the oscillations on the right
hand boundary are largest (see Figure 15), due to the Froude number being close to
unity. The oscillations die out during the iterations and cannot be seen in the steady
state solution. Again, the same result is obtained by omitting the derivative of the
source term S in the Jacobian, with ∆t = 10, 15 − 29 iterations for convergence for
each time step. If ∆t is chosen too large, we get no convergence after the first time
step.
27
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
near the shock. In Figure 17 we can see the result for maximum Froude Number
1.0833 and in Figure 18 the result for maximum Froude Number 1.1735. Shortly af-
ter that time, the scheme breaks down, and we get a completely wrong solution. The
steady state solution cannot even be approached, because it is transcritical. If ∆t is
2 2
Computed Solution after t = 47 Computed Solution after t = 51
Analytic solution for steady state Analytic solution for steady state
1.5 1.5
Depth of the water (m)
0.5 0.5
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Channel length (m) Channel length (m)
Figure 17: Transcritical problem at time t = Figure 18: Transcritical problem at time t =
47 (P 3) 51 (P 3)
chosen too large, we get no convergence after the first time step. The restriction on
the time step is stronger than in the previous cases.
For the problem with changing channel width we just take a Quasi-Newtonmethod.
∂B ∂B
We calculate the Jacobian by assuming that can be neglected. Since max =
∂x ∂x
0.0015 this is justifiable. We use θ = 32 , ∆x = 100, i.e. N = 100 cells and ∆t = 100,
a tolerance of 10−8 and constant initial conditions matching the boundary values.
After t = 8000 the steady state is approached. The result we get for the depth func-
tion can be seen in Figure 19. Initially the maximum Froude Number is 0.8616, the
maximum Froude Number for the steady state is 0.5157. In Figure 20 we can see the
approximation of the Froude Number for the steady state, which clearly indicates
the subcritical case. The maximum CFL number is νmax = 6.6481 and convergence
at each time step takes about 3 − 6 Newton iterations. We can increase the time
step and therefore the maximum CFL number, but we need slightly more iterations
for convergence. If we omit the source term S in the Jacobian entirely, we still get
convergence, but only if we reduce the time-step, for example to ∆t = 10, and con-
vergence takes much longer (7 − 16 iterations).
28
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
3 1.5
Computed Solution Computed Froude Number
2.5
2 1
Depth of the water (m)
Froude Number
1.5
1 0.5
0.5
0 0
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Channel length (m) Channel length (m)
Figure 19: Subcritical problem with chang- Figure 20: Approximations to Froude Num-
ing channel width at steady state ber for subcritical problem at
(P 4a) steady state (P 4a)
In Figure 21, we see the result for the same problem but with a six times steeper
bed slope between x = 4500 and x = 5500. The problem becomes critical at the
steady state. Figure 22 shows Froude Number approximations for the steady state.
From that plot we can see that the problem is near-critical with a Froude Number
close to unity at the steady state. Just two nodes are in the supercritical region and
the problem can still be solved by our unmodified Box Scheme implementation (see
[29]). The maximum CFL number is νmax = 7.0872. Oscillations occur in the critical
region, especially near the shock.
3 1.2
Computed Solution Computed Froude Number
1.1
2.5
1
0.9
2
Depth of the water (m)
0.8
Froude Number
1.5 0.7
0.6
1
0.5
0.4
0.5
0.3
0 0.2
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Channel length (m) Channel length (m)
Figure 21: Near-critical problem with chang- Figure 22: Approximations to Froude Num-
ing channel width, steady state ber for near-critical problem,
(P 4b) steady state (P 4b)
For the same problem with a twenty times steeper bed slope (P4c) between x = 4500
29
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
and x = 5500 the flow becomes supercritical in that particular region. For t = 0
the problem is wholly subcritical, but after running the algorithm for a certain time
t > 0, the unsteady solution becomes supercritical between x = 4500 and x = 5500
and and our unmodified Box Scheme implementation breaks down.
30
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In this section we investigate the accuracy and stability of the Box Scheme applied
to systems of equations. By this means we will also find some explanation, why the
Box Scheme cannot be applied to transcritical flow.
the accuracy of the Box Scheme (3.5) for a regular sized mesh. By using the homo-
geneous equation ut + fx = 0 only, the truncation error (see [22]) of the Box Scheme
may be written as
first order accurate for general values of θ. If we choose θ = 21 , then the truncation
error becomes
∆x2 ∆t2
Tjn = utxx − uttt = O(∆x2 , ∆t2 ), (6.2)
12 12
and the Box Scheme is second order accurate in space and time for this special value
1
of θ. In practice θ = 2
+ O(∆t) is commonly used in order to get second order
accuracy.
Consider the stability of the Box Scheme applied to the linearised form of the homo-
geneous St Venant equations (3.6),
ut + Aux = 0, (6.3)
where A is constant and given by (2.37). This system may be decoupled by intro-
ducing characteristic variables w = [w 1, w 2 ]T (see [13]), with w = V −1 u, where V is
the matrix of eigenvectors (2.41) of A. Then, the system (6.3) can be written as two
31
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Now, in this particular linear constant coefficient case, we can apply Fourier analy-
sis (see Morton and Mayers [24]) individually to each of those two equations. For
convenience, we write them in a general form,
wt + awx = 0, (6.6)
n+1
wj+1 n
− wj+1 wjn+1 − wjn ∆t n+1 ∆t
+ + θa(wj+1 − wjn+1) + n
(1 − θ)a(wj+1 − wjn ) = 0, (6.8)
2 2 ∆x ∆x
must satisfy
|µ| ≤ 1 ∀k. (6.9)
∆t
Substituting (6.7) into (6.8) and defining ν = a yields
∆x
cos k∆x
2
− 2iν(1 − θ) sin k∆x
2
µ= . (6.10)
cos k∆x
2
+ 2iνθ sin k∆x
2
1
θ≥ , (6.11)
2
1
and the scheme is unconditionally stable. For θ = 2
or ν = 0, we have |µ| = 1 and the
scheme is neutrally stable and non-dissipative (see Johnson [9]). For ν = 0 there is
very little dissipation in the scheme and therefore any oscillations are not damped.
Hence, oscillations are likely to occur for the unsteady critical case.
32
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
We have shown, that the Box Scheme is unconditionally stable for the linearised St
Venant equations, the only constraint on the time-step is due to the convergence
theory of Newton’s Method, which we will describe later.
Now, by the fundamental theorem of numerical methods for linear differential equa-
tions, (stated for example in [14]), consistency (showed in the previous section) and
stability ensure convergence of the Box Scheme.
We assume that the solution is known up to time level tn and use (3.7) in order to
calculate the solution at the new time level tn+1 . Omitting the indices for the time,
we get a recurrence relation at the new time level of the form
uj+1 + uj ∆t
+ λj θ(fj+1 − fj ) − θ(sj+1 + sj ) = Pj , (6.14)
2 2
where Pj represents all values which are known from the previous time step. Now
we may linearise this system which yields
uj+1 + uj ∆t
+ λj θA(uj+1 − uj ) − θS(uj+1 + uj ) = ∆tQj , (6.15)
2 2
33
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
where Qj is computed from Pj and further nonlinear terms. Reordering the equa-
tions gives
as an amplification matrix, then, using (6.17) the solution at time tn+1 may be written
as a recurrence relation
N −1
!
Y
N
wN = (−1) Gj w0 + ∆tTN , (6.19)
j=0
For supercritical flow, vj + cj > vj − cj > 0, both the diagonal terms have modulus
less than one. So data w0 is transmitted in a stable manner across the domain. But,
for subcritical flow, the eigenvalues of the Jacobian, vj − cj < 0 and vj + cj > 0 have
opposite sign. Therefore the first component would be amplified, if it was imposed
on the left. So we have to impose one boundary condition at inflow and one at out-
flow, in order to damp small perturbations to boundary values. Then the scheme is
stable with respect to such boundary conditions.
We can also see, why problems arise, when the CFL number is very small, i.e. when
one of the eigenvalues of the Jacobian A passes through zero. If vj = cj , then the first
34
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
entry of the amplification matrix (6.20) equals unity. Using (6.19) we will find that
any small perturbations to the left or right hand boundary conditions will result in
perturbations in the first variable with
Also, if the CFL number is close to zero, the stability analysis in the previous section
(see equation (6.10)) shows, that there is very little damping for those oscillations.
This is characteristic for the so-called washboard effect [9], i.e. spurious period 2∆x
oscillations, which we can see in Figures 15, 17 and 18. The situation gets worse
for problems involving discontinuities, as it can be seen in Figure 21. Smoothing
methods in order to suppress those numerical artifacts, are described in Johnson’s
thesis [9]. Morton and Burgess [23] investigate the stability of boundary conditions
further for a different problem, but this is beyond our project.
The Box Scheme gives a recurrence relation at the new time level. We want to have a
closer look at the natural sweep direction in the case of a system of equations, since
there are boundary conditions given on the left as well as on the right. We want to
check if it is necessary to be careful about the way in which the two sweeps, in order
to solve the tridiagonal system, are carried out.
The use of the recurrence relation (3.28) to calculate the values of Wj may be nu-
merically unstable and lead to increasing errors, if (3.31) is not satisfied. Therefore
we study Ej for the St Venant equations, in the way it has been done for the wave
equation in Morton’s paper[20].
For our calculations, we have to assume that A and Q are constant, such that cj = c
and vj = v. This is just true for the first time step (since we take constant initial con-
ditions), but since oscillations are observed for the first time step, this assumption is
suitable. For convenience we also use a regular grid, i.e. λj = λ. Then, the special
form of D = Dj , A = Aj and C = Cj used in (3.22) and (3.28) gives, after some
35
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
manipulations
ej κej
Ej = , (6.22)
1
κ
(1 + ej ) 1 + ej
1 2 2 1
2
[κ (c − v 2 ) + 2vκ]ej−1 − 2
ej = − 2 . (6.23)
[κ2 (c2 − v 2 ) + 2vκ]ej−1 − κ2 (c2 − v 2 ) + vκ − 1
2
1
ej = − . (6.24)
1+ 2κ2 (c2 − v2)
We can check that only the negative root is attractive and therefore
φ κφ
Ej → , (6.26)
1
κ
(1 + φ) 1 + φ
where q
1
4
− vκ − (vκ + 41 )2 + 12 κ2 (c2 − v 2 )
φ= . (6.27)
κ2 (c2 − v 2 ) + 2vκ
If the flow is transcritical, then v = c and it is easy to check that φ = −1 and
kEj k∞ = 1 + κ as j → ∞ and condition (3.31) is not satisfied for any values of λ and
θ. Therefore, using the Thomas Algorithm, the solution procedure is ill-conditioned
and oscillations will be amplified. In fact, (3.31) is not even satisfied near transcrit-
ical flow. For subcritical flow in contrast condition (3.31) is valid. The same results
are obtained by sweeping from the left to the right first or by interchanging the order
of the equation pairs A and Q, as it was done in [20].
36
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
with J(x0 ) non-singular and that there exist constants β, η ≥ 0 such that
with
1
α := βγη < . (6.30)
2
Furthermore
S := {x ∈ Rn : kx − x0 k < t∗ } ⊂ D, (6.31)
where
1 √
t∗ = (1 − 1 − 2α). (6.32)
βγ
Then the sequence
xk+1 = xk − J(xk )−1 F(xk ), k = 0, 1, . . . (6.33)
1
ηβf (θλ) < . (6.34)
2
37
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
Also, the initial guess x0 has to be close to the solution, from (6.29) and (6.32). This
is why we did not get any convergence for too large ∆t in the previous model cases.
Another issue is that of transcritical flow. We have seen, that small oscillations occur
near transcritical and even worse ones at supercritical flow. Therefore the stopping
criterion for the iteration (3.21),
ku(k+1) − u(k) k1
< tol, (6.35)
ku(k) k1
cannot be satisfied. Newton’s Method converges more slowly. This is the reason,
why we observe more iterations, when the flow is close to being transcritical.
38
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In this section we will describe, how to overcome the limitation of the Box Scheme
using the results of Morton et al. [25] for the steady Euler equations. First we sum-
marise the problems that arise, when the Box Scheme is applied to transcritical flow.
We have discussed the Box Scheme for non-critical flow and seen some computa-
tional examples for its invalidity for transcritical flow. In [17] we will find some
explanation from an engineering view point, why the Box Scheme in its usual im-
plementation is unsuitable to model transcritical flow.
The first problem is that as the critical limit is approached, one of the eigenvalues
becomes small and spurious Fourier modes are allowed to propagate uninhibited.
The Preissmann Scheme becomes marginally stable if critical flow is encountered.
Hence, any error (e.g. arbitrary initial conditions) will not be damped. In other
words the unconditional stability of the Box Scheme will no longer be valid. This
leads to a highly oscillatory solution as we have seen in section 6.
Another problem we have with transcritical flow is a counting problem. For purely
subcritical or supercritical flow there are exactly two boundary conditions required
and the Preissmann scheme can be directly applied. However, for transcritical flow
the number of boundary conditions may differ from two. Suppose that flow in a
channel starts subcritical at the upstream boundary and at some point the flow be-
comes supercritical. Then, to ensure well-posedness, exactly one boundary con-
ditions is required, to be imposed at the upstream boundary. However, the Box
Scheme needs two boundary conditions as stated in section 3. More examples are
illustrated in [17] and [18]. There may be either too few or too many boundary con-
ditions and the problem will be ill-posed.
A third issue is that if the boundary conditions do not correspond to the type of
flow present, the solution becomes unstable. For transcritical flow it is obviously not
39
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
possible to choose boundary conditions which are suitable for both subcritical and
supercritical flow. This is because we are unable to ensure that each of the residuals
(3.8) is zero. For each cell residual Rj+ 1 we have to calculate two unknowns, Aj and
2
Qj . For subcritical flow the eigenvalues of the flux Jacobian A have opposite sign,
hence the characteristics are ingoing and outgoing, and therefore it is possible to set
all the cell residuals to zero by the double sweep algorithm described above. Now,
at a sonic point one eigenvalue of the Jacobian matrix A passes through zero and the
flow becomes supercritical, i.e. both eigenvalues of the Jacobian have the same sign.
1
This situation is illustrated in Figure 23. The cell j + 2
contains a sonic point. The
result is a locally underdeterminded system, since there is just one ingoing characteristic
for this cell. There are not enough equations to determine the nodal value uj+1 to
the right. Therefore the cell residual has to be split there. At supercritical flow
both characteristics point downstream and it is possible to set both cell residuals to
zero, using a single sweep method. When the flow becomes subcritical again, which
corresponds to the existence of a shock in cell j + k + 21 , another problem occurs.
One eigenvalue of the flux Jacobian A passes through zero again, and characteristics
switch back to pointing one upstream and one downstream. At the shock the system
is now locally overdetermined because of three ingoing characteristics. Therefore the
cell residuals have to be combined in some way in this case.
We have seen, that both residuals will be set to zero if the flow is wholly subcritical
by using the double sweep algorithm described in [25]. From the previous section it
40
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
also follows, that for wholly supercritical flow both residuals will be set to zero on
the sweep from inflow to outflow. A single sweep algorithm is sufficient in this case,
but the algorithm structure depends upon the flow direction. We use flow from left
to right, further details on different flow directions may be found in [1]. We need to
switch between those two cases for the transcritical flow.
To understand the mixed type flows we introduce a mapping between the cell resid-
uals and nodal unknowns and the notation of distribution matrices, as it has been
±
done in Morton et al. [25]: For each cell we can define matrices Dj− 1 . Then we
2
can think of our Box Scheme implementation (3.8) in terms of these distributions
matrices. At each interior point, we apply Newton’s Method to
+ −
Nj = Dj− 1 Rj− 1 + D R 1 + Bj = 0,
j+ 1 j+
(7.1)
2 2 2 2
where Bj accounts for the boundary conditions. With equation (7.1), we have in-
droduced a mapping between the cell residuals and the nodal unknowns . If we
+ −
define D− 1 and D
N+ 1
to be zero, then equation (7.1) is valid for all N + 1 nodes
2 2
according to the sweep direction. For supercritical flow these matrices become
−
0 0 +
1 0
Dj+ 1 = and Dj− 1 = . (7.3)
2
0 0 2
0 1
Note, that Morton et al. [24] use distribution matrices which are interchanged from
those used here. The reason is that we use Newton’s Method whereas Morton et
41
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
al.[24] use a general update algorithm. The choice of our distribution matrices ties
up with our ordering of the matrix used for the Thomas Algorithm (3.15): We start
with calculating E0 from the boundary condition plus the mass residual from its
right. If we reordered our equation in (3.15), we would get the same distribution
matrices as in [24].
Clearly, there is a problem in the switch from subcritical to supercritical flow, since
the condition
− +
rank(Dj+ 1 + D ) = 2, (7.4)
j− 1
2 2
stated in [25], is not satisfied, if a transcritical expansion fan occurs. We will describe
an algorithm, by which this problem can be overcome.
The nodal residual mapping (7.1) has been used first by Morton et al. [24] and later
in Johnson et al. [10]. It follows, that the matrix D − represents the component of the
cell residual to be distributed to the node to its left and D + represents the component
of the cell residual to be distributed to the node to its right. For subcritical flow
with depth DR (or cross-sectional area AR ) imposed downstream and discharge QL
imposed upstream, the coefficients in (7.1) become
0 An+1
N − AR
B0 = , BN = , (7.5)
n+1
Q0 − QL 0
and distribution matrices as in (7.2). For supercritical flow with discharge QL and
cross-sectional area AL both imposed upstream we have
An+1
− AL
0 0
B0 = , BN = , (7.6)
n+1
Q0 − QL 0
42
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
(k)
where Ãj± 1 is an average value of A for the cell and ãj± 1 , k = 1, 2, are its eigenval-
2 2
ues. The best choice of Ãj+ 1 is the Roe average matrix (see [4] or [10]), which may be
2
written as
0 1
Ãj+ 1 = , (7.9)
2
c̃2j+ 1 − ṽj+
2
1 2ṽj+ 1
2 2 2
where
s
c2j + c2j+1 vj cj + vj+1 cj+1
c̃j+ 1 = and ṽj+ 1 = , j = 0, . . . , N − 1. (7.10)
2 2 2 cj + cj+1
7.2.2 Implementation
Suppose our flow is subcritical at inflow and outflow and there is an interior super-
critical region as in problems (P3) and (P4c). Then our Box Scheme algorithm may
be used in a modified version, which is a combination of that described in [25] and
the double sweep Thomas Algorithm. Note, that there might be no supercritical re-
gion in the first place. Since we consider the unsteady case the supercritical interior
region might occur after some time t > t0 .
43
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
First, we find the region of supercritical flow in the domain, by checking the Froude
Number.
The Subcritical Region In the subcritical region the nodal values are given from
two cell equations, one from either side. Therefore we start our algorithm as usual,
using sweeping from left to right, until the left of the sonic cell is reached.
Splitting at Sonic Point Suppose the cell j + 21 , contains the sonic point xs . At this
(2)
point, we have the momentum residual equation Rj+ 1 from the left, but no equation
2
(1)
from the right. Therefore the mass cell residual Rj+ 1 will be needed both to update
2
the subcritical node on its left and the supercritical node on its right. Hence, this
mass cell residual is split at the predicted sonic point xs . The sonic point position is
found by interpolation of the Froude Number. Finally, the subcritical partial resid-
(1)−
ual Rj+ 1 is used to update the last subcritical state vector uj and the supercritical
2
(1)+
partial residual Rj+ 1 may be taken as initial condition for the sweep through the
2
The Supercritical Region The supercritical cells use both components of the resid-
ual to determine the nodal value on the right. We continue this to the left of the
shock cell.
Treatment of the Shock At the shock cell, the nodal value on the left is already
determined, but that on the right would have to set both shock cell residual compo-
nents to zero, as well as the mass residual R(1) from the cell to the right. The node
on the right of the cell is determined from the momentum residual R(2) of the cell
and the combined mass residuals R(1) from the two cells either side of it. This ap-
proach satisfies the discrete conservation law for the box scheme. Again, we keep the
momentum cell residual unchanged.
The Subcritical region Finally we can continue the double sweep through the sub-
critical region.
44
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
It is important to note, that we are using two different kinds of algorithms. For sub-
critical regions, where the system is block-tridiagonal, we use the efficient double
sweep method as it is described in section 3.4. The easier single sweeping is used
for the supercritical region, where the system is block-tridiagonal, but has only got
2 × 2 block entries on the diagonal and the subdiagonal.
For transcritical flow with an interior supercritical region as described above, the
modified Newton matrix from (3.15) still has banded structure and may be writ-
ten in the tridiagonal form (3.22). Due to the splitting of the mass residual at the
sonic cell, we introduce one more equation. Assume the sonic point lies in the cell
[xj , xj+1 ]. We interpolate the sonic point by either interpolating the Froude Number,
xj+1 − xj
xsonic = (1 − Fj ) + xj , (7.11)
Fj+1 − Fj
xj+1 − xj
xsonic = −aj + xj . (7.12)
aj+1 − aj
It is obvious, that both approaches give the same result. Splitting the residual and
setting both parts to zero,
(1)− (1)+
Rj+ 1 = 0 and Rj+ 1 = 0, (7.13)
2 2
is consistent with taking the derivative of the equilibrium equation (see Morton et
al. [25, page 223]). Hence, the solution is smoothed at the sonic point and the oscilla-
tions observed in section 5 should vanish. The following matrix shows the structure
of the matrix used for the Thomas Algorithm at the interface from subcritical to
45
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
x x
x x x x R(1)
x x x x R(2)
x− x− x− x− R(1)−
M1 = x+ x+ x+ x+ R(1)+ (7.14)
x x x x R(2)
R(1)
x x x x
R(2)
x x x x
···
From (7.14) we see, that Cj , the superdiagonal block entries, become zero in the su-
percritical region, due to the residual splitting at the sonic point.
At the shock we have to combine two cells, since we have a locally overdetermined
system. In order to find out, which cells we need to combine, we identify a cell
as subcritical or supercritical by averaging the Froude Number. Assume we have
found that the node uj is supercritical and the node uj+1 is subcritical. We need
to find out if the cell is sub- or supercritical. To this end we calculate the Froude
1
Number for the cell j + 2
by
1
Fj+ 1 = (Fj + Fj+1 ). (7.15)
2 2
If Fj+ 1 > 1 we set the cell to be supercritical and we combine cells j + 21 and j + 23 by
2
(1) (1)
Rj+ 1 + Rj+ 3 = 0. (7.16)
2 2
Similarly, if Fj+ 1 < 1 we set the cell to be subcritical and we have to combine the
2
1 1
cells j − 2
and j + 2
by
(1) (1)
Rj− 1 + Rj+ 1 = 0. (7.17)
2 2
46
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
matrix shows the structure of the Newton matrix at the interface from supercritical
to subcritical flow, i.e. at the shock.
···
x x
R(1)
x x
R(2)
x x x x
R(1)
x x x x
R(2)
(1) (1)
x1 x1 x1 + x2 x1 + x2 x2 x2 R1 + R2
M2 = (7.18)
x x x x
R(2)
x x x x
R(2)
x x x x R(1)
x x x x
R(2)
x x
R(1)
···
From (7.18) we see, that Cj , the superdiagonal block entries, only equal zero for the
supercritical region. Due to the combination of the cell residuals at the shock cell we
have Cj 6= 0 for the subcritical flow region.
We sweep from left to right and calculate Ej and Fj successively by the forward
recursions (3.29) and (3.30). E0 is calculated from the boundary condition plus the
(1)
first mass residual R 1 from its right. For the supercritical region Cj and therefore
2
Ej equals zero, and we can omit the forward recursion. We sweep back in order to
calculate Wj by (3.27) and (3.28). Since Ej = 0 for the supercritical region we only
have to compute a back substitution in this case.
We now summarise the overall algorithm. The setup is done as in the subcritical
case (see section 3.5). Then, for each time step we perform the following algorithm,
until the steady state is reached.
47
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
2. find the region of supercritical flow, i.e. the indices j with Fj > 1;
3. find the location of the sonic point by interpolation using (7.11) or (7.12);
4. find the cell with Fj > 1 at the node to its left and Fj+1 < 1 at the node to
its right, i.e. the shock cell and determine the shock cell to be subcritical or
supercritical by (7.15);
6. calculate Ej and Fj by the forward recursions (3.29) and (3.30), note that Ej = 0
for the supercritical region;
9. check, if stopping criterion (3.21) is satisfied. If so, then move on to the next
time level, otherwise start with 1. again.
Since we use Newton’s Method, the number of iterations for each time step should
be small.
We consider the transcritical problems (P3) and (P4c) of section 5, again and apply
them to our modified Box Scheme. Clearly, our modified scheme still works for the
subcritical and near-critical problems (P1), (P2), (P4a) and (P4b).
We recall problem (P3) and take exactly the same setup as described in section 5.
The scheme broke down after t = 51.
48
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
We also want to compare our results with the scheme used by Johnson et al. [10].
They propose to overcome the lack of equations that arises at the sonic point, i.e.
− +
rank(Dj+ 1 + D ) ≤ 1, (7.19)
j− 1
2 2
− +
Bj = (I − Dj+ 1 − D
j− 1
)∆uj , (7.20)
2 2
which clearly provides the missing extra linearly independent equation. They also
show, that the choice of this boundary condition does not contradict the discrete
conservation law of the original Box Scheme. If we implement this scheme for our
problem (P3) we obtain the steady state solution in Figure 24. Oscillations occur
1.6
Computed Solution
Analytic Solution for steady state
1.4
1.2
Depth of the water (m)
0.8
0.6
0 100 200 300 400 500 600 700 800 900 1000
Channel length (m)
at the sonic point, which are clearly not right and which we want to avoid. Fur-
thermore, the convergence is very slow, as soon as the Froude Number approaches
unity. We want to avoid that.
Therefore, we test our modified Box Scheme algorithm which satisfies the discrete
conservation law and compare it to Johnson’s results. We use a time step of ∆t = 1.
The maximum Froude Number for the initial state is 0.3749 again, and it increases
with time. We have just about 3 − 5 iterations for convergence at each time step,
even when the Froude Number is equal to or larger than one. Period 2∆x oscilla-
49
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
tions occur in the supercritical region. But it is important to note, that the scheme
does not break down this time. The reasons for the oscillations, which may be seen
in Figures 25 and 26 have been explained in section 6: We can switch between the
subcritical and supercritical flow regions, but the Froude Number has to pass unity,
which entails that one of the eigenvalues of the Jacobian passes through zero and
the CFL number is very small.
In Figure 27 we can see the analytic and numeric solution for the depth of the water
at steady state, which is indeed very adequate and better than Johnson’s solution.
We can also see that any oscillations have died out. The maximum Froude Number
for that state is 1.2988 and the maximum CFL number is νmax = 0.7102. A plot of the
Froude Numbers for the steady state can be seen in Figure 28. We should also note,
2 1.4
Computed Solution after t = 75 Computed Froude Number for t = 75
1.3
1.2
1.1
1.5
Depth of the water (m)
1
Froude Number
0.9
0.8
1
0.7
0.6
0.5
0.5 0.4
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Channel length (m) Channel length (m)
Figure 25: Transcritical problem approaching Figure 26: Approximation to Froude Number
Froude Number F = 1 after time for transcritical problem after time
t = 75 (P 3) t = 75 (P 3)
that we cannot choose the time step ∆t too large. As long as the flow is subcritical
large time steps are fine, but as the critical region with Froude Number F ≈ 1 is
approached with large ∆t, occurring oscillations are too large, so that Newton’s
Method fails to converge. This problem suggests the use of adaptive time steps,
according to the size of the Froude Number.
We recall problem (P4c) and take exactly the same setup as described in section 5.
The scheme broke down for our original Box Scheme implementation. We use a
50
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
2 1.4
Computed Solution Computed Froude Number
Analytic Solution
1.8
1.2
1.6
1.4
1
Depth of the water (m)
1.2
Froude Number
1 0.8
0.8
0.6
0.6
0.4
0.4
0.2
0 0.2
0 100 200 300 400 500 600 700 800 900 1000 0 100 200 300 400 500 600 700 800 900 1000
Channel length (m) Channel length (m)
Figure 27: Transcritical problem at steady Figure 28: Approximation to Froude Number
state (P 3) at steady state (P 3)
time step of ∆t = 2 for our modified code. The maximum Froude Number for the
initial state is 0.8616 again, and it increases with time. We have just about 2 − 5 itera-
tions for convergence at each time step, even when the Froude Number approaches
unity. Period 2∆x oscillations occur in the supercritical region, but the scheme does
not break down this time. The reasons for the oscillations, which may be seen in
Figure 29 have been explained in section 6: We can switch between the subcritical
and supercritical flow regions, but the Froude Number passes unity, which entails
that one of the eigenvalues of the Jacobian passes through zero and the CFL number
is very small.
In Figure 29 we can see the numeric solution for the steady state. There are still
oscillations at the steady state, due to the discontinuity of the solution. The max-
imum Froude Number for that state is 2.0616 and the maximum CFL number is
νmax = 0.1947. As in the previous problem we cannot choose the time step ∆t too
large. As long as the flow is subcritical large time steps are fine, but as the critical
region with Froude Number F ≈ 1 is approached with a large value of ∆t, occurring
oscillations are too large, so that Newton’s Method fails to converge. This problem
suggests the use of adaptive time steps, according to the size of the Froude Number.
Figure 30 shows approximations to the Froude number for the steady state.
51
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
3 2.5
Computed Solution Computed Froude Number
2.5
2
2
Depth of the water (m)
1.5
Froude Number
1.5
0.5
0.5
0 0
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Channel length (m) Channel length (m)
Figure 29: Transcritical problem at steady Figure 30: Approximation to Froude Number
state (P 4c) at steady state (P 4c)
Analytic Solution
0.5
0 100 200 300 400 500 600 700 800 900 1000
Channel length (m)
21
20.8
Discharge Q (m3/s)
20.6
20.4
20.2
20
0 100 200 300 400 500 600 700 800 900 1000
Channel length (m)
the mass conservation law and therefore is incorrect. We can explain the position
of the isolated point in the discharge Q by selecting a variable that has an interme-
diate value, e.g. if the velocity should have a viscous term in its equation and we
compute the limit as it goes to zero, the velocity should have an intermediate value.
Q
If we compute the velocity v = A
at each point, we will see that the velocity has
52
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In order to suppress the isolated point, we use shock fitting and introduce a discon-
tinuity in the shock cell. It is for this reason we look closer at the shock region, see
Figure 32. Suppose the shock is between the nodes k − 1 and k + 1 with the nodal
value Qk out of line. We assume that all other values for the depth Dj and the dis-
charge Qj , j = 1, . . . , k − 1, k + 1, . . . , N, are computed correctly.
Depth D
hk−1 hk
xk−1 xk xk+1 x
Figure 32: Diagram showing depth function Figure 33: Diagram showing depth function
at the shock before introducing a and shock location xs after intro-
discontinuity ducing a discontinuity
We use equations (2.33)-(2.36), which simplify for the steady state, since ut = 0.
Then we apply mass conservation, which implies Qx = 0 for the steady state, over
the cells [xk−1 , xk ] and [xk , xk+1 ], i.e.
Qk − Qk−1 Qk+1 − Qk
= 0 and = 0. (7.21)
∆x ∆x
This approach gives Qk = Q, the constant value for the discharge in the steady case.
Furthermore we consider the depth D and introduce a discontinuity at the shock xs ,
see Figure 33. We call xs the shock position, which is unknown. We may write
where hk−1 and hk are the sizes of the cells left and right of the shock (see Figure 32)
and θ ∈ [0, 1]. Now, we apply momentum conservation over the cells [xk−1 , xs ] and
[xs , xk+1 ]. Using (2.33)-(2.36), and the simplifications (3.11), which are valid for our
53
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
problem (P3), the momentum conservation law for the steady state is
Q2 D 2 B D 3 ST
+g + = gA(S0 − Sf ). (7.23)
A 2 3 x
Applying this momentum conservation law over both the cells [xk−1 , xs ] and [xs , xk+1 ]
we get
where
2 3
Q2 Dk±1 B Dk±1 ST
Fk±1 = +g + , (7.26)
Ak±1 2 3
Sk±1 = gA(S0 − Sf ), (7.27)
with S0 and Sf evaluated at xk±1 using formula (2.25). Clearly, the values of Fk±1
and Sk±1 are known from the assumption that all values except the ones at the node
xk are computed correctly. Furthermore we have
Q2 DL2 B DL3 ST Q2 2 3
DR B DR ST
Fs− = +g + and Fs+ = +g + , (7.28)
AL 2 3 AR 2 3
54
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
where uL and uR are the states left and right of the shock, s is the shock speed and
f (u) is the flux function. Since we only consider the momentum conservation law,
we deal with a scalar problem. Furthermore our problem is steady, i.e. the shock
does not move and therefore we have
s = [f ] = 0. (7.30)
Q2 DL2 B DL3 ST Q2 2 3
DR B DR ST
+g + = +g + . (7.31)
AL 2 3 AR 2 3
With equations (7.24), (7.25) and (7.31), we now have 3 equations, which we may
write in the form
H(DL , DR , θ) = 0, (7.32)
for our 3 unknowns DL , DR and θ. We will use Newton’s Method in order to solve
the nonlinear system (7.32). If we write y = (DL , DR , θ)T , then Newton’s Method
for the given starting guess y0 is
1
as stated in [30]. As initial guesses we take θ0 = 2
and the computed values left and
right of the shock, i.e. DL0 = Dk−1 and DR
0
= Dk+1 . As stopping criterion we use
where tol = 10−8 . With our initial guess, we indeed get very good results for the
depths left and right of the shock DL and DR and the shock position θ. They may be
seen in table 2. We need only 5 iterations for convergence with Newton’s method,
55
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
0.5
0 100 200 300 400 500 600 700 800 900 1000
Channel length (m)
21
Computed Solution before Shock Fitting
Computed Solution after Shock Fitting
Discharge Q (m3/s)
20.5
20
0 100 200 300 400 500 600 700 800 900 1000
Channel length (m)
Figure 34: Depth D and discharge Q at steady state (P 3) after shock fitting
by shock fitting are compared to the ones without shock fitting. We can see that our
shock recovery procedure indeed works very well. The final solution that we get for
the steady state is very satisfactory and adequate. Of course we can apply the same
shock fitting procedure to problem (P4c).
56
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In this report we have investigated the Box Scheme applied to both non-critical and
transcritical flow.
We gave a detailed derivation of the unsteady St Venant equations for open chan-
nel flow and explained how to apply the Box Scheme to that system of equations.
Special model problems were created, including both entirely subcritical and trans-
critical flow. By applying the Box Scheme to those test problems, we found that the
scheme in its original implementation works very adequate for both wholly sub-
critical and supercritical problems, but breaks down for transcritical flow. We did
extensive analysis on the method and found explanations for its breakdown in the
transcritical case.
From those results we were able to modify the scheme, such that it could then be
applied to transcritical flow. The modification of the Box Scheme was based on the
work done by Morton et al. [25] for the case of the steady Euler equation. We ap-
plied this modified Box Scheme to the unsteady St Venant equations. Since we used
Newton’s Method in order to solve the nonlinear system that arised from the Box
Scheme at each time step, we observed very fast convergence. We also found that
the solution of the linear system at each Newton iteration was very efficient, since
we were able to use the Thomas Algorithm for block-tridiagonal matrices, even in
the case of transcritical flow. The code is fast and easily adaptable. The results that
we obtained indeed were very accurate, see Figures 27 and 29. Finally, we have
shown, that the method of shock fitting works particularly successful in the recovery
of the shock discontinuity, see Figure 34.
Overall, the developed methods worked very well for both non-critical and trans-
critical unsteady flow.
Further work includes the introduction of more than one supercritical interior re-
gion in the problem. The analysis and implementation so far suggests that the mod-
57
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
ified Box Scheme will still work satisfactorily. We also propose to do further inves-
tigations on other nonlinear iteration techniques than Newton’s Method in order to
compare the results. Furthermore, it should be very interesting to see the shock fit-
ting, that was done in section 7.4 for the steady state applied to the result after each
time step, i.e. to the unsteady problem. We therefore should adapt the methods
developed for the scalar case in [19] and apply them to our system of equations. In
addition, we could extend our results to two-dimensional flows.
58
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In section 4 we explained how to create steady state problems in order to test our
algorithms. By using equation (4.3) we can calculate the bed slope function S0 (x).
We have to integrate this function numerically, in order to get the function for the
channel bed itself. The M ATLAB-code for the test problems may be found in
/home/mamamf/Project/work/testproblems.
model1.m creates test problem (P1) using the algorithm stated in section 4.1 and
visualises depth and bed slope
integrate1.m integrates the bed slope function numerically in order to the function
for the height of the channel bed find
model2.m creates test problem (P2) using the algorithm stated in section 4.1 and
visualises depth and bed slope
model3.m creates test problem (P3) using the algorithm stated in section 4.1 and
visualises depth and bed slope
critical.m function which calculates the critical depth for test problems, i.e. the
depth with Froude Number F r = 1
59
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In section 5 we found the solutions to our steady state test problems and we got
indeed very good results for subcritical flows, but problems with the Box Scheme
for transcritical flows. The M ATLAB-code for these Box Scheme implementations
may be found in
/home/mamamf/Project/work/cell.
svcellfull.m solves the unsteady inhomogeneous St Venant equations with bed slope
function given in (P1) or (P2) with Newton’s Method by setting the cell resid-
uals to zero, the Thomas Algorithm is used to solve the system, works only for
subcritical problems as (P1) and (P2)
svcell.m similar to svcellfull.m, but omits source term in the Jacobian for Newton’s
Method and is therefore only a Quasi-Newton Method
svcelltrans.m similar to svcelltransfull.m, but omits source term in the Jacobian for
Newton’s Method and is therefore only a Quasi-Newton Method
chwidth.m similar to chwidthfullfull.m, but omits source term in the Jacobian for
Newton’s Method and is therefore only a Quasi-Newton Method
60
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
dambreak.m similar to dambreakfull.m, but omits source term in the Jacobian for
Newton’s Method and is therefore only a Quasi-Newton Method
getjac.m function which calculates the local Jacobian for each cell (without includ-
ing the source term)
gj.m similar to getjac.m, but includes the derivative of the function for the channel
width
gs.m similar to getsjac.m, but includes the derivative of the function for the channel
width
gr.m similar to getres.m, but includes the derivative of the function for the channel
width
61
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In section 7.2 we found the solutions to steady state test problems with the modified
Box Scheme for transcritical flows. The M ATLAB-code for the modified Box Scheme
may be found in
/home/mamamf/Project/work/cell_trans.
62
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
roe.m function which calculates the Roe matrix and its eigenvalues and eigenvec-
tors
roewidth.m similar to roe.m, but includes the changing channel width in the Roe
matrix
63
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In section 7.2 we described the solutions to steady state test problems using nodal
residuals and distribution matrices. In this section we include the M ATLAB-code
for the nodal residuals with the “internal boundary conditions approach” used by
Johnson et al. (see [9],[10]). We have seen, that this approach gives undesirable
oscillations at the sonic point for transcritical flow. The code is available from
/home/mamamf/Project/work/node.
svnode.m similar to svnodefull.m, but omits source term in the Jacobian for New-
ton’s Method and is therefore only a Quasi-Newton Method, this method gives
exactly the same results with the same number of iterations as svcell.m, see ap-
pendix B
64
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
jac.m function which calculates the local Jacobian for each cell (without including
the source term)
gj.m similar to jac.m, but includes the derivative of the function for the channel
width
gs.m similar to sjac.m, but includes the derivative of the function for the channel
width
gr.m similar to res.m, but includes the derivative of the function for the channel
width
meanjac.m function which calculates an average Jacobian for a cell taking the mean
values of its neighbouring nodes (similar to Roe matrix), eigenvalues and eigen-
vectors of this Jacobian are also computed
65
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
In section 7.4 we applied shock fitting to the steady state. We calculated the left and
right states of the shock and the shock position by applying Newton’s Method to a
nonlinear system of equations. The M ATLAB-code for the Newton iteration may be
found in
/home/mamamf/Project/work/shockfitting.
shockfitting.m main program, which does the set up and the actual Newton itera-
tion (7.33) until the stopping criterion (7.34) is satisfied.
rhsfun.m function, which determines the value of H(y) at each step of the iteration.
funjacobian.m function, which determines the Jacobian Hy (y) at each step of the
iteration
66
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
References
[2] D ENNIS , J. E., AND S CHNABEL , R. B. Numerical Methods for Unconstrained Op-
timization and Nonlinear Equations. Prentice Hall, New Jersey, 1983.
[5] G OLUB , G., AND L OAN , C. V. Matrix Computations, 3nd ed. John Hopkins
University Press, Baltimore, 1996.
[7] H ENDERSON , F. M. Open Channel Flow. McMillan Company, New York, 1966.
[9] J OHNSON , T. C. Implicit numerical schemes for transcritical shallow water flow.
PhD thesis, Department of Mathematics, University of Reading, 2001.
[10] J OHNSON , T. C., B AINES , M. J., AND S WEBY, P. K. A box scheme for trans-
critical flow. International Journal for Numerical Methods in Engineering 55 (2002),
895–912.
67
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
[14] L E V EQUE , R. J. Finite Volume Methods for Hyperbolic Problems. Cambridge Uni-
versity Press, 2002.
[15] M AC D ONALD , I. Test Problems with Analytic Solutions for Steady Open Chan-
nel flow. Numerical analysis report 6/94, University of Reading, Department
of Mathematics, 1995.
[17] M ESELHE , E. A., AND H OLLY, F. M. Invalidity of Preissmann Scheme for Tran-
scritical Flow. Journal of Hydraulic Engineering 123, 7 (1997).
[19] M ITCHELL , S. L. Coupling Transport and Chemistry: Numerics, Analysis and Appli-
cations. PhD thesis, Department of Mathematical Sciences, University of Bath,
2003.
[20] M ORTON , K. W. A preliminary analysis of the Box Scheme for open channel
flow. Ucina project - report for hydraulics research, Oxford University Com-
puting Laboratory, 1984.
[23] M ORTON , K. W., AND B URGESS , N. A. The stability of boundary conditions for
an angled-derivative difference scheme. Advances in Computational Mathematics
6 (1996), 263–279.
68
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
[25] M ORTON , K. W., R UDGYARD , M. A., AND S HAW, G. J. Upwind iteration meth-
ods for the cell vertex scheme in one dimension. Journal of Computational Physics
114, 2 (1994), 209–226.
[29] S KEELS , C. P. One dimensional river modelling. PhD thesis, Department of Nu-
merical Analysis, Faculty of Mathematics, University of Oxford, 1992.
[30] S PENCE , A., AND G RAHAM , I. G. Numerical Methods for Bifurcation Prob-
lems. Lecture Notes, 2002.
69
Index
Accuracy, 31 hydraulic jump, 18, 20
analytical solution, 20 hyperbolic system, 10
70
M ELINA F REITAG MSc Project: Transcritical flow modelling with the Box Scheme
71