Exercises Module 4

Module-4: Visualization of N-body simulations

Exercise 1 - Making a movie of a cosmological N-body simulation

1) Choose one technique to calculate the projected density distribution of the entire simulation box. This could be either the particles-in-cells method or the adaptive clustering method (SPH) used by py-sphviewer or py-sphviewer2.

2) Apply this method to produce the projected density distribution of a simulation snapshot, either the CV or LH simulation provided.

3) Using the two snapshots provided, apply linear interpolation to produce 100 snapshots linearly spaced in a(t) between the two snapshots, where a(t) is the expansion factor.

4) Encode the images using ffmpeg: e.g., ffmpeg -i image_%03d.png -o movie.mp4

Note: Apply your Hash Table code to perform the cross-matching of particles between the two snapshots.

# Exercise 1 - Solution to exercise 1 should go here
#======================================================










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

Exercise 2 - Projecting non-trivial quantities

1) Make the same movie as in Exercise 1, but for the evolution of other quantities, such as the density-weighted temperature:

\[<T>(x,y) = \displaystyle\frac{1}{\displaystyle\int \rho(x,y,z') \ dz'} \displaystyle\int T(x,y,z') \rho(x,y,z') \ dz'\]

2) Add a colour bar to the plot and analyse whether the results are sensible. What’s the typical temperature expected for gas around galaxies in the volume?

# Exercise 2 - Solution to exercise 2 should go here
#======================================================










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