add target_neff parameter to mode solver#711
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds an optional target_neff parameter to the Waveguide mode solver API and threads it through to td.ModeSpec, defaulting to the real part of the core refractive index when unspecified. Sequence diagram for Waveguide target_neff propagation to ModeSpecsequenceDiagram
participant WG as Waveguide
participant Core as CoreMaterial
participant ModeSpec as td_ModeSpec
WG->>Core: get_refractive_index()
Core-->>WG: n_core
WG->>WG: compute_target_neff()
note over WG: if self.target_neff is not None
WG->>ModeSpec: ModeSpec(num_modes, target_neff, bend_radius, bend_axis, num_pml)
Class diagram for updated Waveguide mode solver APIclassDiagram
class Waveguide {
+float surface_thickness
+float surface_k
+float bend_radius
+float target_neff
+int num_modes
+bool group_index_step
+Precision precision
waveguide()
}
class ModeSpec {
+int num_modes
+float target_neff
+float bend_radius
+int bend_axis
+tuple num_pml
}
Waveguide ..> ModeSpec : creates
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
target_neffselection logic (self.target_neffvsn_core.real) is duplicated in bothwaveguideimplementations; consider extracting this into a small helper/property to avoid repetition and keep behavior consistent if it changes later.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `target_neff` selection logic (`self.target_neff` vs `n_core.real`) is duplicated in both `waveguide` implementations; consider extracting this into a small helper/property to avoid repetition and keep behavior consistent if it changes later.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request introduces a target_neff parameter to the Waveguide class in gplugins/tidy3d/modes.py, allowing users to specify a target effective index for the mode solver. This parameter is integrated into the waveguide methods of both Waveguide and WaveguideCoupler. Feedback suggests documenting the new parameter in the WaveguideCoupler docstring for consistency and refactoring the duplicated logic for calculating target_neff into a shared method or property.
|
Changed the default material to lossless SiO2. The current SiO2 material causes perfectly good modes to show losses of 50 dB/cm! |
|
Added functionality to track modes on bend radius sweeps. This makes it so that we are robust to modes changing order as the radius in the mode solver changes. |
Summary by Sourcery
New Features: