Types and Workspaces
Method Types
FlowInvariantTransfer.Types.AbstractEnergyTransferMethod — Type
AbstractEnergyTransferMethodAbstract supertype for all energy transfer computation methods. Concrete subtypes dispatch calculate_energy_transfer to specific algorithms.
FlowInvariantTransfer.Types.SpectralFluxMethod — Type
SpectralFluxMethod{B<:AbstractShellBinning} <: AbstractEnergyTransferMethodCompute the spectral energy flux Π(K) and transfer spectrum T(k) using the pseudospectral method on a periodic uniform grid.
Fields
binning::B: Shell binning strategy for grouping wavenumbers.
Notes
Requires Fourier-space velocity data on a uniform periodic grid. The transforms run through FFTW (O(Nᴰ log N)) when it is loaded, else through the O(N²ᴰ) direct-sum reference.
FlowInvariantTransfer.Types.ShellToShellTransferMethod — Type
ShellToShellTransferMethod{B<:AbstractShellBinning} <: AbstractEnergyTransferMethodCompute the directed shell-to-shell transfer matrix T(n,m), the rate at which shell Sn gives energy to shell Sm through the nonlinear advection term.
Fields
binning::B: Shell binning strategy.
Notes
The antisymmetry property T(n,m) = −T(m,n) holds when the mediator velocity is the full field u (Verma et al. 2002).
FlowInvariantTransfer.Types.ModeToModeTransferMethod — Type
ModeToModeTransferMethod{I<:AbstractInvariant} <: AbstractEnergyTransferMethodCompute the mode-to-mode transfer S(k|p) between stored coefficients — the rate at which the modes of slot k give energy (or another invariant) to the slot field u_p, mediated by q = k − p:
S(k|p) = Re{ û*(k) · N̂_p(k) }, N̂_p = FFT[(u·∇)u_p], u_p(x) = w(p)·Re{û(p) e^{ip·x}},with w the slot's fold weight (see ModeToModeTriadResult). It reduces to the shell-to-shell matrix and the spectral transfer T(k) under summation.
Fields
invariant::I: Which quadratic invariant to accumulate (defaultKineticEnergy()).
Cost
One nonlinear-term evaluation per slot p and an O(N^{2D}) result tensor.
References
- Dar, Verma & Eswaran (2001); Verma (2004 review, 2019 book).
FlowInvariantTransfer.Types.CoarseGrainingFluxMethod — Type
CoarseGrainingFluxMethod{F<:AbstractFilter, S} <: AbstractEnergyTransferMethodCompute the pointwise cross-scale energy flux Π_ℓ(x) = −τ̄ᵢⱼ S̄ᵢⱼ at filter scale ℓ.
Fields
filter::F: Filter kernel (Gaussian, sharp-spectral, or top-hat).scale::S: Filter length scale ℓ (same units as the coordinate arrays).
Notes
Physical-space output; suitable for detecting spatial intermittency in the cascade.
FlowInvariantTransfer.Types.TriadicOrthogonalDecompositionMethod — Type
TriadicOrthogonalDecompositionMethod{N, O, M} <: AbstractEnergyTransferMethodTriadic Orthogonal Decomposition (Yeung, Chu & Schmidt 2026).
Operates on temporal snapshots, decomposing triadic (three-wave) nonlinear interactions in the temporal-frequency domain via the mode bispectrum.
Fields
nfft: DFT block length.nothingfor auto-selection.noverlap: Block overlap in snapshots.nothingfor 50% of window.nmode: Number of modes per triad to retain.nothingfor nblocks.
References
- Yeung, Chu & Schmidt (2026), J. Fluid Mech. 1031, A34. DOI 10.1017/jfm.2026.11183
FlowInvariantTransfer.Types.SphericalTransferMethod — Type
SphericalTransferMethod{T<:Real} <: AbstractEnergyTransferMethodSpectral energy/enstrophy transfer for 2D non-divergent (barotropic) flow on the sphere, in the spherical-harmonic degree spectrum l. Given the vorticity field ζ, with streamfunction ψ = ∇⁻²ζ (so ζ̂_lm = -l(l+1)/a² ψ̂_lm) and advection A = J(ψ,ζ) = u·∇ζ, u = k̂×∇ψ, the transfers are
T_E(l) = -Σ_m Re{ψ̂*_lm Â_lm}, T_Z(l) = Σ_m Re{ζ̂*_lm Â_lm},both conserving (Σ_l T = 0).
Dispatched through calculate_energy_transfer: a regular colatitude–longitude grid (an AbstractMatrix vorticity field) routes to the FastSphericalHarmonics extension; scattered points (a vorticity vector + (θ, φ) coordinates) route to the NUFSHT extension.
Fields
radius::T: sphere radiusa(default1.0).
FlowInvariantTransfer.Types.DivergentSphericalTransferMethod — Type
DivergentSphericalTransferMethod{T<:Real, E<:AbstractEnstrophyOutput} <: AbstractEnergyTransferMethodSpectral kinetic-energy transfer for the full horizontal flow on the sphere — rotational and divergent — in the spherical-harmonic degree spectrum l. Generalises SphericalTransferMethod (which assumes non-divergent/barotropic flow, ∇·u = 0) to a velocity field carrying divergence, and reduces to it exactly in the non-divergent limit.
The input is the horizontal velocity u = (u_θ, u_φ) (colatitude, longitude components), Helmholtz- decomposed as u = k̂×∇ψ + ∇χ (rotational streamfunction ψ, divergent velocity potential χ). The advection is taken in the skew-symmetric form A = (u·∇)u + ½u(∇·u) of Augier & Lindborg (2013, Appendix A; Eq. 35 of arXiv:1211.0607), written in Lamb form as A = ∇(½|u|²) + ζ(k̂×u) + ½δu with vorticity ζ = k̂·(∇×u) and divergence δ = ∇·u. The nonlinear KE transfer of degree l, −dE_l/dt from that advection, is the vector-harmonic projection
T(l) = Σ_m Re{ û*_lm · Â_lm} (spin-1 vector-harmonic coefficients),split by the toroidal (rotational) / spheroidal (divergent) parts of û into T = T_rot + T_div. ∫u·A = 0, so total KE is conserved, Σ_l T(l) ≈ 0; the rotational and divergent channels exchange energy and are not conserved one by one. References: Augier & Lindborg (2013); Burgess, Erler & Shepherd (2013).
The enstrophy transfer comes with it: the curl of the advection (u·∇)u is ∇·(ζu) = u·∇ζ + ζδ, and T_Z(l) = Σ_m Re{ζ*_lm [∇·(ζu)]_lm} sums to ½∫ζ²δ dΩ, conserved for non-divergent flow alone. Point by point ζ ∇·(ζu) = ∇·(½ζ²u_ψ) + ∇·(½ζ²u_χ) + ½ζ²δ, with u_ψ = k̂×∇ψ and u_χ = ∇χ: the transport of enstrophy by the rotational and by the divergent velocity, each integrating to zero, and its production by the divergence. T_Z splits alike into T_Z^ψ + T_Z^χ + S_Z, pairing ζ with u_ψ·∇ζ, with u_χ·∇ζ + ½ζδ and with ½ζδ; enstrophy = EnstrophySplit() computes the three.
Dispatched through calculate_energy_transfer: a regular colatitude–longitude grid (two AbstractMatrix velocity components) routes to the FastSphericalHarmonics extension; scattered points (velocity-component vectors + (θ, φ) coordinates) route to the NUFSHT extension.
Fields
radius::T: sphere radiusa(default1.0).enstrophy::E:EnstrophyTotal(default) orEnstrophySplit.
FlowInvariantTransfer.Types.AbstractEnstrophyOutput — Type
AbstractEnstrophyOutputThe enstrophy transfer a DivergentSphericalTransferMethod computes, passed as enstrophy: EnstrophyTotal or EnstrophySplit.
FlowInvariantTransfer.Types.EnstrophyTotal — Type
EnstrophyTotal <: AbstractEnstrophyOutputThe enstrophy transfer T_Z and its flux alone; the result's split fields are nothing. The default.
FlowInvariantTransfer.Types.EnstrophySplit — Type
EnstrophySplit <: AbstractEnstrophyOutputT_Z with its transport by the rotational velocity T_Z^ψ, its transport by the divergent velocity T_Z^χ and its production by the divergence S_Z, each with its flux where it has one. One spherical synthesis and two analyses more per call than EnstrophyTotal.
Invariant Types
FlowInvariantTransfer.Types.AbstractInvariant — Type
AbstractInvariantTrait supertype selecting which quadratic inviscid invariant a transfer diagnostic accumulates. The same nonlinear-term machinery serves every invariant; only the per-mode transfer-density weighting changes (see Invariants.transfer_density!).
Concrete subtypes: KineticEnergy (default), Helicity (3D), Enstrophy (2D), PassiveScalar (any D).
Advected vs. carrier field
Every transfer diagnostic forms T(k) = Re{ ĉ*(k) · 𝒩̂(k) }, where 𝒩̂ = FFT[(u·∇)f] is the nonlinear term of the advected field f and ĉ is the carrier. For the momentum invariants (KE/helicity/enstrophy) both are the velocity (f = c = u, with vorticity weighting folded into the carrier for helicity/enstrophy). For PassiveScalar the advected and carrier field is the scalar θ, advected by the velocity u — handled by passing the scalar as the primary field and the velocity as advecting_hat.
FlowInvariantTransfer.Types.KineticEnergy — Type
KineticEnergy <: AbstractInvariantKinetic energy E = ½∫|u|². The default invariant; transfer density is Re{ û*(k) · N̂(k) }. Forward cascade in 3D, inverse in 2D.
FlowInvariantTransfer.Types.Helicity — Type
Helicity <: AbstractInvariantHelicity H = ∫ u·ω, ω = ∇×u (3D only). Transfer density is Re{ ω̂*(k) · N̂(k) } with ω̂ = i k × û. Co-directional (forward) with energy.
FlowInvariantTransfer.Types.Enstrophy — Type
Enstrophy <: AbstractInvariantEnstrophy Ω = ½∫|ω|², transfer density Re{ ω̂*(k) · N̂_ω(k) } with ω̂ = i k×û and N̂_ω = i k×N̂.
- 2D (scalar vorticity
ω̂ = i(k_x û_y − k_y û_x)): enstrophy is an inviscid invariant — conserved (Σ_k T_Ω = 0), counter-directional forward cascade dual to the inverse energy cascade (Kraichnan–Batchelor). - 3D (vector vorticity):
N̂_ω = curl[(u·∇)u] = (u·∇)ω − (ω·∇)uincludes vortex stretching, so enstrophy is not conserved (Σ_k T_Ω ≠ 0: net production).
Available in 2D and 3D in the spectral flux, shell-to-shell and mode-to-mode diagnostics.
FlowInvariantTransfer.Types.PassiveScalar — Type
PassiveScalar <: AbstractInvariantPassive-scalar variance E_θ = ½∫θ² (Obukhov–Corrsin), advected by the velocity: ∂_tθ + (u·∇)θ = κ∇²θ. The transfer density is Re{ θ̂*(k) N̂_θ(k) } with N̂_θ = FFT[(u·∇)θ].
The scalar is the advected and carrier field; the velocity only advects it. Pass the scalar (shape (ns..., 1)) as the primary field and the velocity as advecting_hat (the convenience entry points calculate_scalar_* do this for you).
Scalar variance is an inviscid invariant for incompressible flow (∫θ(u·∇)θ = −½∫θ²∇·u = 0), so it is conserved (Σ_k T_θ ≈ 0) and cascades forward (to small scales) in both 2D and 3D.
A family of canonical invariants
Other quadratic invariants are advected by the velocity like a passive scalar, so their cross-scale transfer is computed by this same path (pass the field as the "scalar"):
- Buoyancy / available-potential-energy variance
½⟨b²⟩(APE= ½⟨b²⟩/N²) in the Boussinesq system. The−N²wterm is a separate KE↔APE conversion source, so the variance cascade is the scalar transfer ofb. - QG potential enstrophy
½⟨q²⟩with PVq = ∇²ψ + βyadvected by the geostrophic velocity.
References
- Obukhov (1949); Corrsin (1951); Batchelor (1959); QG: Charney (1971); stratified APE: Lindborg (2006).
Decomposition Types
FlowInvariantTransfer.Types.AbstractFieldDecomposition — Type
AbstractFieldDecompositionAbstract supertype specifying the field decomposition/projection strategy (e.g., Helmholtz rotational/divergent decomposition).
FlowInvariantTransfer.Types.NoDecomposition — Type
NoDecomposition <: AbstractFieldDecompositionNo decomposition or projection is applied; use the full velocity field.
FlowInvariantTransfer.Types.HelmholtzDecomposition — Type
HelmholtzDecomposition <: AbstractFieldDecompositionDecompose the velocity field into rotational (solenoidal) and divergent (dilatational) components, computing transfer results for both.
FlowInvariantTransfer.Types.RotationalDecomposition — Type
RotationalDecomposition <: AbstractFieldDecompositionOnly compute or retain the rotational (solenoidal/divergence-free) component.
FlowInvariantTransfer.Types.DivergentDecomposition — Type
DivergentDecomposition <: AbstractFieldDecompositionOnly compute or retain the divergent (dilatational/curl-free) component.
FlowInvariantTransfer.Types.HelicalDecomposition — Type
HelicalDecomposition <: AbstractFieldDecompositionDecompose a 3D velocity field into its positive- and negative-helicity components via the Craya–Herring/helical basis (Waleffe 1992; Alexakis 2017). For each k ≠ 0 the plane ⊥ k is spanned by the orthonormal helical eigenvectors of the curl, h_±(k) = (e₁ ± i e₂)/√2 with i k̂ × h_± = ± h_± and the Alexakis √2 unit-norm convention (h_± · h_±* = 1, h_+ · h_-* = 0). The velocity projects as û = u_+ h_+ + u_- h_- (u_± = û · h_±*), so
E(k) = E⁺(k) + E⁻(k), E^±(k) = ½|u_±|², H(k) = |k|(|u_+|² − |u_-|²) = 2|k|(E⁺ − E⁻),recovering the realizability bound |H(k)| ≤ 2|k| E(k). Returns the two vector components (positive = u_+ h_+, negative = u_- h_-); for an incompressible field they sum back to û. 3D only. Used as the decomposition argument to calculate_spectral_flux to get helicity-resolved energy fluxes Π^±(K).
FlowInvariantTransfer.Types.ToroidalPoloidalDecomposition — Type
ToroidalPoloidalDecomposition <: AbstractFieldDecompositionSplit a 3D solenoidal velocity into toroidal (horizontal/vortical) and poloidal (vertical/wave) components in the Craya–Herring frame (Craya 1958; Herring 1974; Bartello 1995). For each k with horizontal part k_⊥ ≠ 0, the plane ⊥ k is spanned by e⁽¹⁾ = (k × ẑ)/|k × ẑ| (horizontal, the toroidal direction) and e⁽²⁾ = (k × e⁽¹⁾)/|k| (the poloidal direction); û = u₁ e⁽¹⁾ + u₂ e⁽²⁾. The toroidal part carries the vertical vorticity and has zero vertical velocity; the poloidal part carries the vertical velocity (the linear gravity-wave mode in stratified flow). For purely vertical k (k_⊥ = 0) the split is degenerate and (x̂, ŷ) are used as an arbitrary horizontal orthonormal pair.
Returns (toroidal = u₁ e⁽¹⁾, poloidal = u₂ e⁽²⁾); both are divergence-free and they sum back to the solenoidal part of û. 3D only.
Dealiasing Strategies
FlowInvariantTransfer.Types.AbstractDealiasing — Type
AbstractDealiasingStrategy for removing aliasing from the pseudospectral quadratic product, passed as the dealiasing keyword. A product of two N-mode fields generates wavenumbers up to twice the maximum, which alias back onto the resolved band (Orszag 1971; Canuto et al. 2006). Subtypes: NoDealiasing, OrszagTwoThirds (the default), and PaddedThreeHalves (exact 3/2 zero-padding).
FlowInvariantTransfer.Types.NoDealiasing — Type
NoDealiasing <: AbstractDealiasingNo dealiasing — the raw pseudospectral product, aliasing included.
FlowInvariantTransfer.Types.OrszagTwoThirds — Type
OrszagTwoThirds <: AbstractDealiasingOrszag 2/3-rule truncation: keep modes with |m_d| ≤ ⌊(N_d−1)/3⌋ along every axis, in the inputs and the output (FlowTransformBindings.dealias_cutoff). Exact on the retained band, and discards the top third of the spectrum. The default dealiasing.
FlowInvariantTransfer.Types.PaddedThreeHalves — Type
PaddedThreeHalves <: AbstractDealiasingExact 3/2 zero-padding: form the quadratic product on the grid of FlowTransformBindings.padded_length(N) points per axis, the smallest past 3N/2 on which no alias reaches the resolved band, then truncate back to N. Exact for the quadratic nonlinear term over every mode up to Nyquist (nothing discarded), at ~(3/2)^D the transform cost of the unpadded term, on the FFT and the direct-sum transforms alike.
Nonlinear Forms
FlowInvariantTransfer.Types.AbstractNonlinearForm — Type
AbstractNonlinearFormHow a velocity's self-advection is evaluated for its spectral flux, passed as the form keyword: Advective (the default) or Rotational.
FlowInvariantTransfer.Types.Advective — Type
Advective <: AbstractNonlinearForm(u·∇)u itself: D velocity components and their D² gradients synthesised and the product transformed back, D + D² + D transforms (15 in 3-D, 8 in 2-D). Valid for any field. The default form.
FlowInvariantTransfer.Types.Rotational — Type
Rotational <: AbstractNonlinearFormω × u in place of (u·∇)u: the velocity and its vorticity synthesised and their cross product transformed back, 9 transforms in 3-D and 5 in 2-D (ω ẑ × u). (u·∇)u = ω × u + ∇(½|u|²), and under the 2/3 rule the two differ on the kept modes by i k (½|u|²)^, whose kinetic-energy, enstrophy and helicity transfers vanish where k·û = 0; for a divergence-free velocity this form gives the same fluxes. For a field with divergence it gives the transfer of ω × u, a different quantity.
Result Types
FlowInvariantTransfer.Types.SpectralFluxResult — Type
SpectralFluxResult{KS, E, V}Result of a spectral energy flux computation over the shells [shell_edges[n], shell_edges[n+1]).
Fields
k_shells::KS: Representative wavenumber for each shell (midpoint of its edges).shell_edges::E: The shell boundaries (length = number of shells + 1).transfer_spectrum::V:T(k_n) = −dE_n/dtfrom the nonlinear term,E_nthe energy of shelln: the shell's content, a sum over its modes.T(k_n)/(shell_edges[n+1] − shell_edges[n])is the transfer per unit wavenumber.flux::V:Π[n] = Σ_{m≤n} T(k_m), the flux through the wavenumbershell_edges[n+1](Π > 0 forward/down-scale cascade, Π < 0 inverse; Alexakis–Biferale 2018).
k_shells and shell_edges are host vectors whatever array type the transfer is computed on.
FlowInvariantTransfer.Types.CompressibleFluxResult — Type
CompressibleFluxResult{KS, ES, TS, FL, CH, PD}Result of a compressible kinetic-energy spectral-transfer computation (Singh–Tiwari–Sharma–Verma 2025). The transfer is momentum-weighted (v = ρu), so it needs the density field and, for the KE↔internal-energy exchange, the pressure.
Fields
k_shells::KS: representative wavenumber per shell.shell_edges::ES: the shell boundaries (length = number of shells + 1).transfer_spectrum::TS:T_u(k) = −dE_u(k)/dtof the momentum-weighted KE from the nonlinear terms, the sign of the incompressible transfer. Conserves total KE where the products are dealiased:Σ_k T_u(k) ≈ 0.flux::FL:Π[n] = Σ_{m≤n} T_u(k_m), the flux throughshell_edges[n+1]; its last entry isΣ_k T_u, the residual of conservation.channels::CH: rotational/compressive (Helmholtzu = u_R + u_C) flux channels as aNamedTuple(rotational, compressive, rot_to_comp, comp_to_rot), ornothingif not requested;rot_to_compis the flux the rotational part gives the compressive part,comp_to_rotthe reverse.pressure_dilatation::PD: KE↔IE conversion(rotational = Q_{I,R}(k), compressive = Q_{I,C}(k))as aNamedTuple, ornothingif no pressure field was supplied.
FlowInvariantTransfer.Types.ShellToShellResult — Type
ShellToShellResult{V, W, M}Result of a shell-to-shell energy transfer computation.
Fields
shell_centers::V: Representative wavenumber for each shell.shell_edges::V: Shell boundary wavenumbers (length = N_shells + 1).transfer_matrix::M: T(n,m) — Nshells × Nshells matrix; T[n,m] is the rate at which shell n gives energy to shell m.net_transfer::W: Σm T(n,m) = −dEn/dt, equal to the spectral transferT(k_n).
V carries the wavenumber axes' element type; W and M carry the field's.
FlowInvariantTransfer.Types.ModeToModeTriadResult — Type
ModeToModeTriadResult{I, KS, W, A, S}Result of a mode-resolved triad transfer, indexed by the stored coefficients ("slots") of the spectral layout.
Slot k stands for w(k) modes of the full spectrum (weights): 1 everywhere on a full layout; on a half layout 2 on the interior of the halved axis, where the slot also stands for its unstored mirror −k, and 1 on its k₁ = 0 and Nyquist planes. Its slot field is u_k(x) = w(k)·Re{û(k) e^{ik·x}}, a real field, and the slot fields sum to the velocity.
Fields
invariant::I: The invariant that was accumulated (e.g.KineticEnergy()).ks::KS: The wavenumber axes of the spectral grid.weights::W:w(k)for every slot (shapems).net_transfer::A:T(k) = Σ_p S(k|p)— net per-slot transfer (shapems); equals the spectral transfer fromcalculate_spectral_flux.transfer::S:S(k|p) = Re{û*(k)·[(u·∇)u_p]^(k)}, the rate at which slotkgives energy to the slot fieldu_p, shape(ms..., ms...)(slotk's indices then slotp's).
w(k)·S(k|p) = ⟨u_k·(u·∇)u_p⟩ is the transfer between the two slot fields. For a divergence-free, dealiased field it is antisymmetric, w(k)S(k|p) = −w(p)S(p|k), and Σ_k Σ_p w(k)S(k|p) = 0; on a full layout these read S(k|p) = −S(p|k). Summing w(k)S(k|p) over the slots of two shells gives the shell-to-shell matrix.
FlowInvariantTransfer.Types.CoarseGrainingFluxResult — Type
CoarseGrainingFluxResult{S, A}Result of a coarse-graining energy flux computation (flux field only).
Fields
filter_scale::S: Filter scale ℓ used.flux_field::A: Π_ℓ(x) pointwise energy flux field (same shape as input velocity).mean_flux::S: Area-weighted spatial mean ⟨Π_ℓ⟩.
See also CoarseGrainingFluxResultWithDiagnostics for stress/strain output.
FlowInvariantTransfer.Types.StressStrain — Type
StressStrain()The coarse-graining flux's diagnostics: its filtered stress τ̄ᵢⱼ and strain rate S̄ᵢⱼ beside Π_ℓ, in a CoarseGrainingFluxResultWithDiagnostics. diagnostics = nothing, the default, returns the flux alone.
FlowInvariantTransfer.Types.CoarseGrainingFluxResultWithDiagnostics — Type
CoarseGrainingFluxResultWithDiagnostics{S, A, T}Result of a coarse-graining energy flux computation including stress/strain diagnostics, returned under diagnostics = StressStrain().
Fields
filter_scale::S: Filter scale ℓ used.flux_field::A: Π_ℓ(x) pointwise energy flux field.mean_flux::S: Area-weighted spatial mean ⟨Π_ℓ⟩.stress_tensor::T: τ̄ᵢʲ (component-indexed array, e.g.(Nx,Ny,2,2)).strain_rate::T: S̄ᵢʲ (same array type asstress_tensor).
FlowInvariantTransfer.Types.TriadicOrthogonalDecompositionResult — Type
TriadicOrthogonalDecompositionResult{V, A3, PM, EC, XM}Result container for Triadic Orthogonal Decomposition.
Fields
frequencies::V: Frequency vector (length nFreq).mode_bispectrum::A3: Singular values λ(fl, fn, mode) — array of size(nFreq, nFreq, nmode).modes::PM: Dict mapping(l, n)index tuples to mode arrays. Each value contains convective modes (index 1 along first dim) and recipient modes (index 2) with spatial/variable dimensions.modal_energy_budget::A3: Energy transfer T(fl, fn, mode) per triad per mode. Same shape asmode_bispectrum.expansion_coefficients::EC: Expansion coefficients, ornothingif not requested.auxiliary_modes::XM: Dict mapping(l, n)to donor/catalyst modes, ornothing.
FlowInvariantTransfer.Types.SphericalTransferResult — Type
SphericalTransferResult{V<:AbstractVector, F}Result of a spherical spectral energy/enstrophy transfer (SphericalTransferMethod), indexed by spherical-harmonic degree l = 0…lmax.
Fields
degrees::V: the degreesl.energy_transfer::V:T_E(l) = −dE_l/dtfrom the advection;Σ_l T_E ≈ 0.enstrophy_transfer::V:T_Z(l) = −dZ_l/dtfrom the advection;Σ_l T_Z ≈ 0.energy_flux::V:Π_E(L) = Σ_{l≤L} T_E(l)— cumulative energy flux, positive toward higher degree.enstrophy_flux::V:Π_Z(L) = Σ_{l≤L} T_Z(l).fit::F: at scattered points the coefficients come from least-squares fits, whose outcome this is, aFlowTransformBindings.SolverResult:convergedwhether every fit reachedrtol,iterationsandresidual(the relative normal-equation residual‖A†r‖/‖A†f‖) the largest over the fits.nothingwhere the analysis is a transform exact on the nodes (a regular grid, or quadrature weights).
FlowInvariantTransfer.Types.DivergentSphericalTransferResult — Type
DivergentSphericalTransferResult{V<:AbstractVector, S<:Union{Nothing,AbstractVector}, F}Result of the divergent horizontal kinetic-energy spectral transfer (DivergentSphericalTransferMethod), indexed by spherical-harmonic degree l = 0…lmax. The five enstrophy-split fields are S: vectors under EnstrophySplit, nothing under EnstrophyTotal.
Fields
degrees::V: the degreesl.energy_transfer::V:T(l) = T_rot(l) + T_div(l) = −dE_l/dtof the horizontal KE from the advection; the skew-symmetric (energy-conserving) advection makesΣ_l T ≈ 0.energy_flux::V:Π(L) = Σ_{l≤L} T(l)— cumulative KE flux, positive toward higher degree.rotational_transfer::V: rotational-channel transferT_rot(l)— projection of the advection onto the toroidal (streamfunctionψ) part of the velocity.divergent_transfer::V: divergent-channel transferT_div(l)— projection onto the spheroidal (velocity-potentialχ) part.rotational_flux::V,divergent_flux::V: cumulative fluxesΣ_{l≤L} T_rot,Σ_{l≤L} T_div.enstrophy_transfer::V:T_Z(l) = Σ_m Re{ζ*_lm [∇·(ζu)]_lm} = −dZ_l/dtof the enstrophyZ_l = ½Σ_m |ζ_lm|²from the advection,∇·(ζu) = k̂·∇×((u·∇)u)the vorticity's advection by the full velocity;Σ_l T_Z = ½∫ζ²δ dΩ, zero for non-divergent flow, whereT_Zis the barotropicSphericalTransferResult's.enstrophy_flux::V:Π_Z(L) = Σ_{l≤L} T_Z(l).rotational_enstrophy_transfer::S:T_Z^ψ(l) = Σ_m Re{ζ*_lm [u_ψ·∇ζ]_lm}, the enstrophy transfer by the rotational velocityu_ψ = k̂×∇ψ: the barotropicSphericalTransferResult'sT_Zof the flow'sζ;Σ_l T_Z^ψ = 0.divergent_enstrophy_transfer::S:T_Z^χ(l) = Σ_m Re{ζ*_lm [u_χ·∇ζ + ½ζδ]_lm}, the enstrophy transfer by the divergent velocityu_χ = ∇χ;Σ_l T_Z^χ = 0.rotational_enstrophy_flux::S,divergent_enstrophy_flux::S:Σ_{l≤L} T_Z^ψ,Σ_{l≤L} T_Z^χ.enstrophy_source::S:S_Z(l) = Σ_m Re{ζ*_lm [½ζδ]_lm}, the enstrophy the divergence takes from degreel(convergence,δ < 0, makes it negative);Σ_l S_Z = ½∫ζ²δ dΩandT_Z = T_Z^ψ + T_Z^χ + S_Z.fit::F: the outcome of the least-squares fits at scattered points,nothingwhere none runs, as inSphericalTransferResult.
Only the total is conserved (Σ_l T ≈ 0); the two channels exchange energy, so Σ_l T_rot and Σ_l T_div are individually nonzero (equal and opposite up to the total).
Workspace Types
FlowInvariantTransfer.Workspaces.NonlinearTermWorkspace — Type
NonlinearTermWorkspace(advected_hat, ks; dealiasing, fft_nthreads)Preallocated buffers for the generalized pseudospectral nonlinear term 𝒩(k) = FFT[(u·∇)f], where the advecting velocity u has nd advecting (spatial) components and the advected field f has M components. For the momentum term f = u (M = D); for passive-scalar / vector-potential advection f = θ/a (M = 1).
Physical-space buffers are sized ns, the grid the field lives on; the spectral buffer is sized ms, the shape of the coefficient array. The two differ on the half (real-field) layout, where ms₁ = ns₁÷2+1 — see FlowTransformBindings.RFFTAxis.
Fields
u_phys::RA:(ns..., nd)real physical-space advecting velocity (ranknd+1); only thendspatial directions of the velocity participate in(u·∇), so this never depends onD.g_phys::GA:(ns...)real physical-space gradient∂f_i/∂x_jfor the direction pair being accumulated (ranknd); each(i,j)is transformed, multiplied intoN_physand discarded, so one buffer serves allM·ndpairs.N_phys::RA:(ns..., M)real physical-space nonlinear term (ranknd+1).N̂::CA:(ms..., M)complex spectral output buffer (ranknd+1).phase::PH:ndcomplex vectors,phase[d]of lengthns[d], holding the per-axis factors of a single mode's plane wavee^{ip·x}. Written byModeToModeTransfer._mode_to_mode_giver!, which evaluates that mode's gradient in closed form.pad::PD: thePaddedGridunderPaddedThreeHalves, elsenothing.plans::P: FFT plan/scratch bundle (set by the FFTW extension) ornothing.operators: cached derivative wavenumbers and Hermitian fold weights.execution_state: reusable state supplied by an execution extension.
FlowInvariantTransfer.Workspaces.PaddedGrid — Type
PaddedGrid(advected_hat, ks)The grid of FlowTransformBindings.padded_length points per axis on which PaddedThreeHalves forms the quadratic product, in advected_hat's array type: its axes, the coefficient maps between it and the grid of ks, its derivative wavenumbers and the buffers the padded nonlinear term writes. Every transform reads it; the FFTW extension adds its plans.
Fields
ks: the padded grid's axes, in the layout ofks.maps:FlowTransformBindings.PaddedMapsbetween the two grids.kd: per-axis derivative wavenumbers on the padded grid, zero on the images of an even axis's Nyquist slot.u_phys,g_phys,n_phys: real(Ms..., nd)advecting velocity,(Ms...)gradient and(Ms..., M)nonlinear term.spec,spec1: one component's(Msp...)coefficients, and the same memory shaped(Msp..., 1).invM:1/prod(Ms), the forward normalization.
FlowInvariantTransfer.Workspaces.SpectralFluxWorkspace — Type
SpectralFluxWorkspace(velocity_hat, ks, binning; geometry, dealiasing, fft_nthreads)Preallocated buffers and shell tables for calculate_spectral_flux! and calculate_partial_fluxes!.
Fields
nonlinear::NW:NonlinearTermWorkspacefor computing N̂(k).T_spec::V: Shell transfer spectrum buffer (length N_sh), in the field's array type.flux::V: Cumulative flux buffer (length N_sh).shell_idx: cached mode-to-shell table in the field's memory.partials: retained thread state, filled on first use.
FlowInvariantTransfer.Workspaces.ShellToShellWorkspace — Type
ShellToShellWorkspace(velocity_hat, ks, binning; geometry, dealiasing)Preallocated buffers for calculate_shell_to_shell_transfer!.
Fields
nonlinear::NW:NonlinearTermWorkspace(owns N̂_m and all physical-space temps).û_m::CA: Band-filtered mediator velocity buffer (reused each shellm).T_mat::M: Output transfer matrix (Nsh × Nsh), written in-place.net_transfer::V: Net per-shell transfer buffer (length N_sh).shell_idx::IA: Integer shell-index array (same shape as k_mag).
FlowInvariantTransfer.BandTransfer.BandTransferWorkspace — Type
BandTransferWorkspace(velocity_hat, ks, bands::SmoothBands; geometry=IsotropicShells(),
dealiasing=OrszagTwoThirds())Reusable workspace for calculate_band_to_band_transfer!: the nonlinear-term workspace, band-field/transfer-density scratch, the smooth band weights (BandWeights) and the per-shell sums Dq. dealiasing is the one the transfer will be called with; PaddedThreeHalves() adds the padded-grid scratch.
FlowInvariantTransfer.Compressible.CompressibleWorkspace — Type
CompressibleWorkspaceReusable field-scratch + transform context for calculate_compressible_flux! — holds the FFT plans and every grid-sized intermediate of the momentum-weighted budget (velocity/density/ momentum physical & spectral fields, gradients, nonlinear terms, and the R/C-channel + pressure- dilatation scratch), so repeated per-snapshot calls allocate ~0 field memory (only the small shell vectors of each result). Build once for a given grid/precision and reuse across snapshots.
The products are formed on the working grid: the caller's grid, or under PaddedThreeHalves the grid padded for the transfer's cubic products. The densities are taken on the caller's grid, from the working grid's spectral outputs (coarse, the same arrays unless padded).
Every buffer lives in the memory the workspace's execution computes in. A workspace on a device built from a host array holds in stage the device buffers its host inputs are copied into once per call.
FlowInvariantTransfer.Spherical.SphericalTransferWorkspace — Type
SphericalTransferWorkspace(lmax; ...)Reusable buffers for the regular-grid calculate_spherical_transfer!. Constructed by the FastSphericalHarmonics extension; loading it provides the constructor.
FlowInvariantTransfer.Spherical.ScatteredSphericalTransferWorkspace — Type
ScatteredSphericalTransferWorkspace(coords, lmax; ...)Reusable buffers for the scattered-point calculate_spherical_transfer! (NUFSHT extension). Holds a spin-0 NUFSHT plan at lmax over the scattered points, which fits the vorticity, and two over a Gauss–Legendre grid, on which the Jacobian of the fitted fields is formed and projected onto degree lmax, plus every coefficient, field and reduction buffer and the result vectors. Build one per point set and reuse it across snapshots. The plans hold NUFFT resources that close! releases; the allocating entries close theirs. Requires using NUFSHT.
FlowInvariantTransfer.Spherical.DivergentSphericalTransferWorkspace — Type
DivergentSphericalTransferWorkspace(lmax; ...)Reusable buffers for the regular-grid calculate_divergent_spherical_transfer! (FastSphericalHarmonics extension; loading it provides the constructor): the work-grid fields, the embed targets, the transforms' plans and the reused DivergentSphericalTransferResult. FastSphericalHarmonics has no in-place transform API, so the spin-weighted transforms/eth allocate their outputs on every call. Requires using FastSphericalHarmonics.
FlowInvariantTransfer.Spherical.ScatteredDivergentSphericalTransferWorkspace — Type
ScatteredDivergentSphericalTransferWorkspace(coords, lmax; ...)Reusable buffers for the scattered-point calculate_divergent_spherical_transfer! (NUFSHT extension; loading it provides the constructor). Holds a spin+1 NUFSHT plan at lmax over the scattered points, which fits the velocity, and spin+1 and spin-0 plans over a Gauss–Legendre grid, on which the advection of the fitted velocity is formed and projected onto degree lmax, plus every coefficient, field and reduction buffer and the result. The plans hold NUFFT resources that close! releases. Requires using NUFSHT.