aboutsummaryrefslogtreecommitdiff
path: root/doc/documentation.tex
blob: ac7b59577a2cc6550cd0d3028913da2d37edd7ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
\documentclass{article}
\usepackage{amsmath}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% ***** macro definitions etc *****
%
\bibliographystyle{alpha}

% misc text stuff
\def\code#1{{\tt #1}}			% for formatting code
\def\defn#1{``#1''}			% definition of a term
\def\eg{\hbox{eg.\hbox{}}}
\def\ie{\hbox{i.e.\hbox{}}}
\def\ahf{\code{AHFinderDirect}}		% our own name
\def\Strahlkoerper{Strahl\-k\"{o}rper}           % Minkowski's term

% get size/spacing of "++" right, cf online C++ FAQ question 35.1
\def\Cplusplus{\hbox{C\raise.25ex\hbox{\footnotesize ++}}}

% misc math mode stuff
\def\ltsim{\lesssim}
\def\gtsim{\gtrsim}
\def\tfrac#1#2{{\textstyle\frac{#1}{#2}}}
\def\dfrac#1#2{{\displaystyle\frac{#1}{#2}}}
\def\thalf{\tfrac{1}{2}}
\def\const{{\rm const}}
\def\ij{{ij}}
\def\uv{{uv}}
\def\del{\nabla}

\def\A{{\cal A}}                % 2-D (continuous) domain of angular coords

\def\I{{\text{\scriptsize I}}}                  % grid-point index
\def\J{{\text{\scriptsize J}}}                  % grid-point index
\def\K{{\text{\scriptsize K}}}                  % grid-point index
\def\M{{\text{\scriptsize M}}}                  % molecule index

\def\Jac[#1]{{\bf J} \Bigl[ #1 \Bigr]}          % discrete Jacobian for fn #1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% ***** title/author/abstract *****
%

\begin{document}
\title{The \ahf{} Thorn}
\author{Jonathan Thornburg\quad{}\code{<jthorn@aei.mpg.de>}}
%
% We want CVS to expand the Id keyword on the next line, but we don't
% want TeX to go into math mode to typeset the expansion (because that
% wouldn't look as nice in the output), so we use the "$ $" construct
% to get TeX out of math mode again when typesetting the expansion.
%
\date{$ $Id$ $}
\maketitle

\abstract{
This document describes the \ahf{} thorn.  This thorn locates
apparent horizons in a numerically computed slice using a direct
method, posing the apparent horizon equation as an elliptic PDE
on angular-coordinate space.  This is very fast, but requires a
``reasonable'' initial guess.
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Introduction}

The basic algorithm of this thorn is that of
\cite{Thornburg-1996-horizon-finding}:
We pose the apparent horizon equation
\begin{equation}
H \equiv \del_i n^i + K_\ij n^i n^j - K = 0
							\label{eqn-horizon}
\end{equation}
(where $n^i$ is the outward-pointing unit normal to the horizon)
as an elliptic PDE on angular-coordinate space.

We assume that a local coordinate origin has been chosen such that
the horizon is a \defn{\Strahlkoerper}, defined by Minkowski as
   ``a region in $n$-dimensional Euclidean space containing
     the origin and whose surface, as seen from the origin,
     exhibits only one point in any direction''
(Ref.~\cite[p.~108]{Schroeder-1986-number-theory}).
Introducing generic angular coordinates $(\rho,\sigma)$, we can thus
parameterize the horizon's shape by $r = h(\rho,\sigma)$ for some
single-valued \defn{horizon shape function} $h$ defined on the
2-dimensional domain $\A$ of the angular coordinates $(\rho,\sigma)$.

Finite differencing~\eqref{eqn-horizon}, we obtain a system of
simultaneous nonlinear algebraic equations for $h$ at the angular
grid points.  We solve this system of equations by Newton's method
(or a variant with improved convergence).

This algorithm has 3 main parts:
\begin{itemize}
\item	Evaluation of the ``horizon function'' $H(h)$.
\item	Evaluation of the Jacobian $\Jac[H(h)]$ of $H(h)$.
\item	Solving the nonlinear equations $H(h) = 0$ by Newton's method
	or a variant.
\end{itemize}
(These all actually apply to the finite differenced equations.)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Notation}

We use the following notation:
\begin{center}
\begin{tabular}{ll}
$x^i \equiv (x,y,z)$
		& 3-dimensional Cartesian coordinates			\\
$ijkl$		& indices ranging over $x^i$ coordinates		\\
$r$		& the Euclidean radius $(x^2 + y^2 + z^2)^{1/2}$	\\
$y^u \equiv (\rho,\sigma)$
		& the 2-dimensional angular coordinates on $S^2$	\\
$uvw$		& indices ranging over $y^u$ coordinates		%%%\\
\end{tabular}
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Evaluating the Horizon Function}

The key problem here is that in Cactus we only know the 3-metric $g_\ij$
and extrinsic curvature $K_\ij$ on a Cartesian ($xyz$) grid.  Following
\cite{Thornburg-1996-horizon-finding}, we define the function
$F(x^i) = r - h(\rho,\sigma)$, then define an outward-pointing
normal field (in general {\em not\/} of unit norm) on the horizon,
$s_i \equiv \del_i F$.  Then by equations~\hbox{(14)} and~\hbox{(15)}
of \cite{Thornburg-1996-horizon-finding}, we have
\begin{subequations}
							\label{eqn-ABCD(s-d)}
\begin{equation}
H = \frac{A}{D^{3/2}} + \frac{B}{D^{1/2}} + \frac{C}{D} - K
					\,\text{,}	% text punctuation
\end{equation}
where the subexpressions $A$, $B$, $C$, and $D$ are given by
\begin{eqnarray}
A       & = &   {}
		- (g^{ik} s_k) (g^{jl} s_l) \partial_i s_j
		- \thalf (g^{ij} s_j) \Bigl[ (\partial_i g^{kl}) s_k s_l \Bigr]
									\\
B       & = &   (\partial_i g^{ij}) s_j
		+ g^{ij} \partial_i s_j
		+ (\partial_i \ln \sqrt{g}) (g^{ij} s_j)
									\\
C       & = &   K^{ij} s_i s_j
									\\
D       & = &   g^{ij} s_i s_j
					\,\text{.}	% text punctuation
									%%%\\
\end{eqnarray}
\end{subequations}

The problem of evaluating $H(h)$ thus reduces to that of evaluating
$s_i$ and $\partial_i s_j$, given $h$ on a $(\rho,\sigma)$ grid
and given $g_\ij$ and $K_\ij$ on an $(x,y,z)$ grid.  To do this, we
observe that given 3-D coordinates $x^i$,
\begin{eqnarray}
s_i	& \equiv &
		\del_i F
									\\
	& = &	\del_i r - \del_i h(\rho,\sigma)
									\\
	& = &	\frac{\partial r}{\partial x^i}
		-
		\frac{\partial h}{\partial y^u}
		\left. \frac{\partial y^u}{\partial x^i} \right|_{x^j}
									\\
	& = &	\frac{x^i}{r}
		-
		X^u{}_i \partial_u h
					\,\text{,}	% text punctuation
							\label{eqn-s-i(h)}
									%%%\\
\end{eqnarray}
where we define the coefficients
\begin{equation}
X^u{}_i \equiv \frac{\partial y^u}{\partial x^i}
					\,\text{.}	% text punctuation
\end{equation}
We now have
\begin{eqnarray}
\partial_i s_j
	& \equiv &
		\frac{\partial s_i}{\partial x^j}
									\\
	& = &	\frac{\partial}{\partial x^j}
		\left(
		\frac{x^i}{r}
		-
		X^u{}_i \frac{\partial h}{\partial y^u}
		\right)
									\\
	& = &	\frac{\partial (x^i/r)}{\partial x^j}
		-
		(\partial_j X^u{}_i ) \frac{\partial h}{\partial y^u}
		-
		X^u{}_i \left(
			\frac{\partial}{\partial y^w}
			\frac{\partial h}{\partial y^u}
			\frac{\partial y^w}{\partial x^j}
			\right)
					\,\text{.}	% text punctuation
									%%%\\
\end{eqnarray}
A straightforward calculation gives the first term as
\begin{equation}
\frac{\partial (x^i/r)}{\partial x^j}
	= \begin{cases}
	  \dfrac{\sum_{k \neq i} (x^k)^2}{r^3}	& \text{if $i = j$}
								\\[2ex]
	  - \dfrac{x^i x^j}{r^3}	& \text{if $i \neq j$}	%%%\\
	  \end{cases}
\end{equation}
For the second term, we define the coefficients
\begin{equation}
X^u{}_\ij \equiv \frac{\partial y^u}{\partial x^i \partial x^j}
\end{equation}
The final result is that
\begin{equation}
\partial_i s_j
	= \left.
	  \begin{cases}
	  \dfrac{\sum_{k \neq i} (x^k)^2}{r^3}	& \text{if $i = j$}
								\\[2ex]
	  - \dfrac{x^i x^j}{r^3}	& \text{if $i \neq j$}	%%%\\
	  \end{cases}
	  \right\}
	  - X^u{}_\ij \partial_u y
	  - X^u{}_i X^v{}_j \partial_\uv h
						\label{eqn-partial-i-s-j(h)}
\end{equation}

Using~\eqref{eqn-ABCD(s-d)}, \eqref{eqn-s-i(h)},
 and~\eqref{eqn-partial-i-s-j(h)}, we can evaluate $H(h)$ using
only angular-coordinate derivatives of $h$ and $xyz$-coordinate
derivatives of $g^\ij$ and $\ln \sqrt{g}$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Implementation Notes}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Overview}

The \ahf{} thorn is written primarily in \Cplusplus{}, calling
C and Fortran~77 numerical libraries.  \Cplusplus{} has proven to be
a powerful and flexible language for this type of programming, and
I think this thorn (particularly the interpatch interpolation) would
have been significantly harder to write in a lower-level language
like C or Fortran~77.

The implementation is only loosely coupled to Cactus -- in general
the code uses its own types and classes, which are implemented on
top of the Cactus ones.  Notably, all floating point arithmetic is
done using the type \code{fp}, a typedef for \code{CCTK\_REAL}.

The code should be fairly portable to modern \Cplusplus{} compilers.
Templates are used, but only template classes templated on floating-point
or integer types, and these templates are always instantiated explicitly.
\code{bool}, \code{mutable}, and \code{typename} are used, as are the
new \code{for}-loop scope rules.  The code has been compiled and run
successfully using gcc~2.95.2 on x86 GNU/Linux systems and using
Digital C~V5.6 on Digital Unix~V4.0.  The code won't compile using
badly broken compilers like the current (mid-2001) version of Microsoft
Visual \Cplusplus.)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Maple Code}

The relativity code is all machine-generated from Maple code, which
also uses a Maple preprocessor I wrote in Perl.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\bibliography{jt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}