Wolfgang Kastaun <>

November 12 2021


This thorn provides the RePrimAnd library. The RePrimAnd library is a support library for general relativistic magnetohydrodynamics independent of the EinsteinToolkit/Cactus. It currently provides an EOS framework and an ideal GRMHD primitive variable recovery algorithm.

1 The RePrimAnd library

In detail, the following functionality is provided:

The algorithm for primitive variable recovery is EOS-agnostic and very robust. The method and tests are described in [1]. Full documentation of the library is available online at

RePrimAnd is written in C++ and completely independent of Cactus/Einstein Toolkit or any other framework. The stand-alone version of the library can be found at The stand-alone version also provides unit tests and includes Python bindings. The latter could be used for post-processing, making it possible to, e.g., apply an EOS to numpy arrays.

2 The RePrimAnd Thorn

This thorn simply makes the C++ interface available for use by ET thorns, but provides no further integration. In particular, the thorn provides no aliased functions and no Fortran interface. At the moment, the thorn also contains no test suite. Further thorns providing better integration are planned for the near future.

Some remarks on EOS are in order. First, there are two ways of specifying EOS, either creating them on-the-fly, or by loading from EOS files in the universal format defined by RePrimAnd. At the moment, there is no public repository for such EOS files. Users can however create such files themselves through a dedicated Python-API available in the github repository (see online documentation). The file format will remain backwards-compatible for the foreseeable future. Second, the library allows the addition of custom EOS implementations without recompiling the library. The same holds for extending the universal EOS file format. It should not be necessary to change the library source code for this. For details, see the online documentation.


[1]   Kastaun, W, Kalinani, J, Ciolfi, R. “Robust recovery of primitive variables in relativistic ideal magnetohydrodynamics”. Phys. Rev. D 2021; 103:023018.

3 Parameters

4 Interfaces




5 Schedule

This section lists all the variables which are assigned storage by thorn ExternalLibraries/RePrimAnd. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.