1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| // Small amplitude solitary wave interacting with a parabolic hump
#include "saint-venant.h"
#define MAXLEVEL 9
#define MINLEVEL 7
int main()
{
init_grid (1 << MAXLEVEL);
origin (-0.5, -1.);
size (2.);
run();
}
u.n[left] = neumann(0);
u.n[right] = neumann(0);
u.n[top] = neumann(0);
u.n[bottom] = neumann(0);
event init (i = 0)
{
foreach() {
x += 0.5;
zb[] = 0.8*exp(-5.*sq(x - 0.9) - 50.*y*y);
h[] = (0.05 < x && x < 0.15 ? 1.01 : 1.) - zb[];
}
}
event outputfile (t = {0.6, 0.9, 1.2, 1.5, 1.8})
{
static int nf = 0;
printf ("file: eta-%d\n", nf);
output_field ({eta}, stdout, N, linear = true);
scalar l[];
foreach()
l[] = level;
printf ("file: level-%d\n", nf++);
output_field ({l}, stdout, N);
}
event logfile (i++) {
stats s = statsf (h);
fprintf (stderr, "%g %d %g %g %.8f\n", t, i, s.min, s.max, s.sum);
}
event adapt (i++) {
scalar eta[];
foreach()
eta[] = h[] > dry ? h[] + zb[] : 0.;
astats s = adapt_wavelet ({eta}, (double[]){1e-4}, MAXLEVEL, MINLEVEL);
fprintf (stderr, "# refined %d cells, coarsened %d cells\n", s.nf, s.nc);
}
|