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 strutures are choosen 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.
Preparing the code, as in the first tutorial, copy it over. But before compiling, change the following settings in the Config.sh file:
PERIODIC to #PERIODIC
  NOGRAVITY to #NOGRAVITY
Do not forget the module load XXXX commands before compiling.
As in the first tutorial, copy the parameter file 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
  GravityConstantInternal  0.0 % if set to zero, the physical value 6.672e-8 is taken
  SofteningHalo            20
  SofteningHaloMaxPhys     20
  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.
Npart[0] = N to Npart[1] = N and you also can skip writing the internal energy U to the file.
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.
cp $HOME/Hydro/IDL/Setup/*.pro .
	  idl -e setup_cloud
	cp $HOME/Hydro/C/gadget_io.h .
	  cp $HOME/Hydro/C/setup_collapse.c .
	  icc setup_collapse.c
	  ./a.out
	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
	mpirun -np 1 OpenGadget3/P-Gadget3 box.param
  idl -e show
	  xv frame_0*.jpg -wait 0.1 -wloop
	cp $HOME/Hydro/C/gadget_io.h .
	  cp $HOME/Hydro/C/show_collapse.c .
	  icc show_collapse.c
	  ./a.out snap_* > data.txt
	  gnuplot show.plt
	cp $HOME/Hydro/Julia/show_collapse.jl .
	  julia show_collapse.jl
	  firefox collapse.gif
	