Magnetized squares with friction under increasing gravity on a sphere @NilsBerglund
Magnetized squares with friction under increasing gravity on a sphere  @NilsBerglund
Uploaded August 2026 | Updated November 2026, 3 hours ago
In this variant of the video youtu.be/Y1tRfCCoMtI , the thermostat has been replaced by viscous friction, in order to see whether the artifacts in the previous simulation were due to a kind of "flying ice cubes" effect. Still, I had to cheat by basically imposing a speed limit on the particles, to avoid them starting to "boil" under pressure. This may be due to improper coding of the interactions near the poles.
The squares in this simulation interact via a stiff harmonic potential that approximates squares with hardcore interaction. In addition, there is a torque between squares that tends to align their orientation, similarly to the interaction between magnets, and a gravitational force oriented towards the south pole that increases over time. The gravity is reset to its initial value near the end of the simulation.
The simulation shows artifacts that may be due to the thermostat, as they are reminiscent of the "flying ice cubes" phenomenon, where a large part of the energy is transferred to the translation mode, making the particles move in the same direction.
This simulation has two parts, showing the same evolution with two different visualizations:
3D view: 0:00
2D view: 1:40
In the 3D part, the observer rotates around the sphere on an orbit at constant latitude. The 2D part shows an equirectangular projection (the x- and y-coordinates are proportional to longitude and latitude). The particles are elongated near the poles, to reflect the distortion of the projection near the poles. The particles' color depends on their orientation (angle modulo 90 degrees).
To save on computation time, particles are placed into a "hash grid", each cell of which contains between 3 and 10 particles. Then only the influence of other particles in the same or neighboring cells is taken into account for each particle.
The Lennard-Jones potential is strongly repulsive at short distance, and mildly attracting at long distance. It is widely used as a simple yet realistic model for the motion of electrically neutral molecules. The force results from the repulsion between electrons due to Pauli's exclusion principle, while the attractive part is a more subtle effect appearing in a multipole expansion. For more details, see en.wikipedia.org/wiki/Lennard-Jones_potential

Render time: 3D part - 1 hour 40 minutes
2D part - 1 hour 12 minutes
Color scheme: HSL/Jet

Music: "Minor Mush" by John Deley and the 41 Players

Current version of the C code used to make these animations:
github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html
Some outreach articles on mathematics:
https://images.math.cnrs.fr/_Berglund-Nils-1343_.html
(in French, some with a Spanish translation)
Magnetized squares with friction under increasing gravity on a sphereFrustrated salt: Charged particles on a sphere under decreasing temperatureParticles on a rotating sphere with Earths continents, Blue Marble versionVideo #2100: Voronoi tesselationsWaves in a square with Neumann boundary conditions
Nils Berglund |

Magnetized squares with friction under increasing gravity on a sphere

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER