diff --git a/CHANGELOG.md b/CHANGELOG.md index 09df47b82f..8290ca548e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved performance of adjoint gradient computation for `PolySlab` and `Cylinder` geometries through vectorized sidewall patch collection (~4x speedup). ### Fixed +- Fixed normal for `Box` shape gradient computation to always point outward from boundary which is needed for correct PEC handling. ## [2.10.0rc3] - 2025-11-26 diff --git a/tidy3d/components/geometry/base.py b/tidy3d/components/geometry/base.py index a6eae24230..f83bdce265 100644 --- a/tidy3d/components/geometry/base.py +++ b/tidy3d/components/geometry/base.py @@ -2740,7 +2740,7 @@ def compute_integration_weight(grid_points: NDArray[float]) -> float: perps1 = np.zeros_like(grid_points) perps2 = np.zeros_like(grid_points) - normals[:, axis_normal] = 1 + normals[:, axis_normal] = -1 if (min_max_index == 0) else 1 perps1[:, axis_perp[0]] = 1 perps2[:, axis_perp[1]] = 1