[fdmath] correct Gridlock Yee spacing order

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.
This commit is contained in:
Forgejo Actions 2026-10-28 17:32:21 -07:00
commit 282ed2c38b
10 changed files with 50 additions and 9 deletions

View file

@ -1,5 +1,18 @@
# 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