postgkyl.differentiate¶
- postgkyl.differentiate(data, *, direction=None, inplace=False, tag=None, label=None)¶
Differentiate within DG cells or take a numerical gradient of point values.
Native modal inputs stay modal and use local polynomial derivatives on a uniform Cartesian grid. This does not include jumps between DG cells. Interpolated inputs use a finite-difference gradient across sample points.
With
direction=None, differentiates along every spatial axis and stacks the results in the component axis (num_compsbecomesnum_comps * num_dims, grouped[d0_comp0..d0_compN, d1_comp0.., ...]). With an explicitdirection, differentiates along that one axis only (num_compsunchanged). A separable axis accepts point coordinates matching the value count, or cell edges with one additional entry; only cell edges are centered before differentiating. A curvilinear axis (part of a joint.map(space="conf")block) has no such per-axis length convention of its own; its block’s grid arrays carry it instead.- Parameters:
data – Native modal data or NumPy point values to differentiate.
direction – 0-based axis to differentiate along; None differentiates along every axis.
inplace – mutate and return
datainstead of a new dataset.tag – optional tag for the returned dataset.
label – optional label for the returned dataset.
- Returns:
A dataset of the gradient, on
data’s (unchanged) grid.- Raises:
ValueError – if packed DG data is non-modal, a direction is invalid, or native modal data lacks uniform cell edges.