Finite Differencing and Tensor Calculations
The thorn CactusEinstein/ADMMacros contains code that can be used to calculate derivatives with finite differences. This code should work with both C and Fortran. Bit rot over the last half decade made it so that the Fortran version works well, while the C version has problems. While ADMMacros was very useful and efficient when it was designed, there was recently an unanimous vote from the people who maintain the code that it needs to be overhauled.
Apart from taking finite differences, ADMMacros contains also code to perform various tensor operations, such as inverting a symmetry 3x3 matrix or calculating the trace. It also contains code for various GR operations, such as calculating Christoffel symbols or the 3-Ricci tensor.
To my knowledge (Erik Schnetter, November 2005), there exist in Cactus the following publicly available replacements for ADMMacros (in alphabetical order):
(1) ADMMacros (2) Kranc (3) PointwiseDerivatives (4) FiniteDifferences (and SummationByParts) (5) TGRtensor
(1) ADMMacros (released in its current form 2002; available at least since 1999) is a thorn that contains header files with macros to calculate finite differences and perform tensor operations. It supports both Fortran and C. For Fortran, it is both second and fourth order accurate, while the C version contains known bugs and is only second order accurate. The main feature of this thorn is that it contains a mechanism to avoid recalculating temporary quantities during its tensor calculations, and is thus highly efficient. Its downside is the baroque user interface and rather complicated internal structure that makes it, by today's standards, difficult to use and maintain.
(2) Kranc (released 2004) is a set of Mathematica packages which simplifies both tensor calculus and code generation [http://numrel.aei.mpg.de/Research/Kranc/]. Code that is generated with Kranc uses a thorn GenericFD that contains set of header files which define macros for finite differencing. (GenericFD can also be used stand-alone.) This supports both Fortran and C code, both second and fourth order accurate. Kranc is a very powerful package that makes it possible to write code not in Fortran or C, but in Mathematica's high level language, and automatically create Cactus thorns from that.
(3) PointwiseDerivatives (released 2005) is a thorn that contains a header file with macros to calculate finite differences, written by J. Thornburg, available in the AEIThorns arrangement. This supports only C code, both second and fourth order accurate.
(4) FiniteDifferences (released 2004) is a thorn that contains aliased functions to calculate derivatives, available in the AEIThorns arrangement. This supports both Fortran and C code, both second and fourth order accurate. This thorn calculates derivatives for entire grid functions at once. Another thorn SummationByParts uses the same interface, and it calculates higher order finite differences as well. Calculating derivatives for entire grid functions has the advantage that the function call overhead per grid point is amortized, so that the derivative operators can be selected and modified with run time parameters. The disadvantage is that the result needs to be stored in grid functions, which increases the memory requirement.
(5) TGRtensor (released 2002) is a thorn that contains routines to calculate derivatives, available in the TAT arrangement. This supports only Fortran code, both second and fourth order accurate. This thorn also operates pointwise. It also contains other routines for generic tensor operations and for GR calculations.
Only (1), (2), and (5) can be a complete replacement for ADMMacros. (3) and (4) only calculate derivatives; in order to replace ADMMacros, one needs to write or generate additional code for tensor operations.
Last modified 2005-11-09 01:45 PM