Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

9. Shallow-water equations, the HLL flux and the dam-break problem

School of Engineering, Nazarbayev University

When a hydroelectric dam breaches or a tsunami surges onto a shallow coastal shelf, horizontal wavelengths vastly exceed water depth h(x,t)h(x, t), allowing vertical hydrostatic pressure integration to collapse 3-D free-surface flow into the hyperbolic 1-D Saint-Venant shallow-water conservation system. Unlike scalar Burgers advection, shallow-water waves propagate along two coupled characteristic families λ1,2=u∓gh\lambda_{1,2} = u \mp \sqrt{gh}, splitting an instantaneous dam break into a backward-moving depression rarefaction fan and a forward-moving hydraulic bore (shock). In this lecture we compute the exact solution of the dam-break problem over a wet bed, known as Stoker’s solution (burgers_riemann.exact_dam_break_dry_or_wet), derive and run the Harten–Lax–van Leer two-wave Riemann solver (shallow_water_1d_hll), and quantify Froude criticality and mechanical head loss across hydraulic jumps.

Learning objectives

  1. Derive the 1-D Saint-Venant shallow-water conservation system, flux Jacobian eigenvalues λ1,2=u∓gh\lambda_{1,2} = u \mp \sqrt{gh}, Riemann invariants u±2ghu \pm 2\sqrt{gh}, and Froude number Fr=∣u∣/gh\mathrm{Fr} = |u|/\sqrt{gh}.

  2. Compute the exact solution of the dam-break problem over a wet bed (burgers_riemann.exact_dam_break_dry_or_wet) and Rankine–Hugoniot mass/momentum jump conditions across the hydraulic bore.

  3. Formulate and benchmark the Harten–Lax–van Leer (shallow_water_1d_hll) approximate Riemann solver, showing strict depth positivity, volume conservation, and convergence under grid refinement.

  4. Quantify Rayleigh–Bélanger energy dissipation across bores, audit centered-flux oscillations, and implement a 2nd-order MUSCL–HLL shallow-water solver.

Time: about 60 min

1. Saint-Venant Conservation Laws, Gravity Waves & Stoker’s Exact Dam Break

Integrating incompressible Euler mass and horizontal momentum over water column depth h(x,t)>0h(x, t) > 0 under hydrostatic pressure p(x,z,t)=ρg(h−z)p(x, z, t) = \rho g (h - z) over a flat frictionless bed yields the 1-D shallow-water system:

∂q∂t+∂F(q)∂x=0,q=[hhu],F(q)=[huhu2+12gh2](1.1)\frac{\partial \mathbf{q}}{\partial t} + \frac{\partial \mathbf{F}(\mathbf{q})}{\partial x} = \mathbf{0}, \qquad \mathbf{q} = \begin{bmatrix} h \\ hu \end{bmatrix}, \qquad \mathbf{F}(\mathbf{q}) = \begin{bmatrix} hu \\ hu^2 + \frac{1}{2}g h^2 \end{bmatrix} \tag{1.1}

Evaluating the 2×22\times 2 flux Jacobian A(q)=∂F∂q=[01gh−u22u]\mathbf{A}(\mathbf{q}) = \frac{\partial \mathbf{F}}{\partial \mathbf{q}} = \begin{bmatrix} 0 & 1 \\ gh - u^2 & 2u \end{bmatrix} gives strictly real distinct eigenvalues whenever h>0h > 0:

λ1=u−c,λ2=u+c,c≡gh,Fr≡∣u∣gh(1.2)\lambda_1 = u - c, \qquad \lambda_2 = u + c, \qquad c \equiv \sqrt{gh}, \qquad \mathrm{Fr} \equiv \frac{|u|}{\sqrt{gh}} \tag{1.2}

For the dam-break problem over a wet bed (uL=uR=0u_L = u_R = 0 at t=0t = 0, reservoir depth hL>hR>0h_L > h_R > 0 across x=xdamx = x_{\mathrm{dam}}):

  1. Left Rarefaction Fan (λ1\lambda_1): Preserves the forward Riemann invariant u+2gh=2ghLu + 2\sqrt{gh} = 2\sqrt{g h_L}, giving intermediate star velocity u∗=2(ghL−gh∗)u^* = 2(\sqrt{g h_L} - \sqrt{g h^*}).

  2. Right Hydraulic Bore (λ2\lambda_2 shock at speed S>0S > 0): Enforces Rankine–Hugoniot mass and hydrostatic-thrust jumps between (h∗,u∗)(h^*, u^*) and (hR,0)(h_R, 0):

S(h∗−hR)=h∗u∗,S(h∗u∗)=h∗(u∗)2+12g((h∗)2−hR2)  ⟹  u∗=(h∗−hR)g2(1h∗+1hR)(1.3)S(h^* - h_R) = h^* u^*, \qquad S(h^* u^*) = h^*(u^*)^2 + \frac{1}{2}g\bigl((h^*)^2 - h_R^2\bigr) \;\Longrightarrow\; u^* = (h^* - h_R)\sqrt{\frac{g}{2}\left(\frac{1}{h^*} + \frac{1}{h_R}\right)} \tag{1.3}

Demonstration 1: Exact Wet-Bed Dam Break & Rankine-Hugoniot Bore Verification
=============================================================================
Reservoir h_L = 2.00 m, Tailwater h_R = 0.50 m
Star state: h* = 1.10349 m, u* = 2.27815 m/s, Bore speed S = 4.16561 m/s
Rarefaction invariant drift = 0.00e+00
Rankine-Hugoniot residuals  = mass: 0.00e+00, momentum: 0.00e+00
<Figure size 1188x440 with 2 Axes>

Figure 9.1. Exact solution of the dam-break problem at t=0.60t = 0.60 s. (a) Water depth; the vertical lines mark the head of the rarefaction and the bore. (b) Velocity and local Froude number.

What Demonstration 1 shows. At t=0.60 st = 0.60\ \mathrm{s} the solution has four zones: the undisturbed reservoir (x≤2.34 mx \leq 2.34\ \mathrm{m}), the rarefaction (2.34<x≤4.39 m2.34 < x \leq 4.39\ \mathrm{m}), the constant state (h∗=1.103 m,u∗=2.278 m/s)(h^* = 1.103\ \mathrm{m}, u^* = 2.278\ \mathrm{m/s}) and the bore, which has reached x=7.50 mx = 7.50\ \mathrm{m} and moves at S=4.17 m/sS = 4.17\ \mathrm{m/s}, faster than the wave speed cR=2.21 m/sc_R = 2.21\ \mathrm{m/s} of the tailwater.


2. Harten–Lax–van Leer (HLL) Two-Wave Riemann Solver (shallow_water_1d_hll)

Instead of running an iterative rootfinder at every cell interface (i+1/2)(i+1/2), Harten, Lax & van Leer (1983) bound the leftmost and rightmost acoustic signal speeds by SL=min⁡(uL−cL,uR−cR)S_L = \min(u_L - c_L, u_R - c_R) and SR=max⁡(uL+cL,uR+cR)S_R = \max(u_L + c_L, u_R + c_R). Integrating conservation across the Riemann fan [SLΔt,SRΔt][S_L \Delta t, S_R \Delta t] yields the closed-form HLL numerical flux:

FHLL(qL,qR)={FL,SL≥0,SRFL−SLFR+SLSR(qR−qL)SR−SL,SL<0<SR,FR,SR≤0.(2.1)\mathbf{F}_{\mathrm{HLL}}(\mathbf{q}_L, \mathbf{q}_R) = \begin{cases} \mathbf{F}_L, & S_L \geq 0, \\ \dfrac{S_R \mathbf{F}_L - S_L \mathbf{F}_R + S_L S_R (\mathbf{q}_R - \mathbf{q}_L)}{S_R - S_L}, & S_L < 0 < S_R, \\ \mathbf{F}_R, & S_R \leq 0. \end{cases} \tag{2.1}

We benchmark burgers_riemann.shallow_water_1d_hll directly against Stoker’s exact solution.


Demonstration 2: HLL Approximate Riemann Solver vs exact solution
=================================================================
Total water volume: init = 12.500000 m^2, final = 12.500000 m^2, |drift| = 0.00e+00
HLL (N=400) L1 errors: depth = 8.3228e-03 m, velocity = 2.3981e-02 m/s
<Figure size 1188x440 with 2 Axes>

Figure 9.2. First-order finite-volume solution with the HLL flux on 400 cells (solid lines) and the exact solution (dashed lines). (a) Depth. (b) Velocity.

What Demonstration 2 shows. Without any adjustable parameter, the conservative two-wave HLL flux captures both the rarefaction slope and the position of the bore (x=7.50 mx = 7.50\ \mathrm{m}) without oscillations while conserving total water volume ∫0Lh dx=12.500000 m2\int_0^L h\,dx = 12.500000\ \mathrm{m}^2 to 10-14.


3. Hydraulic-Bore Energy Dissipation & Subcritical-to-Supercritical Transition

Saint-Venant conserves mass and momentum across a hydraulic bore, but not mechanical energy. In the bore’s moving frame, turbulent roller churning dissipates specific mechanical head according to the Rayleigh–Bélanger head-loss theorem:

ΔHloss=(h∗−hR)34 h∗ hR>0(h∗>hR)(3.1)\Delta H_{\mathrm{loss}} = \frac{(h^* - h_R)^3}{4\,h^*\,h_R} > 0 \qquad (h^* > h_R) \tag{3.1}

We sweep the tailwater-to-reservoir depth ratio hR/hL∈[0.02,0.70]h_R / h_L \in [0.02, 0.70] to watch the post-wave star Froude number Fr∗=u∗/gh∗\mathrm{Fr}^* = u^* / \sqrt{g h^*} cross Fr∗=1\mathrm{Fr}^* = 1 (transonic/supercritical transition at hR/hL≈0.1383h_R / h_L \approx 0.1383).


Demonstration 3: Tailwater Depth Ratio Sweep — Froude Criticality & Belanger Head Loss
======================================================================================
 h_R / h_L |  h* / h_L |  Fr* = u*/c* |   S / c_L |  Head Loss dH/h_L
--------------------------------------------------------------------
     0.700 |    0.8431 |       0.1782 |    0.9640 |            0.0012
     0.400 |    0.6627 |       0.4569 |    0.9382 |            0.0171
     0.250 |    0.5517 |       0.6925 |    0.9406 |            0.0498
     0.150 |    0.4576 |       0.9566 |    0.9627 |            0.1060
     0.100 |    0.3962 |       1.1775 |    0.9914 |            0.1639
     0.040 |    0.2863 |       1.7376 |    1.0808 |            0.3263
     0.020 |    0.2224 |       2.2406 |    1.1611 |            0.4662

What Demonstration 3 shows. When tailwater is relatively deep (hR/hL>0.1383h_R / h_L > 0.1383), the post-dam flow is subcritical (Fr∗<1\mathrm{Fr}^* < 1) so the rarefaction tail λ1∗=u∗−c∗<0\lambda_1^* = u^* - c^* < 0 retreats upstream of the dam. Once hR/hL<0.1383h_R / h_L < 0.1383, Fr∗>1\mathrm{Fr}^* > 1 turns supercritical, sweeping the rarefaction tail downstream past xdamx_{\mathrm{dam}} while fixing depth right at the dam site at critical flow h(xdam,t)=49hLh(x_{\mathrm{dam}}, t) = \frac{4}{9}h_L (u=c=23ghLu = c = \frac{2}{3}\sqrt{g h_L}).


4. HLL Grid-Refinement Convergence

How fast does 1st-order shallow_water_1d_hll converge in L1L_1 norm when a discontinuous bore is present? We sweep N∈{100,200,400,800}N \in \{100, 200, 400, 800\} at fixed Courant ratio Δt∝Δx\Delta t \propto \Delta x.


Demonstration 4: Grid-Refinement Convergence of shallow_water_1d_hll
====================================================================
N =  100 | steps =   45 | L1 depth error = 2.0462e-02 m
N =  200 | steps =   90 | L1 depth error = 1.1736e-02 m
N =  400 | steps =  180 | L1 depth error = 6.6982e-03 m
N =  800 | steps =  360 | L1 depth error = 3.7998e-03 m
Observed L1 convergence rate (400 -> 800): 0.818

Inside the algorithm

Even with a jump discontinuity, smearing a shock across O(1)O(1) cells of width Δx\Delta x contributes O(Δx)O(\Delta x) to the L1L_1 integral norm (unlike the L2L_2 norm, which saturates at O(Δx1/2)O(\Delta x^{1/2}) across shocks), which is consistent with the observed L1L_1 rate of 0.82 between 400 and 800 cells (the corners of the rarefaction are also smeared, which keeps the rate below 1).

Below we inspect burgers_riemann.shallow_water_1d_hll and verify two fundamental algebraic properties of the HLL Riemann flux in pure NumPy: consistency FHLL(q,q)=F(q)\mathbf{F}_{\mathrm{HLL}}(\mathbf{q}, \mathbf{q}) = \mathbf{F}(\mathbf{q}) and supercritical upwinding (Fr>1  ⟹  FHLL=FL\mathrm{Fr} > 1 \implies \mathbf{F}_{\mathrm{HLL}} = \mathbf{F}_L when u>cu > c).

Check against the library


Inside the Algorithm: Consistency & Supercritical Upwinding of shallow_water_1d_hll
===================================================================================
def shallow_water_1d_hll(
    h_init: np.ndarray,
    hu_init: np.ndarray,
    L: float,
    dt: float,
    n_steps: int,
    g: float = G_STD,
) -> dict:
    """Solve 1-D shallow-water equations with transmissive BCs via Harten-Lax-van Leer (HLL) Riemann solver."""
    h = np.asarray(h_init, dtype=float).ravel().copy()
    hu = np.asarray(hu_init, dtype=float).ravel().copy()
    dx = float(L) / h.size

    for _ in range(n_steps):
        hp = np.pad(h, 1, mode="edge")
        hup = np.pad(hu, 1, mode="edge")
        hl, hr = hp[:-1], hp[1:]
        hul, hur = hup[:-1], hup[1:]
        ul = hul / hl
        ur = hur / hr
        cl = np.sqrt(g * hl)
        cr = np.sqrt(g * hr)

        sl = np.minimum(ul - cl, ur - cr)
        sr = np.maximum(ul + cl, ur + cr)

        f1_l, f1_r = hul, hur
        f2_l = hul * ul + 0.5 * g * (hl**2)
        f2_r = hur * ur + 0.5 * g * (hr**2)

        denom = np.where(sr - sl > 1e-14, sr - sl, 1.0)
        f1_hll = (sr * f1_l - sl * f1_r + sl * sr * (hr - hl)) / denom
        f2_hll = (sr * f2_l - sl * f2_r + sl * sr * (hur - hul)) / denom

        f1 = np.where(sl >= 0.0, f1_l, np.where(sr <= 0.0, f1_r, f1_hll))
        f2 = np.where(sl >= 0.0, f2_l, np.where(sr <= 0.0, f2_r, f2_hll))

        h = h - (dt / dx) * (f1[1:] - f1[:-1])
        hu = hu - (dt / dx) * (f2[1:] - f2[:-1])

    return {"h": h, "hu": hu, "u": hu / h}

HLL consistency and supercritical pure-upwind property verified to 1e-15

Exercises

Worked solutions are in 09_solutions.ipynb. The cell below the list is a short self-check to start from.

  1. Verify a result. Find the critical tailwater ratio (hR/hL)crit(h_R / h_L)_{\mathrm{crit}} where Fr∗=u∗/gh∗=1\mathrm{Fr}^* = u^* / \sqrt{g h^*} = 1 using exact_dam_break_dry_or_wet, and check numerically across hR/hL∈{0.01,0.05,0.10}h_R / h_L \in \{0.01, 0.05, 0.10\} that depth and Froude number at x=xdamx = x_{\mathrm{dam}} lock onto h=49hLh = \frac{4}{9}h_L and Fr=1.0\mathrm{Fr} = 1.0.

  2. Find how it fails. Verify exact_dam_break_dry_or_wet raises ValueError for invalid inputs (hL≤hRh_L \leq h_R, hR≤0h_R \leq 0, t≤0t \leq 0), and show that centered forward-Euler fluxes without HLL wave-speed viscosity produce severe TV blow-up / non-physical depths on the dam break.

  3. Implement it yourself. Implement shallow_water_1d_muscl_hll(h_init, hu_init, L, dt, n_steps, g) using minmod piecewise-linear interface reconstruction, HLL Riemann fluxes, and SSP-RK2 time stepping. Benchmark at N=200N = 200 against 1st-order shallow_water_1d_hll on the Stoker dam break (hL=2.0,hR=0.5,t=0.6h_L = 2.0, h_R = 0.5, t = 0.6), asserting exact volume conservation and lower L1L_1 depth and velocity errors.


Self-check for the exercises
============================
Stoker dam-break wave ordering and supersonic bore speed verified
All checks passed.