On collective motion and flocking

    Bird Flock

    (Stefano Ghezzi - Unsplash.com)

Have you ever had the chance to admire big flocks of birds flying in the sky? Even though it is made up of hundreds of animals, the flock acts almost as a single entity, swirling and stretching, constantly changing its form in a way that is really appealing to the observing eye. ​

This particular kind of collective motion that creates really appealing and hypnotizing patterns can be found everywhere in Nature: from schools of fish to human crowds, passing through bacterial colonies, cellular tissues, swarms of bugs, group of chemically activated particles, et cetera.


Lance Anderson - Unsplash.com

    The phenomenon, being at the crossing of different topics, has been studied extensively by biologists and physicists, and has led to some neat insights on how large groups behave and self organize, even though there is still a lot to uncover. 
I've decided to take the occasion of writing this blog post to deepen a bit my knowledge on the subject and to try to artificially reproduce the appealing visuals in the pictures above on the small screen of my laptop, with the help of some good ol' programming.

But first, a tiny bit of introduction. 

    With the name Active Matter, one points to all those systems made up of a big number of constituent elements that possess the ability to convert chemical energy into kinetic energy (think of it as being able to do jogging after having had a big meal). Furthermore, active systems show the onset of complex structures due to the collective motion of the particles, qualitatively different from the motion of the individual constituents. This particular characteristic goes under the name of swarming or flocking and it is an emergent behavior that arises from a simple set of rules followed by the individuals in reaction to the behavior of the neighbors and the ambient. In most cases, there is not a leader that coordinates the group, and the structure simply arises by the interactions of the individuals. 

    This is the kind of behavior I wanted to try to reproduce, and more specifically I targeted fish schooling (just because, why not). First, I needed a model, so I focused on a famous one, the Vicsek_model.  Physicists like this model a lot because it is quite simple and general, and yet it manages to describe universal properties for these kind of phenomena.     

It consists of point-like self-propelled particles that evolve at constant speed in a two (or eventually three) dimensional environment. At every time step, the particles' orientation is dictated by the orientation of all the other neighbors that are within a set distance: a fish will always try to align to its neighbors so that the whole school keeps swimming in the same direction.


The second ingredient is random noise: since this kind of mechanism is conditioned by a big amount of different factors (think for example to signal misinterpretations, stimuli from external ambient, etc.) a random factor is put to affect the direction of the individuals.


Next, the individuals take a step in the new direction.  And then the procedure starts all over again.  These simple rules are already sufficient to have an interesting dynamic at hand: it can be seen that with large noise or low density of individuals, particles are not aligned and they move with no apparent order. On the other hand, at low noise and large density, particles are globally aligned and move in the same direction. And the transition between the two states is not as smooth as one would think, since when going from one state to the other some interesting patterns appear in the group. 

In order to simulate our school, we also need two other ingredients: a repulsion rule for when the fishes get to close and an attraction rule to keep them together (this last term represents the social tendency of the individuals to stick together).  In the end, we get a totally believable simulation. 


Then, just to have some more fun, the repulsion dynamic can be extended to include some reefs in the simulation, and to have a look at a simple prey-predator dynamic one can introduce sharks as well! 

Following, a video of the results that can be obtained with the simple dynamic rules described above:

Lastly, some interesting videos you can check:

Additional resources: