sandbox/yonghui/smalltest/visdrop.c
##water drop in viscous environment Based on rising.c,
We replace two liquids with each other in order to simulate falling drops of water in a viscous environment.
The main part of the code has not been modified, comparisons will be neglected here. We simply assume the results is good.
#include "axi.h"
#include "navier-stokes/centered.h"
#include "two-phase.h"
#include "tension.h"
# define LEVEL 10
##Boundary conditions
.t[right] = dirichlet(0);
u.t[left] = dirichlet(0);
u
//u.n[right] = dirichlet(0);
//u.n[left] = dirichlet(0);
[right] = dirichlet(0);
p[left] = neumann(0);
p
[right] = dirichlet(0);
pf[left] = neumann(0);
pf
.n[bottom] = 0.;
uf.n[top] =0.; uf
Main
int main() {
(6);
size (128);
init_grid = 1000., mu1 = 10.;
rho1 = 100., mu2 = 1., f.sigma = 24.5;
rho2 = 1e-4;
TOLERANCE run();
}
init & accelerating
event init (t = 0) {
mask (y > 0.6 ? top : none);
refine (sq(x - L0 + 1.) + sq(y) - sq(0.25) < 0. && level < LEVEL);
fraction (f, -1.*(sq(x - L0 + 1.) + sq(y) - sq(0.25)));
output_ppm (f, linear = true, n=512, file = "init.png");
foreach()
.x[] = -1.*f[];
u}
event acceleration (i++) {
face vector av = a;
foreach_face(x)
.x[] -= 0.98;
avboundary({p});
}
output the results
event outputvideo (i += 20 ) {
output_ppm (f, linear = true, n=1024,file = "f.mp4");
output_ppm (u.x, linear = true, n=1024, file = "ux.mp4");
output_ppm (p, linear = true, n=1024, file = "p.mp4");
fprintf(stderr,"%d %g\n", i,t);
}
event interface (t = 3) {
output_facets (f, stderr);
}
int k=0;
event velo (t += 0.2) {
if (t > 2.){
+= 1;
k char name[40];
char velofield[40];
sprintf (velofield, "ve-%d", k);
sprintf (name, "dump-%d", k);
dump (file = name);
output_field((scalar *){u}, fopen (velofield, "w"));
}
}
mesh adaption will be used
event adapt (i++) {
({f,u}, (double[]){5e-4,1e-3,1e-3}, LEVEL,6);
adapt_wavelet }