Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix polyslab edge gradient assignment #2064

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bug when differentiating with respect to `Cylinder.center`.
- `xarray` 2024.10.0 compatibility for autograd.
- Some failing examples in the expressions plugin documentation.

- Inaccuracy in transforming gradients from edge to `PolySlab.vertices`.

## [2.7.6] - 2024-10-30

Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/geometry/polyslab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ def compute_derivative_vertices(self, derivative_info: DerivativeInfo) -> Traced

vjps_edges_in_plane = vjps_edges.values.reshape((num_vertices, 1)) * normal_vectors_in_plane

vjps_vertices = vjps_edges_in_plane + np.roll(vjps_edges_in_plane, axis=0, shift=-1)
vjps_vertices = vjps_edges_in_plane + np.roll(vjps_edges_in_plane, axis=0, shift=1)
vjps_vertices /= 2.0 # each vertex is effected only 1/2 by each edge

# sign change if counter clockwise, because normal direction is flipped
Expand Down
Loading