User Tools

Site Tools


howto

GETTING STARTED

Download RAMSES

Download the RAMSES code using GIT:

git clone https://bitbucket.org/rteyssie/ramses

Compile the code

The RAMSES code already comes with the “Phantom of RAMSES” patch. The patch is available in the ramses/patch/phantom directory. To compile RAMSES with this patch, you will need to edit the Makefile accordingly.

Makefile

In ramses/bin/Makefile, set

NDIM=3
PATCH=../patch/phantom

Do not forget to also set the compiler options accordingly (options are e.g., gfortran, ifort, with or without MPI).

Units

RAMSES requires the units (mass, length, time) to be such that the gravitational constant G=1 in these units. You must define custom units (in the RAMSES manual referred as “user units”) in the file ramses/amr/units.f90, because the poisson solver requires it. E.g., if you choose the length and mass units arbitrarily (say kpc and Msun), you have to set the time units this way:

  ! scale_l converts distance from user units into cm
  ! 1 kpc = 3.08567758 x 10^21 cm
  scale_l = 3.08567758D+21

  ! scale_d converts mass density from user units into g/cc
  ! From Msun/kpc^3 to g/cm^3
  ! 1 Msun/kpc^3 = (1.98855e+33 g) / (3.08567758e+21 cm)^3 = 6.76838229e-32 g/cm^3
  scale_d = (1.98855D+33 / (3.08567758D+21)**3)

  ! scale_t converts time from user units into seconds
  ! G = 6.674D-8 cm^3 g^-1 s^-2
  ! G = 4.302D-6 kpc Msun^-1 (km/s)^2
  scale_t = 1.0/sqrt(6.674D-8 * scale_d)   ! 1.85e+18

Finally, run make (in the ramses/bin directory). If the code compiled successfully, you find a new runnable called ramses3d in the ramses/bin directory.

To start the code, run

mpiexec -n {number of processes} $RAMSES/bin/ramses3d {configuration file.nml}

E.g., mpiexec -n 16 ~/lib/ramses/bin/ramses3d mysimulation.nml.

Running a QUMOND simulation

To use the QUMOND solver, you have to set poisson=.true. and mond=.true. in your run parameters file. Also make sure to set pic=.true..

&RUN_PARAMS
poisson=.true.
pic=.true.
mond=.true.
/

&POISSON_PARAMS
a0_ms2={a_0 in m/s^2}
gravity_type=0
/

Also, ensure the simulation box is large enough to apply the implemented Dirichlet boundary conditions. That is, the potential must be well approximated by a point mass potential at the box boundaries. The gradient of the potential must be well below a_0.

&AMR_PARAMS 
boxlen={large enough to fulfill the boundary conditions}
/

Next are boundary conditions (BCs). You can apply either periodic BCs (bound_type=0), or Dirichlet BCs (bound_type=3). Set:

&BOUNDARY_PARAMS
nboundary=6
ibound_min=-1, 1, 0, 0, 0, 0,
ibound_max=-1, 1, 0, 0, 0, 0,
jbound_min= 0, 0,-1, 1, 0, 0,
jbound_max= 0, 0,-1, 1, 0, 0,
kbound_min= 0, 0, 0, 0,-1, 1,
kbound_max= 0, 0, 0, 0,-1, 1,
bound_type= 3, 3, 3, 3, 3, 3,
/

For an explanation, see the RAMSES manual.

Providing initial conditions in ascii format

Use case: you have an ascii file containing a list of particles (positions, velocities, masses).
In this case, set filetype='ascii', and initfile={dirname} arbitrarily. RAMSES will look for your initial conditions in {dirname}/ic_part, and expects data in the form {x,y,z, vx,vy,vz, m}.

&INIT_PARAMS
filetype='ascii'
initfile='{dirname}'
/

However, take care of providing the initial conditions in “user units”, that is the units you defined in units.f90!

Using astronomical units

The requirement G=1 constraints the choice of the unit system. E.g., in astronomical units, G is not 1. So, if you would like to use astronomical units, you need to add an additional scaling step to the read-in routine(s).

Below, I share a version of the “phantom” patch that reads in astronomical units:
phantom_units.tar
This “phantom_units” patch is the “phantom” patch plus…
+ units.f90 (with Msun, kpc, G=1)
+ modified read-in routines that convert astronomical units (Msun, kpc, km/s) to N-body or “user units” as used internally in RAMSES.

Extract this file in ramses/patch/. To apply it to the code, set

PATCH=../patch/phantom_units

in the Makefile and compile the code again (run make clean && make in the ramses/bin directory)

Download and run samples

You can find samples at the samples page.

Each sample contains a so called namelist file, and the particle initial conditions (pos, vel, mass) in ic_part. In the sample directory, run

mpiexec -n {number of cores} {ramses location}/bin/ramses3d parameters.nml
howto.txt · Last modified: 2015/09/23 16:04 by fabian