@NilsBerglund
  @NilsBerglund
Nils Berglund | Coagulating falling squares @NilsBerglund | Uploaded July 2024 | Updated October 2024, 1 hour ago.
The video youtu.be/nmFZc5W3rbM showed falling squares interacting via a strongly localized harmonic force. The next step towards simulations of polygons that hopefully assemble into tilings of the plane is to add a merger mechanism between the polygons.
In this simulation, squares can merge to larger polygons when two of their sides are close enough, at a small enough angle. In the approach used here, squares that have merged are considered as belonging to the same cluster. Polygons in the same cluster interact with a different type of force, that aims at keeping the relative positions of the polygons fixed. However, this generates some numerical instability, as can be best seen in the energy representation.
To compute the force and torque of square j on square i, when the squares belong to different clusters, the code computes the distance of each vertex of square j to the faces of square i. If this distance is smaller than a threshold, the force increases linearly with a large spring constant. In addition, radial forces between the vertices of the squares have been added, whenever a vertex of square j is not on a perpendicular to a face of square i. This is important, because otherwise squares can approach each other from the vertices, and when one vertex moves sideways, it is suddenly strongly accelerated, causing numerical instability. A weak Lennard-Jones interaction between squares has been added, as it seems to increase numerical stability.
The temperature is controlled by a thermostat with constant temperature. There is a constant gravitational force directed downward.
This simulation has two parts, showing the evolution with two different color gradients:
Orientation: 0:00
Kinetic energy: 1:20
In the first part, the particles' color depends on their orientation modulo 90 degrees. In the second part, it depends on their kinetic energy, averaged over a sliding time window.
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 temperature is controlled by a thermostat, implemented here with the "Nosé-Hoover-Langevin" algorithm introduced by Ben Leimkuhler, Emad Noorizadeh and Florian Theil, see reference below. The idea of the algorithm is to couple the momenta of the system to a single random process, which fluctuates around a temperature-dependent mean value. Lower temperatures lead to lower mean values.
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: 46 minutes 1 second
Compression: crf 23
Color scheme: Part 1 - HSL/Jet
Part 2 - Turbo, by Anton Mikhailov
gist.github.com/mikhailov-work/6a308c20e494d9e0ccc29036b28faa7a

Music: "Bark" by John Deley and the 41 Players

Reference: Leimkuhler, B., Noorizadeh, E. & Theil, F. A Gentle Stochastic Thermostat for Molecular Dynamics. J Stat Phys 135, 261–277 (2009). doi.org/10.1007/s10955-009-9734-0
maths.warwick.ac.uk/~theil/HL12-3-2009.pdf

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/auteurs/nils-berglund/
(in French, some with a Spanish translation)

#molecular_dynamics #polygon
Coagulating falling squaresShallow water flowing over an immersed dodecahedronExciting spirals in a circle with sixteen out of phase sourcesTriangles on two conveyor beltsFalling pentagons pretending to be bestagonsMartian weather #mars #terraformingmarsThe rock-paper-scissors-lizard-Spock equation on the sphere, with improved behavior at the polesSmaller interacting kites-and-darts-type moleculesEnergy flux of waves of two different frequencies crossing a diffraction gratingBloopers 18: Numerical blow-up in the shallow water equation on the sphereNon-coherent waves of higher frequency in a magnetron-shaped resonatorExciting resonant modes in a circle, with fewer sources than cavities

Coagulating falling squares @NilsBerglund

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER