Ramses Coded Documentation & Tutorial
This documentation is for the a purpose, to run the Ramses code in your system. If possible combining with HPC cluster.
This is a simple guide to generating a GIF like animation for 2D and 3D input file, and layout the exact procedure, I
followed because initially it might confuse anyone. I have performed only Sedov Input code. To just check how ramses
works and what we can extract from this tool. I am interested in combining astronomical calculation with HPC in future.
To showoff this interest and curiosity of mine. I tried running job on “Comet” HPC cluster provided by Newcastle
University. However, I could not get a satisfied output using the cluster. So far, I have just done 1D and 2D in my T430
device, while I tried 3D on cluster. Will look again to re-run the job.
The most major aim to document this is see the animation at the end of compiling the Ramses code. I personally feel,
without seeing an animation, it was little boring to me. Hence here its a simple guide on “how I got a animation of 2D
Sedov Cod for different time line. I have also attached the actual task pictures with step by step procedures to have a
better understanding and easier to guide.
1. What is Ramses Code: Ramses Code is a open-source project code, written in Fortran programming languages. Its
mainly used to study the some properties of evolving universe by modeling phenomena like some explosion, gravitation,
magnetization or any radiation caused and many more. Ramses models these astronomical simulation and complex
calculation to better understand.
Ramses uses AMP techniques, but What is Adaptive Mesh Refinement (AMR)? Its a simulations techniques that
focuses a specified area with more computing power and refined scale to capture more detailing a particular ares.
This makes simulations more efficient and accurate without wasting CPU and memory by using coarser grids in less
important regions. This is enough knowledge I feel to have, but if you want to learn more about RAMSES, you have
a look into this official page.
2. What is Sedov-Taylor-von Neumann: The “Sedov-Taylor-von Neumann” is a mathematical and physical model
used to describe how a strong explosion spreads out in a gas or fluid. As its modeling to understand a explosion is
theorized as blast wave. When an explosion occurs it releases a huge amounts of a shock wave outward. and This
shocks wave are actually studied using mathematical formula and using physics theory to understand universe thats
it. This model explains how the shock wave is behaving with time, like changes in position, density, velocity, pressure,
temperature etc. This model is fundamental in astrophysics and fluid dynamics because it helps us to understand
explosions caused by supernovae, nuclear blasts, or any sudden energy release in universe. This is named after three
scientists, Leonid Sedov, G. I. Taylor and John von Neumann.
Requirments:
Before starting of this, I highly suggest you to use Linux distribution, as its way much easier to figure out the problems.
We must have some packages installed in our system such as:
1. git: to install git code. I have git (2.52.0-2) installed in my system, you cant install it via below comand:
This command is to install
sudo pacman -S git
This command will let you search all the git package
sudo pacman -Ss git
2. gfortran: To compile and run Ramses Code, you usually need a Fortran compiler installed on your system. I have
gfortran (15.2.1) prebuilt in my distro. This Fortran will help us to get a executable file for ramses 1D, 2D, and
3D. However, if you can search using this command flag ’-Ss’. I get this following output, which means, I have it
preinstalled in my system.
[ go lu@ T430 ~] $ sudo pacma n -Ss gfo rtran
core /gcc - libs 1 5.2.1+ r447 + g6a64f6c3 ebb8 -1 [ ins tal led : 15.2.1 + r301 + g f24307422 d1d -1]
Runtime li braries shi pped by GCC
core / lib32 - gcc - libs 15.2 .1+ r447 + g6a 64f6c3ebb 8 -1 [ inst all ed : 15. 2.1+ r301 + gf24307422d 1d -1]
32 - bit runt ime li bra rie s s hipped by GCC
Note: Basicallly gfortran and python should be your system installation. One reason why Linux is great, it
usually comes with important tools, packages and libraries already set up for you.
1
3. Python: To visualize the output in image or gif format, you will need Python (version 3.11.0) or higher, its libraries
such as: Osyris, Pynbody. First you need to make a working directory using this below command, mine is simply
’ramses’, then use cd command to change directory
mkdir < dir ectory_ name >
cd < dir ector y_name >
Once you are inside here you can check your path using command ’pwd’. Now its important to note that Python
libraries cant be installed without having a Python virtual environment and neither it works without it. You can
create a virtual environment using this command where ’mynewvenv’ will create you a directory.
python -m venv mynewvenv
This is where you installe the python libraries. Now you need to activate this virtual environment using below
command,
source my new ven v / bin / activa te
One activated, you will see a prompt near the name, like below,
Now you are ready to intall python package, using this command and once done,
pip in stall osyris pynb ody
You will see this output as shown in the image, which tell you what other packages has been installed.
4. Ramses code: You need to git clone in the working directory, this will download latest github repository.
( my new venv )[ golu@T430 ~] $ git clone https :// g it hub . com / ramses - or gani sati on / ramses
Clon ing into ramses ...
remote : Enum erat ing objects : 26381 , done .
remote : Cou nti ng objects : 100% ( 188/188) , done .
remote : Comp ress ing objects : 100% (104/ 104 ) , done .
remote : Total 26381 ( delta 122) , reused 84 ( delta 84) , pack - re us ed 26193 ( from 2)
Re ceiving obj ects : 100% ( 263 8 1/26 381) , 98.70 MiB | 846.00 KiB /s , done .
Re solving deltas : 100% ( 178 9 4/17 894) , done .
You can check listing using ’ls’ command, here the blue shows me directories while green shows me a text file.
Preparation of Ramses code:
2
1. Here, We need a executable file for all dimensions, ramses1d, ramses2d and ramses3d, each has different Ramses code.
We will first need to prepare the ’Makefile’ in this path (ramses/bin), you need to type ’cd bin’ inside directory where
you just cloned the Ramses code.
( my new venv ) [ golu@T430 ramses ] $ cd bin /
( my new venv ) [ golu@T430 bin ]$ ls
cluster s . mk Makefil e
( my new venv ) [ golu@T430 bin ]$
2. Here, we will edit “Makefile” using vim text editor. Basically we will just add two parameters, F90, which are now
empty and other FFLAGS in the ’Makefile’ and we set this below value to F90 to gfortran as the Fortran compiler,
and FFLAGS to add optimization and compatibility options so RAMSES compiles correctly and runs efficiently.
F90 = gfo rtr an -O3 -frecord - marker =4 - fba ckt race - ffree - line - length - none
FFLAGS = -x f95 -cpp - input - D WITH OUT MPI $ ( DEFIN ES )
3. Also we need to check the following parameters for “Compilation time parameters”
# C omp ilat ion time par ame ters
NVEC TOR = 64
NDIM = 1
NPRE = 8
NVAR = 8
SOLVER = hydro
PATCH =
EXEC = ram se s
DEFI NES = -DN VECTO R = $ ( NVECTOR ) - DNDIM = $ ( NDIM ) -DNPRE =$ ( NPRE ) - DNVAR =$ ( NVAR ) - DSO LVE R$ (
SOLVER )
Executable File:
1. Once all checked, save the file and we will compile the “Makelfile”. First we will clean the folder using this command
’make clean’ command and then re build the program.
( my new venv ) [ golu@T430 bin ]$ make clean
rm -f *. o *. mod *. i
( my new venv ) [ golu@T430 bin ]$ make
You will see something like below image.
Here ’make clean’ command removes old compiled files, and ’make’ command compiles the program again to create
fresh executables. Now you can check “ramses1d” filename.
3
2. here check whether its executable file using this command search. The ’x’ shows its executable file. Now, You will
notice that the file is named as “ramses1d”, its because when we edited the “Makefile” the variable “NDIM=1” and
hence it compiled the 1D Ramses code. Note this point, We will need this in later for 2D and 3D
( my new venv ) [ golu@T430 bin ]$ ls -l rams es1 d
-rwxr - xr - x 1 golu golu 9 55768 Feb 7 21:59 ram ses 1d
Input file:
1. Its very important to have a understanding of out input files. All the input file (sedov1d.nml) for 1D, 2D or 3D are
located inside ’namelist’ directory, which in ˜/ramses/namelist path. We are mainly focusing on sedov input files only
Look for sedov1d.nml file using cat, less or vim
( my new venv ) [ golu@T430 namel ist ] $ vim sedo v1d . nml
4
2. Now, to Run Ramses code for 1D, we need to do so in parent directory of ramses. Go to previous directory using (cd
..). and check check the path using ’pwd’ and start the execute file to run sedov1d.nml file in this path, as shown below,
( my new venv ) [ golu@T430 ramses ] $ bin / ramses 1d namelist / sed ov1d . nml
you will see ’run completed’ as in below image,
3. Now check the listing for “output 0000*” file using ls. We get more that mentioned output (noutput=5) like here, we
have gotten 6 different output directories because RAMSES always writes one extra output at time = 0.
This below is telling how tiny all these output datas are, and hence unable to process those outputs.
( my new venv ) [ golu@T430 ramses ] $ ls - lh outp ut_ 0000 */ amr_ *. out000 01
-rw -r - -r - - 1 golu golu 6.6 K Feb 7 23:08 outp ut_0 0001 / a mr_ 000 01 . out0 000 1
-rw -r - -r - - 1 golu golu 7.4 K Feb 7 23:08 outp ut_0 0002 / a mr_ 000 02 . out0 000 1
-rw -r - -r - - 1 golu golu 7.2 K Feb 7 23:08 outp ut_0 0003 / a mr_ 000 03 . out0 000 1
-rw -r - -r - - 1 golu golu 7.3 K Feb 7 23:08 outp ut_0 0004 / a mr_ 000 04 . out0 000 1
-rw -r - -r - - 1 golu golu 7.4 K Feb 7 23:08 outp ut_0 0005 / a mr_ 000 05 . out0 000 1
-rw -r - -r - - 1 golu golu 7.3 K Feb 7 23:08 outp ut_0 0006 / a mr_ 000 06 . out0 000 1
4. Each output 0000* directory will have similar outputs, like this but will for different.
( my new venv ) [ golu@T430 outp ut_ 0 000 1 ] $ ls
am r_00001 . out00 001 he ader _000 01 . txt hy d r o_fi l e _desc r iptor . txt mak efi le . txt
patches . txt
co mpi lati on . txt hy dro _000 01 . ou t00 001 info_ 000 01 . txt namelis t . txt
ti mer _000 01 . txt
( my new venv ) [ golu@T430 outp ut_ 0 000 1 ] $
Output file log preparation: Usually 1D will have log file, so enclose the output inside this text file.
5
1. Now for 1D, we can save the output in sedov1d.log file using below command,
( my new venv ) [ golu@T430 ramses ] $ bin / ramses 1d namelist / sed ov1d . nml > s edov1 d . log
2. Now, you need to ’cat sedov1d.log’ and copy the last ’Output 66 cells’ dats and save it into ’sedov1d.txt’ file using
vim text editor.
3. Hope you have gnuplot installed in your system or you can install it using previous command mentioned in the
beginning, or use your liked viewer to visualize this 66 cells, if using gnuplot, first you need to type ’gnuplot’ which
will give you a prompt like gnuplot >.
6
( my new venv ) [ golu@T430 ramses ] $ gnuplot
G N U P L O T
Version 6.0 p atc hle vel 4 last mo difie d 2025 -12 -18
Co pyright (C ) 1986 -1993 , 1998 , 2004 , 2007 -2025
Thomas Williams , Colin Kell ey and many others
gnuplot home : http :// www . gnu plot . info
faq , bugs , etc : type " help FAQ "
im med iate help : type " help " (plot window : hit h )
Termina l type is now qt
gnuplot > set grid
gnuplot > set xlabe l " P osition ( x ) " font " ,14"
gnuplot > set ylabe l " D ensity () " font " ,14"
gnuplot > set xtics font " ,14"
gnuplot > set ytics font " ,14"
gnuplot > set size square
gnuplot > plot " s edov1d . txt " using 2:3 with lines lw 2 lc rgb " red "
4. Congrats! You have successfully run the Ramses code for 1D. You can now see a gnuplot figure like the one below,
showing a comparison of position (x) against levels (lev), density (ρ), velocity (u), and pressure (P ).
7
3
4
5
6
7
8
9
10
0 0.1 0.2 0.3 0.4 0.5 0.6
"sedov1d.txt"using2:1
Refinementlevelplot
Position(x)
(a) Position vs Level
0
1
2
3
4
5
0.1 0.2 0.3 0.4 0.5
"sedov1d.txt"using2:3
Density(ρ)
Position(x)
(b) Position vs Density
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0 0.1 0.2 0.3 0.4 0.5
"sedov1d.txt"using2:4
Velocity(u)
Position(x)
(c) Position vs Velocity
0
0.2
0.4
0.6
0.8
1
0 0.1 0.2 0.3 0.4 0.5
"sedov1d.txt"using2:5
Pressure(P)
Position(x)
(d) Position vs Pressure
Figure 1: Comparison of Sedov-Taylor 1D blast wave profiles for refinement levels, density, velocity, and pressure at different
simulation parameters. The shock front is visible as a sharp jump in these physical quantities.
Compilation of 2D Ramses code:
1. First you need to ’make clean the previously executed programs, in the ˜/ramses/bin and rerun the below command,
whiling addressing the dimension value to be 2, and it will give you the executable file name ’ramses2d’.
( my new venv ) [ golu@T430 bin ]$ make clean
rm -f *. o *. mod *. i
( my new venv ) [ golu@T430 bin ]$ ls
cluster s . mk Makefil e ramses 1d
( my new venv ) [ golu@T430 bin ]$ make NDIM =2
8
.
2. Now lets have a look into our sedov2d input file, which is inside ’namelist/’ directory. if you just do ’cat sedov2d.nml’,
you will be able to see what inside the file. Here we will try to edit this file. Right now if you see ”&OUT-
PUT PARAMS” its mentioned ’noutput=1’, we change it to this value ’noutput=5’ and and similarly for ’tout=1.0’,
which tell the boundary conditons at this time, we change this to ’tout=0.0625,0.125,0.25,0.5,1.0’. Which means, it
will have different output for at several time. Now run the Ramses code for 2D, by executing ’ramses2d’ file in ramses
path and load the ’sedov2d.nml’ .
( my new venv ) [ golu@T430 ramses ] $ bin / ramses 2d namelist / sed ov2d . nml
You will get a ”Run completed” in the output. Now again you get to notice you have gotton 6 outputs file because
the first output file will auto make the initial condition at time=0.
3. Using this below command, you can check if you have gotten anything in the output file or not. If you see like some
bigger numbers like 37k, 335K etc, means the position of the sedov2d blast wave has been obtained and you can check
this outputs.
( my new venv ) [ golu@T430 ramses ] $ ls - lh outp ut_ 0000 */ amr_ *. out000 01
-rw -r - -r - - 1 golu golu 37 K Feb 9 20:22 o utpu t_00 001 / amr_00001 . out0 0001
-rw -r - -r - - 1 golu golu 335 K Feb 9 20:22 outp ut_0 0002 / a mr_ 000 02 . out0 000 1
-rw -r - -r - - 1 golu golu 457 K Feb 9 20:22 outp ut_0 0003 / a mr_ 000 03 . out0 000 1
-rw -r - -r - - 1 golu golu 633 K Feb 9 20:22 outp ut_0 0004 / a mr_ 000 04 . out0 000 1
-rw -r - -r - - 1 golu golu 879 K Feb 9 20:22 outp ut_0 0005 / a mr_ 000 05 . out0 000 1
-rw -r - -r - - 1 golu golu 1.2 M Feb 9 20:23 outp ut_0 0006 / a mr_ 000 06 . out0 000 1
Output Analysis for 2D: For 2D, we have to need to have a python script so that we have check the outputs. For 1D it
was simply a text file with data, which we had plotted.
1. First have a python script like this below
( my new venv ) [ golu@T430 ramses ] $ cat 3. py
import o sy ris
import ma tpl otli b . pyplot as plt
# choose outputs you want
outp uts = range (1 , 7) # 1 , 2 ,3 ,4 ,5 ,6
for out in outputs :
print ( f " Proc ess ing outp ut { out }...")
data = osy ri s . Ram s esD a tase t ( out , path ="./") . load ()
plt . figure () # new figure for each plot
osyris . map (
data [" mesh "]. layer (" densit y ") ,
9
norm =" log ",
cmap =" jet "
)
plt . savefig (f" out { out }- sedo v2d . png ")
plt . close () # free m em ory
If this script is compiled properly, you will see something like below text code. If you get any error. its mostly from
the path which you are giving or importing libraries of python package.
Pr oce ssi ng 1 files in ./ outp ut_0 0003
Loaded : 13801 cells , 0 par tic les .
Pr oce ssi ng output 4...
Pr oce ssi ng 1 files in ./ outp ut_0 0004
Loaded : 19426 cells , 0 par tic les .
Pr oce ssi ng output 5...
Pr oce ssi ng 1 files in ./ outp ut_0 0005
Loaded : 27262 cells , 0 par tic les .
Pr oce ssi ng output 6...
Pr oce ssi ng 1 files in ./ outp ut_0 0006
Loaded : 34198 cells , 0 par tic les .
2. Now run this python script below, and once it ran, you check for the image that just created. Notice the image
generated by processing the output 00001 will not show anything because its t=0 and show the initial conditions to
be zero. However we will check the ’out2-sedov2d.png’, because it have plotted the density state of sedov2d blast
wave. Once you check the image, you will see this below image. This image is a plot at radius x=0.25cm.
3. we had the value of ouput time ’tout=0.0625,0.125,0.25,0.5,1.0’. You can the outpust dictionary by, this means we
have this all physical variable available in outputs, that we can model.
( my new venv ) [ golu@T430 outp ut_ 0 000 2 ] $ python
Python 3 .13.1 1 (main , Dec 7 2025 , 13: 01: 45) [ GCC 15.2.1 2 025 111 2] on linux
Type " help ", " copyright ", " c redits " or " lic ense " for more inf orma tio n .
>>> im po rt osyris
...
... data = osy ri s . Ram s esD a tase t (2 , path =".. /") . load ()
... print ( data [" mesh "]. keys () )
...
/ home / golu /NBI - PhD2017 -ex -1/ my new ven v / lib / pyt hon3 .13/ site - packa ges / osyris / io / hydro . py :23:
Us erW arni ng : Input line 1 cont ain ed no data and will not be counted to wards max_rows
=50000 . This diff ers from the behaviour in NumPy <=1.22 which count ed lines rather
than rows . If desired , the pre vio us beh avi our can be achie ved by using i ter too ls .
islice .
Please see the 1.23 release notes for an ex am ple on how to do this . If you wish to
ignore this warning , use w arnin gs . filter warnings . This w arning is exp ected to be
removed in the future and is given only once per loadtxt call .
de s c_f r om_f ile = np . loa dtxt ( fname , dtype = str , delimiter =" ,")
Pr oce ssi ng 1 files in ../ o u tpu t_00 002
Loaded : 9874 cells , 0 particles .
di ct_keys ([ level , cpu , dx , density , pressure , position , velocity , mass ])
>>>
4. Python script for all at once. it will print “done” and save the output images.
import o sy ris
import numpy as np
import ma tpl otli b . pyplot as plt
outp uts = range (1 ,7)
10
for out in outputs :
print ( f " Proc ess ing outp ut { out }...")
data = osy ri s . Ram s esD a tase t ( out , path ="./") . load ()
# For level
plt . figure ()
osyris . map ( data [" mesh "]. layer (" level ") , cmap =" v iridis ")
plt . savefig (f" out { out }- sedov2d - level . png ")
plt . close ()
# For density
plt . figure ()
osyris . map ( data [" mesh "]. layer (" density ") , norm =" log ", cmap =" jet ")
plt . savefig (f" out { out }- density - new - jet . png ")
plt . close ()
# For pressure
plt . figure ()
osyris . map ( data [" mesh "]. layer (" pres sure ") , norm =" log ", cmap =" jet ")
plt . savefig (f" out { out }- sedov2d - pr essur e . png ")
plt . close ()
# For mass
plt . figure ()
osyris . map ( data [" mesh "]. layer (" mass ") , norm =" log ", cmap =" jet ")
plt . savefig (f" out { out }- sedov2d - mass . png ")
plt . close ()
print (" Done .")
5. combine all images, output 4 from each variable, below command is to combine all four image and convert it to one
image. further you can see the image generated. This image is like the one below, showing a comparison of position
(x) against levels (lev), density (ρ), mass (m), and pressure (P ). We will now plot for the velocity seperatly,as its
have x and y axis parameter differently.
( my new venv ) [ golu@T430 ramses ] $ magic k monta ge out4 - sedov2d - level - t esti n gsc r ipt . png out4
- density - te s ting scri pt . png out4 - sedov2d - mass - t esti ngsc ript . png out4 - sedov2d - pressure -
te stin gscr ipt . png -tile 2 x2 - geome try +0+0 4- combined - sedov2d -2 x2 . png
11
6. Now you can also have animation for this image, using this command for each.
level - gif here.
New Script for relationship: There are many things we can carry out to ananlyse the output data.
1. Here one thing is using below script,
( my new venv ) [ golu@T430 ramses ] $ cat phdscript -3. py
import numpy as np
import ma tpl otli b . pyplot as plt
import o sy ris
for nout in range (1 , 7) :
print ( f " Proc ess ing { nout }")
data = osy ri s . Ram s esD a tase t ( nout , path ="./") . load ()
mesh = data [" mesh "]
fig = plt . figure ( figs ize =(12 ,4) )
ax1 = fig . a dd_s ubp lot (121)
ax2 = fig . a dd_s ubp lot (122)
# --- - d ensit y slice --- -
osyris . map (
mesh . layer (" densit y ") ,
12
norm =" log ",
cmap =" jet ",
ax = ax1
)
# --- - rad iu s vs densi ty sc atter -- --
r = mesh [" positi on "]. norm . values
d = mesh [" den sity "]. v alues
ax2 . scatter (r , d , s =5)
ax2 . set_x lab el (" radius ")
ax2 . set_y lab el (" density ")
fig . savefig (f" sedov_ { nout :02 d }. png ", bb ox_ inch es =" tight ")
plt . close ( fig )
we have this below image, this script plots the left 2D density field (shock shape) and Right density vs radius (shock
profile) for each timestep.
Now Running 3D on HPC:
1. I am running inside HPC cluster now. I have used the same steps for executable file called ramses3d and I compiled
with sedov3d.nml input file.
2. Once you compiled in your 3D input file. Its suggested to check whether the data outputs have been created or not
using below command line. In my case, it says alot of data has been generated like 366M.
[ c50 0@co m etlo g in ( comet ) ramses ]$ ls -lh out put_ 000 0 */ amr_ *. out0 0001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:43 ou t put _000 01 / amr_00001 . out 00001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:44 ou t put _000 02 / amr_00002 . out 00001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:45 ou t put _000 03 / amr_00003 . out 00001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:45 ou t put _000 04 / amr_00004 . out 00001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:46 ou t put _000 05 / amr_00005 . out 00001
-rw -r - - - - - 1 c50074 71 c omet l ogin a cces s 366 M Feb 10 2 1:50 ou t put _000 06 / amr_00006 . out 00001
13