Skip to content

Commit d270685

Browse files
Gregory RobertsGregory Roberts
authored andcommitted
hotfix(adjoint): correct normal for box minimum face when computing shape gradient
1 parent 76644d8 commit d270685

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
### Fixed
2020
- Fix to `outer_dot` when frequencies stored in the data were not in increasing order. Previously, the result would be provided with re-sorted frequencies, which would not match the order of the original data.
2121
- Fixed bug where an extra spatial coordinate could appear in `complex_flux` and `ImpedanceCalculator` results.
22+
- Fixed normal for `Box` shape gradient computation to always point outward from boundary which is needed for correct PEC handling.
2223

2324
## [2.10.0rc3] - 2025-11-26
2425

tidy3d/components/geometry/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,7 @@ def compute_integration_weight(grid_points: NDArray[float]) -> float:
27402740
perps1 = np.zeros_like(grid_points)
27412741
perps2 = np.zeros_like(grid_points)
27422742

2743-
normals[:, axis_normal] = 1
2743+
normals[:, axis_normal] = -1 if (min_max_index == 0) else 1
27442744
perps1[:, axis_perp[0]] = 1
27452745
perps2[:, axis_perp[1]] = 1
27462746

0 commit comments

Comments
 (0)