Poisson

Erik Schnetter <schnetter@gmail.com>

November 25, 2014

Abstract

This is an example thorn describing how to use the TATPETSc interface to PETSc. It solves the Poisson equation for a spherical charge distribution on a uniform grid.

1 Introduction

PETSc is a well-known library for solving elliptic equations. TATPETSc is a Cactus thorn that provides a wrapper for calling PETSc to solve elliptic equations on uniform grids. (TATPETSc currently supports neither mesh refinement nor multi-block systems.) TATPETSc can solve both linear and non-linear systems.

2 Physical System

Here we solve the Poisson equation

ΔΦ(x) = ρ(x) (1)

where the right hand side ρ is given by

ρ(r) = QV r R 0 r > R (2)

for the charge Q and the radius R, with V = 4πR33. We use Dirichlet boundary conditions Φ(x) = 0.

3 Numerical Implementation

PETSc supports a large number of options to choose solvers. Here we use PETSc’s default settings.

4 Using This Thorn

In the example parameter file, we set the parameter TATPETSc::options to select the following PETSc options:

4.1 Examples

The solution (the potential Φ(x)) is stored in the grid function potential, the residual (a measure for the error) in the grid function residual.

5 Parameters




charge
Scope: private  REAL



Description: Charge of uniformly charged sphere



Range   Default: 1.0
*:*






options
Scope: private  STRING



Description: Options for the solver



Range   Default: (none)
.*
no restriction






radius
Scope: private  REAL



Description: Radius of uniformly charged sphere



Range   Default: 1.0
0:*






solver
Scope: private  STRING



Description: Name of TATelliptic solver that should be used



Range   Default: TATJacobi
.*
must be an activated TATelliptic solver



6 Interfaces

General

Implements:

poisson

Inherits:

boundary

grid

Grid Variables

6.0.1 PRIVATE GROUPS




  Group Names    Variable Names    Details   




potential   compact0
phi   descriptionPotential for elliptic equation
  dimensions3
  distributionDEFAULT
  group typeGF
  timelevels1
 variable typeREAL




residual   compact0
res   descriptionResidual for elliptic equation
  dimensions3
  distributionDEFAULT
  group typeGF
  timelevels1
 variable typeREAL




Uses header:

carpet.h

TATelliptic.h

7 Schedule

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

Storage

 

Always:  
potential residual 
   

Scheduled Functions

CCTK_INITIAL

  poisson_prepare

  set up initial guess for initial data

 

 Language:c
 Type: function

CCTK_POSTINITIAL

  poisson_solve

  calculate uniform charge initial data

 

 Language:c
 Type: function

  poisson_boundaries

  apply boundary conditions to initial data

 

 Type:group

Poisson_boundaries

  poisson_boundaries_select

  select boundary conditions for initial data

 

 Language:c
 Options: level
 Sync: potential
 Type: function

Poisson_boundaries

  applybcs

  apply boundary conditions to initial data

 

 After:poisson_boundaries_select
 Type:group

Aliased Functions

 

Alias Name:        Function Name:
ApplyBCs Poisson_boundaries_apply