## Outﬂow

August 15 2009

Abstract

Outﬂow calculates the ﬂow of rest mass density across a SphericalSurface, eg. and apparent horizon or a sphere at “inﬁnity”.

### 1 Introduction

Hydrodynamic simulations should conserve eg. the total rest mass in the system (outside he event horizon, that is). This thorn allow to measure the ﬂux of rest mass across a given SphericalSurface.

### 2 Physical System

The Valencia formalism deﬁnes its $D=\rho W$ variable such that one can deﬁne a total rest mass density as:

$M=\int \sqrt{\gamma }D{d}^{3}x$

and from the EOM of $D$ (see [1])

$\frac{\partial }{\partial {x}^{0}}\left(\sqrt{\gamma }D\right)+\frac{\partial }{\partial {x}^{i}}\left(\sqrt{\left(}\gamma \right)\alpha D\left({v}^{i}-{\beta }^{i}∕\alpha \right)=0$

one obtains:

$\begin{array}{rcll}Ṁ& =& -{\int }_{V}\frac{\partial }{\partial {x}^{i}}\left(\sqrt{\gamma }\alpha D\left({v}^{i}-{\beta }^{i}∕\alpha \right){d}^{3}x& \text{(1)}\text{}\text{}\\ & =& -{\int }_{\partial V}\sqrt{\gamma }\alpha D\left({v}^{i}-{\beta }^{i}∕\alpha \right)d{\sigma }_{i}& \text{(2)}\text{}\text{}\end{array}$

where ${\sigma }_{i}$ is the ordinary ﬂat space directed surface element of the enclosing surface, eg.

$d{\sigma }_{i}={\stackrel{̂}{r}}_{i}{r}^{2}sin𝜃d𝜃d\varphi$

with ${\stackrel{̂}{r}}_{i}=\left[cos\varphi sin𝜃,sin\varphi sin𝜃,cos\left(𝜃\right)\right]$ for a sphere of radius r.

For a generic SphericalSurface parametrized by $𝜃$ and $\varphi$ one has:

$\begin{array}{rcll}x& =& \stackrel{̄}{r}\left(𝜃,\varphi \right)cos\varphi sin𝜃& \text{(3)}\text{}\text{}\\ y& =& \stackrel{̄}{r}\left(𝜃,\varphi \right)sin\varphi sin𝜃& \text{(4)}\text{}\text{}\\ z& =& \stackrel{̄}{r}\left(𝜃,\varphi \right)cos𝜃& \text{(5)}\text{}\text{}\end{array}$

where $\stackrel{̄}{r}$ is the isotropic radius. Consequently the surface element is

$\begin{array}{rcll}d{\sigma }_{i}& =& {\left(\frac{\partial \stackrel{\to }{\stackrel{̄}{r}}}{\partial 𝜃}×\frac{\partial \stackrel{\to }{\stackrel{̄}{r}}}{\partial \varphi }\right)}_{i}& \text{(6)}\text{}\text{}\\ & =& {\stackrel{̄}{r}}^{2}sin𝜃{\stackrel{̂}{\stackrel{̄}{r}}}_{i}-\frac{\partial \stackrel{̄}{r}}{\partial 𝜃}\stackrel{̄}{r}sin𝜃{\stackrel{̂}{𝜃}}_{i}-\frac{\partial \stackrel{̄}{r}}{\partial \varphi }\stackrel{̄}{r}{\stackrel{̂}{\varphi }}_{i}& \text{(7)}\text{}\text{}\end{array}$

where $\stackrel{̂}{\stackrel{̄}{r}}$, $\stackrel{̂}{𝜃}$ and $\stackrel{̂}{\varphi }$ are the ﬂat space standard unit vectors on the sphere [?].

### 3 Numerical Implementation

We implement the surface integral by interpolating the required quantities (${g}_{ij}$, $\rho$, ${v}^{i}$, ${\beta }^{i}$, $\alpha$) onto the spherical surface and then integrate using a fourth order convergent Newton-Cotes formula.

For the $𝜃$ direction SphericalSurfaces deﬁnes grid points such that

${𝜃}_{i}=-\left({n}_{𝜃}-1∕2\right){\Delta }_{𝜃}+i{\Delta }_{𝜃}\phantom{\rule{2em}{0ex}}0\le i<{N}_{𝜃}-1$

where ${N}_{𝜃}$ is the total number of intervals (sf_ntheta), ${n}_{𝜃}$ is the number of ghost zones in the $𝜃$ direction (nghosttheta) and ${\Delta }_{𝜃}=\frac{\pi }{{N}_{𝜃}-2n𝜃}$. Since with this

we do not have grid points at the end of the interval $\left\{0,\pi \right\}$ we derive an open extended Newton-Cotes formula from Eq. 4.1.14 of [2] and a third order accurate extrapolative rule (see Maple worksheet). We ﬁnd

$\begin{array}{rcll}{\int }_{{x}_{0}}^{{x}_{N-1}}f\left(x\right)dx& \approx & h\left\{\frac{13}{12}{f}_{1∕2}+\frac{7}{8}{f}_{3∕2}+\frac{25}{24}{f}_{5∕2}+{f}_{7∕2}+{f}_{9∕2}+\cdots +{f}_{N-1-7∕2}& \text{}\\ & & +{f}_{N-1-9∕2}+\frac{25}{24}{f}_{N-1-5∕2}+\frac{7}{8}{f}_{N-1-3∕2}+\frac{13}{12}{f}_{N-1-1∕2}\right\}+O\left(1∕{N}^{4}\right)& \text{(8)}\text{}\text{}\end{array}$

.

For the $\varphi$ direction SphericalSurfaces deﬁnes grid points such that

${\varphi }_{i}=-{n}_{\varphi }{\Delta }_{\varphi }+i{\Delta }_{\varphi }\phantom{\rule{2em}{0ex}}0\le i<{N}_{\varphi }-1$

where ${N}_{\varphi }$ is the total number of intervals (sf_nphi), ${n}_{\varphi }$ is the number of ghost zones in the $\varphi$ direction (nghostphi) and ${\Delta }_{\varphi }=\frac{\pi }{{N}_{\varphi }-2n\varphi }$. With this

we use a simple extended trapezoid rule to achieve spectral convergence due to the periodic nature of $\varphi$ (note: ${x}_{N}={x}_{0}$)

$\begin{array}{rcll}{\int }_{{x}_{0}}^{{x}_{N}}f\left(x\right)dx\approx & h\sum _{i=0}^{N-1}{f}_{i}& & \text{(9)}\text{}\text{}\end{array}$

.

The derivatives of $\stackrel{\to }{\stackrel{̄}{r}}$ along $𝜃$ and $\varphi$ are obtained numerically and require at least two ghost zones in $𝜃$ and $\varphi$.

### 4 Using This Thorn

Right now surface can only be prescribed by SphericalSurfaces, the ﬂux through each surface is output in in a ﬁle outflow_det_%d.asc

#### 4.1 Interaction With Other Thorns

Takes care to schedule itself after SphericalSurfaces_HasBeenSet.

#### 4.2 Examples

See the parameter ﬁle in the test directory. For spherical symmetric infall the ﬂux through all detectors should be equal (since rest mass must be conserved).

### References

[1]   José A. Font, “Numerical Hydrodynamics and Magnetohydrodynamics in General Relativity”, Living Rev. Relativity 11, (2008), 7. URL (cited on August 15. 2009): http://www.livingreviews.org/lrr-2008-7

[2]   Press, W. H. (2002). Numerical recipes in C++: the art of scientiﬁc computing. Array Cambridge, UK: Cambridge University Press.

### 5 Parameters

 compute_every Scope: private INT Description: How frequently to compute the outﬂow Range Default: 1 1:* number of iterations

 compute_every_det Scope: private INT Description: How frequently to compute the outﬂow Range Default: -1 -1 take from compute_every do not compute 1:* number of iterations

 coord_system Scope: private STRING Description: What is the coord system? Range Default: cart3d .* Any smart string will do

 extra_variables Scope: private STRING Description: extra (scalar) variables to project onto the spherical surface Range Default: (none) .* Any Cactus variables

 interpolator_name Scope: private STRING Description: Which interpolator should I use Range Default: Hermite polynomial interpolation .+ Any nonempty string

 interpolator_pars Scope: private STRING Description: Parameters for the interpolator Range Default: order=3 .* ”Any string that Util_TableSetFromStr ing() will take”

 num_detectors Scope: private INT Description: how many detectors do we have Range Default: (none) 0:* number of detectors

 num_thresholds Scope: private INT Description: how many thresholds to use Range Default: (none) ignore thresholds, output only one ﬂux 1:20 how many to use

 out_format Scope: private STRING Description: Which format for Scalar ﬂoating-point number output Range Default: .19g see [1] below output with given precision in exponential / ﬂoating point notation

[1]

\^({\textbackslash}.[1]?[0-9])?[EGefg]\\$

 output_2d_data Scope: private BOOLEAN Description: output 2d data on spherical surface Default: no

 output_relative_coordinates Scope: private BOOLEAN Description: output coordinates on spheroid relative to sf_centroid, absolute coordinates otherwise Default: no

 override_radius Scope: private BOOLEAN Description: do not take radius values from spherical surface Default: no

 rad_rescale Scope: private REAL Description: Factor for scaling radius for this detector surface (e.g. for buﬀer around AH surface) Range Default: 1 (0:* Anything positive

 radius Scope: private REAL Description: spherical radius for this detector surface Range Default: -1 -1 Invalid (0:* any positive value

 surface_index Scope: private INT Description: the indices of the sphericalsurfaces from which we take the surfaces to compute the outﬂow on Range Default: -1 -1 Invalid 0:* valid surface

 surface_name Scope: private STRING Description: the indices of the sphericalsurfaces from which we take the surfaces to compute the outﬂow on Range Default: (none) use surface_index .* any string

 threshold Scope: private REAL Description: compute ﬂuxes with Lorentz factors / speciﬁc energy at inﬁnity above these levels only Range Default: (none) *:* Any real number

 threshold_on_var Scope: private KEYWORD Description: Which variable to use as threshold Range Default: w_lorentz eninf (Approximate) speciﬁc energy at inﬁnity, - u_t - 1 w_lorentz Lorentz factor

 verbose Scope: private INT Description: How verbose do you want it? Range Default: 1 0:* 0 is nothing, 1 is interesting, >1 is crazy

 maxnphi Scope: shared from SPHERICALSURFACE INT

 maxntheta Scope: shared from SPHERICALSURFACE INT

 nghostsphi Scope: shared from SPHERICALSURFACE INT

 nghoststheta Scope: shared from SPHERICALSURFACE INT

 sphericalsurfaces_nsurfaces Scope: shared from SPHERICALSURFACE INT

### 6 Interfaces

Implements:

outﬂow

Inherits:

hydrobase

sphericalsurface

#### Grid Variables

##### 6.0.1 PRIVATE GROUPS
 Group Names Variable Names Details outﬂow_ﬂux compact 0 outﬂow_ﬂux description ﬂux of mass through the detectors dimensions 0 distribution CONSTANT group type SCALAR tags checkpoint=”no” timelevels 1 vararray_size num_detectors variable type REAL ﬂuxdens_projected compact 0 ﬂuxdens_projected description 2D (theta description phi) grid arrays for ﬂux density dimensions 2 distribution CONSTANT group type ARRAY size SPHERICALSURFACE::MAXNTHETA size SPHERICALSURFACE::MAXNPHI tags checkpoint=”no” timelevels 1 vararray_size num_detectors variable type REAL w_lorentz_projected compact 0 w_lorentz_projected description 2D (theta description phi) grid arrays for Lorentz factor dimensions 2 distribution CONSTANT group type ARRAY size SPHERICALSURFACE::MAXNTHETA size SPHERICALSURFACE::MAXNPHI tags checkpoint=”no” timelevels 1 vararray_size num_detectors variable type REAL eninf_projected compact 0 eninf_projected description 2D (theta description phi) grid arrays for the speciﬁc energy at inﬁnity dimensions 2 distribution CONSTANT group type ARRAY size SPHERICALSURFACE::MAXNTHETA size SPHERICALSURFACE::MAXNPHI tags checkpoint=”no” timelevels 1 vararray_size num_detectors variable type REAL surface_projections compact 0 surface_projection_0 description 2D (theta description phi) grid arrays for points on the spherical surfaces surface_projection_1 dimensions 2 surface_projection_2 distribution CONSTANT surface_projection_3 group type ARRAY surface_projection_4 size SPHERICALSURFACE::MAXNTHETA size SPHERICALSURFACE::MAXNPHI surface_projection_5 tags checkpoint=”no” surface_projection_6 timelevels 1 surface_projection_7 vararray_size num_detectors surface_projection_8 variable type REAL

### 7 Schedule

This section lists all the variables which are assigned storage by thorn EinsteinAnalysis/Outﬂow. 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

 Always: outﬂow_ﬂux ﬂuxdens_projected w_lorentz_projected eninf_projected surface_projections

#### Scheduled Functions

CCTK_ANALYSIS

outﬂow

compute outﬂow

 Language: c Options: global Type: function

CCTK_STARTUP

outﬂow_setup

set up global ompute data structures

 Language: c Options: global Type: function