Skip to content

Extraction and integration

Dina Traykova edited this page Aug 14, 2023 · 6 revisions

Both examples calculate and store the integrals of certain quantities in a given volume and the corresponding surface fluxes (in particular for energy and linear/angular momentum fluxes).

We calculate these quantities while the code is running and store their values in small data files at every coarse time step. The outputs can be reconciled as a useful check on the code convergence.

In principle one can calculate the volume or surface integral of any of the variables, or derived quantities, using the same strategy of calculating the integrands, and then integrating in the specificPostTimestep function.

In particular, refer to the following:

Integrating flux through a surface

The key file is FluxExtraction.hpp (see also this one), where the variables to be integrated are specified. The extraction levels and radii are set in the params.txt file, and it is called in the specificPostTimestep() function in KerrBHScalarLevel.cpp.

Note that the integrands are first calculated and assigned to the grid at lines 96-99, and then the flux extraction, that uses the AMRInterpolator of GRChombo, is called in line 146.

For the volume integrals

The volume integrals are calculated in the Level.cpp file for the specific example in specificPostTimeStep(), see e.g. KerrBHScalarLevel.cpp. This is where one could change the variables for integration. These volume integrals use the AMRReductions class of GRChombo, which sums the variable over the multiple levels, using always the data on the finest available resolution at each point.

Note that, in addition, you may want your diagnostic variables to be set to 0 in-/outside some chosen radii. In the examples, this is done in ExcisionDiagnostics.hpp.