May 23, 2024

This thorn is ment to provide “global” first 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.

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) finite differences 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 finite-difference 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 defined by different local coordinates.

We label local grid coordinates by \((x^i) = (a,b,c)\) and global coordinates by \((\hat {x}^i) = (x,y,z)\). The first derivatives in global coordinates are then defined by \begin {equation} \hat {\partial }_i = \frac {\partial x^j}{\partial \hat {x}^i}\frac {\partial }{\partial x^j}, \end {equation} i.e.

\begin {eqnarray} \hat \partial _x &=& \frac {\partial a(x)}{\partial x}\frac {\partial }{\partial a} + \frac {\partial b(x)}{\partial x}\frac {\partial }{\partial b} + \frac {\partial c(x)}{\partial x}\frac {\partial }{\partial c}, \\ \hat \partial _y &=& \frac {\partial a(y)}{\partial y}\frac {\partial }{\partial a} + \frac {\partial b(y)}{\partial y}\frac {\partial }{\partial b} + \frac {\partial c(y)}{\partial y}\frac {\partial }{\partial c}, \\ \hat \partial _z &=& \frac {\partial a(z)}{\partial z}\frac {\partial }{\partial a} + \frac {\partial b(z)}{\partial z}\frac {\partial }{\partial b} + \frac {\partial c(z)}{\partial z}\frac {\partial }{\partial c}. \end {eqnarray}

Similarly, second derivatives are calculated by \begin {equation} \hat \partial _i\hat \partial _j = \frac {\partial x_k}{\partial \hat {x}_i} \partial _k \left ( \frac {\partial x_l}{\partial \hat {x}_j} \right ) \partial _l + \frac {\partial x_k}{\partial \hat {x}_i} \frac {\partial x_l}{\partial \hat {x}_j} \partial _k \partial _l \end {equation}

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

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 effort 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 file.

epsdis_for_level | Scope: restricted | REAL |

Description: Epsdis for a specific refinement 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 different 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 specified in SBP::order
| |

2:8 | 2nd, 4th, 6th and 8th order
| |

order_for_level | Scope: restricted | INT |

Description: Order of accuracy for a specific refinement level
| ||

Range | Default: -1 | |

-1 | Use default as specified 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 |

Implements:

globalderivative

Inherits:

grid

summationbyparts

coordinates

Adds header:

GlobalDerivative.h

AllDerivative.h

AllDerivative_8th.h

Jacobian.h

Provides:

globalDiff_gv to

globalDiff2_gv to

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

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 | |