Friday, April 23, 2010

resolution and time evolution study

I have discovered that the algorithm (for 301 particles) is not as instantaneous as I thought. The reason is that the time between successive collisions shrinks considerably as the simulation progresses. Thus as the system evolves, the rate of time slows down.

To figure out what a faster algorithm would have to accomplish, I've studied the time evolution in the mass sheet code, and also how the timing depends on the resolution (number of mass sheets).

In the two plots below, I have fixed the number of mass sheets to 101, and have evolved the system for a certain number of shell crossings (nc=[1,2,10,50,100,200,500,1000,2000,2200,2600,3000,5000,8000]). Real world computation time is simply proportional to the number of shell crossings. First, the phase space diagrams of these runs here:In the next plot I show the simulation time as a function of real world time:


At some times all the particles are scrunched around x=0 and there are lots and lots of shell crossings in a very short time. At other times the system is more spread out in the x direction, and there is therefore more elapsed time between shell crossings, thus the simulation evolves much faster. The number of windings that occur (and their phases) are highly relevant to the real world time that is taken up reaching a fixed time threshold in the simulation.

Since simulations with fewer particles evolve faster than those with more particles (more shell crossings are required to get to a particular end time as N is increased), the results of resolution studies sort of resemble the time evolution seen above. Below is a plot the simulation is evolved until it crosses some fixed time threshold. Each run has a different number of particles (N=[11,31,51,71,91,95,99,101,111,113,115,121,141,171,221,261]).
Below are three plots that show, as a function of N, the real world time it takes to reach a certain threshold in simulation evolution, the number of shell crossings (proportional to computational time), and the time after the final shell crossing.



Here we see the same sort of behavior. For the very unresolved runs the threshold time is reached after just one shell crossing. As the number of particles is increased the time of the first crossing is below the threshold, and (as discussed before) it takes a very long (real world) time to reach the threshold time because each shell crossing is happening sooner and sooner, so the time advance in the simulation slows down (until the pileup at x=0 is passed, at which point the evolution speeds up again).

In my implementation the scaling is somewhat worse than N*N, because of these jumps associated with the x=0 pileup.

It's clear that most of the time in the sim is spent when the majority of particles are crowded around zero. One possibility for speeding up the algorithm might be to come up with an effective "advance" to get the particles past this hangup point into the next winding. I worried however, because probably most of the energy transfer in the violent relaxation happens in this regime.

No comments:

Post a Comment