PlasmaCalcs.hookups.bifrost.bifrost_stagger.StaggerInterface3D
- class PlasmaCalcs.hookups.bifrost.bifrost_stagger.StaggerInterface3D(*, periodic_x, periodic_y, periodic_z, dx=None, dy=None, dz=None, order=5, mode='numpy_improved')
Bases:
objectclass to do staggering along ‘x’, ‘y’, or ‘z’, axes.Call self(array, opstr) to do the operation(s) implied by opstr (from left to right)E.g. self(array, ‘xup ddzdn’) –> shift array up x, then take z derivative down.- periodic_x, periodix_y, periodic_z: bool
- whether to treat (unsliced) arrays as periodic along x, y, z axes.True –> use pad=’wrap’ to fill values for stagger at edges of array.False –> use pad=’reflect’ to fill values for stagger at edges of array.
- dx, dy, dz: None, number, or 1D array
- spacing along each axis. relevant for deriv but not shift.None –> deriv methods will crash.
- order: 1 or 5.
- order of the scheme to use, by default.
- mode: str
- method for stagger calculations. Right now, only supports ‘numpy_improved’.Eventually might support ‘numpy’, ‘numba’, and ‘numba_improved’.
self.x, self.y, self.z store Staggerer objects for each axis.- __init__(*, periodic_x, periodic_y, periodic_z, dx=None, dy=None, dz=None, order=5, mode='numpy_improved')
Methods
__init__(*, periodic_x, periodic_y, periodic_z)do(array, opstr, *[, prepadder, left_first])Attributes
PAD_AMOUNT- property ddxdn
- alias to self.x.deriv_dn
- property ddxup
- alias to self.x.deriv_up
- property ddydn
- alias to self.y.deriv_dn
- property ddyup
- alias to self.y.deriv_up
- property ddzdn
- alias to self.z.deriv_dn
- property ddzup
- alias to self.z.deriv_up
- do(array, opstr, *, prepadder=None, left_first=True)
- do the operation(s) implied by opstr.
- opstr: str
- string of operations to do, separated by whitespace or ‘_’.each operation must be one of:‘xup’, ‘xdn’, ‘yup’, ‘ydn’, ‘zup’, ‘zdn’,‘ddxup’, ‘ddxdn’, ‘ddyup’, ‘ddydn’, ‘ddzup’, ‘ddzdn’.
- prepadder: None or StaggerPrePadManager3D
- manages prepadding info for array.None –> array has not been prepadded; need to pad internally.else –> array has already been prepadded.
- left_first: bool
- when multiple operations, tells order in which to apply them.True –> apply operations from left to right.E.g. ‘xup ddzdn’ –> first shift x up, then take z derivative down.False –> apply operations from right to left.E.g. ‘xup ddzdn’ –> first take z derivative down, then shift x up.
- property mode
- alias to self.x.mode
- property order
- alias to self.x.order
- property xdn
- alias to self.x.shift_dn
- property xup
- alias to self.x.shift_up
- property ydn
- alias to self.y.shift_dn
- property yup
- alias to self.y.shift_up
- property zdn
- alias to self.z.shift_dn
- property zup
- alias to self.z.shift_up