<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing with OASIS Tables v3.0 20080202//EN" "journalpub-oasis3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://docs.oasis-open.org/ns/oasis-exchange/table" xml:lang="en" dtd-version="3.0"><?xmltex \hack{\allowdisplaybreaks}?>
  <front>
    <journal-meta><journal-id journal-id-type="publisher">GMD</journal-id><journal-title-group>
    <journal-title>Geoscientific Model Development</journal-title>
    <abbrev-journal-title abbrev-type="publisher">GMD</abbrev-journal-title><abbrev-journal-title abbrev-type="nlm-ta">Geosci. Model Dev.</abbrev-journal-title>
  </journal-title-group><issn pub-type="epub">1991-9603</issn><publisher>
    <publisher-name>Copernicus Publications</publisher-name>
    <publisher-loc>Göttingen, Germany</publisher-loc>
  </publisher></journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.5194/gmd-13-5935-2020</article-id><title-group><article-title>Numerical integrators for Lagrangian oceanography</article-title><alt-title>Numerical integrators for Lagrangian oceanography</alt-title>
      </title-group><?xmltex \runningtitle{Numerical integrators for Lagrangian oceanography}?><?xmltex \runningauthor{T.~Nordam and R.~Duran}?>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes" rid="aff1 aff2">
          <name><surname>Nordam</surname><given-names>Tor</given-names></name>
          <email>tor.nordam@sintef.no</email>
        <ext-link>https://orcid.org/0000-0002-3870-6565</ext-link></contrib>
        <contrib contrib-type="author" corresp="no" rid="aff3 aff4">
          <name><surname>Duran</surname><given-names>Rodrigo</given-names></name>
          
        <ext-link>https://orcid.org/0000-0002-2576-5531</ext-link></contrib>
        <aff id="aff1"><label>1</label><institution>SINTEF Ocean, Trondheim, Norway</institution>
        </aff>
        <aff id="aff2"><label>2</label><institution>Department of Physics, Norwegian University of Science and Technology, Trondheim, Norway</institution>
        </aff>
        <aff id="aff3"><label>3</label><institution>National Energy Technology Laboratory, Albany, OR 97321, USA</institution>
        </aff>
        <aff id="aff4"><label>4</label><institution>Theiss Research, San Diego, CA 92037, USA</institution>
        </aff>
      </contrib-group>
      <author-notes><corresp id="corr1">Tor Nordam (tor.nordam@sintef.no)</corresp></author-notes><pub-date><day>1</day><month>December</month><year>2020</year></pub-date>
      
      <volume>13</volume>
      <issue>12</issue>
      <fpage>5935</fpage><lpage>5957</lpage>
      <history>
        <date date-type="received"><day>21</day><month>May</month><year>2020</year></date>
           <date date-type="rev-request"><day>24</day><month>June</month><year>2020</year></date>
           <date date-type="rev-recd"><day>21</day><month>September</month><year>2020</year></date>
           <date date-type="accepted"><day>8</day><month>October</month><year>2020</year></date>
      </history>
      <permissions>
        <copyright-statement>Copyright: © 2020 Tor Nordam</copyright-statement>
        <copyright-year>2020</copyright-year>
      <license license-type="open-access"><license-p>This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this licence, visit <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</ext-link></license-p></license></permissions><self-uri xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020.html">This article is available from https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020.html</self-uri><self-uri xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020.pdf">The full text article is available as a PDF file from https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020.pdf</self-uri>
      <abstract><title>Abstract</title>
    <p id="d1e110">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.</p>
    <p id="d1e113">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.</p>
    <p id="d1e116">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.</p>
  </abstract>
    </article-meta>
  </front>
<body>
      

<sec id="Ch1.S1" sec-type="intro">
  <label>1</label><title>Introduction</title>
      <p id="d1e128">Calculating trajectories of tracers through a precalculated velocity field is a
common task for many applications <xref ref-type="bibr" rid="bib1.bibx53" id="paren.1"/>. Oceanic and
atmospheric transport simulations are frequently built on this approach, and
used to calculate, for example, the transport of pollutants (see, e.g.
<xref ref-type="bibr" rid="bib1.bibx44 bib1.bibx36 bib1.bibx40 bib1.bibx37" id="altparen.2"/>), distribution of algae and plankton (see, e.g. <xref ref-type="bibr" rid="bib1.bibx49 bib1.bibx56 bib1.bibx54" id="altparen.3"/>), search and rescue operations (see, e.g. <xref ref-type="bibr" rid="bib1.bibx7 bib1.bibx46" id="altparen.4"/>), or
temperature and salinity pathways (see, e.g. <xref ref-type="bibr" rid="bib1.bibx3" id="altparen.5"/>). Similarly, climate change studies may compute vast numbers of trajectories to understand transport of heat and salt (see, e.g. <xref ref-type="bibr" rid="bib1.bibx13" id="altparen.6"/>). Computation of trajectories for a variety of atmospheric species is also a common application (see, e.g. <xref ref-type="bibr" rid="bib1.bibx50 bib1.bibx42 bib1.bibx33" id="altparen.7"/>).  Other applications include the calculation of Lagrangian Coherent Structures (LCSs), which is not a transport simulation per se, but which still uses tracer trajectories to analyse flow fields (see, e.g. <xref ref-type="bibr" rid="bib1.bibx16 bib1.bibx38 bib1.bibx25 bib1.bibx14" id="altparen.8"/>).</p>
      <p id="d1e156">For all these applications, it is of interest to obtain trajectories of the
desired accuracy with minimal computational work or conversely to obtain the most accurate solution possible for a given amount of computational effort. Marine and<?pagebreak page5936?> atmospheric transport applications often require computing large numbers of trajectories, which are essentially solutions of an ordinary
differential equation (ODE). As this can be computationally quite demanding,
guidance on how to select the optimal combination of numerical schemes for a
given application is of practical value.</p>
      <p id="d1e159">We further note that in ODE parlance, the velocity fields represented by ocean currents (and wind) may be both stable and unstable, often presenting hyperbolic points where initially small errors may grow exponentially. It may therefore be useful to employ higher-order integration methods or small time steps with lower-order integration methods. This is particularly relevant for long integration times (months to years) where errors accumulate and can be amplified.</p>
      <p id="d1e162">In the applied mathematics community, a standard first choice for numerically
solving an ODE is a variable-step integrator (see, e.g. <xref ref-type="bibr" rid="bib1.bibx18" id="altparen.9"/>). Variable-step integrators use clever choices of function evaluations in order to evaluate the local error in each step of the solution, and the time step is dynamically chosen to be as long as possible while meeting a prescribed error estimate. Thus, variable-step integrators tend to be more efficient than their fixed-step counterparts.</p>
      <p id="d1e169">However, there is limited discussion of such an approach in the literature
on applied Lagrangian oceanography. Integrators used in marine transport
applications may range from Euler's method (see, e.g. <xref ref-type="bibr" rid="bib1.bibx58 bib1.bibx9" id="altparen.10"/>) to a more typical fourth-order Runge–Kutta method (see, e.g. <xref ref-type="bibr" rid="bib1.bibx17" id="altparen.11"/>). Some alternatives seek to cut computational time by using fewer evaluations, like the fourth-order Milne predictor, Hamming corrector integration scheme (see, e.g. <xref ref-type="bibr" rid="bib1.bibx32" id="altparen.12"/>), or the fourth-order Adams–Bashforth method (see, e.g. <xref ref-type="bibr" rid="bib1.bibx57" id="altparen.13"/>).</p>
      <p id="d1e184">In the context of LCS, variable-time-step integrators appear to be a more
common, yet not universal, choice. Interpolation schemes, which must be used to
evaluate discretely gridded velocity fields at arbitrary points, have also
received some attention in the LCS field. <xref ref-type="bibr" rid="bib1.bibx1" id="text.14"/> use a fourth-order
Runge–Kutta–Fehlbergh method and the local cubic interpolation recipe of
<xref ref-type="bibr" rid="bib1.bibx29" id="text.15"/>. <xref ref-type="bibr" rid="bib1.bibx4" id="text.16"/> use linear interpolation and
the classic fourth-order Runge–Kutta. <xref ref-type="bibr" rid="bib1.bibx47" id="text.17"/> use linear basis
functions for interpolation, and a Runge–Kutta–Fehlberg scheme for integration.
<xref ref-type="bibr" rid="bib1.bibx39" id="text.18"/> use the fourth-order Runge–Kutta with a velocity field derived from
Particle Image Velocimetry (PIV), though with no interpolation scheme specified.</p>
      <p id="d1e202">Solving diverse types of marine-transport problems is a common task, and given
the vast number of computations that are often involved, it seems natural to
ask how variable-step integrators perform. Because a precalculated velocity
field is necessarily given at discrete times and spatial locations,
interpolation must be used to create continuous representations of these
velocity fields that can then be integrated using numerical schemes. In
practice, the choice of an interpolation scheme will have implications for the
accuracy that can be achieved with the different numerical integrators, as well
as the computational effort.</p>
      <p id="d1e205">In this paper, we compare several approaches for interpolation of the velocity
field and numerical integration of the trajectories. We include both fixed and
variable step-size integrators. As input data to the trajectory calculations, we use modelled ocean currents at 20 km, 4 km, and 800 m resolutions. These are representative of current high-resolution Earth Modelling Systems, regional (eddy-resolving) ocean models,
and submesoscale-resolving ocean models, respectively <xref ref-type="bibr" rid="bib1.bibx30" id="paren.19"/>,
and they thus span a wide range of applications.</p>
      <p id="d1e211">We note that the purpose of our investigation is not to determine how well
different model resolutions and different interpolation schemes reproduce
physical drifter trajectories. Rather, we address the purely numerical question
of which combinations of integrator and interpolator give the best
work–precision balance for a given resolution.</p>
      <p id="d1e214">The layout of this paper is as follows: in Sect. <xref ref-type="sec" rid="Ch1.S2"/>, we
introduce some theory on numerical integration of ODEs, including a description
of the interpolation and integration schemes used and a discussion of the local
and global error of numerical integrators. Next, in
Sect. <xref ref-type="sec" rid="Ch1.S3"/> we discuss the performance of numerical
integrators for velocity fields with discontinuous derivatives and describe how
we modified well-known variable-step integrators to improve their performance
for this particular application.  Section <xref ref-type="sec" rid="Ch1.S4"/> describes how
the interpolation and integration schemes were implemented in code and the
numerical experiments that were carried out.  Section <xref ref-type="sec" rid="Ch1.S5"/> contains
the results of our investigation and a discussion of the results, and finally
in Sect. <xref ref-type="sec" rid="Ch1.S6"/> we present some conclusions on the most
efficient choice of integrator for different applications.</p>
</sec>
<sec id="Ch1.S2">
  <label>2</label><title>Theory</title>
      <p id="d1e235">The topic of the current paper is to study the numerical calculation of
tracer advection by precalculated, gridded velocity fields, with a focus on
applications in Lagrangian oceanography. Note that we ignore diffusion, and
consider pure advection with ocean currents. In this case, the trajectory of a particle being advected passively through a velocity field is defined by the ODE
          <disp-formula id="Ch1.E1" content-type="numbered"><label>1</label><mml:math id="M1" display="block"><mml:mrow><mml:mover accent="true"><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
        where <inline-formula><mml:math id="M2" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the velocity at position and time
<inline-formula><mml:math id="M3" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, along with an initial condition, <inline-formula><mml:math id="M4" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>. Such a problem is called an initial value problem and solving it means to find the value of <inline-formula><mml:math id="M5" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> at later times, <inline-formula><mml:math id="M6" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p id="d1e353">Finding the solution of an initial value problem by numerical means is known as numerical integration of the differential equation. A large body of literature exists on the topic<?pagebreak page5937?> of numerical integration, and a range of different techniques exist, both general-purpose methods that work with many different problems (see, e.g. <xref ref-type="bibr" rid="bib1.bibx23 bib1.bibx21" id="altparen.20"/>) and special-purpose methods that for example preserve some symmetry of the problem (see, e.g. <xref ref-type="bibr" rid="bib1.bibx24" id="altparen.21"/>). In this paper, we will consider both fixed- and variable-step methods from the Runge–Kutta family.</p>
      <p id="d1e362">In the following, we introduce some elements from the theory of numerical
integration of ODEs, which will be needed for the later discussion. While
elsewhere in this paper we consider <inline-formula><mml:math id="M7" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> a two-dimensional vector giving the position of a particle in a horizontal plane, we here use simply <inline-formula><mml:math id="M8" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, as the theory is general and can be applied to vectors and scalars alike.</p>
      <p id="d1e393">Common to all numerical ODE methods is that they make discrete steps in time.
In a fixed-step method, time is incremented by a fixed amount, <inline-formula><mml:math id="M9" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, at each
iteration, and we have
          <disp-formula id="Ch1.E2" content-type="numbered"><label>2</label><mml:math id="M10" display="block"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mi>n</mml:mi><mml:mi>h</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
        For the variable-step methods, the value of the time step may change  throughout the simulation, such that <inline-formula><mml:math id="M11" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>. Hence, the relationship between time and time step in this case becomes
          <disp-formula id="Ch1.E3" content-type="numbered"><label>3</label><mml:math id="M12" display="block"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:munderover><mml:mo movablelimits="false">∑</mml:mo><mml:mrow><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow><mml:mrow><mml:mi>n</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:munderover><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mi>n</mml:mi><mml:mo>≥</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
        For both types of methods, if the solution is to be calculated up to time <inline-formula><mml:math id="M13" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, we adjust the last time step as necessary to stop the integration exactly at <inline-formula><mml:math id="M14" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>:
          <disp-formula id="Ch1.E4" content-type="numbered"><label>4</label><mml:math id="M15" display="block"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>N</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>→</mml:mo><mml:mo movablelimits="false">min⁡</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>N</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>N</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula></p>
      <p id="d1e590">Finally, we will use notation where we let <inline-formula><mml:math id="M16" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> denote the numerically obtained solution at time <inline-formula><mml:math id="M17" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and we let <inline-formula><mml:math id="M18" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> be the true solution at time <inline-formula><mml:math id="M19" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. Note that while <inline-formula><mml:math id="M20" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is usually not known, we will still assume that there exists a unique, true solution (<xref ref-type="bibr" rid="bib1.bibx23" id="altparen.22"/>, pp. 35–43).</p>
<sec id="Ch1.S2.SS1">
  <label>2.1</label><title>Error bounds</title>
      <p id="d1e671">Since numerical integration is most commonly used in situations where the
exact solution is unknown, it becomes necessary to estimate the error by
purely numerical means. In general, the idea is that a smaller time step, <inline-formula><mml:math id="M21" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>,
gives a more accurate solution, and as <inline-formula><mml:math id="M22" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, the numerically obtained
solution converges to the true solution. The rate of convergence depends on
the chosen integration method.</p>
      <p id="d1e693">There are two important measures of the error: the local error and the global error. The local error is the error made in a single step. Assume there is no error in the position at time <inline-formula><mml:math id="M23" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, that is, <inline-formula><mml:math id="M24" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>. Then, the local error in step <inline-formula><mml:math id="M25" display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula> is given by <xref ref-type="bibr" rid="bib1.bibx23" id="paren.23"><named-content content-type="post">p. 156</named-content></xref>
            <disp-formula id="Ch1.E5" content-type="numbered"><label>5</label><mml:math id="M26" display="block"><mml:mrow><mml:mi>e</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The global error, on the other hand, is the error at the end of the computation, at time <inline-formula><mml:math id="M27" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> (assuming <inline-formula><mml:math id="M28" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>), and is given by
<xref ref-type="bibr" rid="bib1.bibx23" id="paren.24"><named-content content-type="post">p. 159</named-content></xref>
            <disp-formula id="Ch1.E6" content-type="numbered"><label>6</label><mml:math id="M29" display="block"><mml:mrow><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          It can be shown that for a Runge–Kutta method of order <inline-formula><mml:math id="M30" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> and for an ODE given by <inline-formula><mml:math id="M31" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, where all partial derivatives of <inline-formula><mml:math id="M32" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> up to order <inline-formula><mml:math id="M33" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> exist and are continuous (that is, <inline-formula><mml:math id="M34" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>∈</mml:mo><mml:msup><mml:mi>C</mml:mi><mml:mi>p</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>), the local error is bounded by
            <disp-formula id="Ch1.E7" content-type="numbered"><label>7</label><mml:math id="M35" display="block"><mml:mrow><mml:mfenced close="|" open="|"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow></mml:mfenced><mml:mo>≤</mml:mo><mml:mi>C</mml:mi><mml:msup><mml:mi>h</mml:mi><mml:mrow><mml:mi>p</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M36" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula> is some constant, which depends on the method and on the partial
derivatives of <inline-formula><mml:math id="M37" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx23" id="paren.25"><named-content content-type="post">p. 157</named-content></xref>.  If the local error is
<inline-formula><mml:math id="M38" display="inline"><mml:mrow><mml:mi mathvariant="script">O</mml:mi><mml:mo>(</mml:mo><mml:msup><mml:mi>h</mml:mi><mml:mrow><mml:mi>p</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, then the global error will be <inline-formula><mml:math id="M39" display="inline"><mml:mrow><mml:mi mathvariant="script">O</mml:mi><mml:mo>(</mml:mo><mml:msup><mml:mi>h</mml:mi><mml:mi>p</mml:mi></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>
(<xref ref-type="bibr" rid="bib1.bibx23" id="altparen.26"/>, pp. 160–162). When the global error is proportional to <inline-formula><mml:math id="M40" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mi>p</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>, the method is said to be of order <inline-formula><mml:math id="M41" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula>.</p>
</sec>
<sec id="Ch1.S2.SS2">
  <label>2.2</label><title>Numerical integration methods</title>
      <p id="d1e1091">We have chosen to consider seven different numerical integration schemes, all
from the family of Runge–Kutta methods. These include four methods with fixed time step:
<list list-type="custom"><list-item><label>-</label>
      <p id="d1e1096">first-order Runge–Kutta (Euler's method),</p></list-item><list-item><label>-</label>
      <p id="d1e1100">second-order Runge–Kutta (explicit trapezoid),</p></list-item><list-item><label>-</label>
      <p id="d1e1104">third-order Runge–Kutta (Kutta's method),</p></list-item><list-item><label>-</label>
      <p id="d1e1108">fourth-order Runge–Kutta.</p></list-item></list>
For details of these methods, we refer to, e.g. <xref ref-type="bibr" rid="bib1.bibx20" id="text.27"><named-content content-type="post">pp. 24, 44–45, and
131</named-content></xref>. We have also considered three methods with variable
time step:
<list list-type="custom"><list-item><label>-</label>
      <p id="d1e1119">Bogacki–Shampine 3(2),</p></list-item><list-item><label>-</label>
      <p id="d1e1123">Dormand–Prince 5(4),</p></list-item><list-item><label>-</label>
      <p id="d1e1127">Dormand–Prince 8(7).</p></list-item></list>
For further details of these methods, we refer to <xref ref-type="bibr" rid="bib1.bibx6" id="text.28"/>, and
<xref ref-type="bibr" rid="bib1.bibx11 bib1.bibx12" id="text.29"/>.</p>
      <?pagebreak page5938?><p id="d1e1137">As an example and to aid the explanation of the time step adjustment routine
that will follow in Sects. <xref ref-type="sec" rid="Ch1.S2.SS3"/> and <xref ref-type="sec" rid="Ch1.S3.SS3"/>, we will describe the Bogacki–Shampine 3(2) method in some detail. For an ODE given by
            <disp-formula id="Ch1.E8" content-type="numbered"><label>8</label><mml:math id="M42" display="block"><mml:mrow><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          the Bogacki–Shampine 3(2) method, for making a step from position <inline-formula><mml:math id="M43" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, at time <inline-formula><mml:math id="M44" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>,
to position <inline-formula><mml:math id="M45" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, at time <inline-formula><mml:math id="M46" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, is as follows.

                <disp-formula id="Ch1.E9" specific-use="gather" content-type="subnumberedsingle"><mml:math id="M47" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E9.10"><mml:mtd><mml:mtext>9a</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mfenced close=")" open="("><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E9.11"><mml:mtd><mml:mtext>9b</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mfenced open="(" close=")"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">2</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">2</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E9.12"><mml:mtd><mml:mtext>9c</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mfenced close=")" open="("><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">3</mml:mn><mml:mn mathvariant="normal">4</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">3</mml:mn><mml:mn mathvariant="normal">4</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E9.13"><mml:mtd><mml:mtext>9d</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mfenced close=")" open="("><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">2</mml:mn><mml:mn mathvariant="normal">9</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">3</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">4</mml:mn><mml:mn mathvariant="normal">9</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E9.14"><mml:mtd><mml:mtext>9e</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">7</mml:mn><mml:mn mathvariant="normal">24</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">4</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">3</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">8</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E9.15"><mml:mtd><mml:mtext>9f</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">2</mml:mn><mml:mn mathvariant="normal">9</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">3</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">4</mml:mn><mml:mn mathvariant="normal">9</mml:mn></mml:mfrac></mml:mstyle><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            This provides two estimates of the next position, of which <inline-formula><mml:math id="M48" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is of
order 3, and <inline-formula><mml:math id="M49" display="inline"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is of order 2. For this method, the higher-order
estimate is used to continue the integration (known as local extrapolation; see <xref ref-type="bibr" rid="bib1.bibx23" id="altparen.30"/>, p. 168), while the lower-order estimate is used to calculate <inline-formula><mml:math id="M50" display="inline"><mml:mrow><mml:mo>|</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>|</mml:mo></mml:mrow></mml:math></inline-formula>, which is used to estimate the local error and adjust the time step (see Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>).</p>
      <p id="d1e1738">Comparing Eqs. (<xref ref-type="disp-formula" rid="Ch1.E9.13"/>) and (<xref ref-type="disp-formula" rid="Ch1.E9.15"/>), we note that <inline-formula><mml:math id="M51" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. Hence, the weights of this method are chosen such that <inline-formula><mml:math id="M52" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> at one step is equal to <inline-formula><mml:math id="M53" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> at the next step. This property is known as First Same As Last (FSAL) and saves one evaluation of the right-hand side for every step after the first (see, e.g. <xref ref-type="bibr" rid="bib1.bibx23" id="altparen.31"/>, p. 167). Hence, with only three new evaluations of <inline-formula><mml:math id="M54" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, this method can provide both a third-order estimate used to continue the integration and a second-order estimate for error control.</p>
      <p id="d1e1830">Dormand–Prince 5(4) uses 7 evaluations of <inline-formula><mml:math id="M55" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> to construct a fifth-order
estimate for continuing the integration and a fourth-order estimate for error
control and time step adjustment. This method also has the FSAL property, meaning
that it uses only six evaluations for every step after the first. The final method
considered, Dormand–Prince 8(7), uses 13 evaluations of <inline-formula><mml:math id="M56" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> to construct
eighth-order and seventh-order estimates, of which the eighth-order is used to continue
the integration. This integrator does not have the FSAL property.</p>
</sec>
<sec id="Ch1.S2.SS3">
  <label>2.3</label><title>Time step adjustment</title>
      <p id="d1e1877">In the code used to carry out numerical experiments, time step adjustment has
been implemented based on the description in <xref ref-type="bibr" rid="bib1.bibx23" id="text.32"><named-content content-type="post">pp. 167–168</named-content></xref>. The user must specify two tolerance parameters, the absolute tolerance, <inline-formula><mml:math id="M57" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and the relative tolerance, <inline-formula><mml:math id="M58" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. We then want the estimate of the local error to satisfy
            <disp-formula id="Ch1.E16" content-type="numbered"><label>10</label><mml:math id="M59" display="block"><mml:mrow><mml:mfenced close="|" open="|"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mfenced><mml:mo>≤</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>⋅</mml:mo><mml:mo movablelimits="false">max⁡</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          To provide a measure of the error, we introduce <inline-formula><mml:math id="M60" display="inline"><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover></mml:math></inline-formula>, which is a normalised
numerical estimate of the true local error (Eq. <xref ref-type="disp-formula" rid="Ch1.E5"/>), given by
            <disp-formula id="Ch1.E17" content-type="numbered"><label>11</label><mml:math id="M61" display="block"><mml:mrow><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:msqrt><mml:mrow><mml:mo movablelimits="false">∑</mml:mo><mml:msup><mml:mfenced open="(" close=")"><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>⋅</mml:mo><mml:mo>max⁡</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:mfenced close="|" open="|"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:mfenced><mml:mo>,</mml:mo><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mfenced></mml:mrow></mml:mfenced></mml:mrow></mml:mfrac></mml:mstyle></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:msqrt><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where in our case we take the sum over the two vector components of the
solution.  We would like to find the optimal time step, in the sense of giving
the optimal balance between error and computational speed. We consider this to be the time step where the estimated local error is equal to error allowed by the tolerance, in which case we have <inline-formula><mml:math id="M62" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. If, after calculating <inline-formula><mml:math id="M63" display="inline"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M64" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, we find that <inline-formula><mml:math id="M65" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>≤</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, the step is accepted, we update the time to <inline-formula><mml:math id="M66" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and proceed with the calculation from the new position <inline-formula><mml:math id="M67" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>. If, on the other hand, <inline-formula><mml:math id="M68" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>&gt;</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, the step is rejected, and we remain at position <inline-formula><mml:math id="M69" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and attempt to make the step again with a reduced time step.</p>
      <p id="d1e2224">For both accepted and rejected steps, we adjust the time step after every step. Since <inline-formula><mml:math id="M70" display="inline"><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover></mml:math></inline-formula> scales with <inline-formula><mml:math id="M71" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mrow><mml:mi>q</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M72" display="inline"><mml:mi>q</mml:mi></mml:math></inline-formula> is the lower order of the two estimates <inline-formula><mml:math id="M73" display="inline"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M74" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, we find that the optimal time step, <inline-formula><mml:math id="M75" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">opt</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, is given by <xref ref-type="bibr" rid="bib1.bibx23" id="paren.33"><named-content content-type="post">p. 168</named-content></xref>
            <disp-formula id="Ch1.E18" content-type="numbered"><label>12</label><mml:math id="M76" display="block"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">opt</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:msup><mml:mfenced open="(" close=")"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:mover accent="true"><mml:mi>e</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover></mml:mrow></mml:mfenced><mml:mstyle scriptlevel="+1"><mml:mfrac><mml:mn mathvariant="normal">1</mml:mn><mml:mrow><mml:mi>q</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:mfrac></mml:mstyle></mml:msup><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          A rejected step represents wasted computational work. Hence, in order to make it more likely that the next step is accepted, we set the time step to a value
somewhat smaller than <inline-formula><mml:math id="M77" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">opt</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and we also seek to prevent the time step from increasing too quickly:
            <disp-formula id="Ch1.E19" content-type="numbered"><label>13</label><mml:math id="M78" display="block"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:mo movablelimits="false">min⁡</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:mn mathvariant="normal">3.0</mml:mn><mml:mo>⋅</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mn mathvariant="normal">0.9</mml:mn><mml:mo>⋅</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">opt</mml:mi></mml:msub></mml:mrow></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The factors 0.9 and 3.0 were chosen from a range of values recommended by
<xref ref-type="bibr" rid="bib1.bibx23" id="text.34"><named-content content-type="post">p. 168</named-content></xref> and were kept constant for all numerical experiments. The same time step adjustment routine as described above has been used for all three variable-time-step methods used in this paper.</p>
</sec>
<sec id="Ch1.S2.SS4">
  <label>2.4</label><title>Interpolation</title>
      <p id="d1e2424">Modelled ocean current velocity data used in Lagrangian oceanography are
commonly provided as vector components given on regular grids of discrete
points (<inline-formula><mml:math id="M79" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M80" display="inline"><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mi>j</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M81" display="inline"><mml:mrow><mml:msub><mml:mi>z</mml:mi><mml:mi>k</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>) and discrete times (<inline-formula><mml:math id="M82" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>).  In order to
calculate the trajectory of a particle that moves in the velocity field defined by these data, we will have to evaluate the vector field at arbitrary locations and (for variable-step methods) arbitrary times. An important point for our purposes is that the local error of an order <inline-formula><mml:math id="M83" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> Runge–Kutta method is only bounded by <inline-formula><mml:math id="M84" display="inline"><mml:mrow><mml:mi>C</mml:mi><mml:msup><mml:mi>h</mml:mi><mml:mrow><mml:mi>p</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> if all partial derivatives up to order <inline-formula><mml:math id="M85" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> of the velocity field, <inline-formula><mml:math id="M86" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E1"/>), exist and are continuous. This has implications for how we should evaluate the gridded velocity field used in a particle transport simulation. For example, if one uses linear interpolation, the first partial derivatives will be constant inside a cell but discontinuous at cell boundaries. Hence, even for a first-order method the local error is not guaranteed to be bounded by Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>) when stepping across a cell boundary (either in space or time).</p>
      <p id="d1e2526">In this study, we have chosen to consider three different interpolation schemes, using the same order of interpolation in both space and time:
<list list-type="custom"><list-item><label>-</label>
      <p id="d1e2531">second-order: linear interpolation;</p></list-item><list-item><label>-</label>
      <p id="d1e2535">fourth-order: cubic spline interpolation;</p></list-item><list-item><label>-</label>
      <p id="d1e2539">sixth-order: quintic spline interpolation.</p></list-item></list>
Note that the order of interpolation is 1 plus the polynomial degree (<xref ref-type="bibr" rid="bib1.bibx8" id="altparen.35"/>, p. 1).</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F1" specific-use="star"><?xmltex \currentcnt{1}?><label>Figure 1</label><caption><p id="d1e2548">One-dimensional illustration of different degrees of interpolation.    From the same 11 data points (shown as black circles in the top panel), we     have constructed a linear interpolation (continuous lines), a cubic spline     interpolation (dashed lines), and a quintic spline interpolation (dotted     lines). From the top, the panels show the interpolated functions, the first     derivative, the second derivative, and the third derivative. We observe that     linear interpolation, <inline-formula><mml:math id="M87" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, gives a discontinuous derivative, and cubic     interpolation, <inline-formula><mml:math id="M88" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, gives a discontinuous third derivative.</p></caption>
          <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f01.png"/>

        </fig>

      <p id="d1e2592">To aid the later discussion, we will briefly explain spline interpolation in one dimension. The generalisation to higher dimensions is natural.  Assume that we have a grid of <inline-formula><mml:math id="M89" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula> equidistant points, <inline-formula><mml:math id="M90" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>∈</mml:mo><mml:mo mathvariant="italic">{</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>N</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo mathvariant="italic">}</mml:mo></mml:mrow></mml:math></inline-formula>, and the values of some function in those points, <inline-formula><mml:math id="M91" display="inline"><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. The aim of an interpolation procedure is to allow us to approximate the function <inline-formula><mml:math id="M92" display="inline"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> at arbitrary <inline-formula><mml:math id="M93" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula>, subject to <inline-formula><mml:math id="M94" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>≤</mml:mo><mml:mi>x</mml:mi><mml:mo>≤</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. In the case of linear interpolation, the value of the linearly interpolated function <inline-formula><mml:math id="M95" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> on the interval <inline-formula><mml:math id="M96" display="inline"><mml:mrow><mml:mo>[</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>]</mml:mo></mml:mrow></mml:math></inline-formula> is given by
            <disp-formula id="Ch1.E20" content-type="numbered"><label>14</label><mml:math id="M97" display="block"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>⋅</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M98" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is the grid spacing. We see that <inline-formula><mml:math id="M99" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is a continuous function, but its derivative, <inline-formula><mml:math id="M100" display="inline"><mml:mrow><mml:msubsup><mml:mi>F</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mo>′</mml:mo></mml:msubsup><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, is not continuous at the grid points. A cubic spline interpolation, <inline-formula><mml:math id="M101" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, of the same data points as above will be given on an interval <inline-formula><mml:math id="M102" display="inline"><mml:mrow><mml:mo>[</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>]</mml:mo></mml:mrow></mml:math></inline-formula> by a cubic polynomial, e.g.
            <disp-formula id="Ch1.E21" content-type="numbered"><label>15</label><mml:math id="M103" display="block"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">̃</mml:mo></mml:mover><mml:mo>+</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:msup><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">̃</mml:mo></mml:mover><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:msup><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">̃</mml:mo></mml:mover><mml:mn mathvariant="normal">3</mml:mn></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M104" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal" stretchy="false">̃</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and the weights, <inline-formula><mml:math id="M105" display="inline"><mml:mrow><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M106" display="inline"><mml:mrow><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M107" display="inline"><mml:mrow><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M108" display="inline"><mml:mrow><mml:msub><mml:mi>w</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> are chosen such that <inline-formula><mml:math id="M109" display="inline"><mml:mrow><mml:msub><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M110" display="inline"><mml:mrow><mml:msubsup><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn><mml:mo>′</mml:mo></mml:msubsup><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M111" display="inline"><mml:mrow><mml:msubsup><mml:mi>F</mml:mi><mml:mn mathvariant="normal">3</mml:mn><mml:mrow><mml:mo>′</mml:mo><mml:mo>′</mml:mo></mml:mrow></mml:msubsup><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are all continuous at the grid points (see, e.g. Press et al., <xref ref-type="bibr" rid="bib1.bibx41" id="year.36"/>, pp. 120–124). By the
same token, a fifth-degree spline interpolation gives a piecewise polynomial
function of degree 5, with the property that the first, second, third, and fourth derivatives are continuous at the grid points. A one-dimensional illustration of the three degrees of interpolation considered in this paper is provided in Fig. <xref ref-type="fig" rid="Ch1.F1"/>. For a description of how spline interpolation of ocean current velocity fields was implemented, see Sect. <xref ref-type="sec" rid="Ch1.S4"/>.</p>
      <p id="d1e3164">Finally, we would like to note two important points on the subject of
interpolation in Lagrangian oceanography. First, the purpose of interpolating
discrete current data is not to approximate the unresolved turbulent
motion of the ocean but simply to provide a consistent recipe for evaluating
gridded data at arbitrary locations. Second, once an interpolation scheme has been chosen, one has effectively replaced the gridded input data by a set of
analytical expressions, specifying a way in which to evaluate the velocity field at any point and time. Hence, for a given dataset and interpolation scheme, the initial value problem given by <inline-formula><mml:math id="M112" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M113" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>, has a unique true solution (provided the usual conditions for existence
and uniqueness of solutions of ODEs are met; see, e.g. Hairer et al., <xref ref-type="bibr" rid="bib1.bibx23" id="year.37"/>, pp. 35–43). With an increasingly short time step, <inline-formula><mml:math id="M114" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, stable and consistent numerical integration schemes should converge towards the true solution.  However, velocity fields evaluated with different orders of interpolation are not identical, and will not produce identical trajectories, even as <inline-formula><mml:math id="M115" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>.</p>
</sec>
</sec>
<?pagebreak page5939?><sec id="Ch1.S3">
  <label>3</label><title>Special-purpose integrators</title>
      <p id="d1e3252">In this section, we will discuss the implications of our ODE having a right-hand side with discontinuous derivatives. We consider an analytical example with one discontinuity to illustrate the problem and present a modified special-purpose integration routine that handles the discontinuity. We then describe how to implement the same idea in special-purpose variants of regular variable-step integrators for application in Lagrangian oceanography.</p>
<sec id="Ch1.S3.SS1">
  <label>3.1</label><title>Discontinuous derivatives</title>
      <p id="d1e3262">As mentioned in Sect. <xref ref-type="sec" rid="Ch1.S2.SS1"/>, the conditions for a <inline-formula><mml:math id="M116" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula>th-order Runge–Kutta method to actually be <inline-formula><mml:math id="M117" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula>th-order accurate, require
continuous derivatives of the right-hand side, up to and including order <inline-formula><mml:math id="M118" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula>.
The problem is that consistency of order <inline-formula><mml:math id="M119" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> of the numerical method is no
longer satisfied when the derivatives are not continuous (<xref ref-type="bibr" rid="bib1.bibx28" id="altparen.38"/>, pp. 235, 252). In many cases this means that the error is larger than expected, but in some cases the problem may be more serious: the numerical approximation may be meaningless <xref ref-type="bibr" rid="bib1.bibx26" id="paren.39"><named-content content-type="post">p. 346</named-content></xref>. The more pathological examples are perhaps unlikely to occur in practice. However, as we will see later, when the error in even a single step is unbounded by Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>), this can in some cases dominate the global error, rendering the use of a higher-order scheme pointless.</p>
      <p id="d1e3306">In practical applications, with interpolated velocity fields, the derivatives
are not always continuous. For example, a common choice in the LCS literature
appears to be a variable-time-step integrator of order 4 and 5 (see, e.g.
<xref ref-type="bibr" rid="bib1.bibx1 bib1.bibx48 bib1.bibx5 bib1.bibx31" id="altparen.40"/>). Theoretically,
seventh-order spline interpolation, yielding five continuous derivatives, is
required for the error estimates in the step size control routine to hold.
However, higher-order spline interpolation is more computationally demanding,
and in practice cubic spline interpolation appears to be a common choice. It is also worth noting that, in general, spurious oscillations become increasingly problematic with increasing spline order.</p>
      <p id="d1e3312">For such cases, strategies exist to deal with the discontinuities in the right-hand side or (more commonly in our case) its derivatives <xref ref-type="bibr" rid="bib1.bibx22" id="paren.41"><named-content content-type="post">p. 181</named-content></xref>. Three possible strategies for dealing with ODEs with discontinuities are outlined by <xref ref-type="bibr" rid="bib1.bibx23" id="text.42"><named-content content-type="post">pp. 197–198</named-content></xref>.
<list list-type="custom"><list-item><label>i.</label>
      <p id="d1e3327">Ignore the discontinuity, and let the variable-step-size integrator sort out the problem.</p></list-item><list-item><label>ii.</label>
      <p id="d1e3331">Use an integrator with an error control routine specifically         designed to detect and handle discontinuities (see, e.g.        <xref ref-type="bibr" rid="bib1.bibx15 bib1.bibx10" id="altparen.43"/>).</p></list-item><list-item><label>iii.</label>
      <p id="d1e3338">Use information about the position of the discontinuity to stop        and restart integration at that point.</p></list-item></list></p>
      <?pagebreak page5940?><p id="d1e3341">Given that the issue of interpolation and integration is not typically discussed in great detail in applied papers on Lagrangian oceanography, one assumes that most authors implicitly select the first strategy. However, as pointed out by <xref ref-type="bibr" rid="bib1.bibx22" id="text.44"><named-content content-type="post">p. 181</named-content></xref>, this is neither the most accurate nor the most numerically efficient approach.</p>
</sec>
<sec id="Ch1.S3.SS2">
  <label>3.2</label><title>Analytical example</title>
      <p id="d1e3357">To illustrate the effect of discontinuities in the derivative of the right-hand side, we consider the following ODE:
            <disp-formula id="Ch1.E22" content-type="numbered"><label>16</label><mml:math id="M120" display="block"><mml:mrow><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mfenced close="|" open="|"><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">π</mml:mi><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mfenced><mml:mo>,</mml:mo><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          In this case, the right-hand side itself is continuous, but its derivative is
discontinuous at <inline-formula><mml:math id="M121" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. This equation has the following analytical solution:
            <disp-formula id="Ch1.E23" content-type="numbered"><label>17</label><mml:math id="M122" display="block"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:munderover><mml:mo movablelimits="false">∫</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mi>t</mml:mi></mml:munderover><mml:mfenced close="|" open="|"><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">π</mml:mi><mml:mi>s</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mfenced><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mi mathvariant="normal">d</mml:mi><mml:mi>s</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          and if we consider the solution at time <inline-formula><mml:math id="M123" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula> as an example, we find
<inline-formula><mml:math id="M124" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mn mathvariant="normal">4</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="italic">π</mml:mi></mml:mrow></mml:math></inline-formula>. Since the exact solution is known, we can find the error in
our numerical solutions by using the exact result as a reference. Hence, we can investigate the convergence of our numerical integration scheme by considering the error as a function of the time step, <inline-formula><mml:math id="M125" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F2"><?xmltex \currentcnt{2}?><label>Figure 2</label><caption><p id="d1e3512">Global error in the numerical solution of the initial value problem    given by Eq. (<xref ref-type="disp-formula" rid="Ch1.E22"/>) at <inline-formula><mml:math id="M126" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>. The solutions have    been calculated with 161 different time steps, <inline-formula><mml:math id="M127" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, logarithmically spaced     from <inline-formula><mml:math id="M128" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> to 1, using the fourth-order Runge–Kutta integrator and a    special-purpose modification of the same that stops and restarts the    integration exactly at the discontinuity at <inline-formula><mml:math id="M129" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. The two thin lines are    included to indicate the order of convergence and are proportional to <inline-formula><mml:math id="M130" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>    (dashed–dotted line) and <inline-formula><mml:math id="M131" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> (dotted line).</p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f02.png"/>

        </fig>

      <p id="d1e3594">In Fig. <xref ref-type="fig" rid="Ch1.F2"/>, we show the global error in the solution as a function of time step, <inline-formula><mml:math id="M132" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, for the fourth-order Runge–Kutta integrator (continuous black line). The error has been calculated for 161 logarithmically spaced time steps from 1 to <inline-formula><mml:math id="M133" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>. Of these 161 time steps, only 1, <inline-formula><mml:math id="M134" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M135" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M136" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M137" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> will evenly divide an interval of length 1. This is significant, as we observe that the error scales approximately as <inline-formula><mml:math id="M138" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> for the time steps 1, <inline-formula><mml:math id="M139" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M140" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M141" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, while for the other time steps it follows a slower <inline-formula><mml:math id="M142" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> scaling.  (Note that at <inline-formula><mml:math id="M143" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, the error is dominated by roundoff error (see
Appendix <xref ref-type="sec" rid="App1.Ch1.S1.SS1"/>), which adds up to about <inline-formula><mml:math id="M144" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">13</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> after
20 000 steps; <xref ref-type="bibr" rid="bib1.bibx41" id="altparen.45"/>, p. 10.)</p>
      <?pagebreak page5941?><p id="d1e3780">The reason for this behaviour is the discontinuity at <inline-formula><mml:math id="M145" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. For those time steps that divide an interval of length 1 into an integer number of steps, the integration will be stopped and restarted exactly at the discontinuity in the derivative of the right-hand side at <inline-formula><mml:math id="M146" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. Therefore, the error bound (Eq. <xref ref-type="disp-formula" rid="Ch1.E7"/>) holds, since the method does not step across the discontinuity. Stopping and restarting at discontinuities is precisely what <xref ref-type="bibr" rid="bib1.bibx23" id="text.46"><named-content content-type="post">pp. 197–198</named-content></xref> recommends in strategy iii discussed in Sect. <xref ref-type="sec" rid="Ch1.S3.SS1"/> above, and in this sense, isolated discontinuities in the derivatives are easy to handle if it is known where they are a priori.</p>
      <p id="d1e3816">Inspired by this result, we have designed a special-purpose version of the
fourth-order Runge–Kutta integrator, specifically for this problem with a
discontinuity at <inline-formula><mml:math id="M147" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. It is identical to the regular one in every way, except that if <inline-formula><mml:math id="M148" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>&lt;</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>&lt;</mml:mo><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi></mml:mrow></mml:math></inline-formula>, it divides that step into two steps of length <inline-formula><mml:math id="M149" display="inline"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>-</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M150" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>-</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>-</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, such that the integration is always stopped and restarted at <inline-formula><mml:math id="M151" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>.</p>
      <p id="d1e3895">The global error as a function of time step for this special-purpose integrator is also shown in Fig. <xref ref-type="fig" rid="Ch1.F2"/> (dashed line), and we observe that it follows the expected <inline-formula><mml:math id="M152" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> scaling very closely until the point where round off error starts to dominate. The additional computational expense of the special-purpose integrator is completely negligible in this case, as it takes at most one additional step compared to the regular fourth-order Runge–Kutta method, but as we see, it can increase the accuracy by several orders of magnitude. In the next section, we apply this idea to variable-time-step integrators for trajectory calculation in interpolated vector fields.</p>
</sec>
<sec id="Ch1.S3.SS3">
  <label>3.3</label><title>Special-purpose integrators for interpolated velocity fields</title>
      <p id="d1e3919">In terms of the three strategies for dealing with discontinuities (see
Sect. <xref ref-type="sec" rid="Ch1.S3.SS1"/>) we will investigate a hybrid approach in
this paper. We will use information about the location of the discontinuities in the time dimension (strategy iii) and leave the error control routine to deal with the problem in the spatial dimensions (strategy i). The reason for this choice is mainly pragmatic: for a particle trajectory, <inline-formula><mml:math id="M153" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, time is the independent variable, and it is very easy to stop and restart integration at “cell boundaries” in the time direction. Doing the same in the spatial dimensions requires detection of boundary crossings, dense output from the integrator, and a bisection scheme to identify the time at which the boundary is crossed <xref ref-type="bibr" rid="bib1.bibx23" id="paren.47"><named-content content-type="post">pp. 188–196</named-content></xref>.</p>
      <p id="d1e3943">We will take as our starting point variable-time-step Runge–Kutta methods, as
these are commonly used and generally quite efficient, and the time step
adjustment routine outlined in Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>. We then
modify the time step adjustment routine to make sure the integration is always
stopped and restarted at a cell boundary in time. We assume that the input data is given as snapshots of a vector field at a list of known times, <inline-formula><mml:math id="M154" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.
Depending on the degree of interpolation, the (higher) partial derivatives of
the interpolated vector field along the time dimension will thus have
discontinuities at times <inline-formula><mml:math id="M155" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p id="d1e3970">The variable-time-step integrator calculating the trajectory will make steps,
from position <inline-formula><mml:math id="M156" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, at time <inline-formula><mml:math id="M157" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, to position <inline-formula><mml:math id="M158" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, at time <inline-formula><mml:math id="M159" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.  Then, if we have <inline-formula><mml:math id="M160" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, for any <inline-formula><mml:math id="M161" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, i.e. if the integration is about to step across a discontinuity in time, the time step, <inline-formula><mml:math id="M162" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, is adjusted such that
            <disp-formula id="Ch1.E24" content-type="numbered"><label>18</label><mml:math id="M163" display="block"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          After that, integration and error control proceeds as normal. If <inline-formula><mml:math id="M164" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is set to <inline-formula><mml:math id="M165" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, then a step to that time is calculated. The error is then checked, as described in Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>. If the error is found to be too large according to the selected tolerance, the step is rejected, <inline-formula><mml:math id="M166" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is further reduced, and the step is attempted again. In the opposite case, the step is accepted, and time and position is updated to <inline-formula><mml:math id="M167" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M168" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>. At this point, the time step is reset to the original value of <inline-formula><mml:math id="M169" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> to avoid the integration proceeding with an unnecessarily short time step after the discontinuity has been crossed. For any step that does not cross a discontinuity in time, the integrator behaves exactly like the regular version.</p>
</sec>
</sec>
<sec id="Ch1.S4">
  <label>4</label><title>Numerical experiments</title>
      <p id="d1e4218">The aim of the numerical experiments is to investigate the practical implication
of different combinations of interpolation and integration schemes and to compare
the special-purpose integrators described in Sect. <xref ref-type="sec" rid="Ch1.S3.SS3"/> with
their standard counterparts, as well as with fixed-step Runge–Kutta methods. In the following subsections, we describe the input data and the setup used to carry out the numerical experiments. We have chosen to consider two-dimensional (horizontal) transport only, using the surface layer of the modelled current data. The current velocity field is interpolated in three dimensions (two spatial dimensions plus time), using the same degree of interpolation in all three dimensions.</p>
      <p id="d1e4223">In order to allow the interested reader to reproduce our results, we provide the Fortran code used to run the simulations, the ocean current data used, and the Jupyter notebooks that were used to analyse the data <xref ref-type="bibr" rid="bib1.bibx34" id="paren.48"/>. These can all be found on
GitHub<fn id="Ch1.Footn1"><p id="d1e4229"><ext-link xlink:href="https://github.com/nordam/ODE-integrators-for-Lagrangian-particles">https://github.com/nordam/ODE-integrators-for-</ext-link><?xmltex \hack{\break}?><ext-link xlink:href="https://github.com/nordam/ODE-integrators-for-Lagrangian-particles">Lagrangian-particles</ext-link>
(last access: 17 November 2020)</p></fn> under an open-source license. In order to reduce the file size of the current data, the extents of the original datasets were reduced, and unused variables
were deleted from the files. The domains of the reduced datasets are shown in
Fig. <xref ref-type="fig" rid="Ch1.F3"/>. All of the datasets were originally downloaded in the
netCDF format from the ocean and ice section of the THREDDS server of the
Norwegian Meteorological Institute<fn id="Ch1.Footn2"><p id="d1e4240"><uri>https://thredds.met.no/thredds/fou-hi/fou-hi.html</uri> (last access: 17 November 2020)</p></fn>.</p>
<?pagebreak page5942?><sec id="Ch1.S4.SS1">
  <label>4.1</label><title>Ocean currents</title>
      <p id="d1e4253">The datasets used were obtained from the Norwegian Meteorological Institute, and were taken from the following model setups:
<list list-type="custom"><list-item><label>-</label>
      <p id="d1e4258">Arctic20km (20 km horizontal resolution, 1 h time step),</p></list-item><list-item><label>-</label>
      <p id="d1e4262">Nordic4km (4 km horizontal resolution, 1 h time step),</p></list-item><list-item><label>-</label>
      <p id="d1e4266">NorKyst800m (800 m horizontal resolution, 1 h time step).</p></list-item></list></p>
      <p id="d1e4269">The dimensions of the datasets are <inline-formula><mml:math id="M170" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula>, <inline-formula><mml:math id="M171" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula>, <inline-formula><mml:math id="M172" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula>, and <inline-formula><mml:math id="M173" display="inline"><mml:mi>t</mml:mi></mml:math></inline-formula>, with the <inline-formula><mml:math id="M174" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> plane
defined in a polar stereographic projection, giving a regular (constant spacing) quadratic grid in the horizontal plane. The current velocity field is provided as vector components on the <inline-formula><mml:math id="M175" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> basis (as opposed to, e.g. an east–north basis). In our simulations, we track particle positions in metres, using the <inline-formula><mml:math id="M176" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> coordinate system of the polar stereographic projection of the datasets. This allowed us to use the vector components directly from the datasets, with no rotation or other conversion.  All error measurements are calculated from Euclidean distances in the <inline-formula><mml:math id="M177" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> plane.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F3"><?xmltex \currentcnt{3}?><label>Figure 3</label><caption><p id="d1e4343">Map showing the outline of the three datasets considered, as well     as the initial positions of the tracers used in the numerical experiments.</p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f03.png"/>

        </fig>

</sec>
<sec id="Ch1.S4.SS2">
  <label>4.2</label><title>Initial conditions</title>
      <p id="d1e4360">The initial conditions for the trajectory calculations were chosen to be <inline-formula><mml:math id="M178" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">100</mml:mn></mml:mrow></mml:math></inline-formula> points off the coast of Norway, placed on a regular quadratic grid with grid spacing of 1600 m, as shown in Fig. <xref ref-type="fig" rid="Ch1.F3"/>. The
same initial conditions were used for all three datasets. Roughly the
easternmost half of the initial positions are within the Norwegian coastal
current (see, e.g. <xref ref-type="bibr" rid="bib1.bibx45" id="altparen.49"/>) and are predominantly transported
northward along the coast. The trajectories were started at midnight on 8 February 2017 and integrated for 72 h. All the particles remain inside the smallest domain (the 800 m resolution setup; see Fig. <xref ref-type="fig" rid="Ch1.F3"/>) throughout this period. The final positions are shown in Fig. <xref ref-type="fig" rid="Ch1.F4"/> for each of the three different datasets.</p>

      <?xmltex \floatpos{p}?><fig id="Ch1.F4" specific-use="star"><?xmltex \currentcnt{4}?><label>Figure 4</label><caption><p id="d1e4386">The figure shows the initial and final positions of the 10 000 particles for the three different datasets. The initial positions are the    same, but the final positions differ. The average transport is towards the    north in all cases, but the higher-resolution currents show more eddy    activity, particularly in the eastern region, which falls within the    Norwegian Coastal Current (see, e.g. <xref ref-type="bibr" rid="bib1.bibx45" id="altparen.50"/>). These plots show    the positions calculated with cubic interpolation, fourth-order Runge–Kutta,    and a time step of 1 s. Results obtained with the other methods appear visually identical at this scale.</p></caption>
          <?xmltex \igopts{width=398.338583pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f04.png"/>

        </fig>

</sec>
<sec id="Ch1.S4.SS3">
  <label>4.3</label><title>Reference solutions</title>
      <p id="d1e4407">As we wish to estimate the global error of our numerical solutions, when the
true solutions are unknown, we need to establish highly accurate numerical
solutions for all 10 000 initial conditions to use as a reference.
Reference solutions must be established for each dataset, as they will in
general give different trajectories. Additionally, reference solutions must also be established for each interpolation scheme, as they will also in general give different trajectories. Hence, for three datasets and three interpolation schemes, we need nine different sets of reference solutions.</p>
      <p id="d1e4410">We point out that we here talk about reference solutions in a purely numerical sense, as the most mathematically accurate solution of the initial-value problem given by an initial position and a discrete velocity field with a specified interpolation scheme. Which of the datasets and interpolation schemes that most accurately reproduce the trajectories of true Lagrangian drifters in the ocean is a different question, outside the scope of this investigation.</p>
      <p id="d1e4413">For numerically obtained reference solutions to be useable in calculating error estimates, they need to be significantly more accurate than any of the numerical solutions that are to be evaluated. As an example, consider a fixed-step integrator and let the numerical solution at time <inline-formula><mml:math id="M179" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, calculated with a time step <inline-formula><mml:math id="M180" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, be <inline-formula><mml:math id="M181" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and let the true (but usually unknown) solution at time <inline-formula><mml:math id="M182" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be <inline-formula><mml:math id="M183" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>.  Furthermore, assume that a reference solution <inline-formula><mml:math id="M184" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> has been calculated with a very short time step <inline-formula><mml:math id="M185" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p id="d1e4511">Then, the error in the reference solution, relative to the true (but unknown)
solution, is given by
            <disp-formula id="Ch1.E25" content-type="numbered"><label>19</label><mml:math id="M186" display="block"><mml:mrow><mml:msub><mml:mi>E</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mfenced close=")" open="("><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub></mml:mrow></mml:mfenced><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Similarly, the error in a solution calculated with a longer time step, <inline-formula><mml:math id="M187" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, is
            <disp-formula id="Ch1.E26" content-type="numbered"><label>20</label><mml:math id="M188" display="block"><mml:mrow><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          When we estimate the error by purely numerical means, we do not know the true
solution, <inline-formula><mml:math id="M189" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. Instead, we use the reference solution in place of the true solution, and calculate an estimate of the error, given by
            <disp-formula id="Ch1.E27" content-type="numbered"><label>21</label><mml:math id="M190" display="block"><mml:mtable rowspacing="0.2ex" class="split" columnspacing="1em" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mover accent="true"><mml:mi>E</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mfenced open="(" close=")"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub></mml:mrow></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd/><mml:mtd><mml:mrow><mml:mo>=</mml:mo><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>E</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          Hence, we see that the numerical estimate, <inline-formula><mml:math id="M191" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>E</mml:mi><mml:mo mathvariant="normal">‾</mml:mo></mml:mover><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, of the global
error, is only a good estimate if <inline-formula><mml:math id="M192" display="inline"><mml:mrow><mml:msub><mml:mi>E</mml:mi><mml:mi mathvariant="normal">ref</mml:mi></mml:msub><mml:mo>≪</mml:mo><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>.</p>
      <?pagebreak page5944?><p id="d1e4735">To verify that the errors in the reference solutions are indeed much smaller
than any of the other errors we wish to estimate, we consider the convergence of the numerically estimated error. The details of the analysis to identify
reference solutions are shown in Appendix <xref ref-type="sec" rid="App1.Ch1.S1"/>. We found that the most accurate solutions were obtained with the fourth-order Runge–Kutta integrator, using a fixed short time step. The time step that yielded the most accurate solutions varied, depending on the dataset and the order of interpolation. The results are given in Table <xref ref-type="table" rid="App1.Ch1.S1.T4"/>.</p>
</sec>
<sec id="Ch1.S4.SS4">
  <label>4.4</label><title>Implementation</title>
      <p id="d1e4750">To allow easy testing of different combinations of datasets, interpolators, and integrators in a setting relevant for marine transport applications, a simple Lagrangian particle transport code was written in Fortran.  All the integrators were implemented as described in Sects. <xref ref-type="sec" rid="Ch1.S2.SS2"/>,
<xref ref-type="sec" rid="Ch1.S2.SS3"/>, and <xref ref-type="sec" rid="Ch1.S3.SS3"/> and in the references
given. The netCDF library for
Fortran<fn id="Ch1.Footn3"><p id="d1e4759"><uri>https://www.unidata.ucar.edu/software/netcdf/docs-fortran/</uri> (last access: 17 November 2020)</p></fn> was used to read ocean current data, and interpolation was done using the library
bspline-fortran<fn id="Ch1.Footn4"><p id="d1e4765"><uri>https://github.com/jacobwilliams/bspline-fortran</uri> (last access: 17 November 2020)</p></fn>
<xref ref-type="bibr" rid="bib1.bibx55" id="paren.51"/>. Our implementations of the different integrators, and all the code used to run the simulations, are freely available on
GitHub<fn id="Ch1.Footn5"><p id="d1e4775"><ext-link xlink:href="https://github.com/nordam/ODE-integrators-for-Lagrangian-particles">https://github.com/nordam/ODE-integrators-for-</ext-link><?xmltex \hack{\break}?><ext-link xlink:href="https://github.com/nordam/ODE-integrators-for-Lagrangian-particles">Lagrangian-particles</ext-link>  (last access: 17 November 2020)</p></fn>.</p>
      <p id="d1e4784">At the start of the simulations, subsets of the ocean current datasets were
loaded from file. The horizontal extent of the subsets are shown in
Fig. <xref ref-type="fig" rid="Ch1.F3"/>, along with the initial positions of the particles. We used only the surface layer of the datasets and data spanning 5 d. The
subsets were selected to cover the entire simulation period in time and the
entire horizontal extent of the particle trajectories, extending some cells in all directions to avoid edge effects in the spline interpolation. Data points that were on land were set to 0 current velocity. No special steps were taken to handle the coastline, although the initial conditions were chosen to avoid particles getting stuck in land cells. Note that with higher-degree interpolation schemes, the fact that we set the currents to zero in land cells will have an effect on one or more of the closest cells to the coastline. For applications such as oil spill modelling, where shoreline interactions are important, a different strategy might be needed.</p>
      <p id="d1e4789">The data were passed to the <monospace>initialize</monospace> method of the derived type
<monospace>bspline_3d</monospace> from the bspline-fortran library, along with the parameter to select the order of interpolation (note that the order of a spline is 1 plus the polynomial degree, meaning the order is 2 for linear interpolation, 4 for cubic splines, and 6 for quintic splines).  The <inline-formula><mml:math id="M193" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M194" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> components of the current velocity vectors were interpolated separately, and the order of interpolation was always the same along all three dimensions (<inline-formula><mml:math id="M195" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula>, <inline-formula><mml:math id="M196" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula>, <inline-formula><mml:math id="M197" display="inline"><mml:mi>t</mml:mi></mml:math></inline-formula>).</p>
      <p id="d1e4834">We note that this approach constructs a single global interpolation object,
that is used throughout the simulation. It is also possible to construct local spline interpolations using only the smallest required number of points, surrounding the location where the function is to be evaluated
(<inline-formula><mml:math id="M198" display="inline"><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula> points for linear interpolation, <inline-formula><mml:math id="M199" display="inline"><mml:mrow><mml:mn mathvariant="normal">4</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">4</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:math></inline-formula> for cubic splines, and <inline-formula><mml:math id="M200" display="inline"><mml:mrow><mml:mn mathvariant="normal">6</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">6</mml:mn><mml:mo>×</mml:mo><mml:mn mathvariant="normal">6</mml:mn></mml:mrow></mml:math></inline-formula> for quintic). However, this creates additional discontinuities in the derivatives of the right-hand side when switching from one local interpolator to the next, as discussed by, e.g.
<xref ref-type="bibr" rid="bib1.bibx29" id="text.52"/>.</p>
      <p id="d1e4889">During the simulations, the trajectory of each particle was calculated
independently of all others. For the variable-step integrators, this means that each particle had its own time step. It is also possible to apply the
variable-step integrators to all particles simultaneously with the same
time step. However, due the local variability of the ocean currents, it seemed
more reasonable to treat the particles individually, allowing the variable-step integrators to adapt to local conditions for each particle.</p>
</sec>
</sec>
<sec id="Ch1.S5">
  <label>5</label><title>Results and discussion</title>
      <p id="d1e4902">The main results are presented as a work–precision diagram, in
Fig. <xref ref-type="fig" rid="Ch1.F5"/>. The figure shows the median relative global error over all 10 000 particles, as a function of number of evaluations of the right-hand side of the ODE (including rejected steps). The relative global error is calculated as the normalised distance between the endpoint of each trajectory and that of the corresponding reference solution (see Sect. <xref ref-type="sec" rid="Ch1.S4.SS3"/> and Appendix <xref ref-type="sec" rid="App1.Ch1.S1"/>). See also
Fig. <xref ref-type="fig" rid="App1.Ch1.S2.F9"/>, where the range of errors is shown.</p>
      <p id="d1e4913">Number of evaluations of the right-hand side was chosen as a measure of work, as it is more objective than the runtime of the simulation, which would depend on the particular machine used to run the simulations and also be more susceptible to somewhat random variations. However, for the interested reader we show the error as a function of runtime in Fig. <xref ref-type="fig" rid="App1.Ch1.S2.F10"/>.</p>
      <p id="d1e4918">While we analyse the results in terms of number of function calls, we note that higher-degree interpolation is more computationally costly than lower-degree interpolation. This means that the same number of evaluations will take more time if a higher degree of interpolation is used. We found that for the simulations done with the fixed-step fourth-order Runge–Kutta integrator, the simulations with cubic spline interpolation took on average four to five times longer than those with linear interpolation, and the simulations with quintic spline interpolation took on average three to four times longer than those with cubic spline interpolation.  As a concrete example, calculating the trajectories of 10 000 particles for 72 h with a 10 min time step with the fourth-order Runge–Kutta integrator, took 11 s with linear interpolation, 51 s with cubic interpolation, and 177 s with quintic interpolation. The numbers were essentially the same for all three datasets (800 m, 4 km and 20 km). These times cover only the
trajectory calculation itself, not file I/O or the construction of the global
interpolator object.</p>
      <p id="d1e4921">The fixed-step integrators were run with the range of time steps shown in
Table <xref ref-type="table" rid="Ch1.T1"/>. Note that all of these steps evenly divide the
3600 s interval of the data, making sure that the<?pagebreak page5945?> integration is always stopped and restarted at a cell boundary in the time dimension (see
discussion in Sect. <xref ref-type="sec" rid="Ch1.S3"/>).</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T1"><?xmltex \currentcnt{1}?><label>Table 1</label><caption><p id="d1e4932">Time steps and tolerances used in the numerical experiments.</p></caption><oasis:table frame="topbot"><?xmltex \begin{scaleboxenv}{.96}[.96]?><oasis:tgroup cols="2">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:thead>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Time steps [s]</oasis:entry>
         <oasis:entry colname="col2">3600, 1800, 1200, 900, 600, 450, 300, 180, 120</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">Tolerances</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M201" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M202" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M203" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">6</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M204" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">7</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M205" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">8</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M206" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">9</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M207" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>,</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M208" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">11</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M209" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">12</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M210" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">13</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M211" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">14</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup><?xmltex \end{scaleboxenv}?></oasis:table></table-wrap>

      <p id="d1e5128">The tolerances used with the variable-step integrators are also shown in
Table <xref ref-type="table" rid="Ch1.T1"/>, with <inline-formula><mml:math id="M212" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> (see
Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>). Note that in the coordinate system used, the particle positions are all of the order <inline-formula><mml:math id="M213" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">6</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> m, meaning that the relative tolerance dominates in practice (see
Eq. <xref ref-type="disp-formula" rid="Ch1.E16"/>). Both the regular and the special-purpose
variable-step integrators were used with the same tolerances, but we note that the special-purpose integrators are by design unable to take steps longer than the interval on which the data is given. Hence, for the higher tolerances (allowing larger errors), the special-purpose integrators would default to fixed-step integration with a time step of 3600 s (for the datasets used here).</p>
      <p id="d1e5166">We observe from Fig. <xref ref-type="fig" rid="Ch1.F5"/> that the most efficient
choice of integrator, in the sense of fewest evaluations of the right-hand side for a given accuracy, depends on the desired accuracy, the order of the
interpolation, and the spatial resolution of the dataset. We will discuss these points in turn.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F5" specific-use="star"><?xmltex \currentcnt{5}?><label>Figure 5</label><caption><p id="d1e5173">Relative global error (relative to the reference solution) as a     function of number of evaluations of the right-hand side.  Note that the    special-purpose integrators are (by design) unable to make longer steps than    the interval on which the data are provided. This means some of the    simulations with higher tolerance (allowing larger errors) have in practice    defaulted to fixed-step simulation with a time step of 3600 s, making several of the data points identical. This is most readily observed for the special-purpose Dormand–Prince 8(7) integrator in the lower-right panel.</p></caption>
        <?xmltex \igopts{width=469.470472pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f05.png"/>

      </fig>

<sec id="Ch1.S5.SS1">
  <label>5.1</label><title>Fixed-step integrators</title>
      <p id="d1e5189">Variable-step integrators are normally the most efficient choice for
general ODE problems. However, we see that for finding tracer trajectories from interpolated velocity fields, fixed-step integrators are in some cases a better choice than regular variable-step methods. Considering for example cubic spline interpolation (Fig. <xref ref-type="fig" rid="Ch1.F5"/>, middle row), we see that fourth-order Runge–Kutta almost always gives better accuracy for the same amount of work, relative to all three regular variable-step integrators. The only exception is for very small errors, for the 800 m dataset, where Dormand–Prince 5(4) has a small advantage. Similarly, for linear interpolation (Fig. <xref ref-type="fig" rid="Ch1.F5"/>, top row) the third- and fourth-order fixed-step methods outperform the regular variable-step methods, except if very small errors are required.</p>
      <p id="d1e5196">The special-purpose variants of the variable-step integrators, particularly
Dormand–Prince 5(4) and 8(7), perform better than the fixed-step methods in most
cases, though not always by a large margin. The reason for the relatively strong
performance of the fixed-step integrators is that the chosen time steps evenly
divide the 3600 s intervals of the datasets. Hence, the fixed-step
integrators will stop and restart integration at the discontinuities in time,
just like the special-purpose integrators (see Sect. <xref ref-type="sec" rid="Ch1.S3.SS3"/>). For
an illustration of the effect of choosing time steps that do not evenly divide the temporal grid spacing of the dataset, see
<xref ref-type="bibr" rid="bib1.bibx35" id="text.53"><named-content content-type="post">Fig. 18</named-content></xref>.</p>
      <p id="d1e5206">We also note that for the case of linear interpolation, the third-order
Runge–Kutta integrator actually performs slightly better than the fourth-order integrator,
particularly for the smaller errors.  The reason for this is that the lack of
continuous derivatives means the fourth-order method does not achieve fourth-order
convergence. As the third-order method uses one fewer evaluation of the right-hand side per step, it therefore has an advantage in terms of computational effort. It is also worth pointing out that the second-order Runge–Kutta method considered here, known as the explicit trapezoid method, has the advantage that it uses no intermediate points in time. Since it only evaluates the right-hand side at times <inline-formula><mml:math id="M214" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M215" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, it is possible to dispense with interpolation in time entirely if one selects the integration time step, <inline-formula><mml:math id="M216" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>, to be equal to the temporal grid spacing of the data. Note that this requires reasonably high temporal resolution of the dataset, which may not always be practical.</p>
</sec>
<sec id="Ch1.S5.SS2">
  <label>5.2</label><title>Variable-step integrators</title>
      <p id="d1e5252">As a background for discussing the effect of horizontal resolution on our
results, we recall that all the three datasets used have a temporal resolution of 1 h. This means that the particle trajectories will cross a cell boundary in the time-dimension (and thus a discontinuity in the (higher)
derivatives of the right-hand side) every hour. The average current speed for
the time and area studied is approximately 0.2 m s<inline-formula><mml:math id="M217" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> in all three datasets. Hence, we find that a particle that moves in the velocity field defined by the dataset at 800 m spatial resolution will cross a spatial cell boundary approximately once every hour on average. For the dataset with
4 km resolution, this will only happen 1/5th as often, and for the 20 km dataset this will only happen 1/25th as often. These are only crude estimates, but we can nevertheless conclude that for the low-resolution datasets, the errors picked up at the discontinuities in time will be more important than those in space, while for the high-resolution (800 m) dataset, the two will be of similar importance.</p>
      <p id="d1e5267">Looking at the results presented in Fig. <xref ref-type="fig" rid="Ch1.F5"/>, we find that they support these observations. Considering first the case of linear interpolation, we see that for the 20 km dataset
(Fig. <xref ref-type="fig" rid="Ch1.F5"/>, upper-right panel), there is a considerable (several orders of magnitude) reduction in error in the special-purpose integrators compared to the regular variable-step integrators for a given number of evaluations. Recall that the only difference between these is that the special-purpose integrators stop and restart the integration at every cell boundary along the time dimension (see Sect. <xref ref-type="sec" rid="Ch1.S3.SS3"/>). For the 800 m dataset (Fig. <xref ref-type="fig" rid="Ch1.F5"/>, upper-left panel) on the other hand, there is less (up to about an order of magnitude) difference between the regular and special variable-step integrators. This is presumably because the discontinuities in time do not dominate the error as much in this case.</p>
      <?pagebreak page5946?><p id="d1e5278">Looking next at the results for cubic spline interpolation
(Fig. <xref ref-type="fig" rid="Ch1.F5"/>, middle row), we notice that the results for the regular and special-purpose versions of the Bogacki–Shampine
3(2) integrator are now practically identical. For the Dormand–Prince 5(4) and 8(7) integrators, the special-purpose variants are far more accurate than the standard counterparts. This is particularly true for the 4 and
20 km datasets, where the difference is several orders of magnitude.</p>
      <p id="d1e5283">Presumably, the reason why the standard and special-purpose variants of the
Bogacki–Shampine 3(2) integrator give more or less identical results for cubic interpolation is the smoothness of the velocity field. It seems the
interpolated field is now sufficiently smooth that the method is now third-order consistent. Strictly speaking, this is unexpected. A cubic spline
interpolation will have continuous second derivatives, and discontinuous third derivatives. This means that the Bogacki–Shampine 3(2) integrator can indeed be expected to be second-order consistent, but the conditions for the third-order consistency are not satisfied.</p>
      <p id="d1e5287">Using quintic spline interpolation (Fig. <xref ref-type="fig" rid="Ch1.F5"/>, bottom row), the special-purpose variant of the Dormand–Prince 8(7) integrator performs better than all the other methods by at least an order of magnitude. We also find that the results for the regular and special-purpose
versions of the Dormand–Prince 5(4) integrators are more or less identical. As above, this was not entirely expected, since a quintic spline has only four continuous derivatives, not the five that are theoretically required for the local error of a fifth-order method to be bounded by Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>).</p>
      <p id="d1e5294">To understand the large differences in number of function evaluations between
the standard and the special-purpose integrators, we look at the fraction of
rejected steps. For the different integrators and interpolators, and a fixed
tolerance of <inline-formula><mml:math id="M218" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, these fractions are given in Table <xref ref-type="table" rid="Ch1.T2"/>. Rejected steps represent wasted computational effort, since a rejected step requires as many evaluations of the right-hand side of the ODE as an accepted step, without advancing the integration.</p>
      <p id="d1e5327">The results shown in Table <xref ref-type="table" rid="Ch1.T2"/> further support the conclusions we drew from Fig. <xref ref-type="fig" rid="Ch1.F5"/> above. For those cases where the order of interpolation is less than the theoretical requirements of the
integrator, the special-purpose integrators significantly reduce the fraction of rejected steps.  The difference is also largest for the 20 km dataset, as discussed previously. This can be seen particularly for the Dormand–Prince 8(7) integrator with cubic and quintic interpolation, where the rejected fraction falls to almost nothing for the special-purpose variant. The
same, but to a lesser degree, is seen for<?pagebreak page5947?> the Dormand–Prince 5(4) integrator,
with linear and cubic interpolation. On the other hand, for the Bogacki–Shampine 3(2) integrator, with cubic and quintic interpolation, we see that there is essentially no difference between the regular and special variants, as the velocity field is sufficiently smooth for the error control routine not to detect any increased local error at the boundary crossings.</p>
      <p id="d1e5334">The largest improvement in accuracy for the special-purpose integrators is thus seen with linear interpolation, but they can also be advantageous with cubic interpolation. With quintic interpolation, only the special-purpose (8)7 integrator has an advantage over its regular counterpart. However, the relative error of the special (8)7 method with quintic interpolation is comparable to the (5)4 method with cubic interpolation. While the solutions will be different with different interpolation schemes, it is possible that overshooting due to a high-order interpolation method without any additional accuracy implies that the (8)7 method is not a good choice for Lagrangian oceanography. Note also that the quintic interpolation scheme is 3–4 times as computationally expensive as the cubic scheme for each evaluation of the right-hand side.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T2"><?xmltex \currentcnt{2}?><label>Table 2</label><caption><p id="d1e5340">Fraction of steps rejected, averaged over all 10 000 trajectories,    with a duration of 72 h, for each combination of interpolation scheme and variable-step-size integrator, for all three datasets and a fixed    tolerance of <inline-formula><mml:math id="M219" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> (see    Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>).</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="5">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:colspec colnum="3" colname="col3" align="center"/>
     <oasis:colspec colnum="4" colname="col4" align="center"/>
     <oasis:colspec colnum="5" colname="col5" align="center"/>
     <oasis:thead>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Resolution</oasis:entry>
         <oasis:entry colname="col2">Integrator</oasis:entry>
         <oasis:entry colname="col3">Linear</oasis:entry>
         <oasis:entry colname="col4">Cubic</oasis:entry>
         <oasis:entry colname="col5">Quintic</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2)</oasis:entry>
         <oasis:entry colname="col3">0.334</oasis:entry>
         <oasis:entry colname="col4">0.017</oasis:entry>
         <oasis:entry colname="col5">0.018</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2) special</oasis:entry>
         <oasis:entry colname="col3">0.067</oasis:entry>
         <oasis:entry colname="col4">0.016</oasis:entry>
         <oasis:entry colname="col5">0.018</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4)</oasis:entry>
         <oasis:entry colname="col3">0.588</oasis:entry>
         <oasis:entry colname="col4">0.486</oasis:entry>
         <oasis:entry colname="col5">0.251</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4) special</oasis:entry>
         <oasis:entry colname="col3">0.084</oasis:entry>
         <oasis:entry colname="col4">0.113</oasis:entry>
         <oasis:entry colname="col5">0.156</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7)</oasis:entry>
         <oasis:entry colname="col3">0.608</oasis:entry>
         <oasis:entry colname="col4">0.558</oasis:entry>
         <oasis:entry colname="col5">0.482</oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">20 km</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7) special</oasis:entry>
         <oasis:entry colname="col3">0.152</oasis:entry>
         <oasis:entry colname="col4">0.000</oasis:entry>
         <oasis:entry colname="col5">0.000</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2)</oasis:entry>
         <oasis:entry colname="col3">0.309</oasis:entry>
         <oasis:entry colname="col4">0.023</oasis:entry>
         <oasis:entry colname="col5">0.024</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2) special</oasis:entry>
         <oasis:entry colname="col3">0.095</oasis:entry>
         <oasis:entry colname="col4">0.022</oasis:entry>
         <oasis:entry colname="col5">0.024</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4)</oasis:entry>
         <oasis:entry colname="col3">0.587</oasis:entry>
         <oasis:entry colname="col4">0.436</oasis:entry>
         <oasis:entry colname="col5">0.247</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4) special</oasis:entry>
         <oasis:entry colname="col3">0.289</oasis:entry>
         <oasis:entry colname="col4">0.115</oasis:entry>
         <oasis:entry colname="col5">0.158</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7)</oasis:entry>
         <oasis:entry colname="col3">0.609</oasis:entry>
         <oasis:entry colname="col4">0.554</oasis:entry>
         <oasis:entry colname="col5">0.394</oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">4 km</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7) special</oasis:entry>
         <oasis:entry colname="col3">0.379</oasis:entry>
         <oasis:entry colname="col4">0.012</oasis:entry>
         <oasis:entry colname="col5">0.019</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2)</oasis:entry>
         <oasis:entry colname="col3">0.266</oasis:entry>
         <oasis:entry colname="col4">0.016</oasis:entry>
         <oasis:entry colname="col5">0.016</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">B-S 3(2) special</oasis:entry>
         <oasis:entry colname="col3">0.161</oasis:entry>
         <oasis:entry colname="col4">0.016</oasis:entry>
         <oasis:entry colname="col5">0.016</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4)</oasis:entry>
         <oasis:entry colname="col3">0.580</oasis:entry>
         <oasis:entry colname="col4">0.294</oasis:entry>
         <oasis:entry colname="col5">0.217</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">D-P 5(4) special</oasis:entry>
         <oasis:entry colname="col3">0.490</oasis:entry>
         <oasis:entry colname="col4">0.159</oasis:entry>
         <oasis:entry colname="col5">0.152</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7)</oasis:entry>
         <oasis:entry colname="col3">0.615</oasis:entry>
         <oasis:entry colname="col4">0.468</oasis:entry>
         <oasis:entry colname="col5">0.237</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">800 m</oasis:entry>
         <oasis:entry colname="col2">D-P 8(7) special</oasis:entry>
         <oasis:entry colname="col3">0.545</oasis:entry>
         <oasis:entry colname="col4">0.269</oasis:entry>
         <oasis:entry colname="col5">0.124</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table></table-wrap>

</sec>
<sec id="Ch1.S5.SS3">
  <label>5.3</label><title>Diffusion</title>
      <p id="d1e5748">As mentioned in Sect. 2, we have considered pure advection, ignoring diffusion. Calculating trajectories with pure advection by a deterministic
velocity field is common in several applications, perhaps most notably for
identification of LCS (see, e.g. <xref ref-type="bibr" rid="bib1.bibx25 bib1.bibx2 bib1.bibx14" id="altparen.54"/>). Other examples include the use of backwards trajectories to
identify source regions for particles ending up in the sediments
<xref ref-type="bibr" rid="bib1.bibx52" id="paren.55"/> and analysis of Lagrangian pathways to study the source
and history of water parcels reaching a particular upwelling zone
<xref ref-type="bibr" rid="bib1.bibx43" id="paren.56"/>. In general, simulating diffusion in Lagrangian
oceanography (or meteorology) may introduce a complication that encourages some studies to compute trajectories without diffusion: Lagrangian motion becomes ambiguous when diffusive mixing is simulated because the identity of a fluid parcel is lost. On the other hand, ignoring small-scale mixing may also be problematic. One approach to this problem is to supplement purely advective trajectories with along-path changes in parcel properties, as discussed in <xref ref-type="bibr" rid="bib1.bibx43" id="text.57"/>.</p>
      <p id="d1e5763">However, for many other applications diffusion must be included. Solving
the advection-diffusion equation with a particle method amounts to numerical
solution of a stochastic differential equation (SDE) instead of an ODE. A
range of different SDE schemes exist, and the details differ, but all such
schemes involve adding a random increment at each time step. If the random
increment is far larger than the local numerical error in each step, then the
numerical error in the advection is probably of limited practical importance.
The details will depend on the application, and we encourage experimentation. A detailed description of numerical SDE schemes is outside the scope of this
study, but the interested reader may find it useful to refer to, e.g.
<xref ref-type="bibr" rid="bib1.bibx27" id="text.58"/>, <xref ref-type="bibr" rid="bib1.bibx51" id="text.59"/>, and <xref ref-type="bibr" rid="bib1.bibx19" id="text.60"/>.</p>
</sec>
<sec id="Ch1.S5.SS4">
  <label>5.4</label><title>Summary</title>
      <p id="d1e5783">We have seen that the special-purpose integrators are more efficient than their regular counterparts in almost all cases, and sometimes they deliver several
orders of magnitude improvement in accuracy at the same computational cost.
There are two different effects that give the special-purpose integrators their advantage in accuracy and efficiency. The first is that they stop and restart integration exactly at the discontinuities in time, which avoids picking up local errors unbounded by Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>) at those points. The second effect is that they avoid many rejected steps by stopping at the discontinuity, instead of trying to step across.</p>
      <?pagebreak page5948?><p id="d1e5788">The regular variable-step integrators will frequently try to step across a
discontinuity, only to find that the estimated local error is too large, such
that the step must be rejected and retried with a shorter time step. This process will continue until a time step is found that is short enough to allow the discontinuity to be crossed with an error that stays within the tolerance. As we see from the results in Table <xref ref-type="table" rid="Ch1.T2"/>, this can lead to a large fraction of rejected steps. Also, recall that the regular variable-step integrators have no information about the location of the discontinuities in time, which means that the probability of stopping and restarting the integration exactly at a discontinuity is essentially zero. For further details, see the discussion in Sect. <xref ref-type="sec" rid="Ch1.S3"/>, as well as <xref ref-type="bibr" rid="bib1.bibx22" id="text.61"><named-content content-type="post">p. 181</named-content></xref> and <xref ref-type="bibr" rid="bib1.bibx23" id="text.62"><named-content content-type="post">pp. 197–198</named-content></xref>.</p>
</sec>
</sec>
<sec id="Ch1.S6" sec-type="conclusions">
  <label>6</label><title>Conclusions</title>
      <p id="d1e5814">In this paper, we have investigated how different numerical integrators behave
in combination with different degrees of interpolation and datasets of
different spatial resolution. We have calculated trajectories over 72 h,
from 10 000 initial positions, and compared the integrator–interpolator
pairs in terms of the error in the final position of each trajectory. We have
considered linear, cubic, and quintic spline interpolation, along with four
fixed-step Runge–Kutta integrators of orders 1 to 4, three commonly used
variable-step integrators, and three special-purpose variants of the latter.</p>
      <p id="d1e5817">The most striking conclusion from our results is that the special-purpose
integrators we describe in many cases deliver several orders of magnitude more accurate results at no additional cost. Alternatively, they can deliver the same accuracy as standard methods, with highly reduced computational effort. This is achieved by stopping and restarting the integration exactly at the grid points of the dataset along the time dimension. By doing this, we avoid stepping across discontinuities in the (higher) derivatives of the velocity field, and thus we avoid picking up local errors that are unbounded by Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>) at those points.</p>
      <p id="d1e5822">The benefit is particularly visible for linear and cubic interpolation, and the 4 and 20 km datasets. The increased efficiency of these integrators should be particularly relevant for long-term simulations, such as studies of global transport of plastics or global climate simulations.</p>
      <p id="d1e5825">Going into more detail, we find that the most efficient choice of integrator
depends on the resolution of the dataset, the degree of interpolation, and the desired accuracy. Looking at cubic interpolation
(Fig. <xref ref-type="fig" rid="Ch1.F5"/>, middle row), we find that the fixed-step
fourth-order Runge–Kutta method is in most cases a more efficient choice than a
standard variable-step integrator (provided the time step is selected to evenly divide the interval of the dataset). The difference varies with the resolution of the dataset and the required accuracy, but in some cases the error is 2 orders of magnitude smaller for the fourth-order Runge–Kutta than the regular Dormand–Prince 5(4) method.  This is an interesting result, given that the combination of cubic interpolation and a variable-step integrator such as Dormand–Prince 5(4) or Runge–Kutta–Fehlberg <xref ref-type="bibr" rid="bib1.bibx23" id="paren.63"><named-content content-type="post">p. 177</named-content></xref> appears to be a popular choice. In the case of the 20 km dataset, and to a
lesser extent for the 4 km dataset, additional accuracy can be gained by switching to a special-purpose variant of the Dormand–Prince integrators.</p>
      <p id="d1e5836">For linear interpolation, we find that if very small errors are required, the
regular variable-step integrators perform better than the fixed-step methods, particularly the Bogacki–Shampine 3(2) integrator. The special-purpose
variable-step methods achieve notable improvements, often being several orders of magnitude more precise. For less strict requirements, the third-order
Runge–Kutta method appears to be the best choice. However in all cases, there is a considerable improvement in accuracy with the special-purpose integrators relative to the regular variable-step methods.</p>
      <p id="d1e5839">For quintic spline interpolation, the optimal choice of interpolator again
depends on the application. If very small errors are required, the
Dormand–Prince 5(4) method appears to be the best performer, or alternatively
the special-purpose variant of Dormand–Prince 8(7). If larger errors are
acceptable, the fourth-order Runge–Kutta method seems to be the better choice.</p>
      <p id="d1e5842">It is interesting that if an appropriate fixed step is chosen (i.e. a step that divides the interval between discontinuities in time), the fourth-order Runge–Kutta method is more efficient than the regular Dormand–Prince (5)4 method for all ocean model resolutions. This is true for any interpolation scheme and accuracy, except linear and quintic interpolations when very small errors are desired. The fourth-order method with a good choice of time step also performs well relative to the special-purpose 5(4) method although the latter may significantly outperform the former with linear and cubic interpolations. The strong performance of the fourth-order Runge–Kutta with all resolutions and interpolation schemes makes it a good practical choice.</p>
      <p id="d1e5845">To conclude, we have investigated the accuracy of trajectory calculation with
10 different ODE integrators for 9 different combinations of current data
resolution and order of interpolation. We find that the optimal choice of
integrator depends on the interpolation, the resolution, and the required
accuracy. In some cases, the most efficient integrator is not the
most popular choice in the literature.</p>
      <p id="d1e5848">We have designed and investigated special-purpose variants of the regular
variable-step integrators. Only minimal changes to the code is required to
ensure that integration is always stopped and restarted at discontinuities in
time. With this change, these special-purpose integrators can in some cases
increase the accuracy by many orders of magnitude for the same amount of
computational effort. For applications requiring large numbers of trajectories, such as LCS calculations, or for long-term transport calculations, the added accuracy of the special-purpose methods should allow significant reductions in computational expense.</p><?xmltex \hack{\clearpage}?>
</sec>

      
      </body>
    <back><app-group>

<?pagebreak page5949?><app id="App1.Ch1.S1">
  <?xmltex \currentcnt{A}?><label>Appendix A</label><title>Reference solutions</title>
      <p id="d1e5863">In order to establish highly accurate reference solutions, which are needed to estimate the error when the true solutions are unknown, an expanded set of
time steps and tolerances were investigated. These are given in Table <xref ref-type="table" rid="App1.Ch1.S1.T3"/>. For each time step in the expanded set, a solution was calculated with the fourth-order Runge–Kutta method, and for each tolerance in the expanded set, a solution was calculated with the Dormand–Prince 8(7) method, using both the regular and the special-purpose variant. This was done for each of the three datasets, and for each of the three orders of interpolation.</p>
<sec id="App1.Ch1.S1.SS1">
  <label>A1</label><title>Roundoff error and truncation error</title>
      <p id="d1e5875">Every step with a numerical ODE integrator contains some error. The
truncation error stems from approximations that are made in constructing the integrator and decreases with time step. The round-off error comes from the finite-precision representation of numbers on a computer and is independent of the time step. Due to numerical round-off error, one can not simply assume that the shortest time steps or smallest tolerance will always give the most accurate answer. As the number of steps increase, the roundoff error will eventually become larger than the truncation error, at which point no accuracy is gained by reducing the step size further.</p>
      <p id="d1e5878">Loosely speaking, a double precision floating point number can store
approximately 16 significant digits, and any numerical operation should be
thought of as introducing a roundoff error in the least significant digit
<xref ref-type="bibr" rid="bib1.bibx41" id="paren.64"><named-content content-type="post">p. 10</named-content></xref>. This means that any step with an ODE integrator unavoidably introduces a relative error of approximately <inline-formula><mml:math id="M220" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">16</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>. As the time step is reduced, the numbers of steps increase, and eventually the net contribution of the added roundoff errors will dominate. An example of this can be seen in Fig. <xref ref-type="fig" rid="Ch1.F2"/>, where the error of the special-purpose method decreases down to about <inline-formula><mml:math id="M221" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">13</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, whereafter it begins to increase with further reduction of the time step.</p>

<?xmltex \floatpos{!h}?><table-wrap id="App1.Ch1.S1.T3"><?xmltex \currentcnt{A1}?><label>Table A1</label><caption><p id="d1e5919">Time steps and tolerances used in establishing reference solutions.</p></caption><oasis:table frame="topbot"><?xmltex \begin{scaleboxenv}{.96}[.96]?><oasis:tgroup cols="2">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:thead>
       <oasis:row>
         <oasis:entry colname="col1">Time steps [s]</oasis:entry>
         <oasis:entry colname="col2">3600, 1800, 1200, 900, 450, 300, 180, 120, 60,</oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">30, 10, 5, 2, 1</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">Tolerances</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M222" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M223" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M224" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">6</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M225" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">7</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M226" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">8</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M227" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">9</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M228" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>,</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M229" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">11</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>,<inline-formula><mml:math id="M230" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">12</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M231" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">13</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M232" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">14</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M233" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">15</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>,</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M234" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">16</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M235" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">17</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup><?xmltex \end{scaleboxenv}?></oasis:table></table-wrap>

<?xmltex \hack{\newpage}?>
</sec>
<sec id="App1.Ch1.S1.SS2">
  <label>A2</label><title>Finding the most accurate solutions</title>
      <p id="d1e6182">In order to establish the most accurate solutions, we compare the fourth-order
Runge–Kutta solutions obtained with very short time steps and Dormand–Prince
8(7) solutions with very small tolerances. We let the fourth-order Runge–Kutta
solutions obtained with time step <inline-formula><mml:math id="M236" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula> be given by <inline-formula><mml:math id="M237" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, and the
Dormand–Prince 8(7) solutions obtained with relative tolerance <inline-formula><mml:math id="M238" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> (see Sect. <xref ref-type="sec" rid="Ch1.S2.SS3"/>) be given by <inline-formula><mml:math id="M239" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. We also let the (unknown) true solution be given by <inline-formula><mml:math id="M240" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. Then we consider the relative difference between these numerical solutions, <inline-formula><mml:math id="M241" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, given by

                <disp-formula id="App1.Ch1.S1.E28" specific-use="align" content-type="subnumberedsingle"><mml:math id="M242" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="App1.Ch1.S1.E28.29"><mml:mtd><mml:mtext>A1a</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="App1.Ch1.S1.E28.30"><mml:mtd><mml:mtext>A1b</mml:mtext></mml:mtd><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace width="0.25em" linebreak="nobreak"/><?xmltex \hack{\hbox\bgroup\fontsize{9.4}{9.4}\selectfont$\displaystyle}?><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:mo mathsize="1.1em">(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo mathsize="1.1em">)</mml:mo><mml:mo>-</mml:mo><mml:mo mathsize="1.1em">(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo mathsize="1.1em">)</mml:mo></mml:mrow></mml:mfenced></mml:mrow><mml:mrow><mml:mfenced close="|" open="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo><?xmltex \hack{$\egroup}?></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            In Eq. (<xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.30"/>), we have added and subtracted the true (but
typically unknown) solution, <inline-formula><mml:math id="M243" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, highlighting that <inline-formula><mml:math id="M244" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is also equivalent to the difference in the global error of the fixed-step and variable step solutions (see Eq. <xref ref-type="disp-formula" rid="Ch1.E6"/>).</p>
      <p id="d1e6510">To evaluate the accuracy of the numerical solutions, we first keep the
tolerance, <inline-formula><mml:math id="M245" display="inline"><mml:mrow><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, fixed, and we plot the median relative difference as a function of time step, <inline-formula><mml:math id="M246" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>. The result is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/>. We observe that for longer time steps, the relative difference, <inline-formula><mml:math id="M247" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, goes down with the time step, <inline-formula><mml:math id="M248" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>. Starting from the bottom row of Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/>, we observe that for quintic interpolation, <inline-formula><mml:math id="M249" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> scales as <inline-formula><mml:math id="M250" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> (dashed
lines). This is as expected, since a quintic spline has continuous partial
derivatives up to order four, as required for the fourth-order Runge–Kutta method to be guaranteed to deliver fourth-order accuracy (see discussion in
Sect. <xref ref-type="sec" rid="Ch1.S2.SS1"/> and <xref ref-type="sec" rid="Ch1.S2.SS4"/>, as well as <xref ref-type="bibr" rid="bib1.bibx23" id="altparen.65"/>, p. 157).  We also observe the same trend for cubic
interpolation (Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/>, middle row), while for linear
interpolation (Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/>, top row), we find that the estimated
error only goes down proportional to <inline-formula><mml:math id="M251" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>, due to the lack of continuous
derivatives.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.S1.F6" specific-use="star"><?xmltex \currentcnt{A1}?><label>Figure A1</label><caption><p id="d1e6621">Median relative difference (Eqs. <xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.29"/> and <xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.30"/>) between the fourth-order Runge–Kutta solutions and the Dormand–Prince 8(7) solutions, as a function of the time step for the Runge–Kutta method, and shown for different  tolerances for the Dormand–Prince method. The regular Dormand–Prince 8(7) is shown as continuous lines, and the special-purpose variant is shown as dashed lines.</p></caption>
          <?xmltex \igopts{width=455.244094pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f06.png"/>

        </fig>

      <p id="d1e6635">For shorter time steps, we observe that the relative difference, <inline-formula><mml:math id="M252" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, flattens out and becomes constant. The interpretation of this, in light of Eq. (<xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.30"/>), is that for the shorter time steps, <inline-formula><mml:math id="M253" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is dominated by the error in the variable-step reference solution, thus appearing to be constant with the time step <inline-formula><mml:math id="M254" display="inline"><mml:mi>h</mml:mi></mml:math></inline-formula>. Based on this reasoning, we conclude that the most accurate variable-step solutions are obtained with the special-purpose integrator, with a tolerance of <inline-formula><mml:math id="M255" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">13</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M256" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">14</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, or <inline-formula><mml:math id="M257" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">15</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, depending on the dataset and the order of interpolation.</p>
      <p id="d1e6732">Next, we do the opposite comparison, i.e. we use the fourth-order Runge–Kutta
solutions as reference, keep the time step fixed and look at the relative
difference, <inline-formula><mml:math id="M258" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, as a function of tolerance. The results are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F7"/>. Starting from the high tolerances, we observe that the relative difference first goes down as the tolerance is reduced. Then, in all cases except the linearly interpolated 800 m dataset, the<?pagebreak page5950?> smallest estimated differences thereafter go up as the tolerance is reduced further. The reason is that the error in the variable-step solutions goes down until at some point the accumulated roundoff errors begin to dominate, and the error increases as the reduced tolerance leads to an increasing number of steps.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.S1.F7" specific-use="star"><?xmltex \currentcnt{A2}?><label>Figure A2</label><caption><p id="d1e6760">Median relative difference (Eqs. <xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.29"/> and <xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.30"/>) between the
Dormand–Prince 8(7) solutions and the fourth-order Runge–Kutta solutions, as a function of the tolerance for the Dormand–Prince method, and shown for different time steps for the Runge–Kutta method. The regular Dormand–Prince 8(7) is shown as continuous lines, and the special-purpose variant is shown as dashed lines.</p></caption>
          <?xmltex \igopts{width=455.244094pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f07.png"/>

        </fig>

      <p id="d1e6773">From Figs. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/> and <xref ref-type="fig" rid="App1.Ch1.S1.F7"/> together, we conclude
that the fourth-order Runge–Kutta solutions for short time steps are the most
accurate solutions. As we can see from Eq. <xref ref-type="disp-formula" rid="App1.Ch1.S1.E28.30"/>, we are
essentially considering the absolute value of the difference in the error of the fixed-step solution, and the error in the variable-step solution.  Since
<inline-formula><mml:math id="M259" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> (Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F6"/>) appears to be constant with time step (for the shortest time steps), we conclude that <inline-formula><mml:math id="M260" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>h</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>T</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is dominated by the (relatively) large constant error in the variable-step solution, obscuring the small changes with time step in the error in the fixed-step solution.</p>
      <p id="d1e6827">In order to further investigate the relative accuracy of the fourth-order
Runge–Kutta solutions, we consider the change in the solution between two different values of the time step. First, we list all the time steps in Table <xref ref-type="table" rid="App1.Ch1.S1.T3"/>, such that <inline-formula><mml:math id="M261" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> s, <inline-formula><mml:math id="M262" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula> s, <inline-formula><mml:math id="M263" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:math></inline-formula> s, <inline-formula><mml:math id="M264" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> s, etc. Then we consider the quantity

                <disp-formula id="App1.Ch1.S1.E31" specific-use="gather" content-type="subnumberedsingle"><mml:math id="M265" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="App1.Ch1.S1.E31.32"><mml:mtd><mml:mtext>A2a</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mtable class="split" columnspacing="1em" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd/><mml:mtd><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd/><mml:mtd><mml:mrow><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="App1.Ch1.S1.E31.33"><mml:mtd><mml:mtext>A2b</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:mo mathsize="1.1em">(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo mathsize="1.1em">)</mml:mo><mml:mo>-</mml:mo><mml:mo mathsize="1.1em">(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo mathsize="1.1em">)</mml:mo></mml:mrow></mml:mfenced></mml:mrow><mml:mrow><mml:mfenced open="|" close="|"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mi>N</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            As <inline-formula><mml:math id="M266" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M267" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> become smaller, we expect <inline-formula><mml:math id="M268" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> to become smaller as well. Since the global error of a fourth-order Runge–Kutta method (for sufficiently smooth right-hand sides) is <inline-formula><mml:math id="M269" display="inline"><mml:mrow><mml:mi mathvariant="script">O</mml:mi><mml:mo>(</mml:mo><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, we see from Eq. (<xref ref-type="disp-formula" rid="App1.Ch1.S1.E31.33"/>) that
            <disp-formula id="App1.Ch1.S1.E34" content-type="numbered"><label>A3</label><mml:math id="M270" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mfenced open="(" close=")"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mfenced><mml:mo>∼</mml:mo><mml:mfenced close=")" open="("><mml:mrow><mml:mi mathvariant="script">O</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mn mathvariant="normal">4</mml:mn></mml:msubsup><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="script">O</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi>h</mml:mi><mml:mi>i</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msubsup><mml:mo>)</mml:mo></mml:mrow></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          In Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F8"/>, we plot <inline-formula><mml:math id="M271" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, as a function of <inline-formula><mml:math id="M272" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. For the linearly interpolated datasets, we observe that <inline-formula><mml:math id="M273" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> decreases proportionally to <inline-formula><mml:math id="M274" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>, since the linearly interpolated right-hand sides are not sufficiently smooth to yield fourth-order convergence, and does not flatten out for small time steps. Hence, we conclude that the solutions obtained with time step <inline-formula><mml:math id="M275" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> s are the
most accurate in this case.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.S1.F8" specific-use="star"><?xmltex \currentcnt{A3}?><label>Figure A3</label><caption><p id="d1e7381">Median relative difference (Eqs. <xref ref-type="disp-formula" rid="App1.Ch1.S1.E31.32"/> and <xref ref-type="disp-formula" rid="App1.Ch1.S1.E31.33"/>) between two fourth-order Runge–Kutta solutions, obtained with different time steps <inline-formula><mml:math id="M276" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M277" display="inline"><mml:mrow><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, using the list of time steps in Table <xref ref-type="table" rid="App1.Ch1.S1.T3"/>.</p></caption>
          <?xmltex \igopts{width=497.923228pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f08.png"/>

        </fig>

      <p id="d1e7423">With cubic and quintic interpolation, we see that <inline-formula><mml:math id="M278" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">Δ</mml:mi><mml:mrow><mml:mi mathvariant="normal">RK</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>h</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> goes down approximately as <inline-formula><mml:math id="M279" display="inline"><mml:mrow><mml:msup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>, and eventually flattens out and
increases a little for the shortest time steps. As discussed previously, we
interpret this to mean that the accumulated roundoff errors begin to dominate. We find that the smallest difference is obtained with different time steps for the different datasets. For example, for the 800 m resolution dataset, a time step <inline-formula><mml:math id="M280" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:math></inline-formula> s appears to be the most accurate, while for the
20 km dataset, a time step of 30 s appear to give better accuracy.</p>
      <?pagebreak page5952?><p id="d1e7484">Based on the analysis described above, we have decided to use the fourth-order
Runge–Kutta method to obtain the reference solutions used for the analysis in Sect. <xref ref-type="sec" rid="Ch1.S5"/>. For each dataset and order of interpolation, the
reference time step is chosen based on Fig. <xref ref-type="fig" rid="App1.Ch1.S1.F8"/>, and the results are shown in Table <xref ref-type="table" rid="App1.Ch1.S1.T4"/>.</p>

<?xmltex \floatpos{t}?><table-wrap id="App1.Ch1.S1.T4"><?xmltex \currentcnt{A2}?><label>Table A2</label><caption><p id="d1e7496">Time step used with the fourth-order Runge–Kutta method to obtain the
reference solutions used in Sect. <xref ref-type="sec" rid="Ch1.S5"/> for each order of    interpolation and each dataset.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="4">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:colspec colnum="3" colname="col3" align="left"/>
     <oasis:colspec colnum="4" colname="col4" align="left"/>
     <oasis:thead>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">800 m</oasis:entry>
         <oasis:entry colname="col3">4 km</oasis:entry>
         <oasis:entry colname="col4">20 km</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">Linear</oasis:entry>
         <oasis:entry colname="col2">1 s</oasis:entry>
         <oasis:entry colname="col3">1 s</oasis:entry>
         <oasis:entry colname="col4">1 s</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Cubic</oasis:entry>
         <oasis:entry colname="col2">5 s</oasis:entry>
         <oasis:entry colname="col3">30 s</oasis:entry>
         <oasis:entry colname="col4">30 s</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Quintic</oasis:entry>
         <oasis:entry colname="col2">5 s</oasis:entry>
         <oasis:entry colname="col3">30 s</oasis:entry>
         <oasis:entry colname="col4">30 s</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table></table-wrap>

      <p id="d1e7580">As a final remark, we mention that it may seem surprising that we are able to
obtain higher accuracy with the fourth-order Runge–Kutta method than with the
Dormand–Prince 8(7) method. Three things are worth pointing out in this context. First, the time steps considered here (see Table <xref ref-type="table" rid="App1.Ch1.S1.T3"/>) all evenly divide the 1 h step of the data, which means that a fixed-step method will always stop and restart the integration at the discontinuities in the time-direction (see discussion in Sect. <xref ref-type="sec" rid="Ch1.S3.SS1"/>). Second, for the Dormand–Prince 8(7) method to work optimally, the right-hand side of the ODE should strictly have continuous partial derivatives up to order 8, which would require spline interpolation of degree 9. Finally, variable-step methods are generally preferred for their efficiency, not purely for their accuracy. As an example, consider the fifth-degree interpolated 800 m dataset. In this case, the presumed most accurate fixed-step solution, with <inline-formula><mml:math id="M281" display="inline"><mml:mrow><mml:mi>h</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:math></inline-formula> s used 207 360 evaluations of the right-hand side, while the most accurate Dormand–Prince 8(7) solution, with a tolerance of <inline-formula><mml:math id="M282" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">14</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, used 5805 evaluations (including 17 % rejected steps).</p><?xmltex \hack{\newpage}?>
</sec>
</app>

<app id="App1.Ch1.S2">
  <?xmltex \currentcnt{B}?><label>Appendix B</label><title>Additional work–precision diagrams</title>
      <p id="d1e7623">This appendix contains two additional figures to supplement the work–precision diagram shown in Fig. <xref ref-type="fig" rid="Ch1.F5"/>. See
Sect. <xref ref-type="sec" rid="Ch1.S5"/> for further details. First, in Fig. <xref ref-type="fig" rid="App1.Ch1.S2.F9"/>, we show the same data as in
Fig. <xref ref-type="fig" rid="Ch1.F5"/>, i.e. the median global error over
10 000 trajectories, but with the addition of shaded areas that indicate
the range covering 90 % of the errors.</p>
      <p id="d1e7634">Second, Fig. <xref ref-type="fig" rid="App1.Ch1.S2.F10"/> shows the median global error as a function of simulation runtime. The timings were obtained on a desktop workstation with an Intel Xeon 3.3 GHz CPU, running xubuntu 18.04. The code runs on a single core only. As discussed in Sect. <xref ref-type="sec" rid="Ch1.S5"/>, the number of evaluations of the right-hand side of the ODE is a more objective measure of work, as the runtime is susceptible to some random variation (in particular for the shortest simulations) due to other processes running on the machine, etc. However, we include the run times here as an illustration, as it is practically relevant information.</p>

      <?xmltex \floatpos{p}?><fig id="App1.Ch1.S2.F9"><?xmltex \currentcnt{B1}?><label>Figure B1</label><caption><p id="d1e7643">Same as Fig. <xref ref-type="fig" rid="Ch1.F5"/>, showing the median    relative error taken over all 10 000 trajectories. Additionally, the    shaded areas show the range where 90 % of the errors fall.</p></caption>
        <?xmltex \hack{\hsize\textwidth}?>
        <?xmltex \igopts{width=497.923228pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f09.png"/>

      </fig>

      <?xmltex \floatpos{p}?><fig id="App1.Ch1.S2.F10" specific-use="star"><?xmltex \currentcnt{B2}?><label>Figure B2</label><caption><p id="d1e7659">Same as Fig. <xref ref-type="fig" rid="Ch1.F5"/>, showing the median    relative error, taken over all 10 000 trajectories, except that the    median error is shown as a function of simulation runtime, rather than the    number of evaluations of the right-hand side of the ODE.</p></caption>
        <?xmltex \igopts{width=497.923228pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/13/5935/2020/gmd-13-5935-2020-f10.png"/>

      </fig>

<?xmltex \hack{\clearpage}?>
</app>
  </app-group><notes notes-type="codedataavailability"><title>Code and data availability</title>

      <p id="d1e7676">The code used to run the simulations and analyse the
results, as well as the three different ocean current datasets, can be found at <ext-link xlink:href="https://doi.org/10.5281/zenodo.4041979" ext-link-type="DOI">10.5281/zenodo.4041979</ext-link> <xref ref-type="bibr" rid="bib1.bibx34" id="paren.66"/>.</p>
  </notes><notes notes-type="authorcontribution"><title>Author contributions</title>

      <p id="d1e7688">TN wrote the simulation code and the first draft of the manuscript. Both authors participated in development of ideas, analysis of results, and writing of the final manuscript.</p>
  </notes><notes notes-type="competinginterests"><title>Competing interests</title>

      <p id="d1e7694">The authors declare that they have no conflict of interest.</p>
  </notes><ack><title>Acknowledgements</title><p id="d1e7700">The work of Tor Nordam was supported in part by the Norwegian Research Council, and he would also like to thank his colleagues for many a good discussion in the SINTEF CoffeeLab.</p><p id="d1e7702">The work of Rodrigo Duran was performed in support of the US Department of Energy's Fossil Energy, Oil and Natural Gas Research Program. It was executed by NETL's Research and Innovation Center, including work performed by Leidos    Research Support Team staff under the RSS contract 89243318CFE000003. This    work was funded by the Department of Energy, National Energy Technology Laboratory, an agency of the United States Government, through a support
contract with Leidos Research Support Team (LRST). Neither the United States    Government nor any agency thereof, nor any of their employees, nor LRST, nor    any of their employees, makes any warranty, expressed or implied, or assumes    any legal liability or responsibility for the accuracy, completeness, or    usefulness of any information, apparatus, product, or process disclosed, or    represents that its use would not infringe privately owned rights. Reference    herein to any specific commercial product, process, or service by trade    name, trademark, manufacturer, or otherwise, does not necessarily constitute    or imply its endorsement, recommendation, or favoring by the United States    Government or any agency thereof. The views and opinions of authors    expressed herein do not necessarily state or reflect those of the United    States Government or any agency thereof.</p></ack><notes notes-type="financialsupport"><title>Financial support</title>

      <p id="d1e7707">This research has been supported by the Research Council of Norway (INDORSE (project no. 267793)) and the U.S. Department of Energy, Oil and Natural Gas (RSS, contract no. 89243318CFE000003).</p>
  </notes><notes notes-type="reviewstatement"><title>Review statement</title>

      <p id="d1e7713">This paper was edited by Robert Marsh and reviewed by two anonymous referees.</p>
  </notes><?xmltex \hack{\newpage}?><ref-list>
    <title>References</title>

      <ref id="bib1.bibx1"><label>Ali and Shah(2007)</label><?label ali2007?><mixed-citation>Ali, S. and Shah, M.: A Lagrangian Particle Dynamics Approach for Crowd Flow  Segmentation and Stability Analysis, in: 2007 IEEE Conference on Computer  Vision and Pattern Recognition, Minneapolis, MN, USA, 17–22 June 2007, IEEE, 1–6, <ext-link xlink:href="https://doi.org/10.1109/CVPR.2007.382977" ext-link-type="DOI">10.1109/CVPR.2007.382977</ext-link>, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx2"><label>Allshouse et al.(2017)</label><?label allshouse2017impact?><mixed-citation>
Allshouse, M. R., Ivey, G. N., Lowe, R. J., Jones, N. L., Beegle-Krause, C.,   Xu, J., and Peacock, T.: Impact of windage on ocean surface Lagrangian  coherent structures, Environ. Fluid Mech., 17, 473–483, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx3"><label>Barkan et al.(2017)</label><?label barkan2017?><mixed-citation>
Barkan, R., McWilliams, J. C., Molemaker, M. J., Choi, J., Srinivasan, K.,   Shchepetkin, A. F., and Bracco, A.: Submesoscale dynamics in the northern   Gulf of Mexico. Part II: Temperature–salinity relations and cross-shelf   transport processes, J. Phys. Oceanogr., 47, 2347–2360, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx4"><label>Beron-Vera et al.(2008)</label><?label beron-vera2008?><mixed-citation>Beron-Vera, F. J., Olascoaga, M. J., and Goni, G. J.: Oceanic mesoscale eddies as revealed by Lagrangian coherent structures, Geophys. Res. Lett., 35, L12603, <ext-link xlink:href="https://doi.org/10.1029/2008GL033957" ext-link-type="DOI">10.1029/2008GL033957</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx5"><label>Beron-Vera et al.(2010)</label><?label beron2010?><mixed-citation>Beron-Vera, F. J., Olascoaga, M. J., Brown, M. G., Koçak, H., and Rypina,  I. I.: Invariant-tori-like Lagrangian coherent structures in geophysical flows, Chaos, 20, 017514, <ext-link xlink:href="https://doi.org/10.1063/1.3271342" ext-link-type="DOI">10.1063/1.3271342</ext-link>, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx6"><label>Bogacki and Shampine(1989)</label><?label bogacki1989?><mixed-citation>
Bogacki, P. and Shampine, L. F.: A 3(2) pair of Runge-Kutta formulas, Appl. Math. Lett., 2, 321–325, 1989.</mixed-citation></ref>
      <ref id="bib1.bibx7"><label>Breivik and Allen(2008)</label><?label breivik2008?><mixed-citation>
Breivik, Ø. and Allen, A. A.: An operational search and rescue model for the Norwegian Sea and the North Sea, J. Marine Syst., 69, 99–113, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx8"><label>de Boor(2001)</label><?label deboor2001?><mixed-citation>
de Boor, C.: A practical guide to splines, Springer-Verlag, New York Berlin  Heidelberg, 2001.</mixed-citation></ref>
      <ref id="bib1.bibx9"><label>De Dominicis et al.(2013)</label><?label dominicis2013?><mixed-citation>De Dominicis, M., Pinardi, N., Zodiatis, G., and Lardner, R.: MEDSLIK-II, a Lagrangian marine surface oil spill model for short-term forecasting – Part 1: Theory, Geosci. Model Dev., 6, 1851–1869, <ext-link xlink:href="https://doi.org/10.5194/gmd-6-1851-2013" ext-link-type="DOI">10.5194/gmd-6-1851-2013</ext-link>, 2013.</mixed-citation></ref>
      <ref id="bib1.bibx10"><label>Dieci and Lopez(2012)</label><?label dieci2012?><mixed-citation>Dieci, L. and Lopez, L.: A survey of numerical methods for IVPs of ODEs with  discontinuous right-hand side, J. Comput. Appl. Math., 236, 3967–3991, <ext-link xlink:href="https://doi.org/10.1016/j.cam.2012.02.011" ext-link-type="DOI">10.1016/j.cam.2012.02.011</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx11"><label>Dormand and Prince(1980)</label><?label dormand1980?><mixed-citation>
Dormand, J. and Prince, P.: A family of embedded Runge-Kutta formulae, J. Comput. Appl. Math., 6, 19–26, 1980.</mixed-citation></ref>
      <ref id="bib1.bibx12"><label>Dormand and Prince(1986)</label><?label dormand1986?><mixed-citation>Dormand, J. and Prince, P.: A reconsideration of some embedded Runge-Kutta  formulae, J. Comput. Appl. Math., 15, 203–211, <ext-link xlink:href="https://doi.org/10.1016/0377-0427(86)90027-0" ext-link-type="DOI">10.1016/0377-0427(86)90027-0</ext-link>, 1986.</mixed-citation></ref>
      <ref id="bib1.bibx13"><label>Dugstad et al.(2019)</label><?label Dugstad2019?><mixed-citation>Dugstad, J., Fer, I., LaCasce, J., Sanchez de La Lama, M., and Trodahl, M.:  Lateral Heat Transport in the Lofoten Basin: Near-Surface Pathways and  Subsurface Exchange, J. Geophys. Res.-Oceans,124, 2992–3006, <ext-link xlink:href="https://doi.org/10.1029/2018JC014774" ext-link-type="DOI">10.1029/2018JC014774</ext-link>, 2019.</mixed-citation></ref>
      <ref id="bib1.bibx14"><label>Duran et al.(2018)</label><?label duran2018?><mixed-citation>Duran, R., Beron-Vera, F. J., and Olascoaga, M. J.: Extracting quasi-steady  Lagrangian transport patterns from the ocean circulation: An application to  the Gulf of Mexico, Scientific Reports, 8, 5218, <ext-link xlink:href="https://doi.org/10.1038/s41598-018-23121-y" ext-link-type="DOI">10.1038/s41598-018-23121-y</ext-link>, 2018.</mixed-citation></ref>
      <ref id="bib1.bibx15"><label>Enright et al.(1988)</label><?label enright1988?><mixed-citation>Enright, W., Jackson, K., Nørsett, S., and Thomsen, P.: Effective solution of  discontinuous IVPs using a Runge-Kutta formula pair with interpolants, Appl. Math. Comput., 27, 313–335, <ext-link xlink:href="https://doi.org/10.1016/0096-3003(88)90030-6" ext-link-type="DOI">10.1016/0096-3003(88)90030-6</ext-link>, 1988.</mixed-citation></ref>
      <ref id="bib1.bibx16"><label>Farazmand and Haller(2012)</label><?label farazmand2012?><mixed-citation>Farazmand, M. and Haller, G.: Computing Lagrangian coherent structures from  their variational theory, Chaos, 22, 013128, <ext-link xlink:href="https://doi.org/10.1063/1.3690153" ext-link-type="DOI">10.1063/1.3690153</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx17"><?xmltex \def\ref@label{{Garc\'{i}{}a-Mart\'{i}{}nez and Flores-Tovar(1999)}}?><label>García-Martínez and Flores-Tovar(1999)</label><?label garcia1999?><mixed-citation>
García-Martínez, R. and Flores-Tovar, H.: Computer modeling of oil  spill trajectories with a high accuracy method, Spill Sci. Technol. B., 5, 323–330, 1999.</mixed-citation></ref>
      <ref id="bib1.bibx18"><label>Gladwell et al.(2003)</label><?label Gladwell2003?><mixed-citation>
Gladwell, I., Shampine, L., and Thompson, S.: Solving ODEs with MATLAB,  Cambridge University Press, New York, NY, USA, 2003.</mixed-citation></ref>
      <ref id="bib1.bibx19"><?xmltex \def\ref@label{{Gr{\"{a}}we(2011)}}?><label>Gräwe(2011)</label><?label grawe2011?><mixed-citation>
Gräwe, U.: Implementation of high-order particle-tracking schemes in a  water column model, Ocean Model., 36, 80–89, 2011.</mixed-citation></ref>
      <ref id="bib1.bibx20"><label>Griffiths and Higham(2010)</label><?label griffiths2010?><mixed-citation>
Griffiths, D. F. and Higham, D. J.: Numerical methods for ordinary differential equations, Springer-Verlag, London, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx21"><label>Hairer and Wanner(1996)</label><?label hairer2?><mixed-citation>
Hairer, E. and Wanner, G.: Solving Ordinary Differential Equations II: Stiff  and Differential-Algebraic Problems, Springer-Verlag, Berlin, Heidelberg, 1996.</mixed-citation></ref>
      <ref id="bib1.bibx22"><label>Hairer et al.(1987)</label><?label hairer0?><mixed-citation>Hairer, E., Nørsett, S. P., and Wanner, G.: Solving Ordinary Differential   Equations I: Nonstiff Problems, 1st edn., Springer-Verlag Berlin Heidelberg, ISBN 978-3-662-12609-7, <ext-link xlink:href="https://doi.org/10.1007/978-3-662-12607-3" ext-link-type="DOI">10.1007/978-3-662-12607-3</ext-link>, 1987.</mixed-citation></ref>
      <ref id="bib1.bibx23"><label>Hairer et al.(1993)</label><?label hairer1?><mixed-citation>Hairer, E., Nørsett, S. P., and Wanner, G.: Solving Ordinary Differential  Equations I, in: Nonstiff Problems, 2nd edn., Springer-Verlag Berlin Heidelberg, ISBN 978-3-540-56670-0, <ext-link xlink:href="https://doi.org/10.1007/978-3-540-78862-1" ext-link-type="DOI">10.1007/978-3-540-78862-1</ext-link>, 1993.</mixed-citation></ref>
      <ref id="bib1.bibx24"><label>Hairer et al.(2006)</label><?label hairer3?><mixed-citation>Hairer, E., Wanner, G., and Lubich, C.: Geometric Numerical Integration, in:
Structure-Preserving Algorithms for Ordinary Differential Equations, Springer-Verlag, Berlin, Heidelberg, <ext-link xlink:href="https://doi.org/10.1007/3-540-30666-8" ext-link-type="DOI">10.1007/3-540-30666-8</ext-link>, 2006.</mixed-citation></ref>
      <ref id="bib1.bibx25"><label>Haller(2015)</label><?label haller2015?><mixed-citation>
Haller, G.: Lagrangian coherent structures, Annu. Rev. Fluid Mech., 47, 137–162, 2015.</mixed-citation></ref>
      <ref id="bib1.bibx26"><label>Isaacson and Keller(1994)</label><?label isaacson1994?><mixed-citation>
Isaacson, E. and Keller, H. B.: Analysis of Numerical Methods, Dover Publications, New York, USA, 1994.</mixed-citation></ref>
      <ref id="bib1.bibx27"><label>Kloeden and Platen(1992)</label><?label kloeden1992?><mixed-citation>
Kloeden, P. E. and Platen, E.: Numerical Solution of Stochastic Differential
Equations, Springer-Verlag, Berlin, Heidelberg, 1992.</mixed-citation></ref>
      <ref id="bib1.bibx28"><label>Kress(1998)</label><?label kress1998?><mixed-citation>Kress, R.: Numerical Analysis, in: Graduate Texts in Mathematics, Springer-Verlag, New York, <ext-link xlink:href="https://doi.org/10.1007/978-1-4612-0599-9" ext-link-type="DOI">10.1007/978-1-4612-0599-9</ext-link>, 1998.</mixed-citation></ref>
      <ref id="bib1.bibx29"><label>Lekien and Marsden(2005)</label><?label lekien_marsden2005?><mixed-citation>Lekien, F. and Marsden, J.: Tricubic interpolation in three dimensions,  Int. J. Numer. Meth. Eng., 63, 455–471, <ext-link xlink:href="https://doi.org/10.1002/nme.1296" ext-link-type="DOI">10.1002/nme.1296</ext-link>, 2005.</mixed-citation></ref>
      <ref id="bib1.bibx30"><?xmltex \def\ref@label{{L{\'{e}}vy et~al.(2012)}}?><label>Lévy et al.(2012)</label><?label levy2012?><mixed-citation>
Lévy, M., Resplandy, L., Klein, P., Capet, X., Iovino, D., and  Éthé, C.: Grid degradation of submesoscale resolving ocean models:  Benefits for offline passive tracer transport, Ocean Model., 48, 1–9, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx31"><label>Maslo et al.(2020)</label><?label maslo2020?><mixed-citation>Maslo, A., de Souza, J. M. A. C., Andrade-Canto, F., and Outerelo, J. R.:  Connectivity of deep waters in the Gulf of Mexico, J. Marine
Syst., 203, 103267, <ext-link xlink:href="https://doi.org/10.1016/j.jmarsys.2019.103267" ext-link-type="DOI">10.1016/j.jmarsys.2019.103267</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx32"><?xmltex \def\ref@label{{Narv{\'{a}}ez et~al.(2012)}}?><label>Narváez et al.(2012)</label><?label narvaez2012?><mixed-citation>Narváez, D. A., Klinck, J. M., Powell, E. N., Hofmann, E. E., Wilkin, J.,  and Haidvogel, D. B.: Modeling the dispersal of eastern oyster  (<italic>Crassostrea virginica</italic>) larvae in Delaware Bay, J. Mar. Res., 70, 381–409, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx33"><label>Nieto and Gimeno(2019)</label><?label Nieto2019?><mixed-citation>Nieto, R. and Gimeno, L.: A database of optimal integration times for  Lagrangian studies of atmospheric moisture sources and sinks, Scientific  Data, 6, 59, <ext-link xlink:href="https://doi.org/10.1038/s41597-019-0068-8" ext-link-type="DOI">10.1038/s41597-019-0068-8</ext-link>, 2019.</mixed-citation></ref>
      <ref id="bib1.bibx34"><label>Nordam(2020)</label><?label ODEcode?><mixed-citation>Nordam, T.: nordam/ODE-integrators-for-Lagrangian-particles 0.9, Version 0.9, Zenodo, <ext-link xlink:href="https://doi.org/10.5281/zenodo.4041979" ext-link-type="DOI">10.5281/zenodo.4041979</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx35"><label>Nordam et al.(2017)</label><?label nordam2017?><mixed-citation>Nordam, T., Brønner, U., Skancke, J., Nepstad, R., Rønningen, P., and  Alver, M. O.: Numerical integration and interpolation in marine pollutant  transport modelling, in: Proceedings of the 40th AMOP Technical Seminar,  Calgary, AB, Canada, 3–5 October 2017, Environment and Climate Change Canada, Ottawa, 586–609, <uri>https://hdl.handle.net/11250/2652834</uri>, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx36"><label>North et al.(2011)</label><?label North2011?><mixed-citation>
North, E. W., Adams, E. E., Schlag, Z., Sherwood, C. R., He, R., Hyun, K. H.,  and Socolofsky, S. A.: Simulating Oil Droplet Dispersal From the Deepwater  Horizon Spill With a Lagrangian Approach, in: Monitoring and Modeling the  Deepwater Horizon Oil Spill: A Record Breaking Enterprise, Wiley, 195, 217–226, 2011.</mixed-citation></ref>
      <ref id="bib1.bibx37"><label>Onink et al.(2019)</label><?label onink2019?><mixed-citation>Onink, V., Wichmann, D., Delandmeter, P., and van Sebille, E.: The Role of  Ekman Currents, Geostrophy, and Stokes Drift in the Accumulation of Floating Microplastic, J. Geophys. Res.-Oceans, 124, 1474–1490, <ext-link xlink:href="https://doi.org/10.1029/2018JC014547" ext-link-type="DOI">10.1029/2018JC014547</ext-link>, 2019.</mixed-citation></ref>
      <ref id="bib1.bibx38"><label>Onu et al.(2015)</label><?label onu2015?><mixed-citation>
Onu, K., Huhn, F., and Haller, G.: LCS Tool: A computational platform for  Lagrangian coherent structures, J. Computat. Sci., 7, 26–36, 2015.</mixed-citation></ref>
      <ref id="bib1.bibx39"><label>Peng and Dabiri(2009)</label><?label peng2009?><mixed-citation>Peng, J. and Dabiri, J. O.: Transport of inertial particles by Lagrangian  coherent structures: application to predator–prey interaction in jellyfish  feeding, J. Fluid Mech., 623, 75–84, <ext-link xlink:href="https://doi.org/10.1017/S0022112008005089" ext-link-type="DOI">10.1017/S0022112008005089</ext-link>, 2009.</mixed-citation></ref>
      <ref id="bib1.bibx40"><label>Povinec et al.(2013)</label><?label povinec2013?><mixed-citation>Povinec, P., Gera, M., Holý, K., Hirose, K., Lujaniené, G., Nakano, M., Plastino, W., Sýkora, I., Bartok, J., and Gažák, M.: Dispersion of Fukushima radionuclides in the global atmosphere and the ocean, Appl. Radiat. Isotopes, 81, 383–392, <ext-link xlink:href="https://doi.org/10.1016/j.apradiso.2013.03.058" ext-link-type="DOI">10.1016/j.apradiso.2013.03.058</ext-link>, 2013.</mixed-citation></ref>
      <ref id="bib1.bibx41"><label>Press et al.(2007)</label><?label numericalrecipes?><mixed-citation>
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P.:  Numerical recipes, 3rd edn., The art of scientific computing, Cambridge
University Press, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx42"><label>Riuttanen et al.(2013)</label><?label Riuttanen2013?><mixed-citation>Riuttanen, L., Hulkkonen, M., Dal Maso, M., Junninen, H., and Kulmala, M.: Trajectory analysis of atmospheric transport of fine particles, <inline-formula><mml:math id="M283" display="inline"><mml:mrow class="chem"><mml:msub><mml:mi mathvariant="normal">SO</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M284" display="inline"><mml:mrow class="chem"><mml:msub><mml:mi mathvariant="normal">NO</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M285" display="inline"><mml:mrow class="chem"><mml:msub><mml:mi mathvariant="normal">O</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> to the SMEAR II station in Finland in 1996–2008, Atmos. Chem. Phys., 13, 2153–2164, <ext-link xlink:href="https://doi.org/10.5194/acp-13-2153-2013" ext-link-type="DOI">10.5194/acp-13-2153-2013</ext-link>, 2013.</mixed-citation></ref>
      <ref id="bib1.bibx43"><label>Rivas and Samelson(2011)</label><?label rivas2011numerical?><mixed-citation>Rivas, D. and Samelson, R. M.: A Numerical Modeling Study of the Upwelling  Source Waters along the Oregon Coast during 2005, J. Phys. Oceanogr., 41, 88–112, <ext-link xlink:href="https://doi.org/10.1175/2010JPO4327.1" ext-link-type="DOI">10.1175/2010JPO4327.1</ext-link>, 2011.</mixed-citation></ref>
      <ref id="bib1.bibx44"><label>Rye et al.(1998)</label><?label rye1998?><mixed-citation>
Rye, H., Reed, M., and Ekrol, N.: The ParTrack model for calculation of the spreading and deposition of drilling mud, chemicals and drill cuttings,  Environ. Modell. Softw., 13, 431–441, 1998.</mixed-citation></ref>
      <ref id="bib1.bibx45"><?xmltex \def\ref@label{{S{\ae}tre(2005)}}?><label>Sætre(2005)</label><?label saetre2005?><mixed-citation>
Sætre, R.: The Norwegian Coastal Current: Oceanography and Climate, Tapir
Akademisk Forlag, Trondheim, 2005.</mixed-citation></ref>
      <ref id="bib1.bibx46"><label>Serra et al.(2020)</label><?label serra2019search?><mixed-citation>Serra, M., Sathe, P., Rypina, I., Kirincich, A., Ross, S. D., Lermusiaux, P.,  Allen, A., Peacock, T., and Haller, G.: Search and rescue at sea aided by  hidden flow structures, Nat. Commun., 11, 2525, <ext-link xlink:href="https://doi.org/10.1038/s41467-020-16281-x" ext-link-type="DOI">10.1038/s41467-020-16281-x</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx47"><label>Shadden and Taylor(2008)</label><?label shadden2008?><mixed-citation>Shadden, S. C. and Taylor, C. A.: Characterization of Coherent Structures in  the Cardiovascular System, Ann. Biomed. Eng., 36, 1152–1162,   <ext-link xlink:href="https://doi.org/10.1007/s10439-008-9502-3" ext-link-type="DOI">10.1007/s10439-008-9502-3</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx48"><label>Shadden et al.(2010)</label><?label shadden2010?><mixed-citation>Shadden, S. C., Astorino, M., and Gerbeau, J.-F.: Computational analysis of an aortic valve jet with Lagrangian coherent structures, Chaos: An  Interdisciplinary J. Nonlinear Sci., 20, 017512, <ext-link xlink:href="https://doi.org/10.1063/1.3272780" ext-link-type="DOI">10.1063/1.3272780</ext-link>, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx49"><label>Siegel et al.(2003)</label><?label siegel2003?><mixed-citation>
Siegel, D., Kinlan, B., Gaylord, B., and Gaines, S.: Lagrangian descriptions of marine larval dispersion, Mar. Ecol. Prog. Ser., 260, 83–96, 2003.</mixed-citation></ref>
      <ref id="bib1.bibx50"><label>Sirois and Bottenheim(1995)</label><?label Sirois1995?><mixed-citation>Sirois, A. and Bottenheim, J. W.: Use of backward trajectories to interpret  the 5-year record of PAN and O3 ambient air concentrations at Kejimkujik  National Park, Nova Scotia, J. Geophys. Res., 100, 2867–2881, <ext-link xlink:href="https://doi.org/10.1029/94JD02951" ext-link-type="DOI">10.1029/94JD02951</ext-link>, 1995.</mixed-citation></ref>
      <?pagebreak page5957?><ref id="bib1.bibx51"><label>Spivakovskaya et al.(2007)</label><?label spivakovskaya2007?><mixed-citation>
Spivakovskaya, D., Heemink, A. W., and Deleersnijder, E.: Lagrangian modelling of multi-dimensional advection-diffusion with space-varying diffusivities: theory and idealized test cases, Ocean Dynam., 57, 189–203, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx52"><label>van Sebille et al.(2015)</label><?label van2015ocean?><mixed-citation>van Sebille, E., Scussolini, P., Durgadoo, J. V., Peeters, F. J., Biastoch, A., Weijer, W., Turney, C., Paris, C. B., and Zahn, R.: Ocean currents generate large footprints in marine palaeoclimate proxies, Nat. Commun., 6, 6521, <ext-link xlink:href="https://doi.org/10.1038/ncomms7521" ext-link-type="DOI">10.1038/ncomms7521</ext-link>, 2015.</mixed-citation></ref>
      <ref id="bib1.bibx53"><label>van Sebille et al.(2018)</label><?label vansebille2018?><mixed-citation>
van Sebille, E., Griffies, S. M., Abernathey, R., Adams, T. P., Berloff, P.,  Biastoch, A., Blanke, B., Chassignet, E. P., Cheng, Y., Cotter, C. J.,  Deleersnijder, E., Döös, K., Drake, H. F., Drijfhout, S., Gary,  S. F., Heemink, A. W., Kjellsson, J., Koszalka, I. M., Lange, M., Lique, C.,  MacGilchrist, G. A., Marsh, R., Mayorga Adame, C. G., McAdam, R., Nencioli,  F., Paris, C. B., Piggott, M. D., Polton, J. A., Rühs, S., Shah, S. H.,  Thomas, M. D., Wang, J., Wolfram, P. J., Zanna, L., and Zika, J. D.:  Lagrangian ocean analysis: Fundamentals and practices, Ocean Model., 121, 49–75, 2018.</mixed-citation></ref>
      <ref id="bib1.bibx54"><label>Visser(2008)</label><?label visser2008?><mixed-citation>Visser, A. W.: Lagrangian modelling of plankton motion: From deceptively  simple random walks to Fokker-Planck and back again, J. Marine  Syst., 70, 287–299, 2008.
 </mixed-citation></ref><?xmltex \hack{\newpage}?>
      <ref id="bib1.bibx55"><label>Williams(2018)</label><?label bspline-fortran?><mixed-citation>Williams, J.: Bspline-Fortran: Multidimensional B-Spline Interpolation of Data on a Regular Grid (Version 5.4.0), Zenodo, <ext-link xlink:href="https://doi.org/10.5281/zenodo.1215290" ext-link-type="DOI">10.5281/zenodo.1215290</ext-link>, 2018.</mixed-citation></ref>
      <ref id="bib1.bibx56"><label>Woods(2005)</label><?label woods2005?><mixed-citation>
Woods, J.: The Lagrangian Ensemble metamodel for simulating plankton  ecosystems, Prog. Oceanogr., 67, 84–159, 2005.</mixed-citation></ref>
      <ref id="bib1.bibx57"><label>Yang et al.(2008)</label><?label yang2008?><mixed-citation>Yang, Y., He, G.-W., and Wang, L.-P.: Effects of subgrid-scale modeling on  Lagrangian statistics in large-eddy simulation, J. Turbul., 9, 1–24, <ext-link xlink:href="https://doi.org/10.1080/14685240801905360" ext-link-type="DOI">10.1080/14685240801905360</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx58"><label>Zelenke et al.(2012)</label><?label Zelenke2012?><mixed-citation>Zelenke, B., O'Connor, C., Barker, C., Beegle-Krause, C. J., and Eclipse, L. (Eds.): General NOAA Operational Modeling Environment (GNOME) Technical Documentation, U.S. Dept. of Commerce, NOAA Technical Memorandum NOS OR&amp;R 40, Emergency Response Division, Seattle, WA, NOAA, 105 pp., available at: <uri>https://response.restoration.noaa.gov/sites/default/files/GNOME_Tech_Doc.pdf</uri> (last access: 17 November 2020),  2012.</mixed-citation></ref>

  </ref-list></back>
    <!--<article-title-html>Numerical integrators for Lagrangian oceanography</article-title-html>
<abstract-html><p>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.</p><p>We investigate trajectory calculation in modelled ocean currents with 800&thinsp;m, 4&thinsp;km, and 20&thinsp;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.</p><p>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&thinsp;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.</p></abstract-html>
<ref-html id="bib1.bib1"><label>Ali and Shah(2007)</label><mixed-citation>
Ali, S. and Shah, M.: A Lagrangian Particle Dynamics Approach for Crowd Flow  Segmentation and Stability Analysis, in: 2007 IEEE Conference on Computer  Vision and Pattern Recognition, Minneapolis, MN, USA, 17–22 June 2007, IEEE, 1–6, <a href="https://doi.org/10.1109/CVPR.2007.382977" target="_blank">https://doi.org/10.1109/CVPR.2007.382977</a>, 2007.
</mixed-citation></ref-html>
<ref-html id="bib1.bib2"><label>Allshouse et al.(2017)</label><mixed-citation>
Allshouse, M. R., Ivey, G. N., Lowe, R. J., Jones, N. L., Beegle-Krause, C.,   Xu, J., and Peacock, T.: Impact of windage on ocean surface Lagrangian  coherent structures, Environ. Fluid Mech., 17, 473–483, 2017.
</mixed-citation></ref-html>
<ref-html id="bib1.bib3"><label>Barkan et al.(2017)</label><mixed-citation>
Barkan, R., McWilliams, J. C., Molemaker, M. J., Choi, J., Srinivasan, K.,   Shchepetkin, A. F., and Bracco, A.: Submesoscale dynamics in the northern   Gulf of Mexico. Part II: Temperature–salinity relations and cross-shelf   transport processes, J. Phys. Oceanogr., 47, 2347–2360, 2017.
</mixed-citation></ref-html>
<ref-html id="bib1.bib4"><label>Beron-Vera et al.(2008)</label><mixed-citation>
Beron-Vera, F. J., Olascoaga, M. J., and Goni, G. J.: Oceanic mesoscale eddies as revealed by Lagrangian coherent structures, Geophys. Res. Lett., 35, L12603, <a href="https://doi.org/10.1029/2008GL033957" target="_blank">https://doi.org/10.1029/2008GL033957</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib5"><label>Beron-Vera et al.(2010)</label><mixed-citation>
Beron-Vera, F. J., Olascoaga, M. J., Brown, M. G., Koçak, H., and Rypina,  I. I.: Invariant-tori-like Lagrangian coherent structures in geophysical flows, Chaos, 20, 017514, <a href="https://doi.org/10.1063/1.3271342" target="_blank">https://doi.org/10.1063/1.3271342</a>, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib6"><label>Bogacki and Shampine(1989)</label><mixed-citation>
Bogacki, P. and Shampine, L. F.: A 3(2) pair of Runge-Kutta formulas, Appl. Math. Lett., 2, 321–325, 1989.
</mixed-citation></ref-html>
<ref-html id="bib1.bib7"><label>Breivik and Allen(2008)</label><mixed-citation>
Breivik, Ø. and Allen, A. A.: An operational search and rescue model for the Norwegian Sea and the North Sea, J. Marine Syst., 69, 99–113, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib8"><label>de Boor(2001)</label><mixed-citation>
de Boor, C.: A practical guide to splines, Springer-Verlag, New York Berlin  Heidelberg, 2001.
</mixed-citation></ref-html>
<ref-html id="bib1.bib9"><label>De Dominicis et al.(2013)</label><mixed-citation>
De Dominicis, M., Pinardi, N., Zodiatis, G., and Lardner, R.: MEDSLIK-II, a Lagrangian marine surface oil spill model for short-term forecasting – Part 1: Theory, Geosci. Model Dev., 6, 1851–1869, <a href="https://doi.org/10.5194/gmd-6-1851-2013" target="_blank">https://doi.org/10.5194/gmd-6-1851-2013</a>, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib10"><label>Dieci and Lopez(2012)</label><mixed-citation>
Dieci, L. and Lopez, L.: A survey of numerical methods for IVPs of ODEs with  discontinuous right-hand side, J. Comput. Appl. Math., 236, 3967–3991, <a href="https://doi.org/10.1016/j.cam.2012.02.011" target="_blank">https://doi.org/10.1016/j.cam.2012.02.011</a>, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib11"><label>Dormand and Prince(1980)</label><mixed-citation>
Dormand, J. and Prince, P.: A family of embedded Runge-Kutta formulae, J. Comput. Appl. Math., 6, 19–26, 1980.
</mixed-citation></ref-html>
<ref-html id="bib1.bib12"><label>Dormand and Prince(1986)</label><mixed-citation>
Dormand, J. and Prince, P.: A reconsideration of some embedded Runge-Kutta  formulae, J. Comput. Appl. Math., 15, 203–211, <a href="https://doi.org/10.1016/0377-0427(86)90027-0" target="_blank">https://doi.org/10.1016/0377-0427(86)90027-0</a>, 1986.
</mixed-citation></ref-html>
<ref-html id="bib1.bib13"><label>Dugstad et al.(2019)</label><mixed-citation>
Dugstad, J., Fer, I., LaCasce, J., Sanchez de La Lama, M., and Trodahl, M.:  Lateral Heat Transport in the Lofoten Basin: Near-Surface Pathways and  Subsurface Exchange, J. Geophys. Res.-Oceans,124, 2992–3006, <a href="https://doi.org/10.1029/2018JC014774" target="_blank">https://doi.org/10.1029/2018JC014774</a>, 2019.
</mixed-citation></ref-html>
<ref-html id="bib1.bib14"><label>Duran et al.(2018)</label><mixed-citation>
Duran, R., Beron-Vera, F. J., and Olascoaga, M. J.: Extracting quasi-steady  Lagrangian transport patterns from the ocean circulation: An application to  the Gulf of Mexico, Scientific Reports, 8, 5218, <a href="https://doi.org/10.1038/s41598-018-23121-y" target="_blank">https://doi.org/10.1038/s41598-018-23121-y</a>, 2018.
</mixed-citation></ref-html>
<ref-html id="bib1.bib15"><label>Enright et al.(1988)</label><mixed-citation>
Enright, W., Jackson, K., Nørsett, S., and Thomsen, P.: Effective solution of  discontinuous IVPs using a Runge-Kutta formula pair with interpolants, Appl. Math. Comput., 27, 313–335, <a href="https://doi.org/10.1016/0096-3003(88)90030-6" target="_blank">https://doi.org/10.1016/0096-3003(88)90030-6</a>, 1988.
</mixed-citation></ref-html>
<ref-html id="bib1.bib16"><label>Farazmand and Haller(2012)</label><mixed-citation>
Farazmand, M. and Haller, G.: Computing Lagrangian coherent structures from  their variational theory, Chaos, 22, 013128, <a href="https://doi.org/10.1063/1.3690153" target="_blank">https://doi.org/10.1063/1.3690153</a>, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib17"><label>García-Martínez and Flores-Tovar(1999)</label><mixed-citation>
García-Martínez, R. and Flores-Tovar, H.: Computer modeling of oil  spill trajectories with a high accuracy method, Spill Sci. Technol. B., 5, 323–330, 1999.
</mixed-citation></ref-html>
<ref-html id="bib1.bib18"><label>Gladwell et al.(2003)</label><mixed-citation>
Gladwell, I., Shampine, L., and Thompson, S.: Solving ODEs with MATLAB,  Cambridge University Press, New York, NY, USA, 2003.
</mixed-citation></ref-html>
<ref-html id="bib1.bib19"><label>Gräwe(2011)</label><mixed-citation>
Gräwe, U.: Implementation of high-order particle-tracking schemes in a  water column model, Ocean Model., 36, 80–89, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib20"><label>Griffiths and Higham(2010)</label><mixed-citation>
Griffiths, D. F. and Higham, D. J.: Numerical methods for ordinary differential equations, Springer-Verlag, London, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib21"><label>Hairer and Wanner(1996)</label><mixed-citation>
Hairer, E. and Wanner, G.: Solving Ordinary Differential Equations II: Stiff  and Differential-Algebraic Problems, Springer-Verlag, Berlin, Heidelberg, 1996.
</mixed-citation></ref-html>
<ref-html id="bib1.bib22"><label>Hairer et al.(1987)</label><mixed-citation>
Hairer, E., Nørsett, S. P., and Wanner, G.: Solving Ordinary Differential   Equations I: Nonstiff Problems, 1st edn., Springer-Verlag Berlin Heidelberg, ISBN&thinsp;978-3-662-12609-7, <a href="https://doi.org/10.1007/978-3-662-12607-3" target="_blank">https://doi.org/10.1007/978-3-662-12607-3</a>, 1987.
</mixed-citation></ref-html>
<ref-html id="bib1.bib23"><label>Hairer et al.(1993)</label><mixed-citation>
Hairer, E., Nørsett, S. P., and Wanner, G.: Solving Ordinary Differential  Equations I, in: Nonstiff Problems, 2nd edn., Springer-Verlag Berlin Heidelberg, ISBN&thinsp;978-3-540-56670-0, <a href="https://doi.org/10.1007/978-3-540-78862-1" target="_blank">https://doi.org/10.1007/978-3-540-78862-1</a>, 1993.
</mixed-citation></ref-html>
<ref-html id="bib1.bib24"><label>Hairer et al.(2006)</label><mixed-citation>
Hairer, E., Wanner, G., and Lubich, C.: Geometric Numerical Integration, in:
Structure-Preserving Algorithms for Ordinary Differential Equations, Springer-Verlag, Berlin, Heidelberg, <a href="https://doi.org/10.1007/3-540-30666-8" target="_blank">https://doi.org/10.1007/3-540-30666-8</a>, 2006.
</mixed-citation></ref-html>
<ref-html id="bib1.bib25"><label>Haller(2015)</label><mixed-citation>
Haller, G.: Lagrangian coherent structures, Annu. Rev. Fluid Mech., 47, 137–162, 2015.
</mixed-citation></ref-html>
<ref-html id="bib1.bib26"><label>Isaacson and Keller(1994)</label><mixed-citation>
Isaacson, E. and Keller, H. B.: Analysis of Numerical Methods, Dover Publications, New York, USA, 1994.
</mixed-citation></ref-html>
<ref-html id="bib1.bib27"><label>Kloeden and Platen(1992)</label><mixed-citation>
Kloeden, P. E. and Platen, E.: Numerical Solution of Stochastic Differential
Equations, Springer-Verlag, Berlin, Heidelberg, 1992.
</mixed-citation></ref-html>
<ref-html id="bib1.bib28"><label>Kress(1998)</label><mixed-citation>
Kress, R.: Numerical Analysis, in: Graduate Texts in Mathematics, Springer-Verlag, New York, <a href="https://doi.org/10.1007/978-1-4612-0599-9" target="_blank">https://doi.org/10.1007/978-1-4612-0599-9</a>, 1998.
</mixed-citation></ref-html>
<ref-html id="bib1.bib29"><label>Lekien and Marsden(2005)</label><mixed-citation>
Lekien, F. and Marsden, J.: Tricubic interpolation in three dimensions,  Int. J. Numer. Meth. Eng., 63, 455–471, <a href="https://doi.org/10.1002/nme.1296" target="_blank">https://doi.org/10.1002/nme.1296</a>, 2005.
</mixed-citation></ref-html>
<ref-html id="bib1.bib30"><label>Lévy et al.(2012)</label><mixed-citation>
Lévy, M., Resplandy, L., Klein, P., Capet, X., Iovino, D., and  Éthé, C.: Grid degradation of submesoscale resolving ocean models:  Benefits for offline passive tracer transport, Ocean Model., 48, 1–9, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib31"><label>Maslo et al.(2020)</label><mixed-citation>
Maslo, A., de Souza, J. M. A. C., Andrade-Canto, F., and Outerelo, J. R.:  Connectivity of deep waters in the Gulf of Mexico, J. Marine
Syst., 203, 103267, <a href="https://doi.org/10.1016/j.jmarsys.2019.103267" target="_blank">https://doi.org/10.1016/j.jmarsys.2019.103267</a>, 2020.
</mixed-citation></ref-html>
<ref-html id="bib1.bib32"><label>Narváez et al.(2012)</label><mixed-citation>
Narváez, D. A., Klinck, J. M., Powell, E. N., Hofmann, E. E., Wilkin, J.,  and Haidvogel, D. B.: Modeling the dispersal of eastern oyster  (<i>Crassostrea virginica</i>) larvae in Delaware Bay, J. Mar. Res., 70, 381–409, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib33"><label>Nieto and Gimeno(2019)</label><mixed-citation>
Nieto, R. and Gimeno, L.: A database of optimal integration times for  Lagrangian studies of atmospheric moisture sources and sinks, Scientific  Data, 6, 59, <a href="https://doi.org/10.1038/s41597-019-0068-8" target="_blank">https://doi.org/10.1038/s41597-019-0068-8</a>, 2019.
</mixed-citation></ref-html>
<ref-html id="bib1.bib34"><label>Nordam(2020)</label><mixed-citation>
Nordam, T.: nordam/ODE-integrators-for-Lagrangian-particles 0.9, Version 0.9, Zenodo, <a href="https://doi.org/10.5281/zenodo.4041979" target="_blank">https://doi.org/10.5281/zenodo.4041979</a>, 2020.
</mixed-citation></ref-html>
<ref-html id="bib1.bib35"><label>Nordam et al.(2017)</label><mixed-citation>
Nordam, T., Brønner, U., Skancke, J., Nepstad, R., Rønningen, P., and  Alver, M. O.: Numerical integration and interpolation in marine pollutant  transport modelling, in: Proceedings of the 40th AMOP Technical Seminar,  Calgary, AB, Canada, 3–5 October 2017, Environment and Climate Change Canada, Ottawa, 586–609, <a href="https://hdl.handle.net/11250/2652834" target="_blank"/>, 2017.
</mixed-citation></ref-html>
<ref-html id="bib1.bib36"><label>North et al.(2011)</label><mixed-citation>
North, E. W., Adams, E. E., Schlag, Z., Sherwood, C. R., He, R., Hyun, K. H.,  and Socolofsky, S. A.: Simulating Oil Droplet Dispersal From the Deepwater  Horizon Spill With a Lagrangian Approach, in: Monitoring and Modeling the  Deepwater Horizon Oil Spill: A Record Breaking Enterprise, Wiley, 195, 217–226, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib37"><label>Onink et al.(2019)</label><mixed-citation>
Onink, V., Wichmann, D., Delandmeter, P., and van Sebille, E.: The Role of  Ekman Currents, Geostrophy, and Stokes Drift in the Accumulation of Floating Microplastic, J. Geophys. Res.-Oceans, 124, 1474–1490, <a href="https://doi.org/10.1029/2018JC014547" target="_blank">https://doi.org/10.1029/2018JC014547</a>, 2019.
</mixed-citation></ref-html>
<ref-html id="bib1.bib38"><label>Onu et al.(2015)</label><mixed-citation>
Onu, K., Huhn, F., and Haller, G.: LCS Tool: A computational platform for  Lagrangian coherent structures, J. Computat. Sci., 7, 26–36, 2015.
</mixed-citation></ref-html>
<ref-html id="bib1.bib39"><label>Peng and Dabiri(2009)</label><mixed-citation>
Peng, J. and Dabiri, J. O.: Transport of inertial particles by Lagrangian  coherent structures: application to predator–prey interaction in jellyfish  feeding, J. Fluid Mech., 623, 75–84, <a href="https://doi.org/10.1017/S0022112008005089" target="_blank">https://doi.org/10.1017/S0022112008005089</a>, 2009.
</mixed-citation></ref-html>
<ref-html id="bib1.bib40"><label>Povinec et al.(2013)</label><mixed-citation>
Povinec, P., Gera, M., Holý, K., Hirose, K., Lujaniené, G., Nakano, M., Plastino, W., Sýkora, I., Bartok, J., and Gažák, M.: Dispersion of Fukushima radionuclides in the global atmosphere and the ocean, Appl. Radiat. Isotopes, 81, 383–392, <a href="https://doi.org/10.1016/j.apradiso.2013.03.058" target="_blank">https://doi.org/10.1016/j.apradiso.2013.03.058</a>, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib41"><label>Press et al.(2007)</label><mixed-citation>
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P.:  Numerical recipes, 3rd edn., The art of scientific computing, Cambridge
University Press, 2007.
</mixed-citation></ref-html>
<ref-html id="bib1.bib42"><label>Riuttanen et al.(2013)</label><mixed-citation>
Riuttanen, L., Hulkkonen, M., Dal Maso, M., Junninen, H., and Kulmala, M.: Trajectory analysis of atmospheric transport of fine particles, SO<sub>2</sub>, NO<sub><i>x</i></sub> and O<sub>3</sub> to the SMEAR II station in Finland in 1996–2008, Atmos. Chem. Phys., 13, 2153–2164, <a href="https://doi.org/10.5194/acp-13-2153-2013" target="_blank">https://doi.org/10.5194/acp-13-2153-2013</a>, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib43"><label>Rivas and Samelson(2011)</label><mixed-citation>
Rivas, D. and Samelson, R. M.: A Numerical Modeling Study of the Upwelling  Source Waters along the Oregon Coast during 2005, J. Phys. Oceanogr., 41, 88–112, <a href="https://doi.org/10.1175/2010JPO4327.1" target="_blank">https://doi.org/10.1175/2010JPO4327.1</a>, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib44"><label>Rye et al.(1998)</label><mixed-citation>
Rye, H., Reed, M., and Ekrol, N.: The ParTrack model for calculation of the spreading and deposition of drilling mud, chemicals and drill cuttings,  Environ. Modell. Softw., 13, 431–441, 1998.
</mixed-citation></ref-html>
<ref-html id="bib1.bib45"><label>Sætre(2005)</label><mixed-citation>
Sætre, R.: The Norwegian Coastal Current: Oceanography and Climate, Tapir
Akademisk Forlag, Trondheim, 2005.
</mixed-citation></ref-html>
<ref-html id="bib1.bib46"><label>Serra et al.(2020)</label><mixed-citation>
Serra, M., Sathe, P., Rypina, I., Kirincich, A., Ross, S. D., Lermusiaux, P.,  Allen, A., Peacock, T., and Haller, G.: Search and rescue at sea aided by  hidden flow structures, Nat. Commun., 11, 2525, <a href="https://doi.org/10.1038/s41467-020-16281-x" target="_blank">https://doi.org/10.1038/s41467-020-16281-x</a>, 2020.
</mixed-citation></ref-html>
<ref-html id="bib1.bib47"><label>Shadden and Taylor(2008)</label><mixed-citation>
Shadden, S. C. and Taylor, C. A.: Characterization of Coherent Structures in  the Cardiovascular System, Ann. Biomed. Eng., 36, 1152–1162,   <a href="https://doi.org/10.1007/s10439-008-9502-3" target="_blank">https://doi.org/10.1007/s10439-008-9502-3</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib48"><label>Shadden et al.(2010)</label><mixed-citation>
Shadden, S. C., Astorino, M., and Gerbeau, J.-F.: Computational analysis of an aortic valve jet with Lagrangian coherent structures, Chaos: An  Interdisciplinary J. Nonlinear Sci., 20, 017512, <a href="https://doi.org/10.1063/1.3272780" target="_blank">https://doi.org/10.1063/1.3272780</a>, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib49"><label>Siegel et al.(2003)</label><mixed-citation>
Siegel, D., Kinlan, B., Gaylord, B., and Gaines, S.: Lagrangian descriptions of marine larval dispersion, Mar. Ecol. Prog. Ser., 260, 83–96, 2003.
</mixed-citation></ref-html>
<ref-html id="bib1.bib50"><label>Sirois and Bottenheim(1995)</label><mixed-citation>
Sirois, A. and Bottenheim, J. W.: Use of backward trajectories to interpret  the 5-year record of PAN and O3 ambient air concentrations at Kejimkujik  National Park, Nova Scotia, J. Geophys. Res., 100, 2867–2881, <a href="https://doi.org/10.1029/94JD02951" target="_blank">https://doi.org/10.1029/94JD02951</a>, 1995.
</mixed-citation></ref-html>
<ref-html id="bib1.bib51"><label>Spivakovskaya et al.(2007)</label><mixed-citation>
Spivakovskaya, D., Heemink, A. W., and Deleersnijder, E.: Lagrangian modelling of multi-dimensional advection-diffusion with space-varying diffusivities: theory and idealized test cases, Ocean Dynam., 57, 189–203, 2007.
</mixed-citation></ref-html>
<ref-html id="bib1.bib52"><label>van Sebille et al.(2015)</label><mixed-citation>
van Sebille, E., Scussolini, P., Durgadoo, J. V., Peeters, F. J., Biastoch, A., Weijer, W., Turney, C., Paris, C. B., and Zahn, R.: Ocean currents generate large footprints in marine palaeoclimate proxies, Nat. Commun., 6, 6521, <a href="https://doi.org/10.1038/ncomms7521" target="_blank">https://doi.org/10.1038/ncomms7521</a>, 2015.
</mixed-citation></ref-html>
<ref-html id="bib1.bib53"><label>van Sebille et al.(2018)</label><mixed-citation>
van Sebille, E., Griffies, S. M., Abernathey, R., Adams, T. P., Berloff, P.,  Biastoch, A., Blanke, B., Chassignet, E. P., Cheng, Y., Cotter, C. J.,  Deleersnijder, E., Döös, K., Drake, H. F., Drijfhout, S., Gary,  S. F., Heemink, A. W., Kjellsson, J., Koszalka, I. M., Lange, M., Lique, C.,  MacGilchrist, G. A., Marsh, R., Mayorga Adame, C. G., McAdam, R., Nencioli,  F., Paris, C. B., Piggott, M. D., Polton, J. A., Rühs, S., Shah, S. H.,  Thomas, M. D., Wang, J., Wolfram, P. J., Zanna, L., and Zika, J. D.:  Lagrangian ocean analysis: Fundamentals and practices, Ocean Model., 121, 49–75, 2018.
</mixed-citation></ref-html>
<ref-html id="bib1.bib54"><label>Visser(2008)</label><mixed-citation>
Visser, A. W.: Lagrangian modelling of plankton motion: From deceptively  simple random walks to Fokker-Planck and back again, J. Marine  Syst., 70, 287–299, 2008.

</mixed-citation></ref-html>
<ref-html id="bib1.bib55"><label>Williams(2018)</label><mixed-citation>
Williams, J.: Bspline-Fortran: Multidimensional B-Spline Interpolation of Data on a Regular Grid (Version 5.4.0), Zenodo, <a href="https://doi.org/10.5281/zenodo.1215290" target="_blank">https://doi.org/10.5281/zenodo.1215290</a>, 2018.
</mixed-citation></ref-html>
<ref-html id="bib1.bib56"><label>Woods(2005)</label><mixed-citation>
Woods, J.: The Lagrangian Ensemble metamodel for simulating plankton  ecosystems, Prog. Oceanogr., 67, 84–159, 2005.
</mixed-citation></ref-html>
<ref-html id="bib1.bib57"><label>Yang et al.(2008)</label><mixed-citation>
Yang, Y., He, G.-W., and Wang, L.-P.: Effects of subgrid-scale modeling on  Lagrangian statistics in large-eddy simulation, J. Turbul., 9, 1–24, <a href="https://doi.org/10.1080/14685240801905360" target="_blank">https://doi.org/10.1080/14685240801905360</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib58"><label>Zelenke et al.(2012)</label><mixed-citation>
Zelenke, B., O'Connor, C., Barker, C., Beegle-Krause, C. J., and Eclipse, L. (Eds.): General NOAA Operational Modeling Environment (GNOME) Technical Documentation, U.S. Dept. of Commerce, NOAA Technical Memorandum NOS OR&amp;R&thinsp;40, Emergency Response Division, Seattle, WA, NOAA, 105 pp., available at: <a href="https://response.restoration.noaa.gov/sites/default/files/GNOME_Tech_Doc.pdf" target="_blank"/> (last access: 17 November 2020),  2012.
</mixed-citation></ref-html>--></article>
