sandbox/WMW/blow.c
Cavity created by blowing on a free surface
Animation of free surface, vertical velocity (left), horizontal velocity (right).
plot 'log' u 1:4 w l t ''
#include "axi.h"
#include "navier-stokes/centered.h"
#include "two-phase.h"
#include "navier-stokes/conserving.h"
#include "reduced.h"
#include "curvature.h" // for position()
#include "view.h"
#include "navier-stokes/perfs.h"
.n[top] = neumann(0);
u[top] = dirichlet(0);
p
.n[right] = dirichlet (- 40.*(y < 0.1));
u
#define MAXLEVEL 7
int main()
{
(5.);
size (-L0/2.);
origin = 0.001;
rho2 = 0.01;
mu1 = rho2*mu1/rho1;
mu2 .x = -1;
G= 1 << MAXLEVEL;
N run();
}
event init (i = 0) {
foreach()
[] = x < 0;
fboundary ({f});
}
event logfile (i++) {
double ke = 0., pe = 0.;
foreach(reduction(+:ke) reduction(+:pe)) {
double r = rho(f[]);
+= r*sq(norm(u))/2.*dv();
ke += r*G.x*x*dv();
pe }
scalar X[];
position (f, X, (coord){1.,0.});
fprintf (stderr, "%g %g %g %g\n", t, ke, pe, statsf(X).min);
}
event outputs (i += 100) {
dump();
}
event movie (t += 0.03; t <= 5.) {
view (fov = 21.0715, quat = {0,0,-0.707,0.707},
= -0.000575189, ty = 0.0132879, bg = {1,1,1},
tx = 1208, height = 666, samples = 4);
width box (notics = true);
draw_vof ("f", filled = 0, fc = {1,1,1});
squares ("u.x", linear = true);
mirror (n = {0,1}) {
draw_vof ("f", filled = -1, fc = {1,1,1});
squares ("u.y", linear = true);
box (notics = true);
}
save ("movie.mp4");
}
#if TREE
event adapt (i++) {
({f,u}, (double[]){0.01,1e-2,1e-2}, MAXLEVEL);
adapt_wavelet }
#endif