// same as bump2D.c but with "inner" boundaries #include "saint-venant.h" int LEVEL = 8; int main (int argc, char * argv[]) { if (argc > 1) LEVEL = atoi (argv[1]); size (2.); origin (-L0/2., -L0/2.); init_grid (1 << LEVEL); run(); } bid inner; event init (i = 0) { mask (fabs(x) > 0.5 || fabs(y) > 0.5 ? inner : none); foreach() h[] = 0.1 + 1.*exp(-200.*(x*x + y*y)); } event logfile (i++) { stats s = statsf (h); fprintf (stderr, "%g %d %g %g %.8f\n", t, i, s.min, s.max, s.sum); } event outputfile (t <= 2.5; t += 2.5/8) { static int nf = 0; printf ("file: eta-%d\n", nf); output_field ({eta}, linear = true); scalar l[]; foreach() l[] = level; printf ("file: level-%d\n", nf++); output_field ({l}); /* check symmetry */ foreach() { double h0 = h[]; point = locate (-x, -y); // printf ("%g %g %g %g %g\n", x, y, h0, h[], h0 - h[]); assert (fabs(h0 - h[]) < 1e-12); point = locate (-x, y); assert (fabs(h0 - h[]) < 1e-12); point = locate (x, -y); assert (fabs(h0 - h[]) < 1e-12); } } event adapt (i++) { astats s = adapt_wavelet ({h}, (double[]){1e-3}, LEVEL); fprintf (stderr, "# refined %d cells, coarsened %d cells\n", s.nf, s.nc); }