Exercises Module 2.5

Module 2.5: Running a Cosmological N-body simulation

Exercise 1 - Creating Cosmological Initial Conditions

1) Using the example provided, generate your own cosmological initial conditions to simulate structure foramtion in a dark matter-only \(\Lambda\) CDM Universe. For this use the code MUSIC, starting at redshift \(z=200\). Make sure the simulation can run on your laptop in a reasonable amount of time.

# Exercise 1 - calculations for generating the initial conditions should go here:
#=====================================================








#=====================================================

Exercise 2 - Evolving the Initial Conditions all the way down to redshift \(z=0\)

1) Run the simulation with Gadget-4, using the example provided as a guide. For this, compile the code with the following flags:

# Basic code operation

    PERIODIC
    SELFGRAVITY
    NTYPES=2
    NSOFTCLASSES=1
    
# Gravity options

    PMGRID=128

# Allow outputs at the prescribed desired output times

    OUTPUT_NON_SYNCHRONIZED_ALLOWED

# Miscellaneous code options

    DOUBLEPRECISION=1
    GADGET2_HEADER
# Exercise 2 - Calculations on how to chose the gravitational softening should go here
#=====================================================








#=====================================================

Exercise 3 - Finding the collapsed bound structures (halos) that form in the simulation

1) After the simulation finishes, recompile Gadget-4 adding the FOF and SUBFIND flags, and removing OUTPUT_NON_SYNCHRONIZED_ALLOWED. The new Config.sh file should look like this:

# Basic code operation
    
    PERIODIC
    SELFGRAVITY
    NTYPES=2
    NSOFTCLASSES=1

# Gravity options
    
    PMGRID=128

# Miscellaneous code options
    
    DOUBLEPRECISION=1
    GADGET2_HEADER

# FOF and SUBFIND
    
    FOF
    SUBFIND

With the new Gadget4, you should now be able to run the FOF and SUBFIND algorithms on a particular snapshot. Try running it on the last snapshot with:

./Gadget4 paramfile.txt 3 20

in which we assumed that 20 is the last snapshot.

Note that for this to work, you need to change the parameter file parameters as follow:

ICFormat 3

and add a new parameter required by SUBFIND:

DesLinkNgb 32

2) Plot the location of all the halos identified in your simulation.

#Exercise 3 plots should go here
#=====================================================








#=====================================================

Exercise 4 - The Autorrelation Function

1) Measure the autocorrelation function, \(\xi(r)\), of the central galaxies that form in your volume. For this, you can estimate the autocorrelation of all halos whose mass exceeds \(10^{10} \ M_{\odot} h^{-1}\).

2) Assuming \(\xi(r) = A \left ( \displaystyle\frac{r}{r_{0}} \right )^{\gamma}\), what is the value of \(\gamma\) and \(r_{0}\)? What’s the meaning of \(r_{0}\).

Help:

Given a galaxy, the probability of finding \(dN\) galaxies at a distance \(r\), within a shell of thickness \(dr\), is given by the correlation function:

\[dP = n_{0} \ [1 + \xi(r)] \, 4 \pi r^2 \, dr,\]

where \(n_{0}\) is the number density of galaxies, and \(\xi(r)\) represents the correlation function. In this context, \(\xi(r)\) quantifies the excess probability of finding \(dN\) galaxies at a distance \(r\) from another galaxy in a shell of thickness \(dr\) compared to a random (uncorrelated) distribution. This is the usual interpretation of the correlation function in the context of large-scale surveys.

Now, to measure this quantity in a simulation we can think as follows: Assume galaxies are discrete tracers of an underlying number density field, \(n(r)\). Then the probability of finding \(dN\) galaxies within a distance \(r\) of another galaxy can can be expressed in terms of \(n(r)\) as:

\[dN = n(r) \, 4 \pi r^2 \, dr.\]

Equating these two expressions, we have:

\[n_0 \ [1 + \xi(r)] \, 4 \pi r^2 \, dr = n(r) \, 4 \pi r^2 \, dr,\]

which implies that

\[1 + \xi(r) = \displaystyle\frac{n(r)}{n_{0}}.\]

Now, because we want \(\xi\) to represent the excess of the probability of the ensemble, we take the average:

\[1 + \xi(r) = \displaystyle\frac{<n(r)>}{n_{0}}.\]
#Exercise 4 plots should go here
#=====================================================








#=====================================================