Kernels and derivatives
CoarseGrainingEnergyFluxes.Kernels.AbstractCellWeight — Type
AbstractCellWeightHow TopHatKernel weighs a grid cell: CellOverlap or CellCentre.
CoarseGrainingEnergyFluxes.Kernels.AbstractFilterKernel — Type
AbstractFilterKernelAbstract supertype for all filter kernels (TopHat, Gaussian, SharpSpectral, …).
CoarseGrainingEnergyFluxes.Kernels.AxisRate — Type
AxisRate(kernel, Val(d)) <: AbstractFilterKernelA separable kernel's product with its profile along axis d replaced by the profile of ScaleRate: ℓ ∂_ℓ ∏_e g(δ_e/ℓ) = Σ_d H₁(δ_d/ℓ) ∏_{e≠d} g(δ_e/ℓ), H₁(s) = −s g′(s), so a separable filter's derivative in its width is a sum of filters of these, one per axis. Nested, AxisRate(AxisRate(kernel, Val(d)), Val(e)) replaces the profile along d and then along e: J₁ along d = e, H₁ along both otherwise, the terms of (ℓ∂_ℓ)² ∏ g = Σ_d J₁ ∏_{e≠d} g + Σ_{d≠e} H₁H₁ ∏ g. Its footprint is kernel's.
CoarseGrainingEnergyFluxes.Kernels.CellCentre — Type
CellCentre()A cell weighs its whole measure where its centre lies within ℓ/2 of the target, nothing otherwise.
CoarseGrainingEnergyFluxes.Kernels.CellOverlap — Type
CellOverlap()A cell weighs its measure inside the support of radius ℓ/2 about the target, the continuous top-hat integrated over each cell: the segment, disk or ball of a Cartesian grid, the cap on a sphere, the geodesic disk on a spheroid, and the chord ball in a spherical or spheroidal shell. On a node set, whose points carry no cells, the centre test.
CoarseGrainingEnergyFluxes.Kernels.GaussianKernel — Type
GaussianKernel(; α = 6.0) <: AbstractFilterKernelReal-space Gaussian filter G_ℓ(d) ∝ exp(-α (d/ℓ)²), with ℓ the full filter width. Its per-component variance is σ² = ℓ²/(2α) in every dimension; the default α = 6 gives ℓ²/12, the second moment of a top-hat of width ℓ in one dimension (Pope 2000).
TopHatKernel is the disk/ball of radius ℓ/2, whose per-component variance shrinks with dimension:
| 1-D | 2-D (disk) | 3-D (ball) | |
|---|---|---|---|
top-hat ⟨x²⟩ | ℓ²/12 | ℓ²/16 | ℓ²/20 |
α that matches it | 6 | 8 | 10 |
For a like-for-like comparison with TopHatKernel, use α = 8 on a 2-D grid and α = 10 in 3-D.
CoarseGrainingEnergyFluxes.Kernels.HighOrderKernel — Type
HighOrderKernel(; order = 3, b_over_ℓ = 1/8) <: AbstractFilterKernel
HighOrderKernel{P}(; b_over_ℓ = 1/8)Piecewise-constant kernel with P = order vanishing moments (Sadek & Aluie 2018 §V): a positive body of half-width ℓ/2 flanked by alternating-sign limbs of width b = b_over_ℓ · ℓ, whose amplitudes are solved so that ∫xⁿG dx = 0 for n = 1 … P. The order is the type parameter P, which the second form names directly.
P = 3is the paper'sM^I: one negative limb, support|x| < ℓ/2 + b.P = 5isM^II: a negative limb then a positive one, support|x| < ℓ/2 + 2b.
At the paper's b = ℓ/8 the amplitudes reduce to (1, -64/61) and (1, -568/257, +200/257) respectively, relative to the body.
Its form on each geometry
On the plane it is the paper's product G(x, y) = G(x) G(y) over the plane's axes (kernel_profile), whose support is a square. A sphere has no global axes, so there it is the isotropic form: the same body and limbs as a function of geodesic distance, with the amplitudes of spherical_limb_amplitudes and the same P vanishing moments of total degree. The isotropic form is this package's: Sadek & Aluie define the kernel on the plane. kernel_weight throws for it: the product is not a function of distance.
Slope recovery, and the domain it needs
P vanishing moments let the filtering spectrum follow a k^-α spectrum for α < P + 2 (Sadek & Aluie 2018, eq. 18), past the k⁻³ ceiling of TopHatKernel and GaussianKernel. With 𝓔(ℓ) = ∫E(k)|Ĝ(kℓ)|²dk and x = kℓ,
Ẽ(k_ℓ) ∝ k_ℓ^{-α} · I , I = -∫₀^∞ x^{1-α} (|Ĝ|²)'(x) dxso the slope is -α unless I diverges; since 1 - |Ĝ|² ∝ x^{P+1} the integrand is x^{P+1-α} and I diverges at small x = kℓ iff α ≥ P+2 (Sadek & Aluie eq. 18). The saturation is an infrared effect, set by scales larger than the filter: seeing it needs many decades of spectrum below 1/ℓ, more as P grows. A finer grid adds only modes above 1/ℓ, which I does not see.
On a grid
The filter a grid runs is a sum over cells, so the moments that set its order are the discrete ones, Σₖ wₖ eₖᵅ over the cells' displacements eₖ. The paper's grids take ℓ an even number of cells and b at least one, where the cell means are its stencil. Here the weights are the kernel's mean over each cell times the cell measure (profile_cell_average on a rectilinear grid), corrected by the least change that makes every moment of degree 1…P vanish, so the order holds at every ℓ and on every grid; as ℓ nears a few cells the weights tend to the identity filter. The correction is this package's: the cell means alone leave the discrete moments of order 2 and up swinging as the limbs' edges cross cells, and a filtering spectrum differenced across closely spaced scales then swings with them, sign included.
Not for Π
The vanishing moments need negative weights, so the filter is not a positive operator and τ is not guaranteed positive (realizable). Past its first zero |Ĝ|² rises again, above 1 for P = 5, which amplifies those scales. For a flux use TopHatKernel or GaussianKernel.
CoarseGrainingEnergyFluxes.Kernels.HyperGaussianKernel — Type
HyperGaussianKernel(; α = 1.0) <: AbstractFilterKernelSuper-Gaussian, G_ℓ(d) ∝ exp(-α (2d/ℓ)⁴): flatter in the core and steeper in the skirt than a Gaussian of the same nominal width, smooth and strictly positive.
exp(-r⁴) has no elementary Fourier transform, so on the plane method = Spectral() throws; on a sphere its degree transfer is its Legendre transform (spectral_transfer_degrees!). Its |Ĝ|² is not monotone, so transfer_monotone is false.
CoarseGrainingEnergyFluxes.Kernels.LegendreQuadrature — Type
LegendreQuadrature(T = Float64)Gauss–Legendre nodes, weights and per-degree sums for spectral_transfer_degrees!, in T. The buffers are growable host vectors that keep the largest size asked of them, so a transfer repeated at any scale allocates nothing once that size is reached.
CoarseGrainingEnergyFluxes.Kernels.ScaleRate — Type
ScaleRate(kernel) <: AbstractFilterKernelThe weight H(s) = −s G′(s), s = d/ℓ, of a kernel whose weight is G(d/ℓ): ∂_ℓ G(d/ℓ) = H(d/ℓ)/ℓ, so a real-space filter ū = N_G/M_G has ∂_ℓū = (M_H/M_G)(ū_H − ū)/ℓ, ū_H the filter with H and M each filter's window mass. H ≥ 0 for a profile decreasing in d. Its footprint is kernel's, so N_H and M_H sum the cells N_G and M_G do. has_profile_rate names the kernels it has a weight for.
CoarseGrainingEnergyFluxes.Kernels.SharpSpectralKernel — Type
SharpSpectralKernel <: AbstractFilterKernelSharp-spectral (brick-wall) filter: Ĝ_ℓ(k) = 1 for k ≤ k_c, else 0, with k_c = π/ℓ.
method = Spectral() multiplies by that transfer function. RealSpace() convolves with its inverse transform in the grid's D dimensions, G(r) ∝ J_{D/2}(k_c r)/(k_c r)^{D/2}, normalized to 1 at r = 0:
D | weight at x = k_c r |
|---|---|
| 1 | sin x / x |
| 2 | 2 J₁(x)/x, from SpecialFunctions (run using SpecialFunctions) |
| 3 | 3 (sin x − x cos x)/x³ |
G decays as r^{-(D+1)/2}, so ∫|G| diverges and a truncated footprint's transfer function ripples about the brick wall, most near k_c, at any truncation radius. The footprint ends near 10ℓ, at the radius where the truncated kernel's mass equals the full kernel's (kernel_radius), so the passband is centred on 1. The weights change sign, so under Deformable a window mass beside a coast is a sum of signed weights and can approach zero.
CoarseGrainingEnergyFluxes.Kernels.SmoothHatKernel — Type
SmoothHatKernel(; steepness = 10.0) <: AbstractFilterKernelTapered top-hat, G_ℓ(d) ∝ ½(1 − tanh(s(2d/ℓ − 1))), the kernel used in the Storer et al. papers: a top-hat whose rim is smoothed over a width ≈ ℓ/(2s).
steepness = 10 is the published value, i.e. ½(1 − tanh((D − 1)/0.1)) with D = 2d/ℓ; larger values approach TopHatKernel, smaller ones approach a broad bell.
It has no closed-form transfer function on the plane, where method = Spectral() throws; on a sphere its degree transfer is its Legendre transform (spectral_transfer_degrees!). Its |Ĝ|² is not monotone, so transfer_monotone is false.
CoarseGrainingEnergyFluxes.Kernels.TopHatKernel — Type
TopHatKernel(; cells = CellOverlap()) <: AbstractFilterKernelReal-space top-hat (box) filter of full width ℓ: unit weight within distance ℓ/2, zero beyond, each grid cell weighed as cells says (AbstractCellWeight).
CoarseGrainingEnergyFluxes.Kernels.TransferRate — Type
TransferRate(kernel) <: AbstractFilterKernelkernel's transfer differentiated in the filter width, as a transfer: spectral_transfer is scale_rate_transfer and spectral_transfer_degrees! is spectral_rate_degrees!, so a spectral plan built with it synthesizes ∂_ℓū from the analysis kernel's plan holds. Its footprint is kernel's; it has no real-space weight.
CoarseGrainingEnergyFluxes.Kernels._ball_transform — Method
_ball_transform(x, Val(D))The Fourier transform of the unit ball's indicator in D dimensions at |k| = x, divided by the ball's volume: sin x / x, 2J₁(x)/x, 3(sin x − x cos x)/x³. It is the transfer function of a top-hat of radius R at x = |k|R, and the inverse transform of the brick wall |k| ≤ k_c at x = k_c r.
CoarseGrainingEnergyFluxes.Kernels.check_spectrum_kernel — Method
check_spectrum_kernel(kernel::AbstractFilterKernel)Throw an ArgumentError unless kernel satisfies transfer_monotone. This is the strict reading of the admissibility condition, selected by Diagnostics.StrictSpectrum(); the cumulative energy needs no such check.
CoarseGrainingEnergyFluxes.Kernels.has_degree_rate — Method
has_degree_rate(kernel) -> BoolWhether spectral_rate_degrees! has a method for kernel, and for TransferRate(kernel) whether it has the second derivative. The high-order kernel's isotropic limb amplitudes, and the sharp cut's truncation, move with ℓ.
CoarseGrainingEnergyFluxes.Kernels.has_profile_rate — Method
has_profile_rate(kernel) -> BoolWhether ScaleRate has a weight for kernel, a profile differentiable in distance, so a real-space filter's derivative in the filter width is exact; has_profile_rate(ScaleRate(kernel)) whether the second derivative is. The top-hat's H is a ring at its rim, the high-order kernel's sits at its edges, and the sharp cut's footprint ends where its weight is not small.
CoarseGrainingEnergyFluxes.Kernels.has_transfer_rate — Method
has_transfer_rate(kernel) -> BoolWhether scale_rate_transfer has a method for kernel: a planar transfer function differentiable in the filter width; has_transfer_rate(TransferRate(kernel)) whether it is twice.
CoarseGrainingEnergyFluxes.Kernels.is_nonnegative — Function
is_nonnegative(kernel::AbstractFilterKernel) -> BoolWhether the kernel's real-space weight is non-negative everywhere, so the filter is a positive operator and the subfilter stress τ is realizable (Vreman, Geurts & Kuerten 1994). SharpSpectralKernel's J_{D/2} profile and HighOrderKernel's limbs change sign. Every kernel defines its own method.
CoarseGrainingEnergyFluxes.Kernels.is_radial — Method
is_radial(kernel) -> BoolWhether the kernel is a function of the scalar distance alone, i.e. whether kernel_weight has a method for it. HighOrderKernel is the one separable kernel here without a radial form.
CoarseGrainingEnergyFluxes.Kernels.is_separable — Method
is_separable(kernel) -> BoolWhether the kernel factors as G(x₁,…,x_N) = ∏ G(x_d), so it can be applied as successive 1-D passes, and must be, if it has no radial form. See kernel_profile.
CoarseGrainingEnergyFluxes.Kernels.kernel_profile — Function
kernel_profile(kernel, δ::T, ℓ::T) -> TOne-dimensional profile of a separable kernel at signed-or-unsigned axis offset δ. The full weight at a displacement (δ₁, …, δ_N) is the product ∏ kernel_profile(kernel, δ_d, ℓ).
Defined for HighOrderKernel, which is separable by construction, and for GaussianKernel, which is separable as an identity (exp(-α r²/ℓ²) factors), where it coincides with kernel_weight. A kernel with no method here is radial-only.
CoarseGrainingEnergyFluxes.Kernels.kernel_radius — Method
kernel_radius(kernel::AbstractFilterKernel, ℓ::T) where {T<:AbstractFloat}
kernel_radius(kernel::AbstractFilterKernel, ℓ::T, ::Val{D}) where {T<:AbstractFloat, D}Distance at which a physical-space convolution footprint is truncated, in D dimensions: where the weight is negligible, or, for SharpSpectralKernel, where the truncated kernel keeps its full mass.
CoarseGrainingEnergyFluxes.Kernels.kernel_weight — Method
kernel_weight(kernel::AbstractFilterKernel, d::T, ℓ::T) where {T<:AbstractFloat}
kernel_weight(kernel::AbstractFilterKernel, d::T, ℓ::T, ::Val{D}) where {T<:AbstractFloat, D}Evaluate the unnormalized kernel weight at distance d for filter width ℓ, in D dimensions. A kernel given by a radial profile has the same weight in every dimension; SharpSpectralKernel's is the inverse transform of its transfer function, which depends on D.
CoarseGrainingEnergyFluxes.Kernels.limb_amplitudes — Method
limb_amplitudes(k::HighOrderKernel{P}, ::Type{T}) -> NTuple{P == 3 ? 1 : 2, T}Limb amplitudes relative to the body, from the vanishing-moment conditions. Dimensionless in β = b/ℓ, so ℓ does not enter.
CoarseGrainingEnergyFluxes.Kernels.point_kernel — Method
point_kernel(kernel) -> AbstractFilterKernelThe kernel a node set's points are weighted by: kernel itself, and for TopHatKernel the centre test, points carrying no cells to overlap.
CoarseGrainingEnergyFluxes.Kernels.profile_cell_average — Method
profile_cell_average(kernel, δ::T, Δ::T, ℓ::T) -> TThe 1-D profile averaged over a cell of width Δ centred at offset δ, i.e. (1/Δ) ∫_{δ-Δ/2}^{δ+Δ/2} G₁(s) ds.
The default is the point sample kernel_profile(kernel, δ, ℓ), which agrees with the average to O(Δ²) for a smooth kernel. HighOrderKernel takes the exact average through profile_integral.
CoarseGrainingEnergyFluxes.Kernels.profile_integral — Function
profile_integral(kernel, t::T, ℓ::T) -> T∫₀ᵗ G₁(s) ds for the 1-D profile, exact. Odd in t, since the profile is even.
profile_cell_average differences it to average HighOrderKernel's discontinuous profile over a cell, exact for a piecewise-constant kernel. A point sample of its narrow limbs depends on where the nodes fall and can miss a limb on a non-uniform axis (Sadek & Aluie 2018 §III.F).
CoarseGrainingEnergyFluxes.Kernels.radial_limb_amplitudes — Method
radial_limb_amplitudes(k::HighOrderKernel{P}, ::Type{T}, ::Val{D}) -> NTupleLimb amplitudes, relative to the body, of the kernel's isotropic form in D dimensions: the profile G(r) with the body and limbs of HighOrderKernel as a function of distance, whose moments ∫ r^{2m} G(r) dV, m = 1…⌊P/2⌋, vanish. The odd moments, and every moment ∫ x^α G of odd degree in some coordinate, vanish by symmetry, so the form has P vanishing moments of total degree, as the product does. D = 1 is limb_amplitudes.
With ρₙ = ½ + nβ the body and limb radii in units of ℓ and q = 2m + D, the amplitudes solve Σₙ aₙ (ρₙ^q − ρₙ₋₁^q) = −ρ₀^q.
CoarseGrainingEnergyFluxes.Kernels.scale_rate_transfer — Method
scale_rate_transfer(kernel, kmag::T, ℓ::T, ::Val{D}) -> T
scale_rate_transfer(kernel, k::NTuple{D,T}, ℓ::T) -> T∂Ĝ/∂ℓ of spectral_transfer at the wavenumber magnitude kmag or the wavevector k. The top-hat's is (k/2) d/dx of the ball's transform at x = kℓ/2, −x/(D+2) times the (D+2)-dimensional ball's.
CoarseGrainingEnergyFluxes.Kernels.spectral_rate_degrees! — Function
spectral_rate_degrees!(dĜ, kernel, ℓ, R[, quadrature]) -> dĜ∂Ĝ(n)/∂ℓ of spectral_transfer_degrees! for every degree n = 0 … length(dĜ) − 1. With A_n and B_n the degree sums of G and of ScaleRate's H over the same nodes, ∂_ℓĜ(n) = (B_n − Ĝ(n)B_0)/(ℓA_0), the truncation radius, where G is below the truncation tolerance, held. A cap of angular radius θ₀ = ℓ/2R has (P_n(cos θ₀) − Ĝ(n)) cot(θ₀/2)/(2R).
CoarseGrainingEnergyFluxes.Kernels.spectral_transfer — Method
spectral_transfer(kernel, kmag::T, ℓ::T) where {T<:AbstractFloat}
spectral_transfer(kernel, kmag::T, ℓ::T, ::Val{D}) where {T<:AbstractFloat, D}Isotropic transfer function Ĝ(|k|, ℓ) in D dimensions (two without the Val): the factor by which a Fourier mode of wavenumber magnitude kmag (rad m⁻¹) is multiplied when filtering at width ℓ, with Ĝ(0, ℓ) = 1. For the spherical-harmonic-degree analog see spectral_transfer_degree.
GaussianKernel(α):Ĝ = exp(-k² ℓ² / (4α)), the transform ofexp(-α(r/ℓ)²)in every dimension.SharpSpectralKernel:Ĝ = 1fork ≤ π/ℓ, else0.TopHatKernel: the transform of the ball of radiusR = ℓ/2,sin(kR)/(kR),2J₁(kR)/(kR)and3(sin kR − kR cos kR)/(kR)³in one, two and three dimensions. It oscillates and goes negative ink. The two-dimensional form needsusing SpecialFunctions.
CoarseGrainingEnergyFluxes.Kernels.spectral_transfer — Method
spectral_transfer(kernel, k::NTuple{D,T}, ℓ::T) -> TThe transfer function at the wavevector k: spectral_transfer(kernel, |k|, ℓ, Val(D)) for an isotropic kernel, and ∏ Ĝ₁(k_d) for HighOrderKernel's product on the plane, Ĝ₁ the profile's transform over its mass.
CoarseGrainingEnergyFluxes.Kernels.spectral_transfer_degree — Method
spectral_transfer_degree(kernel, l::Integer, ℓ::T, R::T) -> TThe degree-l entry of spectral_transfer_degrees!: the transfer of a degree-l spherical harmonic on a sphere of radius R. It oscillates and goes negative in l for a kernel with an edge, as the planar transfer does in k.
CoarseGrainingEnergyFluxes.Kernels.spectral_transfer_degrees! — Function
spectral_transfer_degrees!(Ĝ, kernel, ℓ, R[, quadrature]) -> ĜĜ[n+1] for every degree n = 0 … length(Ĝ) − 1: the factor by which filtering with kernel at width ℓ on a sphere of radius R multiplies a degree-n spherical harmonic. It is the Legendre transform of the two-dimensional real-space weight G in geodesic distance over the support the real-space engines keep, normalized to Ĝ(0) = 1 (Aluie 2019, eq. 34),
Ĝ(n) = ∫₀^γₜ G(Rγ) Pₙ(cos γ) sin γ dγ / ∫₀^γₜ G(Rγ) sin γ dγ , γₜ = min(kernel_radius(kernel, ℓ, Val(2))/R, π),which by the Funk–Hecke theorem (eqs. 36–37) scales every harmonic of degree n. A spherical cap (TopHatKernel, and each shell of HighOrderKernel's isotropic form) has the closed form of Jekeli (1981); every other kernel is integrated by Gauss–Legendre quadrature in γ. Both run in the element type of quadrature, by default that of Ĝ.
CoarseGrainingEnergyFluxes.Kernels.spherical_limb_amplitudes — Method
spherical_limb_amplitudes(k::HighOrderKernel{P}, ℓ::T, R::T) -> NTupleradial_limb_amplitudes on a sphere of radius R, with the moments taken against the sphere's area element in geodesic polar coordinates, ∫ r^{2m} G(r) R sin(r/R) dr dθ, so the form's moments vanish in the normal coordinates of its centre. They tend to the planar two-dimensional amplitudes as ℓ/R → 0.
CoarseGrainingEnergyFluxes.Kernels.transfer_cutoff — Method
transfer_cutoff(kernel, ℓ::T) -> T or nothingThe wavenumber past which |Ĝ(k, ℓ)| ≤ truncation_tol(T) in every dimension, the relative weight the real-space footprints truncate at, or nothing for a kernel without such a bound in closed form. GaussianKernel(α): exp(−k²ℓ²/(4α)) falls below tol past k = √(4α ln(1/tol))/ℓ.
CoarseGrainingEnergyFluxes.Kernels.transfer_monotone — Function
transfer_monotone(kernel::AbstractFilterKernel) -> BoolWhether d|Ĝ(k)|²/dk ≤ 0 holds on (0, ∞).
Sadek & Aluie (2018) eq. (21): this is the condition under which the filtering spectral density Ẽ(k_ℓ) is guaranteed non-negative. A kernel that fails it can produce a spectrum with negative values: Diagnostics.StrictSpectrum refuses one, and the coarse_grain default Diagnostics.AutoSpectrum fills NaN for it.
| kernel | monotone | why |
|---|---|---|
GaussianKernel | true | |Ĝ|² = exp(-k²ℓ²/2α), strictly decreasing |
SharpSpectralKernel | true | 1 then 0 — non-increasing |
TopHatKernel | false | Ĝ = 2J₁(kR)/(kR) oscillates; |Ĝ|² hits zero at kℓ ≈ 7.66, then climbs to 0.0175 at kℓ ≈ 10.27 |
The condition is sufficient: false means a non-negative spectrum is not guaranteed. It does not bear on the k⁻³ slope ceiling, which binds the Gaussian as hard as the top-hat (see Diagnostics.filtering_spectrum).
transfer_monotone has no fallback method: every kernel defines its own.
CoarseGrainingEnergyFluxes.Kernels.truncation_tol — Method
truncation_tol(T) -> TThe relative weight below which the Gaussian, hyper-Gaussian and smooth-hat footprints are truncated in element type T, and the tolerance of the nonuniform-FFT kernel sum: 1e-10, or 8 eps(T) where T resolves less (Float32: 9.5e-7).
Derivatives
CoarseGrainingEnergyFluxes.Derivatives.AbstractDerivative — Type
AbstractDerivativeHow a diagnostic differentiates a filtered field ū: AutoDerivative, PhysicalDerivative or SpectralDerivative.
CoarseGrainingEnergyFluxes.Derivatives.AutoDerivative — Type
AutoDerivative()The exact derivative where the filter evaluates one, SpectralDerivative on a plan whose output is a series or a ratio of two, and PhysicalDerivative() elsewhere.
CoarseGrainingEnergyFluxes.Derivatives.PhysicalDerivative — Type
PhysicalDerivative(; nodes = 5)Differences of ū's values: on a StructuredGrid FlowGeometries' stencils of nodes nodes, shrinking to a cell's active run beside a mask; on any other grid FlowGeometries' least-squares gradient, which takes no node count.
CoarseGrainingEnergyFluxes.Derivatives.SpectralDerivative — Type
SpectralDerivative()The derivative of the filter's own output: ∂_d ū = Σ_k i k_d Ĝ(k) F̂(k) e^{ik·x} for a plan whose output is that series, and the quotient rule for one whose output is a ratio of two series (a renormalized window mass). A plan with neither raises.
CoarseGrainingEnergyFluxes.Derivatives.ddz! — Method
ddz!(∂f∂z, f, grid, dz[, plan]; execution = SerialBackend()) -> ∂f∂zThe vertical derivative of a stack of levels, a 3-D field over a 2-D grid, the shape filter_field! accepts. The grid describes the horizontal alone, so the vertical spacing dz is an argument. plan is FlowGeometries.Discretization.stencil_plan(range(0; step = dz, length = Nz), 1, 3), built once for repeated calls. A masked horizontal cell is zero at every level. The fields live in the memory of execution, whose loops difference them; a grid already in that memory is read there, and a host grid's mask is copied there on each call.
CoarseGrainingEnergyFluxes.Derivatives.derivative_plan — Method
derivative_plan(grid; nodes = 5, execution = SerialBackend()) -> FG.Operators.StencilPlans | FG.Operators.GradientPlanThe derivative weights the diagnostics difference filtered fields with on grid: on a StructuredGrid, FlowGeometries.Operators.stencil_plans with nodes nodes, where a window reaching an inactive cell shrinks to the cell's active run (ReduceInRun); on any other grid, the least-squares FlowGeometries.Operators.gradient_plan, which needs the grid's adjacency. The weights are built from the host grid and held where execution's loops read them.
The weights depend on the grid alone: build one per grid and pass it as deriv_plan to every diagnostic taken there. Tasks may share it.