# Title: Dam break on complex topography
#
# Description:
#
# An example similar to that
# \htmladdnormallinkfoot{presented}{http://www.amath.washington.edu/~rjl/catalina/leveque1.pdf}
# by Randall J. LeVeque illustrating the solution of the
# \htmladdnormallinkfoot{Saint-Venant}{http://en.wikipedia.org/wiki/Shallow\_water\_equations}
# (or shallow-water) equations with complex topography, wetting and
# drying, shocks and hydrostatic equilibrium.
#
# \begin{figure}[htbp]
# \caption{Topography (red) and animation of the water level (blue).}
# \begin{rawhtml}
#
#

#
# \end{rawhtml}
# \end{figure}
#
# Author: St\'ephane Popinet
# Command: gerris2D dam.gfs
# Version: 1.3.1
# Required files: dam.plot
# Running time: 2 minutes
# Generated files: dam.gif
#
# Use the GfsRiver Saint-Venant solver
1 0 GfsRiver GfsBox GfsGEdge {} {
PhysicalParams { L = 8. }
RefineSolid 9
# Set a solid boundary close to the top boundary to limit the
# domain width to one cell (i.e. a 1D domain)
Solid (y/8. + 1./pow(2,9) - 1e-6 - 0.5)
# Set the topography Zb and the initial water surface elevation P
Init {} {
Zb = x*x/8.+cos(M_PI*x)/2.
P = {
double p = x > 0. ? 0.35 : x < -2. ? 1.9 : -1.;
return MAX (0., p - Zb);
}
}
PhysicalParams { g = 1. }
# Use a first-order scheme rather than the default second-order
# minmod limiter. This is just to add some numerical damping.
AdvectionParams {
# gradient = gfs_center_minmod_gradient
gradient = none
}
Time { end = 40 }
OutputProgress { istep = 10 } stderr
OutputScalarSum { istep = 10 } ke { v = (P > 0. ? U*U/P : 0.) }
OutputScalarSum { istep = 10 } vol { v = P }
OutputScalarNorm { istep = 10 } u { v = (P > 0. ? U/P : 0.) }
# Save a text-formatted simulation
OutputSimulation { step = 0.5 } sim-%g.txt { format = text }
# Use gnuplot to create gif images
EventScript { step = 0.5 } {
time=`echo $GfsTime | awk '{printf("%4.1f\n", $1);}'`
cat < dam.gif
rm -f sim-*.gif sim-*.txt
}
}
GfsBox {
left = Boundary
right = Boundary
}