log(Temperature) =
Energy =
This little project is based on Dan Schroeder's Ising Model animation.
The way this kind of simulation works is that cells in the array are considered one by one. At a particular cell, alternative configurations are examined and one configuration is selected to be newly assigned to the cell. Each possible configuration, or value of the order parameter, will have an energy which is determined by the configurations of the neighboring cells. The new configuration is picked at random, with a bias toward lower energy configurations. The lower the temperature, the stronger the bias.
One of the tricky parts about this kind of simulation: when the order parameter is continuous, it's hard to come up with a good set of alternative values. The full set of alternatives is huge, practically infinite. Some small sample needs to be used. The small sample needs to include some configurations whose energy is at least not too much worse than the existing configuration, or the simulation won't have a good alternative to assign to the cell. At high temperatures, suitable alternatives can be substantially worse. At low temperatures, the alternatives can only be slightly worse. Thus, the temperature determines what makes a good set of alternatives. Trying to figure out that relationship ahead of time is too complicated, so an adaptive approach is suitable.
What I do in this simulation is to consider alternatives one by one. The first alternative is chosen at random at random from the full set. Each next alternative is chosen from those that are within some range of the currently assigned configuration. As each configuration is chosen, a decision is made whether to assign that to the cell in place of the current configuration. As soon as a new configuration is assigned, the simulation moves on to look at other cells. When an alternative is not assigned, another alternative is chosen from a narrower range. The range from which alternatives are picked gets narrower and narrower with each iteration. Eventually the alternatives are so close to the current assignment that the odds of being assigned become 50/50. This narrowing range iteration provides an adaptive approach to picking a set of alternative configurations.