## GlobalDerivative

February 7, 2018

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