Skip to content

Commit c9d33e4

Browse files
authored
Merge pull request #23 from chcheng3/main
NewRadX: Update documentation.tex
2 parents 9925591 + 1abf3bb commit c9d33e4

File tree

2 files changed

+139
-90
lines changed

2 files changed

+139
-90
lines changed

NewRadX/doc/documentation.tex

+138-89
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
% the date your document was last changed, if your document is in CVS,
9292
% please use:
9393
% \date{$ $Date$ $}
94-
\date{July 27 2023}
94+
\date{April 17 2024}
9595

9696
\maketitle
9797

@@ -103,31 +103,33 @@
103103

104104
% Add an abstract for this thorn's documentation
105105
\begin{abstract}
106-
This thorn implements the radiative boundary condition originally introduced
107-
in the Carpet-based NewRad thorn.
106+
This thorn implements radiative boundary conditions for \code{CarpetX}. The
107+
original implementation was introduced in the \code{Carpet}-based \code{NewRad}
108+
thorn in the \code{EinsteinEvolve}~\cite{SpacetimeX_NewRadX_EinsteinEvolve}
109+
arrangement.
108110
\end{abstract}
109111

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

113115
\section{Introduction}
114116
This thorn provides routines to implement radiative boundary conditions as
115-
described in section VI of~\cite{EinsteinEvolve_NewRad_Alcubierre:2002kk}:
117+
described in section VI of~\cite{SpacetimeX_NewRadX_Alcubierre:2002kk}:
116118
\begin{equation}
117119
f = f_0 + u(r - v t)/r\mbox{,}
118-
\label{eqn:EinsteinEvolve_NewRad_bc}
120+
\label{eqn:SpacetimeX_NewRadX_bc}
119121
\end{equation}
120122
in its differential form
121123
\begin{equation}
122124
\partial_t f + v \partial_r f - v\,(f - f_0) = 0\mbox{,}
123-
\label{eqn:EinsteinEvolve_NewRad_diff_bc}
125+
\label{eqn:SpacetimeX_NewRadX_diff_bc}
124126
\end{equation}
125127
where $v$ is the asymptotic propagation speed of the field $f$ and $f_0$
126128
is its asymptotic value.
127129

128130
\section{Physical System}
129131
% RH: this is copied verbatim from Alcubierre:2002kk
130-
Quoting~\cite{EinsteinEvolve_NewRad_Alcubierre:2002kk}:
132+
Quoting~\cite{SpacetimeX_NewRadX_Alcubierre:2002kk}:
131133

132134
At the outer boundary we use a radiation (Sommerfeld) boundary
133135
condition. We start from the assumption that near the boundary all
@@ -184,7 +186,7 @@ \section{Physical System}
184186
\begin{equation}
185187
\frac{x_i}{r} \, \partial_t f + v \partial_i f + \frac{v x_i}{r^2} \,
186188
\left( f - f_0 \right) \simeq \frac{x_i h'(t)}{r^{n+1}} .
187-
\label{eqn:EinsteinEvolve_NewRad_num_bc}
189+
\label{eqn:SpacetimeX_NewRadX_num_bc}
188190
\end{equation}
189191

190192
This expression still contains the unknown function $h'(t)$. Having
@@ -195,26 +197,33 @@ \section{Physical System}
195197
boundary condition on its own.
196198

197199
\section{Numerical Implementation}
198-
The thorn implements to ingredients for the evolution.
199-
\begin{enumerate}
200-
\item the boundary condition~\eqref{eqn:EinsteinEvolve_NewRad_num_bc},
201-
\item a routine to extrapolate the contracted Christoffel symbols
202-
$g^{jk} \Gamma^i_{jk}$ (\code{Xt1}\ldots\code{Xt3} in the code) into the
203-
outer boundaries at $t=0$.
204-
\end{enumerate}
205-
206-
\subsection{Extrapolation}
207-
At outer boundary points, as determined by \code{GenericFD}'s routine
208-
\code{GenericFD\_GetBoundaryInfo} we use cubic polynomials along the
209-
normal of the boundary to extrapolate data from the interior into the
210-
boundary region. Due to the use of cubic polynomial we require at least
211-
four (4) points of valid data to be available for the extrapolation.
212-
This \emph{includes} ghost zones, which are assumed to contain valid
213-
data in the interior of the domain.
200+
The thorn implements the boundary condition
201+
~\eqref{eqn:SpacetimeX_NewRadX_num_bc} for the evolution. The original
202+
\code{Carpet}-based version of \code{NewRad} provides an additional
203+
routine \code{ExtrapolateGammas}, which can be used to extrapolate
204+
a grid function from the interior to the outer boundaries at $t=0$.
205+
Originally, this was used in the BSSN evolution thorn \code{ML\_BSSN}
206+
on the contracted Christoffel symbols
207+
$g^{jk} \Gamma^i_{jk}$ (\code{Xt1}\ldots\code{Xt3} in the code).
208+
This extrapolation routine is not yet ported over to the current version
209+
of \code{NewRadX}.
210+
211+
212+
% \subsection{Extrapolation}
213+
% In the \code{CarpetX} version of NewRadX, the boundary information is
214+
% obtained from the \code{Loop} thorn.
215+
%
216+
% At outer boundary points, as determined by \code{GenericFD}'s routine
217+
% \code{GenericFD\_GetBoundaryInfo} we use cubic polynomials along the
218+
% normal of the boundary to extrapolate data from the interior into the
219+
% boundary region. Due to the use of cubic polynomial we require at least
220+
% four (4) points of valid data to be available for the extrapolation.
221+
% This \emph{includes} ghost zones, which are assumed to contain valid
222+
% data in the interior of the domain.
214223

215224
\subsection{Radiative boundary condition}
216225
The derivatives $\partial_i f$ appearing in
217-
\eqref{eqn:EinsteinEvolve_NewRad_num_bc} are approximated as
226+
\eqref{eqn:SpacetimeX_NewRadX_num_bc} are approximated as
218227
2\textsuperscript{nd} order accurate finite difference expressions using
219228
centred expressions
220229
\begin{equation}
@@ -233,100 +242,128 @@ \subsection{Radiative boundary condition}
233242
that does not behave as a pure wave (i.e.\ Coulomb type
234243
terms caused by infall of the coordinate lines).
235244

236-
This we do by comparing the source term one grid point
245+
This we do by comparing the source term \code{nghostzones} grid points
237246
away from the boundary (which we already have), to what
238247
we would have obtained if we had used the boundary
239-
condition there. The difference gives us an idea of the
248+
condition there. The difference gives us an idea of the
240249
missing part and we extrapolate that to the boundary
241250
assuming a power-law decay.
242251

243252
\section{Using This Thorn}
244-
The thorn exports two aliased functions \code{ExtrapolateGammas} and
245-
\code{NewRad\_Apply} that should be used in \code{INITIAL} and
246-
\code{MoL\_CalcRHS} respectively to extrapolate the contracted
247-
Christoffel symbols and apply radiative boundary conditions to evolved
248-
variables respectively.
253+
The thorn provides the routine \code{NewRadX\_Apply}, which should be scheduled
254+
in the \code{ODESolvers\_RHS} bin to apply radiative boundary conditions on
255+
evolved variables. To use it in an evolution thorn, it can either be called
256+
inside the RHS evaluation routine, or scheduled in a separate function right
257+
after the RHS routine.
249258

250-
There call signatures are:
259+
The call signature is:
251260
\begin{verbatim}
252-
CCTK_INT FUNCTION \
253-
ExtrapolateGammas \
254-
(CCTK_POINTER_TO_CONST IN cctkGH, \
255-
CCTK_REAL ARRAY INOUT var)
256-
257-
CCTK_INT FUNCTION \
258-
NewRad_Apply \
259-
(CCTK_POINTER_TO_CONST IN cctkGH, \
260-
CCTK_REAL ARRAY IN var, \
261-
CCTK_REAL ARRAY INOUT rhs, \
262-
CCTK_REAL IN var0, \
263-
CCTK_REAL IN v0, \
264-
CCTK_INT IN radpower)
261+
void NewRadX_Apply \
262+
(const cGH *restrict const cctkGH, \
263+
const Loop::GF3D2<const CCTK_REAL> var, \
264+
Loop::GF3D2<CCTK_REAL> rhs, \
265+
CCTK_REAL var0, \
266+
CCTK_REAL v0, \
267+
CCTK_REAL radpower)
265268
\end{verbatim}
266269
where \code{var0} corresponds to $f_0$, \code{v0} is $v$ and
267270
\code{radpower} is the assumed decay exponent $n$.
268271

269272
\subsection{Obtaining This Thorn}
270-
The thorn is part of the EinsteinEvolve arrangement available on
271-
bitbucket.
273+
The thorn is part of the \code{SpacetimeX} arrangement available on
274+
GitHub.
272275
\begin{verbatim}
273-
git clone git@bitbucket.org:einsteintoolkit/einsteinevolve.git
276+
git clone git@github.com:lwJi/SpacetimeX.git
274277
\end{verbatim}
275278

276279
\subsection{Basic Usage}
280+
For an overview of the implementation and usage of this thorn, please
281+
see~\cite{SpacetimeX_NewRadX_intro_presentation} for a presentation by
282+
Alexandru Dima and Cheng-Hsin Cheng during the weekly \code{CarpetX}
283+
developer meetings.
284+
277285

278286
\subsection{Special Behaviour}
279-
If the parameter \code{z\_is\_radial} is set it assumes that the $z$
280-
direction is a radial direction and uses this to evaluate the radial
281-
derivative in \eqref{eqn:EinsteinEvolve_NewRad_num_bc}. This is the case
282-
for the multi-patch coordinate systems provided by the
283-
\code{Llama}~\cite{EinsteinEvolve_NewRad_llamacode} infrastructure.
287+
In contrast with the \code{Carpet}-version of \code{NewRad}, which updates
288+
the RHS variables on the physical outer boundary of the simulation domain,
289+
\code{NewRadX} updates them on the so-called ``outermost interior points''.
290+
These points are defined as the interior points which are located
291+
\code{nghostzones} or fewer grid points from the outer boundary.
292+
Therefore, the boundary conditions are effectively applied on a set of points
293+
that are labelled as ``interior'' in \code{CarpetX}.
294+
It is necessary to introduce this change because imposing a wave-like time
295+
evolution on the \code{CarpetX} ``proper'' boundary points is incompatible with the
296+
synchronization conducted by AMReX.
297+
298+
299+
Currently, this thorn only supports single-patch, Cartesian grids provided by
300+
\code{CarpetX}, but not multi-patch coordinate systems.
301+
284302

285303
\subsection{Interaction With Other Thorns}
286-
This thorn requires thorn \code{GenericFD} which is part of
287-
\code{Kranc}~\cite{EinsteinEvolve_NewRad_kranccode}.
304+
This thorn requires thorn \code{Loop} which is part of
305+
\code{CarpetX}.
288306

289307
\subsection{Examples}
290-
The best example is likely to inspect the source code \code{ML\_BSSN}
291-
and \code{ML\_BSSN\_Helper}, namely:
308+
The simplest example is likely to inspect the source code for
309+
\code{TestNewRadX}, which is a thorn from \code{SpacetimeX} that tests the
310+
boundary condition on the evolution of a scalar pulse on flat background.
311+
Here the boundary conditions are applied in the RHS calculation routine
312+
\code{TestNewRadX\_RHS}, where \code{NewRadX\_Apply} is called after the main
313+
loop that updates the RHS of the state variables in the interior.
314+
315+
\begin{verbatim}
316+
<configuration.ccl>
317+
REQUIRES Loop NewRadX
318+
\end{verbatim}
292319

293320
\begin{verbatim}
294321
<interface.ccl>
295-
CCTK_INT FUNCTION \
296-
NewRad_Apply \
297-
(CCTK_POINTER_TO_CONST IN cctkGH, \
298-
CCTK_REAL ARRAY IN var, \
299-
CCTK_REAL ARRAY INOUT rhs, \
300-
CCTK_REAL IN var0, \
301-
CCTK_REAL IN v0, \
302-
CCTK_INT IN radpower)
303-
USES FUNCTION NewRad_Apply
322+
USES INCLUDE HEADER: newradx.hxx
304323
\end{verbatim}
305324

306325
\begin{verbatim}
307326
<schedule.ccl>
308-
SCHEDULE ML_BSSN_NewRad IN MoL_CalcRHS AFTER ML_BSSN_EvolutionInterior
327+
SCHEDULE TestNewRadX_RHS IN ODESolvers_RHS
309328
{
310329
LANG: C
311-
# No need to sync here -- the RHS variables are never synced
312-
} "Apply NewRad boundary conditions to RHS"
330+
READS: state(everywhere)
331+
WRITES: rhs(interior)
332+
SYNC: rhs
333+
} "Calculate scalar wave RHS"
313334
\end{verbatim}
314335

315336
\begin{verbatim}
316-
<NewRad.cc>
317-
#include "cctk_Arguments.h"
318-
#include "cctk_Functions.h"
319-
320-
void ML_BSSN_NewRad(CCTK_ARGUMENTS)
321-
{
322-
DECLARE_CCTK_ARGUMENTS;
337+
<test_newradx.cxx>
338+
#include <newradx.hxx>
339+
340+
extern "C" void TestNewRadX_RHS(CCTK_ARGUMENTS) {
341+
DECLARE_CCTK_ARGUMENTSX_TestNewRadX_RHS;
342+
DECLARE_CCTK_PARAMETERS;
343+
344+
/* First loop over the interior to update RHS of the state variables */
345+
grid.loop_int_device<0, 0, 0>(grid.nghostzones,
346+
[=] CCTK_DEVICE(const Loop::PointDesc &p)
347+
CCTK_ATTRIBUTE_ALWAYS_INLINE {
348+
uu_rhs(p.I) = vv(p.I);
349+
vv_rhs(p.I) = Laplacian_4thorder(uu, p);
350+
});
351+
352+
/* After RHS grid functions are updated, apply boundary conditions */
353+
if (test_use_newradx) {
354+
NewRadX::NewRadX_Apply(cctkGH, uu, uu_rhs, 0, 1, n_falloff);
355+
NewRadX::NewRadX_Apply(cctkGH, vv, vv_rhs, 0, 1, n_falloff + 1);
356+
}
323357
324-
const int radpower = 2; // for example
325-
326-
NewRad_Apply(cctkGH, gt12, gt12rhs, 0.0, 1.0, radpower);
327358
}
328359
\end{verbatim}
329360

361+
362+
Other examples of \code{CarpetX} evolution thorns that use \code{NewRadX}
363+
include \code{CanudaX\_BSSNMoL}\cite{SpacetimeX_NewRadX_CanudaX_BSSNMoL}
364+
and \code{Z4c}\cite{SpacetimeX_NewRadX_Z4c}.
365+
366+
330367
\subsection{Support and Feedback}
331368
Please use the Einstein Toolkit mailing list
332369
\url{[email protected]} to report issues and ask for help.
@@ -336,30 +373,42 @@ \section{History}
336373
\subsection{Thorn Source Code}
337374
\begin{itemize}
338375
\item Initial version of method likely by Miguel Alcubierre;
339-
\item Carpet version of code by Erik Schnetter;
340-
\item CarpetX version of code by Cheng-Hsin Cheng, Jake Doherty, Michail Chabanov, Alexandru Dima.
376+
\item \code{Carpet} version of code by Erik Schnetter;
377+
\item \code{CarpetX} version of code by Cheng-Hsin Cheng, Jake Doherty,
378+
Michail Chabanov, Alexandru Dima.
341379
\end{itemize}
342380

343381
\subsection{Thorn Documentation}
344382
\begin{itemize}
345383
\item Initial version by Roland Haas using text by Miguel, Erik.
346-
\item Current version by Alexandru Dima.
384+
\item Current version by Alexandru Dima and Cheng-Hsin Cheng.
347385
\end{itemize}
348386

349387
\subsection{Acknowledgements}
350-
This documentation copies text from comments in the source code as well
351-
as the paper~\cite{EinsteinEvolve_NewRad_Alcubierre:2002kk}.
388+
This documentation is based on the original one for the \code{Carpet} version
389+
of \code{NewRad}, which copies text from comments in the source code as well
390+
as the paper~\cite{SpacetimeX_NewRadX_Alcubierre:2002kk}.
352391

353392
\begin{thebibliography}{9}
354-
\bibitem{EinsteinEvolve_NewRad_Alcubierre:2002kk}
393+
394+
\bibitem{SpacetimeX_NewRadX_EinsteinEvolve} ``EinsteinEvolve``,
395+
\url{https://bitbucket.org/einsteintoolkit/einsteinevolve}.
396+
397+
\bibitem{SpacetimeX_NewRadX_Alcubierre:2002kk}
355398
M.~Alcubierre, B.~Bruegmann, P.~Diener, M.~Koppitz, D.~Pollney, E.~Seidel and R.~Takahashi,
356399
``Gauge conditions for long term numerical black hole evolutions without excision,''
357400
Phys.\ Rev.\ D {\bf 67}, 084023 (2003)
358401
doi:10.1103/PhysRevD.67.084023
359402
[gr-qc/0206072].
360-
\bibitem{EinsteinEvolve_NewRad_kranccode} ``Kranc: Kranc assembles
361-
numerical code``, \url{http://kranccode.org/}.
362-
\bibitem{EinsteinEvolve_NewRad_llamacode} ``The Llama code``, \url{https://llamacode.bitbucket.io/}.
403+
404+
\bibitem{SpacetimeX_NewRadX_intro_presentation} ``NewRadX Intro``,
405+
\url{https://github.com/eschnett/CarpetX/wiki/NewRadX-Intro}.
406+
407+
\bibitem{SpacetimeX_NewRadX_CanudaX_BSSNMoL} ``CanudaX\_Lean``,
408+
\url{https://bitbucket.org/canuda/canudax_lean}.
409+
410+
\bibitem{SpacetimeX_NewRadX_Z4c} ``Z4c'',
411+
\url{https://github.com/lwJi/SpacetimeX/tree/main/Z4c}.
363412
364413
\end{thebibliography}
365414

TestNewRadX/configuration.ccl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Configuration definition for thorn TestNewRadX
22

3-
REQUIRES Loop
3+
REQUIRES Loop NewRadX

0 commit comments

Comments
 (0)