src/examples/turbulence.c
Decaying two-dimensional turbulence
We solve the two-dimensional incompressible Euler equations using a vorticity–streamfunction formulation.
#include "navier-stokes/stream.h"
The domain is square of size unity by default. The default resolution is constant at 256^2 but can be change using command line arguments.
The initial condition for vorticity is just a white noise in the range [-1:1] .
We generate images of the vorticity field every 4 timesteps up to t=1000. We fix the colorscale to [-0.3:0.3].
event output (t += 1; t <= 1000) {
#if !BENCHMARK
output_ppm (omega, min = -0.3, max = 0.3, file = "omega.mp4");
#endif
}
On GPUs we have the option to display the vorticity field in real time.
#if _GPU && SHOW
event display (i++)
output_ppm (omega, min = -0.3, max = 0.3, fps = 30, fp = NULL);
#endif