Wiki

Clone wiki

KROME / patch2

4.1.3 RAMSES patch*

This version of the patch is designed to work with the public available RAMSES on bitbucket.

If you encounter any problem when using our patch with RAMSES, please send us a message*, because RAMSES is often updated and the patch may not keep track of very recent changes.

The patch and this instructions are compatible with RAMSES changeset df31002 (August 15th 2015).

Running KROME

The minimal options you need to create the RAMSES interface to KROME is

    $ ./krome -n your_network -ramses -compact

for example

    $ ./krome -n networks/react_primordial3 -ramses -compact

Note that the options -compact (which put together the core-files of KROME) is MANDATORY when you use -ramses. You can add any other options you prefer, including -heating=..., -cooling=..., and many others.

After this step you should find a Makefile in the build/ directory together with a subfolder named krome_ramses_patch with the files that have to be replaced in RAMSES, and in particular:

    ~/krome/build/krome_ramses_patch$ ls
    amr_parameters.f90  init_flow_fine.f90      opkda1.f    read_hydro_params.f90
    condinit.f90        krome_all.f90           opkda2.f
    cooling_fine.f90    krome_user_commons.f90  opkdmain.f

Copying the files

To use the patch just

(1) copy the build/krome_ramses_patch directory in ramses/trunk/ramsespatch/hydro/ and

(2) copy the build/Makefile in the ramses/trunk/ramses/bin/ folder.

Remember to rename the original Makefile before replacing it if you want to revert these modifications!

Changing the Makefile

Now you should be in the ramses/trunk/ramses/bin/ folder. Edit the Makefile in the RAMSES folder with your favourite text editor and replace this line

    NVAR = #this must be NDIM+2+9 !RAMSES DEFAULT = 3

by using NDIM accordingly to your problem. Note that the +9 of this example may be different, since it represents the number of species included and it is network-dependent. Also the +2 may change depending on the model, so please refer to this page on the RAMSES' wiki if you don't know what is the best value for you. In general RAMSES has the following prescriptions onNVAR:

For SOLVER=hydro, NVAR>=NDIM+2. For SOLVER=mhd, NVAR>=8 and for SOLVER=rhd, one has NVAR>=5.

We included in KROME a new option -ramsesOffset which sets the array of the species according to the kind of simulation based on the above RAMSES prescription for NVAR. Then for an hydro run NVAR will be NDIM+OFFSET+NMOLS, with OFFSET=2

As you can see from the Makefile KROME provides the number you should add to your NDIM, so in the end what you need is to set NVAR = NDIM + NUMBER_PROVIDED_BY_KROME, in this example NDIM+11.

Now let's change the path of the patch. The line

    PATCH = #requires ABSOLUTE path ending with patch/hydro/krome_ramses_patch

is self-explanatory and for example it could be something like

    PATCH = /home/johndoe/repos/ramses/trunk/ramses/patch/hydro/krome_ramses_patch

depending on where is your working directory. Note that using the tilde (~) for the home folder, as in ~/repos/ramses/trunk/ramses/patch/hydro/krome_ramses_patch, may not work. Additionally, paths containing spaces may not work. Additionally, do not put any spaces after the path

Compiling

This is quite easy, just type make. You might have some warning message form the .f files depending on the compiler employed, but in the end you should have something like

 ...
 rm write_makefile.f90
 rm write_patch.f90

If everything went smooth you have successfully patched RAMSES! Note that krome_chem is set to false by default in amr_parameters.f90

If you get errors talking about the lack of declarations of variables, it's most likely caused by using an updated version of ramses that contains new variables which are overwritten by krome patch. Modify the respective .f90 files in krome_ramses_patch with the new variables and update. Here are some ramses commits that might cause errors: https://bitbucket.org/rteyssie/ramses/pull-requests/130/added-no_inflow-parameter/diff https://bitbucket.org/rteyssie/ramses/pull-requests/128/mhd-minor-improvements/diff https://bitbucket.org/rteyssie/ramses/pull-requests/155/added-movie_vars_txt/diff https://searchcode.com/codesearch/view/91847290/


*in case of problems contact @tgrassi or @stefanobovino via the discussion group.

thanks to @jpprieto and Michela Mapelli.

Updated