Use center-to-center intervals for forward E derivatives and base-cell widths for backward H derivatives in the Gridlock examples. Document the distinction from meshes defined directly by forward intervals and fix the random fixture's backward averaging direction. Add coordinate-derivative regression coverage for graded periodic and nonperiodic Gridlock meshes using both functional and sparse operators. Validation: 1689 tests passed, 586 skipped; no new Ruff findings in changed Python files.
938 B
fdmath
For Gridlock's default E-field Yee shifts, construct solver spacings as
dxes = [grid.autoshifted_dxyz(), grid.dxyz]. The forward E curl needs
distances between adjacent base-cell centers; the backward H curl needs
distances between adjacent upper cell edges. Reversing these two width families
introduces an error on graded grids that uniform grids hide.
If constructing the mesh directly from forward derivative intervals d,
with H samples at their midpoints, the backward intervals instead follow
(d + numpy.roll(d, 1)) / 2 for periodic boundaries. These d arrays are
already center-to-center distances, whereas grid.dxyz contains base-cell
volume widths. Applying this averaging rule to grid.dxyz does not fix the
ordering error above.
::: meanas.fdmath
Functional and sparse operators
::: meanas.fdmath.functional
::: meanas.fdmath.operators
::: meanas.fdmath.vectorization
::: meanas.fdmath.types