T2:
Generating field lines:
voids and superclusters in cosmological simulations
Before the tutorials:
As discussed in last tutorial, the assembly of the largest structures in cosmology, like galaxy clusters, is a fight
of gravitational collapse with the expansion of the universe. Therefore, superclusters are the regions in the universe
that will continue to collapse into individual objects, while the distance between them will grow with the expansion
of the universe.
- Watch this video on the Laniakea supercluster.
- Think about how you could define a velocity field if you were given the velocities on a distribution of points
(like the galaxies in the case of Laniakea).
- Recap the methods we discussed for creating the density field for the PM method,
“Nearest-Grid-Point” (NGP),
“Cloud-in-a-Cell” (CIC) and
“Triangular-Shaped-Cloud” (TSC).
- What are stream lines and how could you compute them like in the video?
During the tutorials:
We provide a snapshot of a cosmological simulation, so just copy it over to your directory:
cp ~/Hydro/snap_144.gz .
gunzip snap_144.gz
With the help of the following sketch:
try to create a grid for which you compute the mean velocity
of all particles within each grid cell.
You can then use this grid to create and visualize the field lines.
Just follow the simple steps:
- Read all gas particles and create a grid with the mean velocities.
Hint: BoxSize=48000
can be also found in the header and NGrid=20
is a reasonable value.
Hint: Don’t forget a counter for the grid to be able to compute the mean.
- To create a field line you have to:
- Select a starting point.
- Find the grid cell in which this point lives.
- Propagate the point with the velocity of the grid cell using a small timestep.
- Take this new point as a starting point and repeat this for a reasonable number of times.
Hint: Do not forget to draw a line between the starting and the propagated point before setting the new starting point.
- You might want to do this for several starting points.
Hint: You can use the grid points itself as starting point.
Hint: You can restrict yourself to a thin slice in the simulation volume.
Programming goals for T2:
Goal of this tutorial is that you learn better how to deal with the simulation output,
how to select special regions in the simulation output and
how to compute more complex results in post processing.
Solutions
- Python template you can use as a starting point for your own code:
- Example(s) for computing and visualising the results
- Use the example in the IDL language
- Use the example in the Fortran language and gnuplot
- You should see an image like this, with gray particles in the background and white stream lines:
- Very advanced version, looking much more fancy (thanks to Benjamin):
- 3d rendering showing streamlines in slices through the snapshot volume:
- 3d rendering showing the velocity along the streamlines encoded as color (thanks to Anita):