Skip to content

Add Karman-Howarth-Monin (KHM) tensor and equation #25

Open

Description

@jbphyswx

Full tensor output.
Also tensor decompositions if that's useful

Activity

  1. jbphyswx commented on Sep 6, 2026

    @jbphyswx
    OwnerAuthor

    Partly done. The tensor exists and a real defect in it is fixed; the backend coverage this issue is really asking about is still open.

    Fixed: the tensor bypassed the geometry abstraction entirely. It was the one calculation file with no pair_frame / pair_delta call — it formed dx = X2 - X1 and U2 - U1 as flat differences while binning with the metric's distance. So on a non-Euclidean metric it got the distance right and the increment wrong: no parallel transport, components left in raw (east, north) coordinates rather than a common pair frame, meaning ⟨δu_a δu_b⟩ on a sphere was not a tensor in any consistent frame. The D = 3 spherical case at least failed loudly on a reshape; D = 2 was the silent one.

    Now routed through pair_frame/pair_delta like every other kernel.

    Gated by an invariance rather than a value. The trace of the second-order tensor is the second-order structure function in any frame, so trace(D_ab) == S2SF is a direct test of the transport — and it is silent on a flat geometry, where a raw coordinate difference and a transported increment coincide. The test therefore asserts it on a sphere as well as a plane, which nothing did before: the tensor had no curved-geometry coverage at all. Verified discriminating by re-injecting the raw difference — the flat assertion still passes while the curved one fails, 393 against 734 for the trace.

    Also asserted: on a sphere the pair frame is the basis, so the tensor's longitudinal component equals L2SF.

    The gridded transform produces the full second-order tensor natively — Σ_x δu_a δu_b expands into four correlations of the padded field, so the whole tensor for every lag costs 1 + D + D(D+1)/2 forward transforms and D(D+1)/2 inverse ones. Third order is verified to expand the same way (into six cross-correlations between the D component fields and the D(D+1)/2 quadratic fields) but is not wired up.

    Still open, and probably the substance of this issue: the tensor path is serial-only. Threaded, distributed and GPU all throw "not implemented yet".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions