Shallow water solver
The (augmented) shallow water equations take the form:
with \(h\) is the fluid height, \(U\) the fluid velocity, \(g\) the gravitational acceleration and \(\psi = \psi(x, t)\) represents some passive scalar.
The implementation here has flattening at shocks and a choice of Riemann solvers.
The main parameters that affect this solver are:
apply flattening at shocks (1)
artificial viscosity coefficient
limiter (0 = none, 1 = 2nd order, 2 = 4th order)
gravitational acceleration (in y-direction)
HLLC or Roe
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,
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.
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.
The quad problem sets up different states in four regions of the domain and watches the complex interfaces that develop as shocks interact. This problem has appeared in several places (and a detailed investigation is online by Pawel Artymowicz). It is run as:
pyro_sim.py swe quad inputs.quad
The Kelvin-Helmholtz problem models three layers of fluid: two at the top and bottom of the domain travelling in one direction, one in the central part of the domain travelling in the opposite direction. At the interface of the layers, shearing produces the characteristic Kelvin-Helmholtz instabilities, just as is seen in the standard compressible problem. It is run as:
pyro_sim.py swe kh inputs.kh
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?
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).