Skip to content
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

QuasiUniformGrid and min_steps_per_sim_size` #2130

Open
wants to merge 5 commits into
base: pre/2.8
Choose a base branch
from

Conversation

weiliangjin2021
Copy link
Collaborator

@weiliangjin2021 weiliangjin2021 commented Dec 18, 2024

Two main features:

  • QuasiUniformGrid: grid is roughly uniform, but locally snapped. This makes it more useful than UniformGrid in many simulations.
  • In AutoGrid, adds a field min_steps_per_sim_size. Now the grid step size is constrained by both min_steps_per_sim_size and min_steps_per_wvl. In many RF simulations, the entire simulation domain is deep subwavelength. Previously, one needs to set a dramatically large value of min_steps_per_wvl so that the simulation domain has more than 1 grid point. min_steps_per_sim_size will be more useful in those simulations.

Added `min_steps_per_sim_size` field to Autogrid for subwavelength simulation domain
@weiliangjin2021
Copy link
Collaborator Author

Uniform grid vs Quasi-uniform grid (from notebook)
image
image

Copy link
Contributor

@dmarek-flex dmarek-flex left a comment

Choose a reason for hiding this comment

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

Great thanks @weiliangjin2021, just a couple of small comments.

I also think we should make it clear that snapping_points take priority over override_structure boundaries when they are closer than dl_min. Maybe add a small comment in the snapping_points field of GridSpec.

tests/test_components/test_grid_spec.py Outdated Show resolved Hide resolved
tidy3d/components/grid/grid_spec.py Outdated Show resolved Hide resolved
tidy3d/components/grid/grid_spec.py Outdated Show resolved Hide resolved
tidy3d/components/grid/grid_spec.py Outdated Show resolved Hide resolved
@QimingFlex
Copy link
Contributor

Thanks @weiliangjin2021 for this great feature! This is useful in CPW simulations when we want to avoid reflections at non-uniform mesh interfaces while still need to snap grid to edges. I have only one slight comment for now.

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.

So in text you describe the QuasiUniformGrid as a type of UniformGrid that still snaps to special points, but in code it seems to be much closer to an AutoGrid (subclassing from the same AbstractAutoGrid now). It makes me wonder about a few things:

  • Is the name QuasiUniformGrid appropriate: did you come up with this or is it used somewhere else?
  • Should this just be an option in AutoGrid as opposed to its own class? Like, ignore the structure media and use this specific dl, but still apply the auto gridding?
  • And anyway if not, maybe at least also explain the connection to AutoGrid, i.e. it uses the same meshing but ignores the media information in favor for a user-defined dl.

Looks great otherwise!

@weiliangjin2021
Copy link
Collaborator Author

  • Is the name QuasiUniformGrid appropriate: did you come up with this or is it used somewhere else?

Myself

  • Should this just be an option in AutoGrid as opposed to its own class? Like, ignore the structure media and use this specific dl, but still apply the auto gridding?

From user's perspective, it feels much closer to UniformGrid. So originally, I was thinking just adding a flag to UniformGrid to indicate whether to locally tune the grid. But yeah, implementation-wise, it's closer to AutoGrid. So I'm not sure what's the best approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants