Skip to content

Commit f179f91

Browse files
committed
grep
1 parent ea6974d commit f179f91

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8888
- Removed mode solver warnings about evaluating permittivity of a `Medium2D`.
8989
- Maximum number of grid points in an EME simulation is now based solely on transverse grid points. Maximum number of EME cells is unchanged.
9090
- Fixed handling of polygons with holes (interiors) in `subdivide()` function. The function now properly converts polygons with interiors into `PolySlab` geometries using subtraction operations with `GeometryGroup`.
91+
- Fixed mode solver grid extending beyond simulation domain boundaries, causing incorrect PEC boundary application. The solver now properly truncates the computational grid to simulation bounds and zero-pads fields outside the domain.
9192

9293
### Removed
9394
- Removed deprecated `use_complex_fields` parameter from `TwoPhotonAbsorption` and `KerrNonlinearity`. Parameters `beta` and `n2` are now real-valued only, as is `n0` if specified.

tidy3d/components/mode/solver.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,11 @@ def compute_modes(
161161
cell_max = [trim_max[0] - 1, trim_max[1] - 1]
162162

163163
# Truncate eps_cross
164-
eps_cross = cls._truncate_medium_data(
165-
eps_cross, cell_min, cell_max, original_Nx, original_Ny
166-
)
164+
eps_cross = cls._truncate_medium_data(eps_cross, cell_min, cell_max)
167165

168166
# Truncate mu_cross if provided
169167
if mu_cross is not None:
170-
mu_cross = cls._truncate_medium_data(
171-
mu_cross, cell_min, cell_max, original_Nx, original_Ny
172-
)
168+
mu_cross = cls._truncate_medium_data(mu_cross, cell_min, cell_max)
173169

174170
# Truncate split_curl_scaling if provided
175171
if split_curl_scaling is not None:
@@ -1117,7 +1113,7 @@ def eigs_to_effective_index(cls, eig_list: Numpy, mode_solver_type: ModeSolverTy
11171113
raise RuntimeError(f"Unidentified 'mode_solver_type={mode_solver_type}'.")
11181114

11191115
@staticmethod
1120-
def _truncate_medium_data(mat_data, cell_min, cell_max, original_Nx, original_Ny):
1116+
def _truncate_medium_data(mat_data, cell_min, cell_max):
11211117
"""Truncate medium data (eps or mu) to the specified cell range.
11221118
11231119
Parameters
@@ -1128,10 +1124,6 @@ def _truncate_medium_data(mat_data, cell_min, cell_max, original_Nx, original_Ny
11281124
[x_min, y_min] cell indices for truncation start.
11291125
cell_max : list[int]
11301126
[x_max, y_max] cell indices for truncation end.
1131-
original_Nx : int
1132-
Original number of cells in x.
1133-
original_Ny : int
1134-
Original number of cells in y.
11351127
11361128
Returns
11371129
-------

0 commit comments

Comments
 (0)