Shallow water hydrodynamics#

The (augmented) shallow water equations take the form:

\[\begin{split}\frac{\partial h}{\partial t} + \nabla \cdot (h U) &= 0 \\ \frac{\partial (h U)}{\partial t} + \nabla \cdot (h U U) + \frac{1}{2}g\nabla h^2 &= 0 \\ \frac{\partial (h \psi)}{\partial t} + \nabla \cdot (h U \psi) &= 0\end{split}\]

with \(h\) is the fluid height, \(U\) the fluid velocity, \(g\) the gravitational acceleration and \(\psi = \psi(x, t)\) represents some passive scalar.

swe solver#

The pyro swe implementation has flattening at shocks and a choice of Riemann solvers.

The main parameters that affect this solver are:

  • section: [driver]

    option

    value

    description

    cfl

    0.8

  • section: [particles]

    option

    value

    description

    do_particles

    0

    particle_generator

    grid

  • section: [swe]

    option

    value

    description

    use_flattening

    0

    apply flattening at shocks (1)

    cvisc

    0.1

    artificial viscosity coefficient

    limiter

    2

    limiter (0 = none, 1 = 2nd order, 2 = 4th order)

    grav

    1.0

    gravitational acceleration (in y-direction)

    riemann

    Roe

    HLLC or Roe

supported problems#

acoustic_pulse#

parameters:

name

default

acoustic_pulse.h0

1.4

acoustic_pulse.dh0

0.14

advect#

dam#

parameters:

name

default

dam.direction

x

dam.h_left

1.0

dam.h_right

0.125

dam.u_left

0.0

dam.u_right

0.0

kh#

parameters:

name

default

kh.h_1

1.0

kh.v_1

-1.0

kh.h_2

2.0

kh.v_2

1.0

quad#

parameters:

name

default

quadrant.h1

1.5

quadrant.u1

0.0

quadrant.v1

0.0

quadrant.h2

0.532258064516129

quadrant.u2

1.206045378311055

quadrant.v2

0.0

quadrant.h3

0.137992831541219

quadrant.u3

1.206045378311055

quadrant.v3

1.206045378311055

quadrant.h4

0.532258064516129

quadrant.u4

0.0

quadrant.v4

1.206045378311055

quadrant.cx

0.5

quadrant.cy

0.5

test#

Examples#

dam#

The dam break problem is a standard hydrodynamics problem, analogous to the Sod shock tube problem in compressible hydrodynamics. It considers a one-multidimensional problem of two regions of fluid at different heights, initially separated by a dam. The problem then models the evolution of the system when this dam is removed. As for the Sod problem, there exists an exact solution for the dam break problem, so we can check our solution against the exact solutions. See Toro’s shallow water equations book for details on this problem and the exact Riemann solver.

Because it is one-dimensional, we run it in narrow domains in the x- or y-directions. It can be run as:

pyro_sim.py swe dam inputs.dam.x
pyro_sim.py swe dam inputs.dam.y

A simple script, dam_compare.py in analysis/ will read a pyro output file and plot the solution over the exact dam break solution (as given by [SL58] and [WHZ99]). Below we see the result for a dam break run with 128 points in the x-direction, and run until t = 0.3 s.

_images/dam_compare.png

We see excellent agreement for all quantities. The shock wave is very steep, as expected. For this problem, the Roe-fix solver performs slightly better than the HLLC solver, with less smearing at the shock and head/tail of the rarefaction.

Exercises#

Explorations#

  • There are multiple Riemann solvers in the swe algorithm. Run the same problem with the different Riemann solvers and look at the differences. Toro’s shallow water text is a good book to help understand what is happening.

  • Run the problems with and without limiting—do you notice any overshoots?

Extensions#

  • Limit on the characteristic variables instead of the primitive variables. What changes do you see? (the notes show how to implement this change.)

  • Add a source term to model a non-flat sea floor (bathymetry).