Von Kármán vortices behind an elliptical obstacle
Channel: Nils Berglund
Date: 09/02/2023

Having obtained von Kármán vortices behind a circular obstacle in the simulation https://youtu.be/U-GBicPDWS8 , it is now time to start changing the shape of the obstacle. Here the circle has been deformed into a more general ellipse. The ultimate aim is to do the same for airfoils and airplane wings.
The equations used here are the compressible Euler equations. Instead of using a hard obstacle, which tends to cause numerical instabilities, there is a strongly localized force field in an elliptical region. The force field is perpendicular to the surface of the obstacle, and interpolates between a constant magnitude inside the obstacle, and a zero magnitude outside a small boundary layer. In addition, the velocity and density are artificially set to zero inside the soft obstacle, with a similar boundary layer transition.  
The video has two parts, showing the same simulation with two different color schemes:
Vorticity: 0:00
Speed: 1:46
In the first part, the color hue shows the vorticity of the fluid, which measures its quantity of rotation (given by the curl, or rotational, of the velocity field). In the second part, it shows the speed (norm of velocity) of the fluid. The velocity field of the fluid is materialized by 1000 tracer particles, whose initial position is distributed randomly over the simulation region. There are periodic boundary conditions, which is why vortices can be seen wrap around the displayed rectangular region.
The compressible Euler equations are partial differential equations for the density and the velocity field of the fluid. The system as such is not closed, because the right-hand side of the velocity equation involves the pressure, which has to be linked to known quantities by a thermodynamic relation. I assumed here that the fluid is an ideal gas, so that the pressure is proportional to the density. 
In a sense, the compressible Euler equations are easier to simulate than the incompressible ones, because one does not have to impose a zero divergence condition on the velocity field. However, they appear to be a bit more unstable numerically, and I had to add a smoothing mechanism to avoid blow-up. This mechanism is equivalent to adding a small viscosity, making the equations effectively a version of the Navier-Stokes equations. 

Render time: 1 hour 35 minutes 
Color scheme: Part 1 -  Turbo, by Anton Mikhailovhttps://gist.github.com/mikhailov-work/6a308c20e494d9e0ccc29036b28faa7a
Part 2 - Viridis by Nathaniel J. Smith, Stefan van der Walt and Eric Firing
https://github.com/BIDS/colormap
 
Music: "Joker" by Causmic@Causmic

See also https://images.math.cnrs.fr/Des-ondes-dans-mon-billard-partie-I.html for more explanations (in French) on  a few previous simulations of wave equations. 

The simulation solves the 2D compressible Euler equation by discretization (finite differences).

C code: https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html
Many thanks to Marco Mancini and Julian Kauth for helping me to accelerate my code!