xx VolumeIntegralsGRMHD: An Einstein Toolkit thorn for GRMHD volume integrations

VolumeIntegralsxGRMHD: An Einstein Toolkit thorn for GRMHD volume integrations

Zachariah B.xEtienne <zachetie *at* gmail *dot* com >

Documentation by Leonardo R.xWerneck <wernecklr *at* gmail *dot* com >

July 24, 2023

Abstract

VolumeIntegralsxGRMHD is a thorn for integration of spacetime quantities, accepting integration volumes consisting of spherical shells, regions with hollowed balls, and simple spheres. Results from of integrals, such as the center of mass, can be used to track e.g.xneutron stars.

1 Volume integrals We now briefly describe the volume integrals that can be performed using the VolumeIntegralsxGRMHD thorn.

1.1 Rest mass

We start by defining the “densitised density” (see e.g.x[1]) where is the lapse function, is the determinant of the physical spatial metric , is the baryonic density, is the fluid four-velocity, and is the Lorentz factor. The rest mass integral is then given by

The volume can be specified using spherical shells, regions with hollowed balls, and simple spheres. It can also be set to the entire computational domain.

1.2 Center of mass

The coordinates of center of mass are computed from the integral where is the position vector. The volume can be specified using spherical shells, regions with hollowed balls, and simple spheres. It can also be set to the entire domain size.

1.3 Unit (for debugging)

This thorn also provides the functionality of performing a volume integral with a unit integrand, which should just yield the volume of the integrated region, i.e.

2 Basic usage

Except for the definition of the integrands, the behavior of this thorn is almost completely driver by the configuration of the parameter file. We present here an example of such a parameter file, which performs the following tasks:

Integrate the entire volume with an integrand of 1. (used for testing/validation purposes only). Perform all four integrals required to compute the center of mass (numerator=3, denominator=1 integral), in an integration volume originally centered at with a coordinate radius of 13.5 Also use the center of mass integral result to SET the ZEROTH AMR center. In this way, the AMR grids will track the center of mass as computed by this integration. Same as 2, except use the integrand=1 (for validation purposes, to ensure the integration volume is approximately ). Also disable tracking of this integration volume. Same as 2, except for the neutron star originally centered at . Same as 4, except use the integrand=1 (for validation purposes, to ensure the integration volume is approximately ). Also disable tracking of this integration volume. Perform rest-mass integrals over entire volume.

To achieve this, add the following configuration to your parameter file:

ActiveThornsx=x"VolumeIntegrals_GRMHD"
#xSetxnumberxofxintegrals
VolumeIntegrals_GRMHD::NumIntegralsx=x6
#xSetxfrequencyxofxintegration.xIfxtrackingxAMRxcentresxthisxshould
#xmatchxthexregriddingxfrequencyxofxthexthornxCactusRegrid2
VolumeIntegrals_GRMHD::VolIntegral_out_everyx=x32
#xEnablexfilexoutput
VolumeIntegrals_GRMHD::enable_file_outputx=x1
#xSetxoutputxdirectory
VolumeIntegrals_GRMHD::outVolIntegral_dirx=x"volume_integration"
#xSetxverbosexlevel.x0xdisablesxit,x1xprovidesxuseful
#xinformation,xandx2xisxveryxverbose.
VolumeIntegrals_GRMHD::verbosex=x1
#xThexAMRxcentrexwillxonlyxtrackxthexfirstxreferenced
#xintegrationxquantitiesxthatxtrackxsaidxcentre.
#xIntegralx#1:xunitxintegrand
VolumeIntegrals_GRMHD::Integration_quantity_keyword[1]x=x"one"
#xIntegralx#2:xCoM
VolumeIntegrals_GRMHD::Integration_quantity_keyword[2]x=x"centerofmass"
#xIntegralx#3:xunitxintegrand
VolumeIntegrals_GRMHD::Integration_quantity_keyword[3]x=x"one"
#xIntegralx#4:xCoM
VolumeIntegrals_GRMHD::Integration_quantity_keyword[4]x=x"centerofmass"
#xIntegralx#5:xunitxintegrand
VolumeIntegrals_GRMHD::Integration_quantity_keyword[5]x=x"one"
#xIntegralx#6:xrestxmass
VolumeIntegrals_GRMHD::Integration_quantity_keyword[6]x=x"restmass"
#xSetxradiusxofxintegrationxforxintegralx#2
VolumeIntegrals_GRMHD::volintegral_sphere__center_x_initialxxxxxxxxx[2]x=x-15.2
VolumeIntegrals_GRMHD::volintegral_inside_sphere__radiusxxxxxxxxxxxx[2]x=xx13.5
#xLetxthexresultxofxintegralx#2xtrackxthexgridxcentrex0
VolumeIntegrals_GRMHD::amr_centre__tracks__volintegral_inside_sphere[2]x=xx0
#xSetxradiusxofxintegrattionxforxintegralx#3
VolumeIntegrals_GRMHD::volintegral_sphere__center_x_initialxxxxxxxxx[3]x=x-15.2
VolumeIntegrals_GRMHD::volintegral_inside_sphere__radiusxxxxxxxxxxxx[3]x=xx13.5

#xSetxradiusxofxintegrationxforxintegralx#4
VolumeIntegrals_GRMHD::volintegral_sphere__center_x_initialxxxxxxxxx[4]x=xx15.2
VolumeIntegrals_GRMHD::volintegral_inside_sphere__radiusxxxxxxxxxxxx[4]x=xx13.5
#xLetxthexresultxofxintegralx#4xtrackxthexgridxcentrex1
VolumeIntegrals_GRMHD::amr_centre__tracks__volintegral_inside_sphere[4]x=xx1
#xSetxradiusxofxintegrattionxforxintegralx#5
VolumeIntegrals_GRMHD::volintegral_sphere__center_x_initialxxxxxxxxx[5]x=xx15.2
VolumeIntegrals_GRMHD::volintegral_inside_sphere__radiusxxxxxxxxxxxx[5]x=xx13.5

References

[1]xxxM.D. Duez, Y.T. Liu, S.L. Shapiro, and B.C. Stephens, Relativistic magnetohydrodynamics in dynamical spacetimes: Numerical methods and tests, Physical Review D, 72, 2, 024028 (2005).

3 Parameters

11amrxcentrexxtracksxxvolintegralxinsidexsphere10Scope: privatex01  INT

11Description: Use output from volume integral to move AMR box centre N.

11 Range 10 x01 Default: -1
11-1:100  10-1 = do not track an AMR box centre. Otherwise track AMR box centre number N = [0,100]

11

11comxintegrandxgammaxspeedxlimit  10Scope: privatex01  REAL

11Description:

11 Range 10 x01 Default: 1e4
110:*  10Any positive number

11

11enablexfilexoutput  10Scope: privatex01  INT

11Description: Enable output file

11 Range 10 x01 Default: 1
110:1  100 = no output; 1 = yes, output to file

11enablextimexreparameterization  10Scope: privatex01  BOOLEAN

11Description: Enable time reparameterization a la http://arxiv.org/abs/1404.6523

11                                        10  x01  Default: no

11

11integrationxquantityxkeyword  10Scope: privatex01  KEYWORD

11Description: Which quantity to integrate

11 Range 10 x01 Default: nothing
11nothing  10Default, null parameter
11see [1] below  10Use integrands from step(s) immediately preceeding. Useful for Swiss-cheese-type volume integrations.
11centerofmass  10Center of Mass
11restmass  10Rest Mass
11one  10Integrand = 1. Useful for debugging

11

usepreviousintegrands

11numintegrals  10Scope: privatex01  INT

11Description: Number of volume integrals to perform

11 Range 10 x01 Default: (none)
110:1000  10zero (disable integration) or some other number

11

11outvolintegralxdir  10Scope: privatex01  STRING

11Description: Output directory for volume integration output files, overrides IO::outxdir

11 Range 10 x01 Default: (none)
11.+  10A valid directory name
11ˆ$  10An empty string to choose the default from IO::outxdir

11

11verbose  10Scope: privatex01  INT

11Description: Set verbosity level: 1=useful info; 2=moderately annoying (though useful for debugging)

11  Range  10  x01  Default: 1
110:2  100 = no output; 1=useful info; 2=moderately annoying (though useful for debugging)

11

11vivxtimexreparamxt0  10Scope: privatex01  REAL

11Description: Time reparameterization parameter tx0: Center of time reparameterization curve. SET TO BE SAME AS IN ImprovedPunctureGauge thorn

11  Range  10  x01  Default: 10.0
110:*  10Probably don’t want to set this <0, so >=0 enforced

11

11vivxtimexreparamxw  10Scope: privatex01  REAL

11Description: Time reparameterization parameter w: Width of time reparameterization curve. SET TO BE SAME AS IN ImprovedPunctureGauge thorn

11  Range  10  x01  Default: 5.0
110:*  10Probably don’t want to set this <0, so >=0 enforced

11

11volintegralxinsidexspherexxradius  10Scope: privatex01  REAL

11Description: Volume integral in a spherical region: radius of spherical region

11 Range 10 x01 Default: (none)
11*:*  10Any number

11

11volintegralxoutxevery  10Scope: privatex01  INT

11Description: How often to compute volume integrals?

11 Range 10 x01 Default: (none)
110:1000  10zero (disable integration) or some other number

11

11volintegralxoutsidexspherexxradius  10Scope: privatex01  REAL

11Description: Volume integral outside a spherical region: radius of spherical region

11 Range 10 x01 Default: (none)
11*:*  10Any number

11volintegralxspherexxcenterxxxinitial  10Scope: privatex01  REAL

11Description: Volume integral in a spherical region: x-coord of center(s)

11 Range 10 x01 Default: (none)
11*:*  10Any number

11

11volintegralxspherexxcenterxyxinitial  10Scope: privatex01  REAL

11Description: Volume integral in a spherical region: y-coord of center(s)

11 Range 10 x01 Default: (none)
11*:*  10Any number

11

11volintegralxspherexxcenterxzxinitial  10Scope: privatex01  REAL

11Description: Volume integral in a spherical region: z-coord of center(s)

11 Range 10 x01 Default: (none)
11*:*  10Any number

11

11volintegralxspherexxtracksxxamrxcentre  10Scope: privatex01  INT

11Description: Volume integral tracks AMR box centre N.

11 Range 10 x01 Default: -1
11-1:100  10-1 = do not track an AMR box centre. Otherwise track AMR box centre number N = [0,100]

11

11volintegralxusepreviousintegrandsxnumxintegrands 10Scope: privatex01  INT

11Description: Number of integrands for usepreviousintegrands, must be specified explicitly as information from previous integrand is not passed.

11  Range  10  x01  Default: 4
110:100  10Default is set to the maximum, 4.

11

11outxdir  10Scope: shared from IOx01STRING

11

4 Interfaces

General Implements: volumeintegralsxgrmhd

Inherits: grid admbase carpetregrid2 hydrobase admbase Grid Variables

4.0.1 PRIVATE GROUPS

11 x Group Names x 10  x Variable Names x  x01 Details x11x
11  volintegrands  10  x01  compact110
11                      10  VolIntegrand1  x01 dimensions113
11                      10  VolIntegrand2  x01 distribution11DEFAULT
11                      10  VolIntegrand3  x01 group type11GF
11                      10  VolIntegrand4  x01  tags11InterpNumTimelevels=1 prolongation=”none” Checkpoint=”no”
11                      10  x01 timelevels111
11                      10  x01variable type11REAL
11  volintegrals  10  x01  compact110
11                      10  VolIntegral  x01 description11Volume integrals
11                      10  x  x01 description11post-sum. The first dimension denotes which integral(s)
11                      10  VolIntegral  x01 description11and the second denotes the values of the integral(s). E.g.
11                      10  VolIntegral  x01 description11a center of mass volume integral will have 3 outputs.
11                      10  x01 dimensions112
11                      10  x01 distribution11CONSTANT
11                      10  x01 group type11ARRAY

11                      10  x01  size11101
11                      10  x  x01  size114

11                      10  x01 timelevels111
11                      10  x01variable type11REAL
11 movingsphregionintegrals 10 x01 compact110
11                      10 volintegralxinsidexspherexxcenterxx x01 description11Specify regions for volume integrals inside/outside spheres THAT MOVE.
11                      10 volintegralxinsidexspherexxcenterxy x01 dimensions111
11                      10 volintegralxinsidexspherexxcenterxz x01 distribution11CONSTANT
11                      10volintegralxoutsidexspherexxcenterxxx01 group type11ARRAY
11                      10volintegralxoutsidexspherexxcenterxyx01  size11101
11                      10volintegralxoutsidexspherexxcenterxzx01 timelevels111
11                      10  x01variable type11REAL
11 integralcountervar 10  x01  compact110
11                      10  IntegralCounter  x01 description11Counter that keeps track of which integral we are calculating.
11                      10  x01 dimensions110
11                      10  x01 distribution11CONSTANT
11                      10  x01 group type11SCALAR
11 10 x01 tags11checkpoint=”no”
11                      10  x01 timelevels111
11                      10  x01variable type11INT
11volintegralsxvacuumxtime10  x01  compact110
11                      10  physicalxtime  x01 description11keeps track of the physical time
11                      10  x  x01 description11in case time coordinate is reparameterized
11                      10  physicalxtime  x01 description11a la http://arxiv.org/abs/1404.6523
11                      10  x01 dimensions110
11                      10  x01 distribution11CONSTANT
11                      10  x01 group type11SCALAR
11 10 x01 tags11checkpoint=”no”
11                      10  x01 timelevels111
11                      10  x01variable type11REAL

5 Schedule This section lists all the variables which are assigned storage by thorn WVUThornsxDiagnostics/VolumeIntegralsxGRMHD. 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.

Storage x

11Always:  11x
11VolIntegrands VolIntegrals MovingSphRegionIntegrals IntegralCounterVar VolIntegralsxvacuumxtime11x

11x  11x

11

Scheduled Functions

CCTKxINITIAL (conditional) x vixgrmhdxfilexoutputxroutinexstartup x create directory for vi grmhd file output. x

11x11Language:11c
11 x 11Type: 11function

11

CCTKxPOSTxRECOVERxVARIABLES (conditional) x vixgrmhdxfilexoutputxroutinexstartup x create directory for vi grmhd file output. x

11x11Language:11c
11 x 11Type: 11function

11

CCTKxINITIAL x vixgrmhdxinitializeintegralcountertozero x initialize integralcounter variable to zero x

11x11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function

11

CCTKxPOSTxRECOVERxVARIABLES x vixgrmhdxinitializeintegralcountertozero x initialize integralcounter variable to zero x

11x11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function

11

CCTKxANALYSIS x vixgrmhdxinitializeintegralcounter x initialize integralcounter variable x

11x11Before: 11vixgrmhdxvolumeintegralgroup
11 x 11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function

11

CCTKxANALYSIS x vixgrmhdxvolumeintegralgroup x evaluate all volume integrals x

11x11Before:11carpetlibxprinttimestats
11 x 11x  11carpetlibxprintmemstats
11 x 11Type: 11group
11 x 11While: 11volumeintegralsxgrmhd::integralcounter

11

VIxGRMHDxVolumeIntegralGroup x vixgrmhdxcomputeintegrand x compute integrand x

11x11Before: 11dosum
11 x 11Language:11c
11 x 11Options: 11global
11 x 11x  11loop-local
11 x 11Storage: 11volintegrands
11 x 11x  11volintegrals
11 x 11x  11movingsphregionintegrals
11 x 11Type: 11function

11

VIxGRMHDxVolumeIntegralGroup x vixgrmhdxdosum x do sum x

11x11After: 11computeintegrand
11 x 11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function

11

VIxGRMHDxVolumeIntegralGroup x vixgrmhdxdecrementintegralcounter x decrement integralcounter variable x

11x11After: 11dosum
11 x 11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function

11

CCTKxANALYSIS x vixgrmhdxfilexoutput x output volumeintegral results to disk x

11x11After: 11vixgrmhdxvolumeintegralgroup
11 x 11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function