6.4 Code validation and calibration 225
on different computational domains. In each one of them the solutions are smooth, and
the different patches are glued together with suitable boundary conditions on the stellar
surfaces. This approach works well as long as the surface does not develop cusps, which
may result in Gibbs phenomena. This may happen, for example, just before the star
is tidally disrupted by a binary companion. We will discuss techniques and results for
binary neutron star initial data in Chapter 15, and for black hole-neutron star binaries in
Chapter 17.1.
The most attractive features of finite-difference methods are their ease of implementation
and their robustness. In general, it is reasonably straightforward to implement at least
a low-order finite-difference algorithm, and in general these algorithms are reasonably
robust, and are less sensitive to the properties of the solutions than spectral methods.
These observations probably explain why, with some notable exceptions, most dynamical
simulations of binary mergers have been carried out with finite difference simulations. This
is especially true of simulations involving fluid stars, where the presence of discontinuous
shocks proves particularly challenging for spectral methods. We will describe simulations
of binary black holes in Chapter 13, for binary neutron stars in Chapter 16, and for black
hole-neutron star binaries in Chapter 17.2, where we will summarize some of the different
methods used to perform them.
6.4 Code validation and calibration
Before closing this chapter we should briefly discuss some general strategies for testing
numerical codes. One obvious code test is to use the code to treat a case in which an
analytical solution, or at least some very accurate numerical solution, is available for
comparison. For example, a code that is designed to evolve multiple spinning black holes
could be used to simulate a single, stationary black hole. The results could then be compared
to a stationary Kerr spacetime. Even if we were careful to employ only gauge-invariant
quantities in performing such comparisons, we inevitably would find that the numerical
results do not agree exactly with the analytical results. The reason for the discrepancy
would be that, with very few exceptions, any numerical calculation will always have some
truncation error. Comparing a single simulation with an analytical solution is therefore
not very meaningful, because it would not be possible to distinguish a deviation caused by
a coding error from a truncation error. A more meaningful test, one that can distinguish
between coding mistakes and truncation error, is performing a sequence of simulations and
using the sequence to check the convergence of the results to an analytical solution. The
point is that the truncation error decreases in a predictable way with increasing numerical
resources, while coding mistakes do not. We have already relied on such a convergence
test in Chapter 5.2.4 to calibrate a relativistic MHD code.
Focusing on finite difference methods for the remainder of the section, we will denote
the numerical solution at a point (t, x), achieved with a grid spacing h,asu
h
(t, x). We
assume that we can express this solution as a Taylor expansion about the analytical solution