## Multipole

01 Jun 2010

Abstract

The Multipole thorn performs spherical harmonic mode decomposition of Cactus grid functions on coordinate spheres.

### 1 Introduction

This thorn allows the user to compute the coeﬃcients of the spherical harmonic expansion of a ﬁeld stored in a Cactus grid function on coordinate spheres of given radii. A set of radii for these spheres, as well as the number of angular points to use, can be speciﬁed. Complex ﬁelds can be used, but they must be stored in pairs of real Cactus grid functions (the CCTK_COMPLEX type is not supported).

### 2 Physical System

The angular dependence of a ﬁeld $u\left(t,r,𝜃,\phi \right)$ can be expanded in spin-weight $s$ spherical harmonics :

$\begin{array}{rcll}u\left(t,r,𝜃,\phi \right)=\sum _{l=0}^{\infty }\sum _{m=-l}^{l}{C}^{lm}{\left(t,r\right)}_{s}{Y}_{lm}\left(𝜃,\phi \right)& & & \text{(1)}\text{}\text{}\end{array}$

where the coeﬃcients ${C}^{lm}\left(t,r\right)$ are given by

$\begin{array}{rcll}{C}^{lm}\left(t,r\right)={\int }_{s}{Y}_{lm}^{\ast }u\left(t,r,𝜃,\phi \right){r}^{2}d\Omega & & & \text{(2)}\text{}\text{}\end{array}$

At any given time, $t$, this thorn can compute ${C}^{lm}\left(t,r\right)$ for a number of grid functions on several coordinate spheres with radii ${r}_{i}$. The coordinate system of the Cactus grids must be Cartesian and the coordinates $r$, $𝜃$, $\phi$ are related to $x$, $y$ and $z$ by the usual transformation between Cartesian and spherical polar coordinates ($𝜃$ is the polar angle and $\phi$ is the azimuthal angle).

The spin-weighted spherical harmonics are computed using Eq. 3.1 in Ref. .

### 3 Numerical Implementation

The coordinate sphere on which the multipolar decomposition is performed is represented internally as a 2-dimensional grid evenly spaced in $𝜃$ and $\phi$ with coordinates

$\begin{array}{rcll}{𝜃}_{k}& =& \frac{\pi k}{{n}_{𝜃}}\phantom{\rule{1em}{0ex}}k=0,1,...,{n}_{𝜃}& \text{(3)}\text{}\text{}\\ {\phi }_{k}& =& \frac{2\pi k}{{n}_{\phi }}\phantom{\rule{1em}{0ex}}k=0,1,...,{n}_{\phi },& \text{(4)}\text{}\text{}\end{array}$

so ${n}_{𝜃}$ and ${n}_{\phi }$ count the number of cells (not the number of points). The gridfunction to be decomposed, $u$, is ﬁrst interpolated from the 3D Cactus grid onto this 2D grid at a given radius, ${r}_{i}$, and the ${C}^{lm}$ are computed by evaluating the integral in Eq. 2 for diﬀerent values of $l$ and $m$. The interpolation is performed using the Cactus interpolation interface, so any Cactus interpolator can be used. The numerical method used for interpolation should be speciﬁed in the documentation for the thorn which provides it. One such thorn is AEILocalInterp. The integration is performed using either the midpoint rule, yielding a result which is ﬁrst order accurate in the angular spacings $\Delta 𝜃=\pi ∕{n}_{𝜃}$ and $\Delta \phi =2\pi ∕{n}_{𝜃}$, or Simpson’s rule, which is fourth order accurate.

### 4 Using This Thorn

#### 4.1 Obtaining This Thorn

This thorn is available as part of the Einstein Toolkit via:

svn checkout https://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/Multipole/trunk Multipole

or by using the Einstein Toolkit GetComponents script and thornguide.

#### 4.2 Basic Usage

Suppose that you have a real grid function, $u$, for which you want to compute the spherical harmonic coeﬃcients ${C}^{lm}$. Start by including Multipole and an interpolator (for example AEILocalInterp) in the ActiveThorns line of your parameter ﬁle (for interpolation thorns other than AEILocalInterp, you will need to modify the interpolator and interpolator_options accoording to the documentation of the interpolation thorn). Next decide the number and radii of the coordinate spheres on which you want to decompose. Set the number of spheres with the nradii parameter, and the radii themselves with the radius[i] parameters (the indices $i$ are zero-based). For example,

ActiveThorns = ".... AEILocalInterp Multipole"

Multipole::variables    = "MyThorn::u"

The default parameters will compute all $l=2$ modes assuming a spin-weight $s=0$ on every iteration of your simulation. The coeﬃcients ${C}^{lm}$ will be output in the ﬁles with names of the form mp_<var>_l<lmode>_m<mmode>_r<rad>.asc, for example

mp_u_l2_m2_r10.00.asc
mp_u_l2_m-1_r20.00.asc

For the ﬁlename, the radius is converted to a string with two decimal places, which should be suﬃcient. These are ASCII ﬁles where each line has columns

$t$, $Re\phantom{\rule{0.3em}{0ex}}{C}^{lm}$, $Im\phantom{\rule{0.3em}{0ex}}{C}^{lm}$.

#### 4.3 Special Behaviour

Often it will be necessary to go beyond the basic usage described in the previous section.

##### 4.3.1 Higher modes

By default, Multipole computes only $l=2$ modes. You can choose whether to extract a single mode, or all modes from $l=$ l_min to $l=$ l_mode, with $|m|\le$ m_mode. This is controlled by the mode_type parameter, which can be set to "all_modes" or "specific_mode". The parameters l_min and l_mode specify the lowest and highest modes to compute. The parameter m_mode speciﬁes up to which value of $m$ to compute. When using mode_type = "specific_mode", the mode $l$ and $m$ are given by l_mode and m_mode respectively.

##### 4.3.2 Variable options

Several variable-speciﬁc options can be listed as tags in the variables parameter:

Multipole::variables = "<imp>::<var>{<tagname> = <tagvalue> ... } ..."

Valid tags are:

 cmplx A string giving the fully qualiﬁed variable name for the imaginary part of a complex ﬁeld, assuming that :: is the real part. name A string giving an alias to use for the decomposed variable in the output ﬁlename, for use in the case of complex variable when otherwise the name of the real part would be used, which might be confusing. sw The integer spin-weight of the spherical harmonic decomposition to use.

Strings should be enclosed in single quotes within the list of tags.

##### 4.3.3 Complex variables

In order to decompose a complex quantity, Multipole currently requires that the ﬁeld is stored in two separate CCTK_REAL grid functions, one for the real and one for the imaginary part. Suppose the complex function $u$ is stored in two gridfunctions u_re and u_im. In order to correctly decompose $u$, specify the real variable in the variables parameter, and use the tag cmplx to specify the name of its imaginary companion:

Multipole::variables = "MyThorn::u_re{cmplx = ’MyThorn::u_im’}"

##### 4.3.4 Renaming variables

In some cases, you might want the name of the variable in the output ﬁlename to be diﬀerent to the name of the grid function. This can be done by setting the name tag of the variable:

Multipole::variables = "MyThorn::u{name = ’myfunction’}"

For example, in the case of a complex variable where the output ﬁle contains the name of the real part, you can rename it as follows:

Multipole::variables = "MyThorn::u_re{cmplx = ’MyThorn::u_im’ name = ’u’}"

##### 4.3.5 Spin weight

Depending on the nature of the ﬁeld to be decomposed, a spin-weight other than 0 might be required in the spherical harmonic basis. Use the tag sw for this

Multipole::variables = "MyThorn::u_re{cmplx = ’MyThorn::u_im’ name = ’u’ sw = -2}"

##### 4.3.6 Interpolator options

The interpolator to be used can be speciﬁed in the interpolator_name parameter, and a string containing interpolator parameters can be speciﬁed in the interpolator_pars parameter. See the interpolator (for example AEIThorns/AEILocalInterp) documentation for details of interpolators available and their options.

##### 4.3.7 Output

When used with mesh-reﬁnement, it is common to require mode decomposition less frequently than every iteration. The parameter out_every can be used to control this. 1D and 2D output of the coordinate spheres can be enabled using out_1d_every and out_2d_every.

#### 4.4 Interaction With Other Thorns

This thorn obtains grid function data via the standard Cactus interpolator interface. To use this, one needs the parallel driver (for example PUGHInterp or CarpetInterp) as well as the low-level interpolator (e.g. AEILocalInterp).

#### 4.5 Examples

To use this thorn with WeylScal4 to compute modes of the complex ${\Psi }_{4}$ variable, one could use the following example:

ActiveThorns = ".... WeylScal4 CarpetInterp AEILocalInterp Multipole"