KROME.jl

KROME.jl is a lightweight wrapper for KROME, a Fortran library for including chemistry and microphysics in astrophysics simulations.
Author trixi-framework
Popularity
3 Stars
Updated Last
1 Year Ago
Started In
February 2021

KROME.jl

Build Status Coveralls License: MIT

KROME.jl is a Julia package that wraps KROME, a Fortran library for including chemistry and microphysics in astrophysics simulations.

NOTE: This package is in its early stages and still highly experimental! Some things might not work yet, and implementation details may change at any time without warning.

Prerequisites

The following programs and tools must be available in the PATH such that they can be called by the Julia process while building the package:

  • Python 3 (python3)
  • make
  • GNU Fortran compiler (gfortran)

Also note that KROME has primarily been developed for Linux, but also works on macOS. Both OS are automatically tested with KROME.jl. Windows is not supported by KROME.

Installation

If you have not yet installed Julia, please follow the instructions for your operating system. KROMEjl works with Julia v1.5.

You can then install KROME.jl by executing

julia -e 'using Pkg; Pkg.add("KROME")'

By default, this will build the KROME library with the hello test activated, i.e., passing -test=hello to the KROME preprocessing script. However, usually you will want to pass your own network file and possibly other options to KROME during preprocessing. This can be achieved via the environment variable JULIA_KROME_CUSTOM_ARGS, which accepts a ;-separated list of arguments that will be passed to the krome preprocessor. For example, to provide a custom network file while disabling the recombinations check, you can run the build command above with

JULIA_KROME_CUSTOM_ARGS="-n;abs/path/to/react_skynet" julia -e 'using Pkg; Pkg.build("KROME")'

Please note that you have to specify the absolute path to the network file.

Next to the arguments to the krome preprocessing script, you can also configure which Python 3 executable to use by setting the environment variable JULIA_KROME_PYTHON3_EXEC to its full path. Furthermore, you can disable compiler optimizations for the KROME library by setting the environment variable JULIA_KROME_OPTIMIZED_BUILD to something other than true. By default, optimizations are enabled.

Usage

Have a look at the examples in examples/ to find out how to use KROME.jl. Right now there are two examples available.

test_hello

To run this example, start Julia and execute the following:

julia> using KROME

julia> include(joinpath(KROME.examples_dir(), "test_hello", "test_hello.jl"));

julia> test_hello()

This will print out the abundancies as the chemical network evolves in time. To store the results in a file, e.g., test_hello.txt, change the last line of the snippet above to

julia> open("test_hello.txt", "w+") do io; test_hello(io); end

av-slab-benchmark

To run this example, you first need to build KROME.jl with a different network file by executing

KROME_NETWORK_FILE=$(julia -e 'using KROME; println(joinpath(KROME.examples_dir(), "av-slab-benchmark", "react_chnet5"))') \
  JULIA_KROME_CUSTOM_ARGS="-n;$KROME_NETWORK_FILE;-noRecCheck" \
  julia -e 'using Pkg; Pkg.build("KROME")'

The command

julia -e 'using KROME; println(joinpath(KROME.examples_dir(), "av-slab-benchmark", "react_chnet5"))'

is used here to obtain the path to the chemical network file from the corresponding example directory of the KROME.jl package.

After re-building KROME.jl successfully, start Julia and execute the following:

julia> using KROME

julia> include(joinpath(KROME.examples_dir(), "av-slab-benchmark", "av_slab.jl"))

julia> av_slab()

This will start the example and printing the chemical network updates as they are computed. Note that this example takes a minute or two to fully run through.

Authors

KROME.jl was initiated by Michael Schlottke-Lakemper (University of Cologne, Germany). The KROME package itself is developed and maintained by Tommaso Grassi, Stefano Bovino, and many others.

License and contributing

KROME.jl is licensed under the MIT license (see LICENSE.md). The KROME package itself is licensed under the GNU General Public License, version 3.

Used By Packages

No packages found.