## GlobalDerivative

April 20, 2017

Abstract

This thorn is ment to provide “global” ﬁrst and second derivatives by taking summation by parts (SBP) derivatives in the local grid coordinate system and transforming them to the global coordinate system. For this, the Jacobian and its derivatives must be provided as functional arguments. If no Jacobian is given, i.e. the grid variable pointers are NULL, the global derivatives reduce to the local derivatives.

### 1 Introduction

Some thorns, e.g. those that use the Llama multipatch system, use a local grid coordinate system but the (tensor) quantities are represented in a global coordinate system. Since (SBP) ﬁnite diﬀerences are calculated in the local grid-coordinate system, the derivative operators have to be transformed to the global coordinate system in order to be correctly represented in the global coordinate basis.

By using this thorn as a provider for ﬁnite-diﬀerence derivative operators, one can implement a thorn by assuming one global coordinate system. By providing Jacobians from local to global coordinates one then ends up with a code that is valid on all “patches” that are eventually deﬁned by diﬀerent local coordinates.

We label local grid coordinates by $\left({x}^{i}\right)=\left(a,b,c\right)$ and global coordinates by $\left({\stackrel{̂}{x}}^{i}\right)=\left(x,y,z\right)$. The ﬁrst derivatives in global coordinates are then deﬁned by

 ${\stackrel{̂}{\partial }}_{i}=\frac{\partial {x}^{j}}{\partial {\stackrel{̂}{x}}^{i}}\frac{\partial }{\partial {x}^{j}},$ (1)

i.e.

$\begin{array}{rcll}{\stackrel{̂}{\partial }}_{x}& =& \frac{\partial a\left(x\right)}{\partial x}\frac{\partial }{\partial a}+\frac{\partial b\left(x\right)}{\partial x}\frac{\partial }{\partial b}+\frac{\partial c\left(x\right)}{\partial x}\frac{\partial }{\partial c},& \text{(2)}\text{}\text{}\\ {\stackrel{̂}{\partial }}_{y}& =& \frac{\partial a\left(y\right)}{\partial y}\frac{\partial }{\partial a}+\frac{\partial b\left(y\right)}{\partial y}\frac{\partial }{\partial b}+\frac{\partial c\left(y\right)}{\partial y}\frac{\partial }{\partial c},& \text{(3)}\text{}\text{}\\ {\stackrel{̂}{\partial }}_{z}& =& \frac{\partial a\left(z\right)}{\partial z}\frac{\partial }{\partial a}+\frac{\partial b\left(z\right)}{\partial z}\frac{\partial }{\partial b}+\frac{\partial c\left(z\right)}{\partial z}\frac{\partial }{\partial c}.& \text{(4)}\text{}\text{}\end{array}$

Similarly, second derivatives are calculated by

 ${\stackrel{̂}{\partial }}_{i}{\stackrel{̂}{\partial }}_{j}=\frac{\partial {x}_{k}}{\partial {\stackrel{̂}{x}}_{i}}{\partial }_{k}\left(\frac{\partial {x}_{l}}{\partial {\stackrel{̂}{x}}_{j}}\right){\partial }_{l}+\frac{\partial {x}_{k}}{\partial {\stackrel{̂}{x}}_{i}}\frac{\partial {x}_{l}}{\partial {\stackrel{̂}{x}}_{j}}{\partial }_{k}{\partial }_{l}$ (5)

If local and global coordinate system are identical then the global derivatives reduce to the local derivatives.

### 2 Numerical Implementation

Similar to the SummationByParts thorn, there are subroutines that can be called to apply a global derivative to an entire grid variable. However, in most cases, one cannot eﬀort to store the result of the derivative as an extra grid variable. Hence, the thorn provides a number of pointwise inline functions that can be used by including the GlobalDerivative header ﬁle.

### 3 Parameters

 epsdis_for_level Scope: restricted REAL Description: Epsdis for a speciﬁc reﬁnement level Range Default: -1.0 : Negative indicates use default

 fd_order_on_non_cart_maps Scope: restricted INT Description: Order of accuracy of spatial derivatives on non-Cartesian patches. Range Default: -1 -1 use same FD order everywhere 2:* use diﬀerent FD order on non-Cartesian patches

 force_diss_order Scope: restricted INT Description: Force this order of accuracy for dissipation operator Range Default: -1 -1 Use default as speciﬁed in SBP::order 2:8 2nd, 4th, 6th and 8th order

 order_for_level Scope: restricted INT Description: Order of accuracy for a speciﬁc reﬁnement level Range Default: -1 -1 Use default as speciﬁed in SBP::order 2:8 2nd, 4th, 6th and 8th order

 use_dissipation Scope: restricted BOOLEAN Description: Use global dissipation Default: no

 diss_fraction Scope: shared from SUMMATIONBYPARTS REAL

 dissipation_type Scope: shared from SUMMATIONBYPARTS KEYWORD

 epsdis Scope: shared from SUMMATIONBYPARTS REAL

 h_scaling Scope: shared from SUMMATIONBYPARTS REAL

 norm_type Scope: shared from SUMMATIONBYPARTS KEYWORD

 order Scope: shared from SUMMATIONBYPARTS INT

 poison_dissipation Scope: shared from SUMMATIONBYPARTS BOOLEAN

 use_variable_deltas Scope: shared from SUMMATIONBYPARTS BOOLEAN

 vars Scope: shared from SUMMATIONBYPARTS STRING

### 4 Interfaces

#### General

Implements:

globalderivative

Inherits:

grid

summationbyparts

coordinates

GlobalDerivative.h

AllDerivative.h

AllDerivative_8th.h

Jacobian.h

Provides:

globalDiﬀ_gv to

globalDiﬀ2_gv to

### 5 Schedule

This section lists all the variables which are assigned storage by thorn Llama/GlobalDerivative. 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.

NONE

#### Scheduled Functions

CCTK_PARAMCHECK

globalderiv_paramcheck

check parameters

 Language: c Options: global Type: function

MoL_PostRHS (conditional)

globalderiv_dissipation

apply global dissipation to registered variables

 Language: c Options: local Type: function