Offline Lagrangian filtering equations

This page describes the Lagrangian filtering equations for the 'offline' configuration of OceananigansLagrangianFilter.jl. The offline scheme runs a forward pass very similar to the online configuration, before running a backward pass through the offline data and combining the backward and forward outputs.

We compute the Lagrangian mean of some scalar $f$ as

\[\begin{equation}\label{fstardef} f^*(\vb*{\varphi}(\vb*{a},t),t) = \int_{-\infty}^\infty G(t-s)f(\vb*{\varphi}(\vb*{a},s),s) \, \mathrm{d} s\,, \end{equation}\]

and optionally compute

\[\begin{equation}\label{Xidefoffline} \vb*{\Xi}(\vb*{\varphi}(\vb*{a},t),t) = \int_{-\infty}^\infty G(t-s)\vb*{\varphi}(\vb*{a},s)\,\mathrm{d} s\,, \end{equation}\]

so that the generalised Lagrangian mean $\bar{f}^{\mathrm{L}}$ (see definition in Lagrangian averaging) can be recovered by a post-processing interpolation step using

\[\begin{equation} \bar{f}^{\mathrm{L}}(\vb*{\Xi}(\vb*{x},t),t) = f^*(\vb*{x},t)\,. \end{equation}\]

We consider filter kernels composed of sums of exponentials of the absolute value of $t$:

\[\begin{equation} G(t) = \sum_{n=1}^{N/2} e^{-c_n |t|} \left( a_n \cos(d_n t) + b_n \sigma(t) \sin(d_n |t|) \right)\,, \end{equation}\]

where the sine terms are either even in time, with $\sigma(t) = 1$ (sine_parity = :even, the default, for which $G$ is even), or odd in time, with $\sigma(t) = \mathrm{sgn}(t)$ (sine_parity = :odd, for which the sine terms are $b_n \sin(d_n t)$). We define a set of $N$ weight functions, for even $N$. For $k = 1,...,N/2$ we have

\[\begin{align} G_{Ck}(t) &=e^{-c_k|t|}\cos d_k t\,, \\ G_{Sk}(t) &=e^{-c_k|t|}\sigma(t)\sin d_k |t|\,, \\ \end{align}\]

For $t>0$, we have

\[\begin{align} \label{forward_G_derivs} G_{Ck}'(t) &= - c_kG_{Ck}(t) - d_k G_{Sk}(t) \\ G_{Sk}'(t) &= - c_kG_{Sk}(t) + d_k G_{Ck}(t) \\ \end{align}\]

and for $t<0$, where $\sigma = \sigma(t)$ is $1$ for even sine terms and $-1$ for odd sine terms,

\[\begin{align} \label{backward_G_derivs} G_{Ck}'(t) &= -G_{Ck}'(-t) = c_kG_{Ck}(t) + \sigma d_k G_{Sk}(t) \\ G_{Sk}'(t) &= -\sigma G_{Sk}'(-t) = c_kG_{Sk}(t) - \sigma d_k G_{Ck}(t) \\ \end{align}\]

We then define a corresponding set of $N$ filtered scalars

\[\begin{align}\label{forwardgdef} g_{Ck}(\vb*{\varphi}(\vb*{a},t),t) &= \int_{-\infty}^t G_{Ck}(t-s)f(\vb*{\varphi}(\vb*{a},s),s)\, \mathrm{d} s\\ g_{Sk}(\vb*{\varphi}(\vb*{a},t),t) &= \int_{-\infty}^t G_{Sk}(t-s)f(\vb*{\varphi}(\vb*{a},s),s)\, \mathrm{d} s\\ \end{align}\]

so that the contribution of the forward pass (from the past, $s < t$) to $f^*$ is

\[\begin{equation} f_1^*(\vb*{x},t) = \sum_{n=1}^{N/2} a_n g_{Cn}(\vb*{x},t) + b_n g_{Sn}(\vb*{x},t)\,. \end{equation}\]

We derive PDEs for the $g_{Ck}$ and $g_{Sk}$ by taking the time derivative of \eqref{forwardgdef}:

\[\begin{align} \frac{\partial g_{Ck}}{\partial t} + \vb*{u} \cdot \nabla g_{Ck} &= f - c_k g_{Ck} - d_k g_{Sk} \\ \frac{\partial g_{Sk}}{\partial t} + \vb*{u} \cdot \nabla g_{Sk} &= - c_k g_{Sk} + d_k g_{Ck} \end{align}\]

This system of equations can be solved with initial conditions $g_{Ck}(\vb*{x},0) = g_{Sk}(\vb*{x},0)=0$.

If we want to find $\bar{f}^{\mathrm{L}}$, we define map functions with which to interpolate $f^*$ to $\bar{f}^{\mathrm{L}}$ after the simulation. We define

\[\begin{align} \vb*{\Xi}_{Ck}(\vb*{\varphi}(\vb*{a},t),t) &= \int_{-\infty}^t G_{Ck}(t-s)\vb*{\varphi}(\vb*{a},s) \mathrm{d} s\\ \vb*{\Xi}_{Sk}(\vb*{\varphi}(\vb*{a},t),t) &= \int_{-\infty}^t G_{Sk}(t-s)\vb*{\varphi}(\vb*{a},s) \mathrm{d} s\,, \end{align}\]

so that the forward pass contributes

\[\begin{equation} \vb*{\Xi}_1(\vb*{x},t) = \sum_{n=1}^{N/2} a_n \vb*{\Xi}_{Cn}(\vb*{x},t) + b_n \vb*{\Xi}_{Sn}(\vb*{x},t) \end{equation}\]

and

\[\begin{align} \frac{\partial \vb*{\Xi}_{Ck}}{\partial t} + \vb*{u} \cdot \nabla \vb*{\Xi}_{Ck} &= \vb*{x} - c_k \vb*{\Xi}_{Ck} - d_k \vb*{\Xi}_{Sk} \\ \frac{\partial \vb*{\Xi}_{Sk}}{\partial t} + \vb*{u} \cdot \nabla \vb*{\Xi}_{Sk} &= - c_k \vb*{\Xi}_{Sk} + d_k \vb*{\Xi}_{Ck}\,. \end{align}\]

To define perturbation equations, we set:

\[\begin{align} \vb*{\Xi}_{Ck} &= \vb*{\xi}_{Ck} + \frac{c_k}{c_k^2 + d_k^2}\vb*{x} \\ \vb*{\Xi}_{Sk} &= \vb*{\xi}_{Sk} + \frac{d_k}{c_k^2 + d_k^2}\vb*{x}\,, \end{align}\]

where the coefficients of $\vb*{x}$ are needed because each of the filters $G_{Ck}$ and $G_{Sk}$ are not individually normalised over the interval $[-\infty,0]$. The perturbation map equations are then given by

\[\begin{align} \frac{\partial \vb*{\xi}_{Ck}}{\partial t} + \vb*{u} \cdot \nabla \vb*{\xi}_{Ck} &= -\frac{c_k}{c_k^2 + d_k^2}\vb*{u} - c_k \vb*{\xi}_{Ck} - d_k \vb*{\xi}_{Sk} \\ \frac{\partial \vb*{\xi}_{Sk}}{\partial t} + \vb*{u} \cdot \nabla \vb*{\xi}_{Sk} &= -\frac{d_k}{c_k^2 + d_k^2}\vb*{u} - c_k \vb*{\xi}_{Sk} + d_k \vb*{\xi}_{Ck}\,. \end{align}\]

Backward-pass equations of the same form are solved by time-reversing the velocity and field data, and changing the sign of the velocity. The backward pass gives filtered scalars $h_{Ck}$ and $h_{Sk}$, defined like $g_{Ck}$ and $g_{Sk}$ but integrating over the future ($s > t$) with weight functions $G_{Ck}(s-t)$ and $G_{Sk}(s-t)$. For $s > t$ we have $G_{Ck}(t-s) = G_{Ck}(s-t)$ and $G_{Sk}(t-s) = \sigma G_{Sk}(s-t)$, with $\sigma = -1$ for odd sine terms, so the contribution of the backward pass is

\[\begin{equation} f_2^*(\vb*{x},t) = \sum_{n=1}^{N/2} a_n h_{Cn}(\vb*{x},t) + \sigma b_n h_{Sn}(\vb*{x},t)\,, \end{equation}\]

and $f^* = f_1^* + f_2^*$, and similarly for the maps. The backward pass outputs its contribution directly (changing the sign of the odd sine terms, and of the mean velocities, which change sign under time reversal), so the final filtered field is reconstructed by summing the forward and backward pass outputs at each time.

For a cutoff frequency that varies in space or time, see Varying cutoff frequency.