A shear flow on the sphere
Channel: Nils Berglund
Date: 26/03/2024

This simulation shows a solution of the incompressible Euler equations on the sphere. The initial state is a shear flow, that consists of 6 layers moving at different speeds. The layers have almost constant latitude, but not quite: there is a small oscillation of period 2*pi/6 in the North-South directions that induces an instability leading to vortex formation.
The color hue and radial coordinate depend on the vorticity of the fluid, which measures its quantity of rotation. In pink areas, the vorticity is zero, meaning that the speed of the fluid does not change when moving laterally with respect to its velocity. In yellow and dark putple areas, the vorticity is large. The point of view of the observer is rotating around the polar axis of the sphere at constant latitude. 
The incompressible Euler equations describe the velocity field of a non-viscous, incompressible fluid. They are strongly non-linear, because of the presence of a so-called advection term in what is known as the material derivative. Another difficulty in solving these equations numerically is the incompressibility condition, which requires the velocity to remain divergence-free. Since most numerical schemes will not conserve the divergence, a common approach is to "project" the solution on the space of divergence-free flows after each integration step. 
I used here a different approach, based on the so-called stream function. By writing the velocity as the curl (rotational) of a stream function, directed along the z-axis perpendicular to the plane of the two-dimensional fluid, one ensures that the velocity is always divergence-free. The incompressible Euler equations are then equivalent to a partial differential equation for the stream function, and a Poisson equation linking stream function and vorticity. Since I had no solver for the Poisson equation at hand, I used a forced heat equation for the evolution of the vorticity, which admits the solution of the Poisson equation as a stationary solution. This induces additional errors, which are hopefully not too important. There is also a weak dissipation term, proportional to the Laplacian of the stream function, to prevent numerical blow-up, so the governing system is in fact closer to the Navier-Stokes equations with small viscosity. 
The equation is solved by finite differences, where the Laplacian and gradient are computed in spherical coordinates. Some smoothing has been used at the poles, where the Laplacian becomes singular in these coordinates. 

Render time: 56 minutes 57 seconds
Compression: crf 23
Color scheme:  Magma by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap

Music: "Lose Yourself" by Drew Banga@textmerecords 

The simulation solves the incompressible Euler equation by discretization. 
C code: https://github.com/nilsberglund-orleans/YouTube-simulations

#Euler_equation #fluid_mechanics #vortex