sandbox/Antoonvh/ABL/tp.c
Generate periodic Topography
Perlin’s noise
are they really periodic?

#include "grid/octree.h"
#include "perlin.h"
#include "view.h"
#include "../domain_dohicky.h"
scalar cs[];
face vector fs[];
vertex scalar phi[];
int main() {
periodic (left);
periodic (back);
= 11;
L0 = Y0 = Z0 = -L0/2;
X0(32);
init_grid refine (fabs(y) < 1 && level < 7);
view (theta = 0.3, phi = 0.4);
for (int g = 0; g < 35; g++) {
(g);
srand
int nx = 5;
int ny = 3;
init_perlin (nx, ny);
foreach_vertex()
[] = y - 2*(perlin (x, z, nx, ny));
phifree (gradp);
= 7;
nx = 7;
ny init_perlin (nx, ny);
foreach_vertex()
[] += 0.75*perlin (x, z, nx, ny);
phifree (gradp);
= 17;
nx = 17;
ny init_perlin (nx, ny);
foreach_vertex()
[] += 0.2*perlin (x, z, nx, ny);
phifree (gradp);
= 31;
nx = 31;
ny init_perlin (nx, ny);
foreach_vertex()
[] += 0.05*perlin (x, z, nx, ny);
phifree (gradp);
scalar h[];
foreach()
[] = y;
hboundary ({phi});
fractions (phi, cs, fs);
draw_vof ("cs", "fs", color = "h", min = -1, max = 1);
save ("h.mp4", opt = "-r 2");
}
enlarge_hor({cs}); //Bview could do `translate()`...
foreach() {
if (y > Y0 + L0/3)
[] = 1;
cs}
draw_vof ("cs");
save ("h.png");
}