-
Notifications
You must be signed in to change notification settings - Fork 66
Fix subdivision for named 2D materials #2854
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
Conversation
65dbcf9 to
3d1bc0e
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.
4 files reviewed, no comments
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/components/simulation.py |
dbochkov-flexcompute
left a comment
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.
looks good! I wasn't sure initially whether super().validate_pre_upload() should be in the same begin_capture/end_capture, and whether _validate_finalized would produce duplicated set of warnings, but it seems to be working ok as it is
dmarek-flex
left a comment
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.
Looks good to me!
3d1bc0e to
e010091
Compare
2D materials are subdivided when they have inhomogeneous substrates. The new structures were inheriting the name from the old structure, giving an error due to name reuse. Also, this validator was not run for EME simulations.
This PR:
sim._finalizedfor anyAbstractYeeGridSimulationinvalidate_pre_upload(which must now be called by subclasses)Greptile Overview
Updated On: 2025-09-30 20:38:03 UTC
Summary
This PR fixes a critical bug affecting named 2D materials with inhomogeneous substrates. When Tidy3D encounters 2D materials on inhomogeneous substrates, it automatically subdivides them into volumetric equivalents for simulation accuracy. However, the subdivision process was inheriting the original structure's name for all subdivided pieces, causing validation errors due to duplicate names within the simulation.The fix implements two key changes: First, it modifies the subdivision logic in
simulation.pyto append unique suffixes (_SUBDIVIDED[{i}]) to each subdivided structure's name, preventing naming conflicts. Second, it restructures the validation hierarchy by moving the_validate_finalizedcall to the baseAbstractYeeGridSimulation.validate_pre_uploadmethod and ensuring EME simulations properly call the parent validation throughsuper().validate_pre_upload().These changes ensure that all simulation types (FDTD, EME, etc.) that inherit from
AbstractYeeGridSimulationconsistently handle 2D material subdivision validation, maintaining the integrity of the simulation setup process while preventing solver errors.Important Files Changed
Changed Files
CHANGELOG.mdtidy3d/components/simulation.pytests/test_components/test_simulation.pytidy3d/components/eme/simulation.pysuper().validate_pre_upload()call to inherit critical parent class validationsConfidence score: 4/5
tidy3d/components/simulation.pyfor the subdivision naming logic and validation restructuring