Skip to content

Enable bulk PMC material #2502

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Enable bulk PMC material #2502

wants to merge 1 commit into from

Conversation

weiliangjin2021
Copy link
Collaborator

@weiliangjin2021 weiliangjin2021 commented May 22, 2025

PMC material is plotted in purple, but please suggest if you have better color in mind.
image

Limitations to be addressed in a future PR:

  • meshing features to place PMC structure boundary on dual grids
  • 2D PMC material (we don't support it now as we lack the meshing feature to place 2D PMC on dual grids)

Greptile Summary

Added support for Perfect Magnetic Conductor (PMC) material in Tidy3D, introducing PMCMedium class with visualization in purple and basic functionality similar to PEC materials.

  • Added PMCMedium class in tidy3d/components/medium.py with properties for is_pmc, eps_model, and n_cfl
  • Added PMC handling in tidy3d/components/subpixel_spec.py supporting Staircasing and HeuristicPECStaircasing methods
  • Added PMC support in mode solver and simulation components for proper boundary handling
  • Updated documentation in docs/api/mediums.rst to include PMCMedium under 'Non-Dispersive Medium'
  • Note: Future PRs will address meshing features for dual grids and 2D PMC material support

@weiliangjin2021 weiliangjin2021 added rc2 2nd pre-release awaiting backend not to be merged as backend is not finalized 2.9 will go into version 2.9.* labels May 22, 2025
@weiliangjin2021
Copy link
Collaborator Author

@greptileai

@weiliangjin2021
Copy link
Collaborator Author

hmm, nothing happens. @yaugenst how do i get AI review on this PR?

Copy link
Contributor

github-actions bot commented Jul 1, 2025

Diff Coverage

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

  • tidy3d/components/medium.py (100%)
  • tidy3d/components/mode/mode_solver.py (0.0%): Missing lines 1814-1815
  • tidy3d/components/scene.py (83.3%): Missing lines 1297
  • tidy3d/components/simulation.py (100%)
  • tidy3d/components/subpixel_spec.py (100%)

Summary

  • Total: 42 lines
  • Missing: 3 lines
  • Coverage: 92%

tidy3d/components/mode/mode_solver.py

Lines 1810-1819

  1810         apply_sibc = isinstance(sim._subpixel.lossy_metal, SurfaceImpedance)
  1811         for medium in sim.scene.mediums:
  1812             if medium.is_pec:
  1813                 return True
! 1814             if medium.is_pmc:
! 1815                 return True
  1816             if apply_sibc and isinstance(medium, LossyMetalMedium):
  1817                 return True
  1818         return False

tidy3d/components/scene.py

Lines 1293-1301

  1293                 update={"facecolor": "gold", "edgecolor": "k", "linewidth": 1}
  1294             )
  1295         elif medium.is_pmc:
  1296             # perfect magnetic conductor
! 1297             plot_params = plot_params.copy(
  1298                 update={"facecolor": "purple", "edgecolor": "k", "linewidth": 1}
  1299             )
  1300         elif isinstance(medium, Medium2D):
  1301             # 2d material

@weiliangjin2021 weiliangjin2021 removed the awaiting backend not to be merged as backend is not finalized label Jul 4, 2025
@yaugenst-flex
Copy link
Collaborator

hey sorry @weiliangjin2021 i enabled it again

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

13 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile

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.* rc2 2nd pre-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants