Skip to content

Min size autodetect #2325

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 3 commits into
base: develop
Choose a base branch
from

Conversation

dbochkov-flexcompute
Copy link
Contributor

I am not sure about naming SmallestFeatureSpec and also how deep it is tucked away:

td.Simulation(
    ...
    grid_spec=td.GridSpec.auto(
        layer_refinement_specs=[
            td.LayerRefinementSpec(
                corner_finder=td.CornerFinderSpec(
                    dl_min_spec=td.SmallestFeatureSpec(
                        concave_resolution=1,
                        convex_resolution=2,
                        mixed_resolution=3,
                    )
                )
            )
        ]
    )
)

would appreciate any suggestions

@weiliangjin2021
Copy link
Collaborator

Regarding deeply nested field, maybe concave_resolution etc. can be part of CornerFinderSpec fields directly? We have a field distance_threshold already, that might also have some impact on the minimal feature.

Another questions is what would be good default values for those resolutions?

Copy link
Collaborator

@weiliangjin2021 weiliangjin2021 left a comment

Choose a reason for hiding this comment

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

Went through it again, and now makes more sense to me: your default value in the code is probably good enough.

A high-level question: this PR looks also partially resolve the short-issue. I guess they will work together?

)
convex_resolution: pd.NonNegativeInt = pd.Field(
0,
title="Concave Region Resolution.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

convex

2,
title="Concave Region Resolution.",
description="Specifies number of steps to use for determining `dl_min` based on concave featues."
"If set to 0, then the corresponding `dl_min` reduction is not applied.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if we should use 0 or None when not applied

@@ -136,5 +221,12 @@ def normalize(v):
inner_product = np.where(inner_product > 1, 1, inner_product)
inner_product = np.where(inner_product < -1, -1, inner_product)
angle = np.arccos(inner_product)
num_vs = len(vs_orig)
cross_product = np.cross(
Copy link
Collaborator

Choose a reason for hiding this comment

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

np.cross seems to have issues in photonforge: #2317

@dbochkov-flexcompute
Copy link
Contributor Author

Went through it again, and now makes more sense to me: your default value in the code is probably good enough.

A high-level question: this PR looks also partially resolve the short-issue. I guess they will work together?

yeah, it does partially resolve it, but not as robustly as the other one. For example, if structure has rounded corners everywhere this autodetection feature would not see anything. But given that the other approach is more computationally intensive, might still be good to have a rough estimation like this one

@weiliangjin2021
Copy link
Collaborator

Just tested the microstrip: I removed lumped elements and substrate layer refinement so that they don't set the minimal grid size. Before this PR, I get
image

And with the default parameters in this PR, I get
image

Quite nice meshing!

@dbochkov-flexcompute dbochkov-flexcompute force-pushed the daniil/min_size_autodetect branch from b73cff8 to cd6bdb1 Compare April 17, 2025 08:26
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.

2 participants