Skip to content

Commit ab082e6

Browse files
Fix field colocation in EMEModeSolverMonitor (#2526)
Co-authored-by: Yannick Augenstein <[email protected]>
1 parent a50bd5b commit ab082e6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Fixed shaping of `CustomMedium` gradients when permittivity data includes a frequency dimension with multiple entries.
2323
- Bug in contains check for `LumpedElement`, which should allow the case of a `LumpedElement` touching the simulation boundaries.
2424
- Bug when generating a grid with snapping points near the simulation boundaries.
25+
- Fixed field colocation in `EMEModeSolverMonitor`.
2526
- Solver error for EME simulations with bends, introduced when support for 2D EME simulations was added.
2627

2728
### Changed

tidy3d/components/eme/data/sim_data.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from tidy3d.components.data.monitor_data import FieldData, ModeData, ModeSolverData
1313
from tidy3d.components.data.sim_data import AbstractYeeGridSimulationData
1414
from tidy3d.components.eme.simulation import EMESimulation
15+
from tidy3d.components.geometry.base import Box
1516
from tidy3d.components.types import annotate_type
1617
from tidy3d.exceptions import SetupError
1718

@@ -72,9 +73,12 @@ def _extract_mode_solver_data(
7273
}
7374

7475
monitor = self.simulation.mode_solver_monitors[eme_cell_index]
75-
monitor = monitor.updated_copy(
76-
colocate=data.monitor.colocate,
76+
box = Box.from_bounds(
77+
*Box.bounds_intersection(monitor.geometry.bounds, data.monitor.geometry.bounds)
7778
)
79+
size = box.size
80+
center = box.center
81+
monitor = monitor.updated_copy(colocate=data.monitor.colocate, size=size, center=center)
7882
grid_expanded = self.simulation.discretize_monitor(monitor=monitor)
7983
return ModeSolverData(**update_dict, monitor=monitor, grid_expanded=grid_expanded)
8084

0 commit comments

Comments
 (0)