Instruction Mannual for Gadget-2

System Tools We Needed

For Linux and Mac user, skip to the third bullet. For Windows user, choose between MobaXterm or Cygwin/X

mobaxterm_c cygwin_c

 

MobaXterm is toolbox for remote computing for Windows. It provides important packages: remote networking tools and Unix commands. Cygwin/X is Linux-like environment for Windows. It contains thousand of packages from Open Source including GNU tools, an X server and X applications. Cygwin/X come with small necessary packages. If you need more packages for your work, you can re-install it and select the desired packages. However, for purpose of using (to access the remote desktop) and simplicity, we recommend using MobaXterm.

        • For MobaXterm
          1. It is simple! Download the setup file from the MobaXterm’s website, and run it.
          2. After installation completed, open MobaXterm and click Start local terminal.
        • For Cygwin/X
          1. You may download it from Cygwin’s website. Download setup-x86.exe, if you are using 32-bit OS and setup-x64.exe if you are using 64-bit.
          2. If you don’t know which system type of windows you are using. Right-click at This Computer or My Computer –> properties and look at System Type.
          3. Run the setup program, choose Install from Internet. Then choose between All Users or Just Me.
          4. Next and next and choose internet connection types as Direct Connection. Then choose the packages download server.
            Note: Choose the closest server, for Thailand we choose one with the suffix .sg (Singapore).
          5. Selecting Packages: You can use search box to search for the package without press ENTER (it would takes few seconds to filtered out and show you results). Choose xorg-server and xinit and ensure that inetutils and openssh packages are selected.
          6. Optional Packages: (for edit file, download, etc.) wget, tar, vim, bash-completion, ca-cerificates, and curl.
          7. For more information see Cygwin/X installation guide and how to select the packages here.
          8. When the program is installed, open Cygwin Terminal and type startxwin. When the Cygwin/X Server and X application menu appear at your taskbar (it may be hidden at the ^ symbol on your taskbar, click to see them), right-click at X application menu –> system tools –> terminal.

For Linux and Mac user open terminal

        • Once the terminal appear, start Secure SHell to remote SSH with provided IP and port and the flag -X:

          The machine will ask for your password, type it and the welcome message will be displayed.
        • Then connect to the head node by typing

          Type yes then you are asked for continue connecting and press ENTER.
        • Try type xeyes or xclock to check whether X Windows can be used. Another window will be appeared, shows the xeyes or clock. See this tutorials for more details.

 

Initial Conditions with Music

We use MUti Scale Initial Condition (MUSIC) to generate initial conditions. MUSIC supports both Zel’dovich approximation (first order) and second order (2LPT) Lagrangian perturbation theory.

  1. Luckily, we have install MUSIC for you which can be used by load it from modulefile.
  2. Edit your parameter file, fill in some missing parameters.
    Tip: When you edit a file, it is useful to copy the original file for backup, i.e. cp ics.conf ics.conf.bak.
    When you are ready, run MUSIC with your parameter file.

    The initial condition file for Gadget-2, ics_gadget.dat, will be generated. Note that an output name can be changed in a configuration (.conf) file.

 

Installing and Run Your First Gadget-2

We provide just simple configuration ti ensure that Gadget-2 can be run with default MPI compiler (rocks-openmpi) and without HDF5 support. If you need these, the methods are described in addition configurations below.

  1. In the terminal, download Gadget-2.0.7 by type:
  2. The use this command to unpack the files:
  3. Goes to ./Gadget-2.0.7/Gadget2 and open Makefile with text editor (whatever you prefer). Comment these line by add #:

    Save & exit.
  4. Add SYSTYPE and the directories for required include files and libraries. For our system, we use:

    Save & exit.
  5. To produce executable for Gadget-2, type:

    then
  6. Then edit galaxy.param, the first two lines:

    Save & exit.
  7. To run your Gadget2, basically we type: (Note: The flag -np 2 specifies the number of processors required to run Gadget).

    However, for using computing nodes efficiently, here we write shell script file to send our work to run.

    1. Firstly, we create empty file
    2. Then open the file with an editor and type:

      Save & exit. For more information about these flags see how to submit a job using qsub.
    3. Now send your work to computing node using qsub
  8. The output will be generated in your output directory.

 

SPH Simulation

  1. We recommend you to read Nathan Goldbaum’ article on astrobites for the details. When you are ready, obtain initial condition to your working directory:
  2. Goes to your Gadget2 directory. Open Makefile with an editor. Then COMMENT these lines (add #):

    And REMOVE comment these lines (remove #):

    Save & exit.
  3. Then type

    This will produce a new executable Gadget2.
  4. Copy your new Gadget2 executable and jobscript file from previous section to 15 and navigate to this directory and edit jobscript.sh.

    Gadgat2 will generate many snapshot files like these:
  5. To open this file, it requires SPH visualization suite. Here we use Gadget Viewer.

 

Visualization

To open snapshot files, it is require a SPH visualization suite. See SPH visualization suites.

 

Additional Configurations

Using Gadget-2 with HDF5
Edit Makefile by uncomment the line OPT += -DHAVE_HDF5 and add path to HDF5INCL and HDF5LIB:

Then re-compile executable Gadget-2 by type make clean and make. Copy the executable file to your working directory like normal Gadget-2 file. To force Gadget-2 to produced HDF5 snapshot, open parameter file (.param) and change SnapFormat to 3. If you want Gadget-2 to read HDF5 initial condition file change ICFormat to 3.

Note: Gadget-2 is old, it support HDF5 up to version 1.6.x.

Compiling with Other MPI library
If you want to change MPI library to another one, first, you have to unload currently use modulefile and load the new one. After that, open Makefile, delete path to MPICHLIB and add new path for mpicc at CC. For example, we want to use openmpi:

Then re-compile as usual type make clean and make.