src/test/dry.c

Drying of a lake

We test the robustness of the explicit and implicit Saint-Venant solvers for an emptying lake in one dimension. The topography dries and the lake-at-rest condition must be reached at the end of the run.

#include "grid/multigrid1D.h"
#if EXPLICIT
# include "saint-venant.h"
#else
# include "saint-venant-implicit.h"
#endif

int main()
{
  origin (-0.5);
  init_grid (256);
  DT = 1e-2;
  run();
}

#if EXPLICIT
h[right] = dry;
η[right] = zb[];
u.n[right] = u.x[];
#else
q.n[right] = q.x[];
p[right] = dirichlet(0);
#endif

event init (i = 0)
{
  foreach() {
    zb[] = 0.25*(cos(π*x/0.1) + 1.)*(fabs(x) < 0.1);
    h[] = 0.8 - zb[];
  }
}

event logfile (t = {0.5, 0.75, 1, 3, 50}) {
  printf ("%g %g %d\n", t, dt, i);
  foreach() {
    fprintf (stderr, "%g %g %.6f %g\n", x, h[],
#if EXPLICIT
	     u.x[],
#else
	     q.x[],
#endif
	     zb[]);
    assert (h[] > 0.);
  }
  fprintf (stderr, "\n");
}
Evolution of the free surface (red) and topography (green)

Evolution of the free surface (red) and topography (green)