Sloshing water in a circular bucket: shallow water equation with weaker viscosity
Channel: Nils Berglund
Date: 2023-06-04

This is a variant of the simulation shown in the video https://youtu.be/r8JFpuo4gSg , with much smaller viscosity. One cause of instabilities in my first simulations of the shallow water equations was the choice of initial state: I used a Gaussian water height, that reached almost zero outside a small region. Here the Gaussian has been added to a nonzero constant water height, making the simulation much more stable.
The simulation uses soft boundary conditions on the walls of the circular bucket, that consist in a localized repelling force, and a smooth but steep cut-off, that acts like a strong drag outside the container. 
The shallow water equations are nonlinear equations, which give a better description of the motion of water than the linear wave equation. In particular, unlike the linear wave equation, they conserve the total volume of water. The linear equation gives an approximation of the solutions, when the wave height remains close to its average over space. 
The equations used here include viscosity and dissipation, as described for instance in 
https://en.wikipedia.org/wiki/Shallow_water_equations#Non-conservative_form , without the Coriolis force. 
The video has four parts, showing the same simulation with two different color schemes and at two different speeds:
Wave height: 0:00
Velocity (norm and direction): 1:22
Wave height (time lapse): 2:44
Velocity (time lapse): 3:11
In the first and third part, the color hue and z coordinate show the height of the water. In the second and fourth part, the color hue shows the direction of the flow, and the z-coordinates shows its speed (the norm of the velocity). 

I will be traveling for the next few days, and only able to reply to comments when I'm back.
 
Render time: 1 hour 38 minutes
Color scheme: Parts 1 and 3 -   Viridis by Nathaniel J. Smith, Stefan van der Walt and Eric Firing
https://github.com/BIDS/colormap
 Parts 2 and 4 - Twilight by Bastian Bechtold
https://github.com/bastibe/twilight
 
Music: Lightning on a Blue Sky by Twin Musicom is licensed under a Creative Commons Attribution 4.0 licence. https://creativecommons.org/licenses/by/4.0/
Artist: http://www.twinmusicom.org/

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 shallow water 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!

#shallowwater #waves