Abstract. A common task in Lagrangian oceanography is to calculate a large number of
drifter trajectories from a velocity field precalculated with an ocean model. Mathematically, this is simply numerical integration of an ordinary
differential equation (ODE), for which a wide range of different methods
exist. However, the discrete nature of the modelled ocean currents requires interpolation of the velocity field in both space and time, and the choice
of interpolation scheme has implications for the accuracy and efficiency of the different numerical ODE methods. We investigate trajectory calculation in modelled ocean currents with 800 m, 4 km, and 20 km horizontal resolution, in combination with linear, cubic and quintic spline interpolation. We use fixed-step Runge–Kutta integrators of orders 1–4, as well as three variable-step Runge–Kutta methods (Bogacki–Shampine 3(2), Dormand–Prince 5(4) and 8(7)). Additionally, we design and test modified special-purpose variants of the three variable-step integrators, which are better able to handle discontinuous derivatives in an interpolated velocity field. Our results show that the optimal choice of ODE integrator depends on the resolution of the ocean model, the degree of interpolation, and the desired
accuracy. For cubic interpolation, the commonly used Dormand–Prince 5(4) is
rarely the most efficient choice. We find that in many cases, our
special-purpose integrators can improve accuracy by many orders of magnitude over their standard counterparts, with no increase in computational effort. Equivalently, the special-purpose integrators can provide the same accuracy as standard methods at a reduced computational cost. The best results are seen for coarser resolutions (4 and 20 km),
thus the special-purpose integrators are particularly advantageous for
research using regional to global ocean models to compute large numbers of
trajectories. Our results are also applicable to trajectory computations on
data from atmospheric models.