Wiki

Clone wiki

hast / Home

Welcome to the HAST wiki! This wiki describes the steps in order to set up a cosmological zoom-in simulation with the Ramses code. The cosmological initial conditions are assumed to be generated with Music.

Unigrid simulation

The first step is to run a cosmological unigrid dark matter only simulation. We will select our halo of interest in this cosmological volume. The initial conditions are generated using Music. A example of configuration file can be found in the public distribution. Make sure to have the following lines in your Music configuration file:

format                  = grafic2
filename                = ics_ramses
ramses_nml              = yes
Music will generate a skeleton of a Ramses namelist with the right AMR grid parameters that you can use as it is. However, the HAST code uses the Ramses clump finder. It is therefore mandatory to activate it before running the simulation. To activate the clump finder, make sure to have the following parameter block in your Ramses namelist:

&CLUMPFIND_PARAMS
relevance_threshold=3
density_threshold=8.
saddle_threshold=-1.0
mass_threshold=10.
ivar_clump=0
clinfo=.true.
/
Also add clumpfind=.true. in the &RUN_PARAMS parameter block.

The HAST halo selection script works with a python configuration file. Here is an example to select a Milky Way type galaxy:

[selection]
# Initial output
output_zinit            = output_unigrid/output_00001
# Selection output
output_zlast            = output_unigrid/output_00100
# Minimum mass of the candidates [Msol]
min_mass                = 9.5e11
# Maximum mass of the candidates [Msol]
max_mass                = 1.5e12
# Traceback radius [in units of Virial radius]
rtb                     = 1.50
# Center x-coords of the region of search [in code units]
xsearch                 = 0.50
# Center y-coords of the region of search [in code units]
ysearch                 = 0.50
# Center z-coords of the region of search [in code units]
zsearch                 = 0.50
# Radius of the search region [in code units] deactivated if negative
rsearch                 = -1.0
# Buffer radius where the neighbours properties are computed [Mpc]
rbuffer                 = 2.0
# Minimum number of neighbours
min_neighb              = 0
# Maximum number of neighbours
max_neighb              = 100000
# Maximum mass fraction of the most massive neighbour [in units of candidate mass]
max_mass_neighb         = 0.75
# Name of the file listing the particle to be zoomed
fname                   = myhalo
# Plot in a PDF file the matter distribution and overplot the valid candidates
plot                    = True
# Overplot the Lagrangian regions of each candidate
plot_traceback          = True
# Leaf number for the KDTree: increasing this number lowers memory consumption but increases execution time
tree_nleaves            = 100
Store these lines in hast.config file for example. To run the selection script, open a python terminal and type:

import hast
hast.select("hast.config")
HAST will display to the standard output the properties of each halo meeting the imposed criteria. Two numbers are to be looked carefully: the volume and the density of the initial Lagrangian region. The lower the volume and the higher the density the more efficient your zoom simulation will be. However, even a halo with a small volume and a high density can be contaminated by coarse particles and the decontamination process will unavoidably increase the volume of the initial Lagrangian region.

Halo tracking

The candidate halo mass accretion history is a valuable knowledge for the zoom selection. HAST can track a halo from snapshot to snapshot to provide an estimate of the evolution of this quantity. The algorithm starts from the selection snapshot (i.e. the latest snapshot you want to consider), find the closest halo from the user specified coordinates and starts to loop backwards in time snapshot by snapshot. In each iteration, HAST gathers the nhalo closest halos in snapshot t=t-1 around the selected halo position found in snapshot t=t. The halo containing the highest fraction of particles from the selected halo in snapshot t=t becomes the selected halo in snapshot t=t-1. Only the particles within the fraction rvir of the virial radius of each halo are considered during this operation. Here is an example of a tracking configuration file:

[tracking]
# The folder that contains the ramses outputs
output_dir   = output_unigrid
# The halo xyz-coordinates in the selection snapshot
halo_coords  = 0.60975,0.70154,0.46008
# Fraction of the virial radius in which the particles are considered for the search
rvir         = 0.25
# Search radius (in units of virial radius) to find halos at t=t-1 around the selected halo position at t=t
rvir_search  = 5.0
# Minimum expansion factor to stop tracking
aexp_min     = 0.0
# Minimum halo mass for tracking [Msol]
halo_cutoff  = 1e6
# Name of the output files
fname        = hast_part/test_tracking
# Plot coordinates and mass evolution
plot         = True

The tracking method can be called by typing in a python terminal:

import hast
hast.track("hast.config")
As a result, an ascii file is produced containing the position, mass, and fraction of the particles found for each expansion factors.

Initial zoom simulation

Once the halo of interest has been picked, it is time to generate zoomed initial condition with Music. The following lines should be added to the Music configuration file:

region                  = convex_hull
region_point_file       = music_myhalo
One should note that it is essential to keep the same seed values as in the unigrid simulation in order to get an identical initial random velocity field and therefore the same cosmological structure. Additionally, the levelmin paramter can be lowered in order to reduce the computational cost of the simulation. One should keep in mind that there should be more particles in the zoom region than outside the zoom region!

Decontamination of the zoom

There is no guarantee that the zoomed halo that has been simulated is free of coarse massive particles. Ideally, the zoomed halo shouldn't contain any coarse particles within the virial radius. These massive particles can produce two body gravitational relaxation and alter the dynamics of the system. HAST contains a script that can look for these particles, and add them to the initial Lagrangian region. This process will of course make the zoom simulation more expensive. Add the following lines to the hast.config file previously created:

[decontamination]
# Folder containing ramses outputs to decontaminate
output_dir            = output_zoom_dmo
# Minimum expansion factor to consider for tracking & decontamination
aexp_min              = 0.50  
# Traceback radius [in units of Virial radius]
rvir                  = 3.0
# Buffer for the virial radius computation [Mpc]
rbuffer                 = 2.0
# Halo particle particle ID matching radius [in units of Virial radius]
rvir_track            = 0.25
# Previous halos search radius [in units of Virial radius]
rvir_search           = 0.25
# Exclude coarse particles outside this radius from the decontamination [in code units]
rexclude              = 0.1
# Name of the file listing the particles to be zoomed
fname                 = myhalo_decontaminated
# Select halo number in terms of cell number in the latest output
halo_num              = 1
# Ranking function for initial halo selection
rank_function         = mass
# Maximum halo mass to consider for tracking
halo_cutoff           = 1e7
# Maximum halo mass to consider in units of currently selected halo
halo_massfrac         = 0.10
# Point shift of the cartesian coordinates (to be taken in the Music log file)
point_shift           = 18,0,10
# Levelmin used for the shifting of the region (to be taken in the Music log file)
point_shift_lmin      = 7
# Leaf number for the KDTree: increasing this number lowers memory consumption but increases execution time
tree_nleaves          = 100
# Plot in a PDF file the matter distribution of the zoom region and its contaminating particles
plot                  = True
and run this script by opening a python terminal and typing:

import hast
hast.decontaminate("hast.config")

Once this step has been performed, the initial conditions for the decontaminated zoomed halo can be generated in Music using the myhalo_decontaminated file in this example. This files contains the vertices of the convex hull defined by the particles in the traceback volume. There is no need to shift back the position of these particles to the one of the unigrid simulation if the point_shift parameters were specified properly. Baryons can also be added in the Music initial conditions.

Analysis of a single output

It is possible to analyse the content and the properties of a galaxy in a single output using the hast.analysis method. The configuration is the following:

[analysis]
# Output to analyse
output = output_00100
# Compute quantities in rvr*R200
rvr = 1.0
# Buffer zone in Mpc for Virial radius computation
rbuffer = 1.0
# Halo rank for the selection in the zoom region in terms of numbers of cells found by the clump finder
halo_num = 1
# Number of bins for the SFR computation
nbin_sfr = 100
# Leaf number for the KDTree: increasing this number lowers memory consumption but increases execution time
tree_nleaves = 100
# Plot in a PDF file
plot = True

The analysis is performed by typing:

import hast
hast.analyse("hast.config")

Updated