## CT_MultiLevel

May 27 2013

Abstract

This thorn implements a multigrid solver for systems of elliptic partial differential equations. It uses Carpet’s interface to handle loops over the grid hierarchy and pass information between different components. The system of equations is passed to the solver via parameters pointing to the external grid functions that hold the equation coefficients.

### 1 Introduction

CT_MultiLevel is a Cactus thorn that implements a multigrid solver for elliptic partial differential equations (PDEs). The implementation is rather standard, and it also allows for local AMR grids (in which case it uses a rudimentary multilevel algorithm).

This thorn requires Carpet, which it uses to manage the access to the grid structure (via the BEGIN_*_LOOP and END_*_LOOP macros) and to pass information between the different levels (via the restriction and prolongation operators).

Structurally, the solver can tackle any type of equation or system of equations, their coefficients being passed to CT_MultiLevel via string parameters holding the names of the corresponding grid function. The thorn comes with a number of test cases which should be easy to customize and extend.

### 2 Principle of multigrid

Multigrid schemes are designed to solve elliptic equations on a hierarchy of grids, with the goal of speeding up the convergence rate of relaxation algorithms (such as Gauss-Seidel) by eliminating different frequency modes of the solution error on different grids. It is known that relaxation techniques are very effective at eliminating the high-frequency part of the error; when solving an elliptic PDE on a grid, it is then advantageous to relax it on a coarser grid beforehand and interpolate the result back onto the original grid. Complex schemes involving several grid levels, each with a different PDE, can be designed to maximize the speed up. Please refer to [?] for the details.

### 3 Using This Thorn

CT_MultiLevel, along with the rest of the Cosmology arrangement, is released under the General Public License, version 2 and higher. The copyright of this thorn remains with myself.

#### 3.1 Obtaining This Thorn

CT_MultiLevel is publicly available in COSMOTOOLKIT’s git repository:

git clone https://eloisa@bitbucket.org/eloisa/cosmology.git

A helper thorn CT_Analytic is available under the same repository.

#### 3.2 Basic Usage

In order to solve an elliptic PDE with CT_MultiLevel, CT_MultiLevel can be simply compiled in, with the requirement that Carpet is compiled as well. The thorn also inherits from boundary and grid for boundary APIs and coordinate labels.

Currently, the equation is solved in a single schedule call at CCTK_INITIAL, in GLOBAL_LATE mode (to ensure that necessary objects such as the grid arrays have been populated).

As the equation coefficients will be set by grid functions, a thorn allocating and setting these grid functions to the desired values has to be included. Another thorn in the Cosmology arrangement, CT_Analytic, serves this purpose. Grid functions of other origin are naturally just as good.

Each equation in the system to solve is parametrized as follows:

\begin{eqnarray} c_{xx} \partial _{xx} \psi + c_{xy} \partial _{xy} \psi + c_{xz} \partial _{xz} \psi + c_{yy} \partial _{yy} \psi + c_{yz} \partial _{yz} \psi + c_{zz} \partial _{zz} \psi &+& \\ c_{x} \partial _{x} \psi + c_{y} \partial _{y} \psi + c_{z} \partial _{z} \psi + c_{0} \psi ^{n_0} + c_{1} \psi ^{n_1} + c_{2} \psi ^{n_2} + c_{3} \psi ^{n_3} + c_4 \psi ^{n_4} &=& 0 \end{eqnarray}
All the coefficients $$c_*$$ and the powers $$n_*$$ can be specified by setting the parameters *_gfname[*] to the desired grid function name. These parameters are arrays to allow for the solution of systems of equations.

The only other parameter which must be set to ensure correct operation is CT_MultiLevel::topMGlevel, which tells the solver which is the finest refinement level that covers the entire domain in which the equation is to be solved. All levels below and including this will be used in the classical multigrid sense (e.g., in a V- or FMG-cycle). The ones above will be treated as local AMR boxes, and be solved via a multilevel prescription; presently, this involves simply interpolating the solution from the topMGlevel refinement level at the end of the multigrid part and relaxing it progressively, from coarser to finer, on all the local grids.

Other parameters control the stopping criteria (numbers of relaxation sweeps and residual tolerance), the finite-differencing order used to discretized the equation, the number of equations in the system, and whether the solution error should be calculated (this obviously requires the exact solution to be known and stored in a grid function, its name passed to CT_MultiLevel via the usual parameter mechanism).

Concrete examples on how to set these parameters are provided below.