% *======================================================================*
%  Cactus Thorn template for ThornGuide documentation
%  Author: Ian Kelley
%  Date: Sun Jun 02, 2002
%  $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $
%
%  Thorn documentation in the latex file doc/documentation.tex
%  will be included in ThornGuides built with the Cactus make system.
%  The scripts employed by the make system automatically include
%  pages about variables, parameters and scheduling parsed from the
%  relevant thorn CCL files.
%
%  This template contains guidelines which help to assure that your
%  documentation will be correctly added to ThornGuides. More
%  information is available in the Cactus UsersGuide.
%
%  Guidelines:
%   - Do not change anything before the line
%       % START CACTUS THORNGUIDE",
%     except for filling in the title, author, date, etc. fields.
%        - Each of these fields should only be on ONE line.
%        - Author names should be separated with a \\ or a comma.
%   - You can define your own macros, but they must appear after
%     the START CACTUS THORNGUIDE line, and must not redefine standard
%     latex commands.
%   - To avoid name clashes with other thorns, 'labels', 'citations',
%     'references', and 'image' names should conform to the following
%     convention:
%       ARRANGEMENT_THORN_LABEL
%     For example, an image wave.eps in the arrangement CactusWave and
%     thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps
%   - Graphics should only be included using the graphicx package.
%     More specifically, with the "\includegraphics" command.  Do
%     not specify any graphic file extensions in your .tex file. This
%     will allow us to create a PDF version of the ThornGuide
%     via pdflatex.
%   - References should be included with the latex "\bibitem" command.
%   - Use \begin{abstract}...\end{abstract} instead of \abstract{...}
%   - Do not use \appendix, instead include any appendices you need as
%     standard sections.
%   - For the benefit of our Perl scripts, and for future extensions,
%     please use simple latex.
%
% *======================================================================*
%
% Example of including a graphic image:
%    \begin{figure}[ht]
% 	\begin{center}
%    	   \includegraphics[width=6cm]{/home/runner/work/tests/tests/arrangements/EinsteinAnalysis/Outflow/doc/MyArrangement_MyThorn_MyFigure}
% 	\end{center}
% 	\caption{Illustration of this and that}
% 	\label{MyArrangement_MyThorn_MyLabel}
%    \end{figure}
%
% Example of using a label:
%   \label{MyArrangement_MyThorn_MyLabel}
%
% Example of a citation:
%    \cite{MyArrangement_MyThorn_Author99}
%
% Example of including a reference
%   \bibitem{MyArrangement_MyThorn_Author99}
%   {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999),
%   1--16. {\tt http://www.nowhere.com/}}
%
% *======================================================================*

% If you are using CVS use this line to give version information
% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $

\documentclass{article}

% Use the Cactus ThornGuide style file
% (Automatically used from Cactus distribution, if you have a
%  thorn without the Cactus Flesh download this from the Cactus
%  homepage at www.cactuscode.org)
\usepackage{../../../../../doc/latex/cactus}

\newlength{\tableWidth} \newlength{\maxVarWidth} \newlength{\paraWidth} \newlength{\descWidth} \begin{document}

% The author of the documentation
\author{Roland Haas \textless roland.haas@physcis.gatech.edu\textgreater}

% The title of the document (not necessarily the name of the Thorn)
\title{Outflow}

% the date your document was last changed, if your document is in CVS,
% please use:
%    \date{$ $Date: 2004/01/07 20:12:39 $ $}
\date{August 15 2009}

\maketitle

% Do not delete next line
% START CACTUS THORNGUIDE

% Add all definitions used in this documentation here
%   \def\mydef etc

% Add an abstract for this thorn's documentation
\begin{abstract}
    Outflow calculates the flow of rest mass density  across a
    SphericalSurface, eg. and apparent horizon or a sphere at ``infinity''.
\end{abstract}

% The following sections are suggestive only.
% Remove them or add your own.

\section{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 flux of
rest mass across a given SphericalSurface.

\section{Physical System}
The Valencia formalism defines its $D = \rho W$ variable such that one can define a 
total rest mass density as:
\begin{displaymath}
    M = \int \sqrt{\gamma} D d^3x
\end{displaymath}
and from the EOM of $D$ (see~\cite{lrr-font})
\begin{displaymath}
    \frac{\partial }{\partial x^0} (\sqrt{\gamma}D )+ 
    \frac{\partial }{\partial x^i} (\sqrt{\gamma} \alpha D (v^i-
      \beta^i/\alpha)) = 0
\end{displaymath}
one obtains:
\begin{eqnarray}
\dot M
&=& - \int_V \frac{\partial }{\partial x^i} 
   (\sqrt\gamma \alpha D(v^i - \beta^i/\alpha)) d^3x \\
&=& -\int_{\partial V} \sqrt\gamma \alpha D (v^i-\beta^i/\alpha) d\sigma_i
\end{eqnarray}
where $\sigma_i$ is the ordinary flat space directed surface element of 
the enclosing surface, eg.\
\begin{displaymath}
d\sigma_i = \hat r_i r^2 \sin\theta d\theta d\phi
\end{displaymath}
with $\hat r_i = [\cos\phi\sin\theta, \sin\phi\sin\theta,
\cos(\theta)]$ 
for a sphere of radius r.

For a generic SphericalSurface parametrized by $\theta$ and $\phi$ one has:
\begin{eqnarray}
    x &=& \bar r(\theta, \phi) \cos\phi \sin\theta \\
    y &=& \bar r(\theta, \phi) \sin\phi \sin\theta \\
    z &=& \bar r(\theta, \phi)          \cos\theta
\end{eqnarray}
where $\bar r$ is the isotropic radius.
Consequently the surface element is
\begin{eqnarray}
    d \sigma_i 
    &=& \left( 
        \frac{\partial\vec{\bar r}}{\partial\theta} \times
        \frac{\partial\vec{\bar r}}{\partial\phi}
        \right)_i \\
    &=& \bar r^2 \sin\theta \hat{\bar r}_i 
        - \frac{\partial\bar r}{\partial\theta} \bar r \sin \theta \hat \theta_i
        - \frac{\partial\bar r}{\partial\phi} \bar r \hat \phi_i
\end{eqnarray}
where $\hat{\bar r}$, $\hat \theta$ and $\hat \phi$ are the flat space
standard unit vectors on the sphere~\cite{mtw:73}. 

\section{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
$\theta$ direction SphericalSurfaces defines grid points such that
\begin{displaymath}
    \theta_i = -(n_\theta - 1/2) \Delta_\theta + i \Delta_\theta \qquad
    0 \le i < N_\theta-1
\end{displaymath}
where $N_\theta$ is the total number of intervals (\verb|sf_ntheta|),
$n_\theta$ is the number of ghost zones in the $\theta$ direction
(\verb|nghosttheta|) and $\Delta_\theta = \frac{\pi}{N_\theta-2n\theta}$.
Since with this 
\begin{displaymath}
    \theta_i \in [\Delta_\theta/2, \pi - \Delta_\theta/2] \qquad 
    \mbox{for $i \in [n_\theta, N_\theta-n_\theta-1]$}
\end{displaymath}
we do not have grid points at the end of the interval $\{0,\pi\}$ we derive
an open extended Newton-Cotes formula from Eq.~4.1.14 of~\cite{nr-cpp-2nd} and
a third order accurate extrapolative rule (see Maple worksheet). We find
\begin{eqnarray}
    \int_{x_0}^{x_{N-1}} f(x) dx &\approx& h \Bigl\{ 
    \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} \nonumber \\
    && + 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}
    \Bigr\} + O(1/N^4)
\end{eqnarray}.

For the
$\phi$ direction SphericalSurfaces defines grid points such that
\begin{displaymath}
    \phi_i = -n_\phi \Delta_\phi + i \Delta_\phi \qquad
    0 \le i < N_\phi-1
\end{displaymath}
where $N_\phi$ is the total number of intervals (\verb|sf_nphi|),
$n_\phi$ is the number of ghost zones in the $\phi$ direction
(\verb|nghostphi|) and $\Delta_\phi = \frac{\pi}{N_\phi-2n\phi}$.
With this 
\begin{displaymath}
    \phi_i \in [0, 2 \pi - \Delta_\phi] \qquad 
    \mbox{for $i \in [n_\phi, N_\phi-n_\phi-1]$}
\end{displaymath}
we use a simple extended trapezoid rule to achieve spectral convergence due to
the periodic nature of $\phi$ (note: $x_N = x_0$)
\begin{eqnarray}
    \int_{x_0}^{x_N} f(x) dx  \approx& h \sum_{i=0}^{N-1} f_i
\end{eqnarray}.

The derivatives of $\vec{\bar r}$ along $\theta$ and $\phi$ are obtained
numerically and require at least two ghost zones in $\theta$ and $\phi$.

\section{Using This Thorn}
Right now surface can only be prescribed by SphericalSurfaces, the flux through
each surface is output in in a file \verb|outflow_det_%d.asc|

\subsection{Interaction With Other Thorns}
Takes care to schedule itself after \verb|SphericalSurfaces_HasBeenSet|.

\subsection{Examples}
See the parameter file in the test directory. For spherical symmetric infall
the flux through all detectors should be equal (since rest mass must be
conserved).

\begin{thebibliography}{9}
    \bibitem{lrr-font} Jos\'e 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

    \bibitem{nr-cpp-2nd} Press, W. H. (2002). Numerical recipes in C++: the
        art of scientific computing. Array Cambridge, UK: Cambridge University
        Press. 

    \bibitem{mtw:73} Charles W. Misner, Kip S. Thorne, and John Archibald Wheeler (1973).
       ``Gravitation''. New York: W.H. Freeman and Company.
\end{thebibliography}

% Do not delete next line
% END CACTUS THORNGUIDE



\section{Parameters} 


\parskip = 0pt

\setlength{\tableWidth}{160mm}

\setlength{\paraWidth}{\tableWidth}
\setlength{\descWidth}{\tableWidth}
\settowidth{\maxVarWidth}{output\_relative\_coordinates}

\addtolength{\paraWidth}{-\maxVarWidth}
\addtolength{\paraWidth}{-\columnsep}
\addtolength{\paraWidth}{-\columnsep}
\addtolength{\paraWidth}{-\columnsep}

\addtolength{\descWidth}{-\columnsep}
\addtolength{\descWidth}{-\columnsep}
\addtolength{\descWidth}{-\columnsep}
\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{compute\_every} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em How frequently to compute the outflow}} \\
\hline{\bf Range} & &  {\bf Default:} 1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 1:*} & \multicolumn{2}{p{\paraWidth}|}{number of iterations} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{compute\_every\_det} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em How frequently to compute the outflow}} \\
\hline{\bf Range} & &  {\bf Default:} -1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering -1} & \multicolumn{2}{p{\paraWidth}|}{take from compute\_every} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering } & \multicolumn{2}{p{\paraWidth}|}{do not compute} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 1:*} & \multicolumn{2}{p{\paraWidth}|}{number of iterations} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{coord\_system} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em What is the coord system?}} \\
\hline{\bf Range} & &  {\bf Default:} cart3d \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering .*} & \multicolumn{2}{p{\paraWidth}|}{Any smart string will do} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{extra\_variables} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em extra (scalar) variables to project onto the spherical surface}} \\
\hline{\bf Range} & &  {\bf Default:} (none) \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering .*} & \multicolumn{2}{p{\paraWidth}|}{Any Cactus variables} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{interpolator\_name} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Which interpolator should I use}} \\
\hline{\bf Range} & &  {\bf Default:} Hermite polynomial interpolation \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering .+} & \multicolumn{2}{p{\paraWidth}|}{Any nonempty string} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{interpolator\_pars} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Parameters for the interpolator}} \\
\hline{\bf Range} & &  {\bf Default:} order=3 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering .*} & \multicolumn{2}{p{\paraWidth}|}{"Any string that Util\_TableSetFromStr 
ing() will take"} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{num\_detectors} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em how many detectors do we have}} \\
\hline{\bf Range} & &  {\bf Default:} (none) \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 0:*} & \multicolumn{2}{p{\paraWidth}|}{number of detectors} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{num\_thresholds} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em how many thresholds to use}} \\
\hline{\bf Range} & &  {\bf Default:} (none) \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering } & \multicolumn{2}{p{\paraWidth}|}{ignore thresholds, output only one flux} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 1:20} & \multicolumn{2}{p{\paraWidth}|}{how many to use} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{out\_format} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Which format for Scalar floating-point number output}} \\
\hline{\bf Range} & &  {\bf Default:} .19g \\\multicolumn{1}{|p{\maxVarWidth}|}{see [1] below} & \multicolumn{2}{p{\paraWidth}|}{output with given precision in exponential / floating point notation} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent {\bf [1]} \noindent \begin{verbatim}\^({\textbackslash}.[1]?[0-9])?[EGefg]\$\end{verbatim}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{output\_2d\_data} & {\bf Scope:} private & BOOLEAN \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em output 2d data on spherical surface}} \\
\hline & & {\bf Default:} no \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{output\_relative\_coordinates} & {\bf Scope:} private & BOOLEAN \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em output coordinates on spheroid relative to sf\_centroid, absolute coordinates otherwise}} \\
\hline & & {\bf Default:} no \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{override\_radius} & {\bf Scope:} private & BOOLEAN \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em do not take radius values from spherical surface}} \\
\hline & & {\bf Default:} no \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{rad\_rescale} & {\bf Scope:} private & REAL \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Factor for scaling radius for this detector surface (e.g. for buffer around AH surface)}} \\
\hline{\bf Range} & &  {\bf Default:} 1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering (0:*} & \multicolumn{2}{p{\paraWidth}|}{Anything positive} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{radius} & {\bf Scope:} private & REAL \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em spherical radius for this detector surface}} \\
\hline{\bf Range} & &  {\bf Default:} -1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering -1} & \multicolumn{2}{p{\paraWidth}|}{Invalid} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering (0:*} & \multicolumn{2}{p{\paraWidth}|}{any positive value} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{surface\_index} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em the indices of the sphericalsurfaces from which we take the surfaces to compute the outflow on}} \\
\hline{\bf Range} & &  {\bf Default:} -1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering -1} & \multicolumn{2}{p{\paraWidth}|}{Invalid} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 0:*} & \multicolumn{2}{p{\paraWidth}|}{valid surface} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{surface\_name} & {\bf Scope:} private & STRING \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em the indices of the sphericalsurfaces from which we take the surfaces to compute the outflow on}} \\
\hline{\bf Range} & &  {\bf Default:} (none) \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering } & \multicolumn{2}{p{\paraWidth}|}{use surface\_index} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering .*} & \multicolumn{2}{p{\paraWidth}|}{any string} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{threshold} & {\bf Scope:} private & REAL \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em compute fluxes with Lorentz factors / specific energy at infinity above these levels only}} \\
\hline{\bf Range} & &  {\bf Default:} (none) \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering *:*} & \multicolumn{2}{p{\paraWidth}|}{Any real number} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{threshold\_on\_var} & {\bf Scope:} private & KEYWORD \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Which variable to use as threshold}} \\
\hline{\bf Range} & &  {\bf Default:} w\_lorentz \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering eninf} & \multicolumn{2}{p{\paraWidth}|}{(Approximate) specific energy at infinity, - u\_t - 1} \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering w\_lorentz} & \multicolumn{2}{p{\paraWidth}|}{Lorentz factor} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{verbose} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em How verbose do you want it?}} \\
\hline{\bf Range} & &  {\bf Default:} 1 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering 0:*} & \multicolumn{2}{p{\paraWidth}|}{0 is nothing, 1 is interesting, {\textgreater}1 is crazy} \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{maxnphi} & {\bf Scope:} shared from SPHERICALSURFACE & INT \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{maxntheta} & {\bf Scope:} shared from SPHERICALSURFACE & INT \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{nghostsphi} & {\bf Scope:} shared from SPHERICALSURFACE & INT \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{nghoststheta} & {\bf Scope:} shared from SPHERICALSURFACE & INT \\\hline
\end{tabular*}

\vspace{0.5cm}\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{sphericalsurfaces\_nsurfaces} & {\bf Scope:} shared from SPHERICALSURFACE & INT \\\hline
\end{tabular*}

\vspace{0.5cm}\parskip = 10pt 

\section{Interfaces} 


\parskip = 0pt

\vspace{3mm} \subsection*{General}

\noindent {\bf Implements}: 

outflow
\vspace{2mm}

\noindent {\bf Inherits}: 

admbase

hydrobase

sphericalsurface
\vspace{2mm}
\subsection*{Grid Variables}
\vspace{5mm}\subsubsection{PRIVATE GROUPS}

\vspace{5mm}

\begin{tabular*}{150mm}{|c|c@{\extracolsep{\fill}}|rl|} \hline 
~ {\bf Group Names} ~ & ~ {\bf Variable Names} ~  &{\bf Details} ~ & ~\\ 
\hline 
outflow\_flux & outflow\_flux & compact & 0 \\ 
 &  & description & flux of mass through the detectors \\ 
 &  & dimensions & 0 \\ 
 &  & distribution & CONSTANT \\ 
 &  & group type & SCALAR \\ 
 &  & tags & checkpoint="no" \\ 
 &  & timelevels & 1 \\ 
 &  & vararray\_size & num\_detectors \\ 
 &  & variable type & REAL \\ 
\hline 
fluxdens\_projected & fluxdens\_projected & compact & 0 \\ 
 &  & description & 2D (theta \\ 
& ~ & description & phi) grid arrays for flux 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 \\ 
\hline 
w\_lorentz\_projected & w\_lorentz\_projected & compact & 0 \\ 
 &  & 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 \\ 
\hline 
eninf\_projected & eninf\_projected & compact & 0 \\ 
 &  & description & 2D (theta \\ 
& ~ & description & phi) grid arrays for the specific energy at infinity \\ 
 &  & 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 \\ 
\hline 
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 \\ 
\hline 
\end{tabular*} 



\vspace{5mm}\parskip = 10pt 

\section{Schedule} 


\parskip = 0pt


\noindent This section lists all the variables which are assigned storage by thorn EinsteinAnalysis/Outflow.  Storage can either last for the duration of the run ({\bf Always} means that if this thorn is activated storage will be assigned, {\bf 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.


\subsection*{Storage}

\hspace{5mm}

 \begin{tabular*}{160mm}{ll} 

{\bf Always:}&  ~ \\ 
 outflow\_flux & ~\\ 
 fluxdens\_projected & ~\\ 
 w\_lorentz\_projected & ~\\ 
 eninf\_projected & ~\\ 
 surface\_projections & ~\\ 
~ & ~\\ 
\end{tabular*} 


\subsection*{Scheduled Functions}
\vspace{5mm}

\noindent {\bf CCTK\_ANALYSIS} 

\hspace{5mm} outflow 

\hspace{5mm}{\it compute outflow } 


\hspace{5mm}

 \begin{tabular*}{160mm}{cll} 
~ & Language:  & c \\ 
~ & Options:  & global \\ 
~ & Type:  & function \\ 
\end{tabular*} 


\vspace{5mm}

\noindent {\bf CCTK\_STARTUP} 

\hspace{5mm} outflow\_setup 

\hspace{5mm}{\it set up global ompute data structures } 


\hspace{5mm}

 \begin{tabular*}{160mm}{cll} 
~ & Language:  & c \\ 
~ & Options:  & global \\ 
~ & Type:  & function \\ 
\end{tabular*} 



\vspace{5mm}\parskip = 10pt 
\end{document}
