Wiki

Clone wiki

KROME / patch3

4.1.4 GIZMO patch*

This version of the patch is designed to work with the public version of GIZMO. If you encounter any problem when using our patch with GIZMO, please send us a message*, because the patch may not keep track of very recent changes. The patch and this instructions are compatible with the latest public version of GIZMO (25th July 2017).

Running KROME

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

    $ ./krome -n your_network -interfaceC -gizmo -compact -useX

for example

    $ ./krome -n networks/react_primordial3 -interfaceC -gizmo -compact -useX

Note that the options -compact (which put together the core-files of KROME) is MANDATORY when you use -gizmo. 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_gizmo_patch with the files needed to run KROME within GIZMO. In particular:

    ~/krome/build/krome_gizmo_patch$ ls
    krome_all.f90   krome.c     krome_user_commons.f90  opkda1.f  
    opkda2.f    opkdmain.f      README.gizmo
    ~/krome/build/$ ls
    krome_all.h krome_header.c

Copying the files

To use the patch (1) create a new directory in gizmo named cooling, (2) copy the files in the build/krome_gizmo_patch directory in the cooling folder and (3) copy the build/krome_all.h and the build/krome_header.c files in the cooling folder.

Edit the files

Follow the instructions in the README.gizmo file to edit the opportune files in the GIZMO code.

Compiling

First, go to the cooling directory and compile the opkda1.f, opkda2.f, and opkdmain.f files separately. For instance:

    ifort -c opkda1.f
    ifort -c opkda2.f
    ifort -c opkdmain.f

Second, edit the Makefile, adding the necessary block to include the KROME files amongst the compiled and linked ones: 1) Add the krome interface files to the list of compiled files (which should be into a directory called cooling)

    ifeq (KROME,$(findstring KROME,$(CONFIGVARS)))
    OBJS    += cooling/krome.o
    OBJS    += cooling/krome_header.o
    FOBJS   += cooling/krome_user_commons.o
    FOBJS   += cooling/krome_all.o
    endif

2) Add a link to the opkda1.o, opkda2.o, and opkdmain.o files to the list of files to be linked with gizmo. This is an example of the command:

    $(CC) $(OPTIMIZE) $(OBJS) $(FOBJS) $(LIBS) $(RLIBS) cooling/opkd*.o -o $(EXEC)_KR

3) Add the option KROME to the Config.sh file in the main GIZMO directory, then just type make. You might have some warning message form the .f files depending on the compiler employed. If everything went smooth you have successfully patched GIZMO!

Consistent species conservation

If you have metal enrichment implemented in the code, you must always ensure the exact conservation of the total species abundances (X+Y+Z=1).

To do that, you have to rescale the total hydrogen and helium abundances after the enrichment event (you can define a routine in the krome.c file, following, for instance, Jimenez et al. 2003,Science 299, 5612).


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

thanks to Alessandro Lupi.

Updated