PlasmaCalcs.hookups.bifrost.bifrost_stagger

File Purpose: Bifrost Stagger (align inputs to grid)
STAGGER ORDERS DEFINED HERE:
1 - “simplest” method available.
good enough, for most uses. ~20% faster than order=5
5 - improved 5th order scheme.
the improvement refers to improved precision for “shift” operations.
The implementations here use numpy.
Future implementations may use numba if numpy is too slow
helita has numba implementation but numba can make installation more challenging;
if adding numba here be sure to make it optional, not a requirement for PlasmaCalcs.
TESTED:
seems to give same results as helita implementation, for 5th order numpy scheme.
seems to take roughly the same amount of time as helita implementation
(maybe 5 to 10% faster for shifts. Within 5% speed for derivatives.)
[TODO]
mod_J is not identical when comparing stagger_minimal_slicing=True & False modes,
even though I would expect it to be identical in both cases.
However, the result seems to be very close
(e.g. J_z within 0.1% except for points with very small J)
In the interest of time, I am saying “that’s good enough” for now. (-SE, 2025/01/28)
Also, currently cannot slice using nontrivial step in multiple slices at once :(

Functions

simple_slice(start_shift, end_shift)

transpose_to_0(array, x)

transpose_to_0_tuple(ndim, x)

Classes

BifrostStaggerable()

StaggerConstants(a, b, c)

StaggerInterface3D(*, periodic_x, ...[, dx, ...])

StaggerPrePadManager3D(ops[, slices])

Staggerer(x, *, periodic[, dx, order, mode, ...])