Lagrangian ocean analysis. Lagrangian ocean analysis is a way of analysing ocean dynamics by computing the trajectories of virtual fluid particles, following the Lagrangian perspective of fluid flow, from a specified velocity field. Often, the Eulerian velocity field used as an input for Lagrangian ocean analysis has been computed using an ocean general circulation model (OGCM). Lagrangian techniques can be employed on a range of scales, from modelling the dispersal of biological matter within the Great Barrier Reef to global scales. Lagrangian ocean analysis has numerous applications, from modelling the diffusion of tracers, through the dispersal of aircraft debris and plastics, to determining the biological connectivity of ocean regions.

Techniques 

Lagrangian ocean analysis makes use of the relation between the Lagrangian and Eulerian specifications of the flow field, namely

where  defines the trajectory of a particle (fluid parcel), labelled , as a function of the time , and the partial derivative is taken for a given fluid parcel . In this context,  is used to identify a given virtual particle - physically it corresponds to the position through which that particle passed at time . In words, this equation expresses that the velocity of a fluid parcel at the position along its trajectory that it reaches at time  can also be interpreted as the velocity at that point in the Eulerian coordinate system. Using this relation, the Eulerian velocity field can be integrated in time to trace a trajectory,

where  is a dummy integration variable. In this equation,  is continuous in space – for the integration of trajectories in a Lagrangian ocean model, the velocity field must be evaluable at any point in space. Spatial interpolation is used so that the velocity field can be evaluated at points inside the grid cells outputted by OGCMs.

Time Integration 

In some cases, the time integration is performed using explicit time-stepping methods. Lagrangian ocean analysis codes may make use of, for instance, an Euler method, or a higher order method, such as Runge-Kutta 4 or Runge-Kutta 4-5. If the timestep of the integration method is shorter than the time resolution of the Eulerian velocity field used as an input, then the velocity field must be interpolated in the temporal domain, so that there is a velocity value to be integrated for each time.

To ensure volume conservation in integrating the trajectories, symplectic methods, can be used. These methods are generally implicit in nature, requiring extra computation when compared to explicit methods.

Alternatively, if each component of the flow velocity within a spatial grid is assumed to vary linearly along its axis, trajectories can be analytically calculated. If the velocity field is steady-state, then trajectories can be treated as streamlines, and considered together in bundles known as stream tubes, which bound fluid flow in different parts of the spatial domain. If the velocity field provided as the starting point of the Lagrangian analysis is a divergence-free flow, the volume of fluid moving through a stream tube is conserved throughout the stream tube. To show this mathematically, the starting point is the condition that the divergence of the velocity field is zero,

Integrating this over the volume of a stream tube, the divergence theorem can be used to show that

where  is the normal to the surface of the stream tube,  denotes the entire volume of the stream tube and  its surface. If the streamlines and pathlines (trajectories) are equivalent, as is the case for steady-state (non time-evolving) flows, then the walls of the stream tube do not contribute to the integral, as the flow cannot cross them. Thus, only the ends,  and  will contribute to the integral, so

Physically, this equation expresses that the fluid flux passing through the two ends of the streamtube are equal, demonstrating the volume conservation. The equation also shows that the area of each end of the stream tube is inversely proportional to the speed of the normal flow through it. These features of the analytical method of calculating trajectories lend themselves to Lagrangian analyses primarily concerned with the advective (as opposed to diffusive) component of the flow. 
There exists a caveat to this approach: given that the velocity fields considered can be time-evolving, the equivalence between stream tubes and material pathways may not hold. Lagrangian ocean models can address this formalism by considering the flow field to be a piecewise function in the temporal domain, where each sub-function is a steady-state velocity field. A Boussinesq model, in which flow is incompressible and thus non-divergent, can be used to generate the velocity field used as an input for the Lagrangian analysis code to ensure volume is conserved when using this method.

Incorporating Diffusion 

For a Lagrangian ocean analysis code to include the effects of molecular diffusion, or other small-scale mixing which may be modelled as a diffusive process, stochastic terms must be added to the trajectory computations. Stochastic terms may be added in accordance with a stochastic differential equation (SDE) derived from the tracer diffusion equation in the form of the Fokker-Planck equation. This method requires that a diffusion tensor be provided.

Rather than using an SDE derived with a diffusion tensor, Lagrangian ocean models may instead find an SDE based on how well the resulting diffusivity statistics fit either observations or models built with a finer resolution. This method involves the use of a Markov chain; the order of the Markov chain used is another point where different Lagrangian analysis codes differ.

Online and Offline Analysis 
Lagrangian ocean analysis codes can be characterised as online or offline. Online codes work in tandem with the Eulerian model that outputs the velocity field: each time the Eulerian model updates, the trajectories are timestepped using the new velocity information. The Lagrangian analysis packages available with some OGCMs are examples of online Lagrangian ocean analysis codes. Offline codes calculate trajectories using stored velocity fields outputted by Eulerian models at a prior stage. As a result of this, offline models may be used to calculate trajectories forwards or backwards through time; the latter may be helpful in determining the origins of water masses. As of 2018, there are no examples of online models that use the tracer equation to compute diffusive effects.

Applications 
One strength of Lagrangian ocean models is that they can be less computationally expensive than calculating the advection diffusion of a tracer concentration within the Eulerian paradigm: for each timestep, the Lagrangian code needs only evaluate the position of each virtual particle, as opposed to the Eulerian model which must explicitly calculate the tracer concentration in every grid cell. In the case of offline models, trajectories may be advected backwards in time which can be useful in finding sources of the material being tracked.

Lagrangian ocean analysis has found use in tracking  water masses, for instance tracking the source and pathways of the Subantarctic Mode Water, as well as how its temperature and salinity evolve along its path. Another application of Lagrangian modelling techniques is in simulating the dispersal of biological matter in different ocean regions to gauge their biological connectivity.

Lagrangian ocean analysis has also been used to model the dispersal of materials originating in human activities, for example in tracking the spread of oil following the 2010 Deepwater Horizon oil spill and in attempts to model dispersal of Debris from flight MH370 in the Indian Ocean since 2014. Furthermore, Lagrangian ocean analysis has played a role in the tracking of the transport of plastics across the global ocean, for instance helping researchers estimate the fraction of plastic debris that ends up at the coast.

Examples 

While small scale Lagrangian analysis codes have been written for many individual research projects, there exists a smaller number of community codes that can implement Lagrangian ocean models on a global scale. The differences between 10 such community codes are illustrated in the venn diagram, where they are grouped in terms of whether they are offline, whether they include a stochastic term to model diffusion or small-scale turbulent mixing, and whether they compute trajectories analytically. All of the codes in the diagram that lie outside of the analytic trajectories circle employ explicit integration methods to compute the trajectories. Ariane, for example, is a code that runs offline, calculates trajectories with the analytic streamtube method and does not model diffusive effects. By contrast, Parcels computes particle trajectories through explicit time-stepping and can include stochastic terms if the user desires; it is also offline. A caveat to this is that Parcels' integration framework is customisable, and could be reprogrammed to instead use the analytical method to calculate trajectories.

See also 
Lagrangian and Eulerian specification of the flow field
Lagrangian analysis
Lagrangian particle tracking

References 

Physical oceanography