-
Notifications
You must be signed in to change notification settings - Fork 58
feat: add validation for grid spacing in AutoGrid #2453
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
(3e21, True), # dl<1e-6 → fail | ||
(1e14, False), # dl>1e-7 → pass | ||
], | ||
) |
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.
if you just make the simulation size 1e7 smaller wouldn't that avoid the long runtime of the test?
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.
Yes, it reduces the runtime. Thanks!
("freq0", "expect_error"), | ||
[ | ||
(3e21, True), # dl<1e-6 → fail | ||
(1e14, False), # dl>1e-7 → pass |
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.
1e-6 for both
@@ -3596,6 +3619,9 @@ def _post_init_validators(self) -> None: | |||
self._validate_custom_source_time() | |||
self._validate_mode_object_bends() | |||
self._warn_mode_object_pml() | |||
_validate_min_grid_spacing( | |||
self.grid, threshold=1e-7, msg_prefix=f"'{self.__class__.__name__}'" | |||
) |
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.
Let's do 1e-6, even that sounds too large, but to be consistent with the uniform grid validator. Or maybe we should increase the threshold for both? I don't know if I missed anything in the other discussion but wouldn't even 1e-5 be more than reasonable (hard to imagine any simulation that needs to go even below 1e-4). @yaugenst ?
Extend
Simulation._post_init_validators
to compute the minimum cell size (dl) after AutoGrid construction and validate it against threshold [1e-7 µm]. Addresses this issue.Note: The pytest takes a lot of time and memory to run locally, because it builds the full grid before running the dl check.