sandbox/fuster/Allmach3.0/stepAllMach.c
A Mach-3 wind tunnel with a step
This test included in the review paper of Woodward & Colella, 1984 shows the interaction between a shock wave and a step.
In this case we use the Bell-Colella-Glaz advection scheme using the minmod2 slope limiter
This script obtain the isocontours below that can be compared with Woodward & Colella, 1984

two-phase-compressible.h: No such file or directory
#include "two-phase-compressible.h"
# define LEVEL 10
double rho0 = 1.4;
double p0 = 1.;
double tend = 2.;
Boundary conditions
.n[left] = dirichlet(3*rho0);
q.t[left] = dirichlet(0.);
q
.n[right] = neumann(0.);
q[right] = neumann(0.);
fE1[right] = neumann(0.);
frho1
.n[bottom] = dirichlet(0.);
q.t[bottom] = neumann(0.);
q
.n[top] = dirichlet(0.);
q.t[top] = neumann(0.);
q
[left] = dirichlet(rho0); frho1
Main program
int main() {
= 1.4;
gamma1
(3. [0]);
size = HUGE [0];
DT (1 << LEVEL);
init_grid ();
run}
event init (t = 0)
{
mask (y > 1. ? top : none);
mask ( (x > 0.6 && y < 0.2) ? bottom : none );
.gradient = minmod2;
f= 1.3;
theta
foreach() {
[] = 1.;
f[] = p0;
p[] = rho0;
frho1[] = 0.;
frho2.x[] = 3*frho1[];
q.y[] = 0.;
q[] = p[]/(gamma1 - 1.) + 0.5*pow(q.x[],2)/frho1[];
fE1[] = 0.;
fE2}
}
We test the grid adaptation
event adapt (i++) {
((scalar *){p},(double[]){0.1},maxlevel = LEVEL);
adapt_wavelet}
Output
event logfile (i++) {
if (i == 0)
fprintf (ferr, "t dt grid->tn perf.t perf.speed\n");
fprintf (ferr, "%g %g %ld %g %g\n", t, dt, grid->tn, perf.t, perf.speed);
}
Movies
event movies (i += 5)
{
static FILE * fp1 = popen ("ppm2mp4 rho.mp4", "w");
(frho1, fp1, box = {{0.,0.},{3.,1.}},
output_ppm = true, spread = 2, n = 512);
linear
scalar l[];
foreach()
[] = level;
l
static FILE * fp2 = popen ("ppm2mp4 level.mp4", "w");
(l, fp2, box = {{0.,0.},{3.,1.}},
output_ppm = false, min = 0, max = LEVEL, n = 512);
linear }
Evolution of the density field
Evolution of the level of refinement
We plot the evolution of iso-density contours.

event isovalue (t += tend/20.; t <= tend)
{
static FILE * fp = popen ("gnuplot", "w");
if (t == 0.)
fprintf (fp,
"set term gif animate crop\n"
"set output 'tmp.gif'\n"
"set xrange [0:3]\n"
"set yrange [0:1]\n"
"unset surface\n"
"set view map\n"
"unset key\n"
"set size ratio -1\n"
"set contour base\n"
// "set cntrlabel onecolor\n"
"unset clabel\n"
"set cntrparam levels incremental 0.267,(6.75-0.267)/30,6.75\n"
);
fprintf (fp, "splot '-' w l lt -1\n");
({rho}, fp, n = 512, linear = true);
output_field ("e\n", fp);
fputs fflush (fp);
}
event end (t = tend)
{
FILE * fp = fopen ("rho.end", "w");
({rho}, fp, n = 512, linear = true);
output_field fclose (fp);
system ("gifsicle --optimize --delay 10 --loopcount=0 tmp.gif > isovalue.gif "
"&& rm -f tmp.gif");
}
References
[woodward1984] |
Paul Woodward and Phillip Colella. The numerical simulation of two-dimensional fluid flow with strong shocks. Journal of computational physics, 54(1):115–173, 1984. [ .pdf ] |