Skip to content

Commit 09f8e08

Browse files
committed
revert size=0 grad monitors for polyslab + custom_mediums
1 parent 30bd56b commit 09f8e08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tidy3d/components/structure.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,17 @@ def make_adjoint_monitors(
249249
) -> (FieldMonitor, PermittivityMonitor):
250250
"""Generate the field and permittivity monitor for this structure."""
251251

252-
box = self.geometry.bounding_box
252+
geometry = self.geometry
253+
box = geometry.bounding_box
253254

254255
# we dont want these fields getting traced by autograd, otherwise it messes stuff up
255256

256257
size = [get_static(x) for x in box.size] # TODO: expand slightly?
257258
center = [get_static(x) for x in box.center]
258259

259260
# polyslab only needs fields at the midpoint along axis
260-
if isinstance(self.geometry, PolySlab):
261-
size[self.geometry.axis] = 0
261+
if isinstance(geometry, PolySlab) and not isinstance(self.medium, AbstractCustomMedium):
262+
size[geometry.axis] = 0
262263

263264
mnt_fld = FieldMonitor(
264265
size=size,

0 commit comments

Comments
 (0)