Validation/Shallow water
A dam break
An idealised dam break has a closed form, so there is nothing to argue about — including the depth at the dam itself, which is exactly four ninths of the reservoir, whatever the reservoir is.
Why this case
The shallow-water solver had no reference behind it at all. This case gives it one, and like the shock tube the reference is arithmetic rather than somebody else’s experiment: an ideal dam break over a flat, frictionless bed has a closed-form answer, so there is nothing to transcribe from a paper and nothing that can be mis-transcribed.
It also has a number a reader can check without running anything. Whatever the reservoir depth, the water directly over the dam site settles instantly at exactly four ninths of it, and stays there.
| Physics | Shallow water — depth-averaged, inviscid, flat bed, no friction |
|---|---|
| Reservoir | Still water 1.0 m deep to the left of a dam at x = 0 |
| Downstream | A thin film 0.001 m deep — see the caveat below |
| Gravity | 9.81 m/s² |
| Domain | ±10.0 m, compared at t = 1.0 s |
| Mesh | Three uniform meshes: 200, 400 and 800 cells, so 0.1, 0.05 and 0.025 m |
| Reference | Ritter (1892) for the fan, exactly; Stoker for the whole domain — Ritter (1892), Zeitschrift des Vereines deutscher Ingenieure 36, 947–954 |
| Agreement | Depth at the dam 0.44507931 m against an exact 0.44444444 m on the finest mesh |
The exact solution
Water at rest, depth h₀ to the left of a dam at x = 0, the dam removed at t = 0. With c₀ = √(g h₀) the state depends on x and t only through the similarity variable s = x/t:
Ritter (1892)
s <= -c0 h = h0 u = 0
-c0 < s < 2c0 h = (2c0 - s)^2 / (9 g) u = (2/3)(s + c0)
s >= 2c0 h = 0 u = 0The harness derives it rather than quoting it: the fan is the simple wave on which the Riemann invariant u + 2c is constant at its upstream value 2c₀, and on which the other characteristic speed u − c equals s. Solving those two together gives the formulae above, and a self-check confirms the result satisfies the shallow-water equations in similarity form to machine precision.
Putting s = 0 into the middle line gives the two numbers this page is measured on:
| Quantity | Exact value |
|---|---|
| Depth at x = 0 | 0.44444444 m — exactly 4h₀/9 |
| Velocity at x = 0 | 2.08806130 m/s |
| Wave speed c₀ = √(g h₀) | 3.13209195 m/s |
| Front, at 2c₀ | 6.26418391 m/s — so x = 6.264 m at t = 1 s |
The bed is dry, and the solver cannot run a dry bed
This is the one place where the reference and the product are solving different problems, and it is stated rather than tuned away.
| Feature | Value |
|---|---|
| Fan head, x/t | −3.13209195 |
| Fan tail, x/t | +3.83510968 |
| Shock, x/t | +4.71535884 |
| Plateau depth h₂ | 0.06682978 m |
| Plateau velocity u₂ | 4.64480109 m/s |
| Plateau wave speed c₂ | 0.80969141 m/s |
Ritter’s other two assumptions do hold here exactly, and the harness asserts both rather than assuming them. The solver has no friction term at all — no Manning, no Chézy, no Laplacian in its momentum equation — so there is nothing to switch off. And the bed elevation is an optional field the product does not write, so the bed is flat; the harness refuses to continue if one ever appears, and keeps a separate fixture showing what a sloping bed looks like. Coriolis is off in the staged gravity properties, and that is asserted too.
Result
| Cells | Cell size | Depth at x = 0 (m) | vs 4h₀/9 | Velocity at x = 0 (m/s) | vs exact |
|---|---|---|---|---|---|
| 200 | 0.1 m | 0.44587633 | +0.322 % | 2.0824862 | −0.267 % |
| 400 | 0.05 m | 0.44525011 | +0.181 % | 2.0840715 | −0.191 % |
| 800 | 0.025 m | 0.44507931 | +0.143 % | 2.0848160 | −0.155 % |
Mesh refinement
One agreeing depth is one number that happens to be close. What makes this verification is that the error over the fan falls when the mesh is refined.
| Cells | Cells in the fan | L1 in h over the fan | L∞ in h over the fan | L1 in u over the fan | L1 in h over the whole domain |
|---|---|---|---|---|---|
| 200 | 69 | 4.021 × 10⁻³ | 2.277 × 10⁻² | 1.774 × 10⁻² | 2.374 × 10⁻³ |
| 400 | 140 | 2.400 × 10⁻³ | 2.196 × 10⁻² | 1.230 × 10⁻² | 1.229 × 10⁻³ |
| 800 | 278 | 1.503 × 10⁻³ | 1.614 × 10⁻² | 8.234 × 10⁻³ | 8.573 × 10⁻⁴ |
| Meshes | Depth over the fan | Velocity over the fan |
|---|---|---|
| 200 → 400 | 0.744 | 0.529 |
| 400 → 800 | 0.675 | 0.579 |
The order sits below one, and that is the expected behaviour rather than a shortcoming: this solution has a shock in it, and a shock reduces any scheme to first order locally. The fan norm still falls monotonically on both fields and on every pair of meshes.
What this page does not establish
Three things, and none of them is hidden in the numbers above.
- Ritter’s dry bed has not been run, and cannot be. The solver cannot construct a velocity where the depth is zero. Every number here is from a case with a 1 mm film downstream, and the whole-domain solution for that case is Stoker’s, not Ritter’s. Ritter is exact only over the fan, and that is the only place the headline error is taken.
- The shock is not what this case verifies. Its position on the three meshes is 4.550, 4.625 and 4.6625 m against Stoker’s 4.71535884 m at t = 1 s — 3.5 %, 1.9 % and 1.1 % short. It is approaching the right place under refinement, but a shock position resolved to a cell width on a 0.025 m mesh is a capture measurement, not an accuracy one, and it is reported here rather than claimed as agreement.
- Nothing is established about friction, a sloping bed or Coriolis. All three are absent from this case by construction, which is what makes the reference exact. A real dam break has all of them.
Repeat this yourself
Every case here is set up from the worked examples in the product, with no hand-editing of solver files — so you can run it, and get the same numbers. The free tier runs real cases up to 250,000 cells of fluids, or 100,000 nodes of solid, with no account needed to download and no time limit.
Other cases
- Sod shock tubeThe exact Riemann solution, compared point by point. It found a defect nobody had noticed: the solver was using the wrong ratio of specific heats.
- Lid-driven cavityThe oldest benchmark in incompressible CFD, run on a deliberately coarse mesh — because one that only agrees when it is expensive is not much of a reassurance.
All validation cases · Written by the team building SHD Sim.