Skip to content

Automatically use periodic boundary on zero-size dimensions #2553

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

caseyflex
Copy link
Contributor

@caseyflex caseyflex commented Jun 6, 2025

This is mainly to address the annoying issue with ModeSimulation, where if it is 2D, the boundary must be manually set to periodic in the normal direction. It replaces some of this PR for 1D mode solving (#2478), so that we can get it in before all the issues are resolved there.

@caseyflex
Copy link
Contributor Author

@momchil-flex @yaugenst-flex

The boundary is silently replaced (per @e-g-melo 's suggestion) for EMESimulation and ModeSimulation. For FDTD Simulation, it gives a warning. Previously, it would error for all simulation types if the boundary was not periodic or bloch.

@caseyflex
Copy link
Contributor Author

@momchil-flex let's try to get this in 2.9.0rc1?

@caseyflex caseyflex added the 2.9 will go into version 2.9.* label Jun 6, 2025
Copy link
Contributor

github-actions bot commented Jun 6, 2025

Diff Coverage

Diff: origin/develop...HEAD, staged and unstaged changes

  • tidy3d/components/eme/simulation.py (100%)
  • tidy3d/components/mode/simulation.py (100%)
  • tidy3d/components/simulation.py (100%)

Summary

  • Total: 8 lines
  • Missing: 0 lines
  • Coverage: 100%

Copy link
Collaborator

@momchil-flex momchil-flex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I tested locally and it works, merging now so I can test rc1.

if size_dim == 0:
boundaries[dim] = Boundary.periodic()

return BoundarySpec(x=boundaries[0], y=boundaries[1], z=boundaries[2])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah so this validator actually existed but it wasn't taking effect because _boundaries_for_zero_dims = validate_boundaries_for_zero_dims() was also included (and probably executed first?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think that's right

@momchil-flex momchil-flex merged commit d13703c into develop Jun 10, 2025
29 checks passed
@momchil-flex momchil-flex deleted the casey/zerosizemode branch June 10, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.9 will go into version 2.9.*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants