As discussed in the lecture, structures in the universe collapse under their own gravity.
This holds from the larges structures like galaxy clusters where dark matter dominates the
potential down to star formation, where gaseous clouds collapse.
Units are important (and tricky). Typical units for cosmological structures are chosen to be kpc for lengths, 1010 M⊙ for masses, and km/s for velocities. Think about what this means for the time unit in such simulations.
As in the previous tutorial, get a copy of the code and the configuration file Config.sh. But before compiling, change the following settings in the Config.sh file:
PERIODIC
to #PERIODIC
NOGRAVITY
to #NOGRAVITY
Do not forget the module load compiler openmpi
command before compiling.
As in the first tutorial, copy the parameter file box.param and modify it to be non-periodic and choose a reasonable unit system and adapt the times according to your calculated free-fall time for the galaxy cluster:
PeriodicBoundariesOn 0
TimeMax 50.0
TimeBetSnapshot 0.5
UnitLength_in_cm 3.085678e21 % 1.0 kpc /h
UnitMass_in_g 1.989e43 % 1e10 solar masses
UnitVelocity_in_cm_per_s 1e5 % 1 km/sec
SofteningHalo 20
SofteningHaloMaxPhys 20
As the simulations get more demanding, edit the job script runme.sh and modify the number of CPUs used per task by changing --cpus-per-task=4, i.e., using 4 OpenMP threads per MPI rank.
Use the prepared ICs to do your simulation:
cp $HOME/Hydro/T01/box.ic .
Now run the simulation and look at the result. Note that you can already watch the results from the existing snapshots while the simulation is still running. Try to modify your plotting scripts from last time to the new simulation.
Now try to create the initial conditions on your own.
Extend the program which you used last time to create a sphere of particles as a
representation of a collapsing cloud for the galaxy cluster case.
As you treat dark matter particles this time, set the particle number in
npart[1]
instead of index [0]
as last time.
You also do not need to create a rho field for the density.
Now you can run the simulation as last time and use the same tools to visualize the results.
Now try to play around with the parameters.
Now you can run the simulation as last time and use the same tools to visualize the results.
balance.txt
, what do you observe?
Now you can run the simulation as last time and use the same tools to visualize the results.
Goal of this tutorial is that you learn better how to create initial conditions files
and how to plot the results from a simulation.
You should also learn to run the same simulation with different parameters and compare the results.
cp $HOME/Hydro/IDL/Setup/*.pro .
idl -e setup_cloud
cp $HOME/Hydro/C/gadget_io.h .
cp $HOME/Hydro/C/setup_collapse.c .
icx setup_collapse.c
./a.out
ifx -g -traceback -fpe0 -check all -o setup_cloud setup_cloud.f90
./setup_cloud
cp $HOME/Hydro/Python/g3read.py .
cp $HOME/Hydro/Python/setup_freefall.py .
cp $HOME/Hydro/Python/ic_header .
python3 setup_freefall.py
cp $HOME/Hydro/Julia/setup_collapse.jl .
julia setup_collapse.jl
sbatch runme.sh
idl -e show
xv frame_0*.png -wait 0.1 -wloop
cp $HOME/Hydro/C/gadget_io.h .
cp $HOME/Hydro/C/show_collapse.c .
icx show_collapse.c
./a.out snap_* > data.txt
gnuplot show.plt
ifx -g -traceback -check all -fpe0 -o readsnap readsnap.f90
for file in snap_???; do ./readsnap $file >$file.txt; done
gnuplot movie.plt
ffplay -loop 0 movie.mp4
cp $HOME/Hydro/Julia/show_collapse.jl .
julia show_collapse.jl
animate collapse.gif