ScienceSays: Simulate Structure Formation in an Expanding Universe

In this notebook, we use "ScienceSays" to model a small swarm of kindergartners collectively acting out the physical behaviour of matter in the early stages of the expansion of the Universe.


In [5]:
%matplotlib inline
from sciencesays import *

Let's suppose we have 2 K-classes, each containing 25 students. We can emulate their behavior with 50 software agents.


In [6]:
swarm_params['Npart'] = 50

Now, we instantiate a swarm object to model this group. For now, the local rules that we are interested in figuring out are hard-coded into the swarm class. We'll change that at some point.


In [7]:
classroom = swarm(swarm_params)

Now, let's evolve the swarm, and see what happens.


In [8]:
classroom.play()


Out[8]:


Once Loop Reflect

What just happened? First the Universe underwent a period of rapid expansion with all tracer particles moving apart from all others at a rapid rate. All of our agents lie at the same comoving radius relative to some origin, so when viewed in physical coordinates, they appear to be on an expanding shell.

Then, after some time, the expansion slows (such that you can't see it any more) and gravity starts to dominate. The agents fall together to form overdensities, which whill turn into galaxies.

Let's evolve the swarm by a few time steps at a time, and look at these different phases. We'll need to reset the classroom!


In [9]:
classroom = swarm(swarm_params)
classroom.timeEvolveBeforeDecoupling(5)
classroom.showCurrentState()


That's the expansion phase done. Now let's see the results of gravity acting.


In [10]:
classroom.timeEvolveAfterDecoupling(50)
classroom.showCurrentState()


Structure has formed!

There are some conceptual problems with this model, such as the artificial choice of all agents starting at the same comoving radius. This might lead the kindergartners and their watching parents to believe that there was a centre of the Universe, and that the Big Bang was like an explosion from that point. Can you think of some better local rules that could capture uniform, centre-less expansion?

Also, having two separate sets of rules is a little artificial as well: doesn't gravity act before decoupling too? But, this illustrates a feature that needs to be coded, that systems' rules don't stay fixed, but change over time...

Before that, though, we need to bring out the local rules from the swarm class and make them be an input to the evolve method. That way, we can fiddle with the rules in a notebook, and see what happens in the animated plot.

Mike Baumer, Keara Connor & Phil Marshall, Science Hack Day, San Francisco 2014.