Erik Schnetter <>



Provide grid functions for the stress-energy tensor Tμν, and schedule when these grid functions are calculated. This allows different thorns to cooperate without explicitly depending on each other. This thorn is compatible with the interface, in the sense that thorns using this interface will work correctly with TmunuBase. Thorn TmunuBase is for the stress-energy tensor what thorn ADMBase is for the metric tensor.

1 Introduction

Thorn TmunuBase provides core infrastructure for thorns implementing some kind of energy or matter in general relativity, for example general relativistic hydrodynamics formulations. It provides the basic variables, i.e., the stress-energy tensor Tμν, in addition to a set of parameters to regulate their use. These variables are used to communicate between (possibly multiple) thorns contributing to the stress-energy content of the spacetime, and thorns needing to evaluate the stress-energy tensor such as spacetime evolution methods. It also provides schedule groups to manage when Tμν is calculated and when it is ready for access.

2 Using TmunuBase

2.1 Variables

TmunuBase weakly assumes (but does not require) that the spacetime is described in terms of a 3 + 1 decomposition. The variables provided by TmunuBase are:

These components have the prefix e to avoid naming conflicts with existing variables. Many thorns dealing with matter already use variable names such as Ttt.

These variables have up to three time levels.

2.2 Parameters

By default, the TmunuBase variables have no storage, and TmunuBase is inactive. This makes it possible to add a matter interface to existing vacuum spacetime methods without changing their behaviour.

Several parameters choose how TmunuBase behaves at run time:

The grid scalar stress_energy_state describes whether the Tμν variables have storage.

3 Programming with TmunuBase

3.1 Contributing to Tμν

There may be multiple thorns contributing to Tμν. Therefore, thorn TmunuBase initialises Tμν to zero, and each thorn has to add to the existing values in Tμν. The corresponding routine should be scheduled in the bin AddToTmunu. Note: Do not schedule anything in the schedule bin SetTmunu.

3.2 Reading from Tμν

Since the values of Tμν change at each time step, or – if a thorn like MoL is used – at each substep, Tμν needs to be recalculated frequently. This happens either in the schedule bin evol or in the schedule group MoL_PostStep. Tμν may only be accessed after it has been calculated, e.g. IN MoL_PostStep AFTER SetTmunu. Tμν can be freely accessed at other times, e.g. in MoL_CalcRHS or at poststep or analyisis.

4 Compatibility to ADMCoupling

Cactus provides another interface for contributing to the stress-energy tensor, called CalcTmunu. This alternative interface (which is described in thorn ADMCoupling) requires writing routines in fixed-format Fortran 77 and inserting lines of code into a file We suggest to use exactly one of these two interface and not to mix them.

Thorn TmunuBase takes contributions from the CalcTmunu interface automatically into account as well. It also collects the values which are added to its Tμν and provides these to other thorns which use the interface. That is, thorn TmunuBase is fully backwards compatible.

4.1 Comparison to ADMCoupling

The CalcTmunu interface and this thorn TmunuBase make different space/performance tradeoffs. CalcTmunu does not store any components of the stress-energy tensor, which saves memory and is also more efficient if its components can be quickly calculated from other variables (presumably the state vector of a hydrodynamics thorn).

TmunuBase requires explicit storage for Tμν. This is necessary if Tμν needs to be interpolated e.g. for dynamical horizon calculations. Compared to the overall number of grid function in a typical simulation the number of additional variables is tolerable (typical numbers are 10 additional variables with 200 existing variables). With the exception of the parts ensuring compatibility to CalcTmunu, TmunuBase is also a much simpler and more flexible mechanism.