Kuramoto.pl - a simple simulation of the Kuramoto model
If you have not yet installed PDL::Drawing::Prima but you have compiled it, you can run this example program from the root directory with the following:
perl -Mblib examples/Kuramoto.pl
If you have installed PDL::Drawing::Prima, you can run it simply with
The script optionally takes the desired number of oscillators to simulate as an argument, so the following will simulate 200 oscillators:
perl examples/Kuramoto.pl 200
This covers a description of the actual application and the science that underlies it. To understand how the code functions, you should look directly at the (hopefully well-documented) code.
The Kuramoto model is a simple model for spontaneous collective synchronization. The model is significant because the underlying single-particle interaction dynamics are very simple, yet in the limit of large system size, the Kuramoto model exhibits a second-order phase transition in the coupling strength.
If you are not a physicist (or if it's been a while since you've thought about phase transitions), you probably do not know what a second-order phase transition is. Before I can define what a phase transition is, though, I must first define an order parameter, because the difference between a first order and a second order phase transition is what happens to the order parameter at the phase transition. An order parameter is some measure of the system which is zero on one side of the transition and nonzero on the other side of the transition.
Clear as mud, right? Stick with me, it'll make sense. :-)
Let's think about the most familiar phase transition: water freezing into ice. A good order parameter for this phase transition is the shear modulus, that is, how hard you have to press to get your finger through the thing. Above the transition temperature, you can easily insert your hand into the liquid water, so the shear modulus is essentially zero. Below the transition temperature, you can't insert your finger into the block of ice, but you can shear it with a finite force. So, the force necessary to shear the material has gone from zero (for liquid water) to nonzero (for solid ice) at the phase transition. In fact, as a function of temperature, the shear modulus jumps discontinuously from zero to a finite value. This is the hallmark of a first order transition: the order parameter jumps discontinuously at the transition.
Second order phase transitions exhibit a continuous change in their order parameter. The transition in magnets at the Currie point is an example of a continuous or second-order phase transition. The Kuramoto model is another.
In the Kuramoto model, the order parameter is taken as the length of the vector average position of the oscillators divided by the radius of the circle. In other words, if all the oscillators are sitting on top of each other, their vector average position
You can find a full write-up on the Kuramoto model at wikipedia. To see a simple real-world example of synchronization that behaves in a similar fashion, search on YouTube for "synchronizing metronomes".