sandbox/Antoonvh/impinging.c
Impinging jets
Two opposing jets in a reactor can create a splash. This page focusses on the visualization. The physical scenario borrows from the atomizing jet example, but concerns two opposing jets.
Output_ppm()
is neat for slices, but cant do ā3Dā shading
effects
With Bview, a 3D snapshot can be rendered each iteration with little overhead
Bwatch can visualize refractive objects
#include "grid/octree.h"
#include "navier-stokes/centered.h"
#include "two-phase.h"
#include "tension.h"
#include "view.h"
#include "bwatch.h"
#include "tag.h"
#define radius 1./12.
#define length 0.025
#define Re 400
#define SIGMA 3e-4
double uemax = 0.1;
double femax = 0.01;
int maxlevel = 8;
Jet injection with a Poissuille-flow profile prevents early atomization
#define RAD (sqrt(sq(y) + sq(z)))
#define UR (-(RAD - radius)*(RAD + radius)/sq(radius)*min(2., 10.*t))
scalar f0[];
.n[left] = dirichlet(f0[]*UR);
u.t[left] = dirichlet(0);
u#if dimension > 2
.r[left] = dirichlet(0);
u#endif
[left] = neumann(0);
p[left] = f0[];
f
.n[right] = dirichlet(-f0[-1]*UR);
u.t[right] = dirichlet(0);
u#if dimension > 2
.r[right] = dirichlet(0);
u#endif
[right] = neumann(0);
p[right] = f0[-1];
f
.n[top] = neumann(0.);
u[top] = dirichlet (0.);
p.n[bottom] = neumann(0.);
u[bottom] = dirichlet (0.);
p
int main () {
(64);
init_grid (0, -1.5, -1.5);
origin (3.);
size = 1., rho2 = 1./27.84;
rho1 = 2.*radius/Re*rho1, mu2 = 2.*radius/Re*rho2;
mu1 .sigma = SIGMA;
frun();
}
event init (t = 0) {
refine (1.1*radius > RAD && level < maxlevel);
fraction (f0, sq(radius) - sq(y) - sq(z));
#if TREE
.refine = f0.prolongation = fraction_refine;
f0#endif
({f0}); // for boundary conditions on levels
restriction foreach() {
[] = f0[]*(x < length) + f0[]*(x > (X0 + L0 - length));
f.x[] = f[]* sign (X0 + L0/2 - x);
u}
boundary ({f, u.x});
// Get an image
system ("wget https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/screen-shot-2020-09-30-at-1-56-23-pm-1601488673.png?resize=768:*");
system ("convert screen-shot-2020-09-30-at-1-56-23-pm-1601488673.png?resize=768:* "
"-resize 500x500! reactor.png");
}
event adapt (i++) {
({f, u}, (double[]){femax, uemax, uemax, uemax}, maxlevel, 5);
adapt_wavelet }
Movie makers
event mov (t += 0.025) {
output_ppm (f, file = "f.mp4", n = 500);
}
event bviewer (i++) {
view (tx = -0.5, phi = 0.3, theta = 0.5);
draw_vof ("f");
cells();
save ("mov.mp4");
}
event droplet_cleanup_project (t += 0.01) {
// Remove fov crap ...
remove_droplets (f, minsize = 4);
// ... and remove atomized features
remove_droplets (f, minsize = -10);
}
event bwatch_images (t += 0.01) {
static FILE * fp = popen ("ppm2mp4 bw.mp4", "w");
watch (fov = 2.5, poi = {1.75, 0.25, 0}, O = {6, 3, 5},
= 600, ny = 500);
nx image ("reactor.png", res = 400, alpha = Z0 + L0/10.);
sphere (R = 30, mat = {.dull = true});
equiplane (f, vof = true, mat = {.ind = 1.2});
volume (f, sc = 0.2, mval = 0.5, col = {0, 95, 104});
store (fp);
plain();
}
event stop (t = 2.5) {
return 1;
}