[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:
parent
a08e9ce71b
commit
282ed2c38b
10 changed files with 50 additions and 9 deletions
|
|
@ -109,7 +109,7 @@ def build_geometry(
|
|||
z=Extent(min=0, max=1e6),
|
||||
)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
dxes_2d = [[d[0], d[1]] for d in dxes]
|
||||
return grid, epsilon, dxes_2d, omega
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ def build_geometry(
|
|||
z=Extent(min=-1e6, center=0),
|
||||
)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
dxes_2d = [[d[0], d[1]] for d in dxes]
|
||||
return grid, epsilon, dxes_2d, omega
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ def test0(solver=generic_solver):
|
|||
num_points = 24,
|
||||
)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
for a in (0, 1, 2):
|
||||
for p in (-1, 1):
|
||||
dxes = meanas.fdfd.scpml.stretch_with_scpml(dxes, axis=a, polarity=p, omega=omega,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ def test1(solver=generic_solver):
|
|||
epsilon = grid.allocate(n_air**2, dtype=numpy.float32)
|
||||
grid.draw_cuboid(epsilon, x=dict(center=0, span=8e3), y=dict(center=0, span=w), z=dict(center=0, span=th), foreground=n_wg**2)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
for a in (0, 1, 2):
|
||||
for p in (-1, 1):
|
||||
dxes = scpml.stretch_with_scpml(dxes,omega=omega, axis=a, polarity=p,
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ def main() -> None:
|
|||
ee = numpy.zeros_like(epsilon, dtype=complex)
|
||||
hh = numpy.zeros_like(epsilon, dtype=complex)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
|
||||
# PMLs in every direction
|
||||
pml_params = [
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ def test1(solver=generic_solver):
|
|||
epsilon = grid.allocate(n_air**2, dtype=numpy.float32)
|
||||
grid.draw_cuboid(epsilon, center=center, dimensions=[8e3, w, th], foreground=n_wg**2)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
for a in (1, 2):
|
||||
for p in (-1, 1):
|
||||
dxes = scpml.stretch_with_scpml(
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ def main(
|
|||
|
||||
# Add SCPML stretching to the FDFD grid; this matches the CPML-backed FDTD
|
||||
# run below so the two solvers see the same absorbing boundary profile.
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
for a in (0, 1, 2):
|
||||
for p in (-1, 1):
|
||||
dxes = scpml.stretch_with_scpml(dxes, omega=omega, axis=a, polarity=p, thickness=pml_thickness)
|
||||
|
|
@ -269,7 +269,7 @@ def main2():
|
|||
ee = numpy.zeros_like(epsilon, dtype=complex)
|
||||
hh = numpy.zeros_like(epsilon, dtype=complex)
|
||||
|
||||
dxes = [grid.dxyz, grid.autoshifted_dxyz()]
|
||||
dxes = [grid.autoshifted_dxyz(), grid.dxyz]
|
||||
|
||||
# PMLs in every direction
|
||||
pml_params = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue