-
Notifications
You must be signed in to change notification settings - Fork 64
Updates for fully anisotropic mode solver #2728
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 files reviewed, 9 comments
34938d1
to
1f5ce51
Compare
direction, | ||
dls, | ||
Nxy=None, | ||
dmin_pmc=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is mostly because of a bit of reorganizing, but nothing substantial is changing in this file except for passing dls
, Nxy
and dmin_pmc
around.
0b6e9aa
to
ced91bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, a couple of comments:
- Maybe a changelog entry, at least for the change to
make_eps_data
- We can go ahead and merge this, right (with the backend after those changes)? Then when tidy3d-extras is released, we can add
requires_tidy3d_extras
decorators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, no comments
Ok, yeah, we can get this in already (after a changelog item), but I'll run backend tests with this change to make sure nothing breaks when it's standalone, without the backend PR. |
ced91bb
to
dcbe03f
Compare
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
Looser tolerance for plane/simulation center match in mode solver symmetry
dcbe03f
to
056cf28
Compare
Greptile Summary
This PR enhances the Tidy3D mode solver to support fully anisotropic materials by implementing proper grid positioning for off-diagonal permittivity tensor components and improving numerical robustness in symmetry detection.
The changes span three key areas:
Epsilon Calculation Fix (
simulation.py
): Updates the grid coordinate handling for off-diagonal permittivity tensor components (likeeps_xy
,eps_xz
, etc.). These components are now correctly positioned at grid boundaries with proper coordinate truncation, ensuring accurate electromagnetic field calculations on the Yee grid for anisotropic materials.Symmetry Detection Robustness (
mode_solver.py
): Replaces direct floating-point equality comparison with tolerance-based comparison usingisclose()
when checking if the mode plane center aligns with simulation symmetry center. This prevents numerical precision errors from incorrectly breaking symmetry assumptions.Tensorial Solver Enhancement (
solver.py
): Extends the mode solver with new parameters (dls
for grid steps,dmin_pmc
for PMC boundary conditions, andNxy
for grid dimensions) to enable full anisotropic mode solving capabilities. The code also includes organizational improvements by relocating utility methods.These modifications work together to enable accurate mode solving for materials with full anisotropic permittivity and permeability tensors, which is critical for advanced photonic applications involving complex material properties.
Important Files Changed
Files Overview
tidy3d/components/simulation.py
tidy3d/components/mode/mode_solver.py
isclose()
for symmetry detectiontidy3d/components/mode/solver.py
Confidence score: 3/5
col_mats
parameter in the complex case of the tensorial solver, which could cause inconsistent behavior or crashestidy3d/components/mode/solver.py
where thecol_mats
parameter is missing in the complex solver callSequence Diagram
Context used:
Rule - Use a tolerance-based comparison (e.g., np.isclose) for floating-point numbers instead of direct equality (==) to avoid precision issues. (link)