Wiki

Clone wiki

DICE / RAMSES simulation

Principle

In the public repository of the RAMSES code, a dice patch is included. This patch allows to read a Gadget1 or Gadget2 file containing any kind of particles, and transfer it to the RAMSES particle tree. If gas particles are included, the patch will use a NGP scheme to transfer their mass to the corresponding AMR cells. Once the full gas mass has been transferred to the AMR grid, the gas particles are erased from the particle list.

Makefile

To include the dice patch in your compiled RAMSES version, the Makefile needs to be modified:

#!make

# Compilation time parameters
NVECTOR = 64
NDIM = 3
NPRE = 8
NVAR = 6
NENER = 0
SOLVER = hydro
PATCH = ../patch/init/dice
EXEC = ramses_dice

Namelist

To be able to start a simulation with a Gadget1 or Gadget2 file generated by DICE, it is needed to specify the initial conditions type in the &INIT_PARAMS namelist block:

#!fortran
&INIT_PARAMS
filetype='dice'
initfile(1)='/path/to/your/ics/folder'
/
The boundary conditions for isolated simulation can be defined as:

&BOUNDARY_PARAMS
nboundary=6
bound_type= 2, 2,  2,  2,  2,  2
ibound_min=-1, 1, -1, -1, -1, -1
ibound_max=-1, 1,  1,  1,  1,  1
jbound_min= 0, 0, -1,  1, -1, -1
jbound_max= 0, 0, -1,  1,  1,  1
kbound_min= 0, 0,  0,  0, -1,  1
kbound_max= 0, 0,  0,  0, -1,  1
no_inflow=.true.
/

The code units have to be specified. The following setup is recommended:

&PHYSICS_PARAMS
units_density = 0.677025430198932E-22 ! 1e9 Msol/kpc^3
units_time    = 0.470430312423675E+15 ! G=1
units_length  = 0.308567758128200E+22 ! kpc
...
/

The &DICE_PARAMS namelist block is then used to specify the DICE patch parameters:

#!fortran
&DICE_PARAMS
ic_file='dice_ics.g2'         ! Name of the initial conditions file
ic_nfile=1                    ! If greater than one, look for files with name matching ic_file//'.n'
ic_ifout=1                    ! Change ramses output index for restarts
ic_format='Gadget2'           ! Format of the initial conditions. 'Gadget1' or 'Gadget2'
ic_center=0.0,0.0,0.0         ! Shift center parameter. ICs are automatically shifted with boxlen/2
ic_scale_pos=1.0              ! Scaling factor for the position vector 
ic_scale_vel=1.0              ! Scaling factor for the velocity vector
ic_scale_mass=1.0             ! Scaling factor for the mass
ic_scale_u=1.0                ! Scaling factor for the internal energy
ic_scale_age=1.0              ! Scaling factor for the particles age
ic_scale_metal=1.0            ! Scaling factor for the metallicity
ic_head_name='HEAD'           ! Name of the Header datablock (Gadget2 format only)
ic_pos_name='POS '            ! Name of the position vector datablock (Gadget2 format only)
ic_vel_name='VEL '            ! Name of the velocity vector datablock (Gadget2 format only)
ic_mass_name='MASS'           ! Name of the mass datablock (Gadget2 format only)
ic_id_name='ID  '             ! Name of the particle identifier datablock (Gadget2 format only)
ic_u_name='U   '              ! Name of the internal energy datablock (Gadget2 format only)
ic_metal_name='Z   '          ! Name of the metallicity datablock (Gadget2 format only)
ic_age_name='AGE '            ! Name of the particle age datablock (Gadget2 format only)
IG_rho=1.0D-6                 ! Intergalactic gas density
IG_T2=1.0D6                   ! Intergalactic gas temperature
IG_metal=1.0D-4               ! Intergalactic gas metallicity
amr_struct=.false.            ! Reproduce the AMR structure of the Gadget2 file resulting from a ramses to gadget conversion
gadget_scale_l=3.085677581282D21 ! Gadget file length unit
gadget_scale_v=1.0D5             ! Gadget file velocity unit
gadget_scale_m=1.9891D43         ! Gadget file mass unit
gadget_scale_t=3.15360e+13       ! Gadget file time unit
ic_skip_type        = -1      ! Skip specific particle type
cosmo_add_gas_index = -1      ! Gas particle type index for cosmo runs
ic_mag_const=0.0,0.0,0.0      ! Background magnetic field value for x,y,z component
ic_mag_center_x=0.0           ! x-coordinate of the magnetic field symmetry center
ic_mag_center_y=0.0           ! y-coordinate of the magnetic field symmetry center
ic_mag_center_z=0.0           ! z-coordinate of the magnetic field symmetry center
ic_mag_axis_x=0.0             ! Magnetic field normal vector x-component 
ic_mag_axis_y=0.0             ! Magnetic field normal vector y-component 
ic_mag_axis_z=1.0             ! Magnetic field normal vector z-component 
ic_mag_scale_R=1.0            ! Toroidal magnetic field scalelength
ic_mag_scale_H=1.0            ! Toroidal magnetic field scaleheight
ic_mag_scale_B=0.0            ! Foreground toroidal magnetic field value
/

Updated