Skip to content

GRMHD Output Format

Ben Prather edited this page Aug 13, 2021 · 5 revisions

HDF5 Fluid Output Format (v3.7)

Fluid simulation output data are saved in HDF5 "dump" files according to the format specified on this page. This unified format is meant to enable interoperability between the various hydro+ and radiative transfer codes we provide.

In the specification below, we use "double" to mean the 8-byte wide floating-point type, "float" to mean the 4-byte wide floating-point type, "int" to mean the 4-byte wide floating point type, and "string" to mean fixed-size zero-terminated character arrays of size 20. Arrays are indicated by the use of trailing square brackets "[]" where the number of sets of brackets corresponds to the dimension of the array. All numerical values are stored in little-endian format.

At a glance

Full specification

At A Glance

Just interested in reconstructing four-vector and metric tensor quantities? Check here.

The data in our output files can be schematically separated into two parts: header information and fluid-state data. Because many fluid dumps typically correspond to the same fluid simulation, we further divide header information into data that does and does not change over the course of the simulation. Data that is constant over the entire simulation is stored in the /header group. Other dump-specific information is rooted at the document root /.

Header data

At minimum, header data includes the following information:

Description Path Type Notes
simulation time /t double in code units
fluid gamma /header/gam double
logical grid dimensions /header/n1, /header/n2, /header/n3 int
metric name /header/metric string
names of primitive variables /header/prim_names string[]
number of primitive variables /header/n_prim int
simulation end time /header/tf double in code units
version string /header/version string

Optional entries into header data include:

Description Path Type Notes
use of electron temperature model /header/has_electrons int flag value 0 or 1 for true or false
use of radiation physics (sets units) /header/has_radiation int flag value 0 or 1 for true or false
notes /header/notes string
thermodynamic gamma of electrons /header/gam_e double if has_electrons
thermodynamic gamma of ions /header/gam_p double if has_electrons
length unit (code -> cgs) /header/units/L_unit double if has_radiation
mass unit (code -> cgs) /header/units/M_unit double if has_radiation
time unit (code -> cgs) /header/units/T_unit double if has_radiation

Header data also includes geometric information about the grid within the /header/geom group. The logical grid description is given by the six double values described below:

Description Path Type Notes
logical grid left edge /header/geom/startx1, /header/geom/startx2, /header/geom/startx3 double
logical zone width /header/geom/dx1, /header/geom/dx2, /header/geom/dx3 double

Finally, the header also includes metric parameters for the metric identified in the /header/metric string variable. These parameters, along with an understanding of the specified metric form, enable conversion between logical coordinates and (especially) Kerr-Schild coordinates. Metric variables are rooted at /header/geom/$METRIC where $MERTIC is defined by /header/metric.

For a mathematical description of how to use metric parameters, click here.

Fluid data

The bulk of the fluid data is stored as primitive variables (in code units) in a single four-dimensional array /prims of data type float. This array should be indexed by position and then variable number, where variable number corresponds to the desired primitive as listed in the "names of primitive variables" array in the header. For MHD+ simulations, the first eight variables will always be

RHO, UU, U1, U2, U3, B1, B2, B3

so to access the density (rho) of the cell at zone i, j, k, you should do

/prims[i][j][k][0]

Any indices 7 < i < NVAR correspond to extra variables moving passively with the fluid. Currently in iharm3d these are all entropy values, first for the total fluid (k_tot = /prims[i][j][k][8]) and then for electrons, under different heating models. These are written at index 9, 10, 11, 12 as KEL0, KEL1, KEL2, KEL3 correspond to KAWAZURA, WERNER, ROWAN, and SHARMA respectively. See iharm3d source file electrons.c for details. Note that the electron ordering is changed from v3.5 & 3.6, which placed a single electron entropy KEL at index 8 and KTOT at index 9.

The contravariant components of the four-current ja, calculated according to Fab;b = 4 π ja, are stored in a four-dimensional array /jcon of data type float and should be indexed according to position and then component index a as

/jcon[i][j][k][a]

Full Specification

/header/cour     float
       /fel0     float
       /gam      float
       /tf       float
       /gam_e    float  # if has_electrons
       /gam_p    float  # if has_electrons
       /tptemax  float  # if has_electrons
       /tptemin  float  # if has_electrons

/header/gridfile        string
       /metric          string
       /reconstruction  string
       /version         string
       /prim_names      string[NVARS]

/header/n1      int
       /n2      int
       /n3      int
       /n_prim  int
       /n_prims_passive  int
       /has_electrons    int
       /has_radiation    int

/header/units/L_unit         float  # if has_radiation
             /M_unit         float  # if has_radiation
             /T_unit         float  # if has_radiation
             /RHO_unit       float  # if has_radiation
             /U_unit         float  # if has_radiation
             /B_unit         float  # if has_radiation
             /Ne_unit        float  # if has_radiation
             /Thetae_unit    float  # if has_radiation

/header/geom/dx1      float
            /dx2      float
            /dx3      float
            /startx1  float
            /startx2  float
            /startx3  float
            /n_dim    int

# if /header/metric == "mks", then 
/header/geom/mks/r_eh
                /r_in
                /r_out
                /a
                /hslope

# if /header/metric == "mmks", then
/header/geom/mmks/r_eh
                 /r_in
                 /r_out
                 /a
                 /hslope
                 /mks_smooth
                 /poly_alpha
                 /poly_xt

/dt                 float               
/dump_cadence       float
/full_dump_cadence  float
/t                  float 

/is_full_dump  int
/n_dump        int
/n_step        int

/jcon      float[N1][N2][N3][4]
/prims     float[N1][N2][N3][NVARS]

# nothing beyond this point is guaranteed
/fail    int[N1][N2][N3]
/divB    float[N1][N2][N3]   
/gamma   float[N1][N2][N3]

/extras ...