-
Notifications
You must be signed in to change notification settings - Fork 65
FXC-2087 Implement automatic structure extrusion for boundary waveports #2793
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 2 comments
f844379 to
8fcbe0b
Compare
afc9622 to
6ecc0eb
Compare
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/components/simulation.pyLines 2161-2169 2161 else:
2162 if direction == "-":
2163 del surfaces[2 * axis + 1]
2164 else:
! 2165 del surfaces[2 * axis]
2166
2167 structure = Structure(
2168 geometry=GeometryGroup(
2169 geometries=surfaces, |
a469ec2 to
f1007a7
Compare
67a0ba1 to
102b073
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, a couple of comments + let's add an example where a waveguide assembly contains a geometry which is a union of two disjoint objects (something like GeometryGroup(geometries=[box_left, box_right]), like a differential strip
7e11342 to
0d3abc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looking like a good feature, just a couple of minor style comments.
c01d9fa to
156ae24
Compare
156ae24 to
0e5cb72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
0e5cb72 to
ba95248
Compare
a80a406 to
9f9b5ba
Compare
5b4f4b6 to
7e4bcb7
Compare
484720b to
696fcc1
Compare
696fcc1 to
086d5ec
Compare
086d5ec to
30fbe97
Compare
30fbe97 to
31bc218
Compare

This PR adds automatic extrusion of structures intersecting waveports that are placed on boundaries.
Key changes:
This improves simulation accuracy when waveports are located on structure boundaries and simplifies user workflow.
Greptile Summary
Updated On: 2025-09-04 15:39:10 UTC
This PR implements automatic structure extrusion for waveports positioned on simulation boundaries. The main functionality adds a new
extrude_structuresboolean field to theWavePortclass that, when set toTrue, triggers automatic extension of intersecting structures to ensure mode sources, internal absorbers, and PEC frames are fully contained within the material geometry.The core implementation resides in the
TerminalComponentModelerclass with the addition of a new_extrude_port_structuresmethod that performs the geometric operations. This method identifies structures intersecting the waveport plane and creates extendedPolySlabgeometries that stretch from the port location to cover all necessary simulation components. The extrusion logic handles complex geometries with holes usingClipOperationand integrates seamlessly into the existing simulation pipeline.This feature addresses a common simulation accuracy issue where waveports placed directly on structure boundaries might not provide adequate material coverage for electromagnetic field calculations. By automating the extrusion process, the PR simplifies user workflow while ensuring proper containment of all port-related simulation elements.
Important Files Changed
Changed Files
Confidence score: 3/5
_extrude_port_structuresmethodSequence Diagram
sequenceDiagram participant User participant TerminalComponentModeler as TCM participant WavePort participant Simulation as Sim participant Structure participant GeometryGroup as GeoGroup participant PolySlab participant ClipOperation as ClipOp User->>WavePort: "Create WavePort with extrude_structures=True" User->>TCM: "Create TerminalComponentModeler with WavePort" User->>TCM: "Access sim_dict property" TCM->>TCM: "_add_source_to_sim(network_index)" TCM->>WavePort: "to_source(source_time, snap_center)" WavePort-->>TCM: "ModeSource" TCM->>Sim: "updated_copy(sources=[port_source])" Sim-->>TCM: "simulation with source" TCM->>TCM: "_extrude_port_structures(sim_with_src)" loop "For each WavePort with extrude_structures=True" TCM->>WavePort: "Check extrude_structures flag" WavePort-->>TCM: "True" TCM->>TCM: "Calculate mode source position and offset" TCM->>TCM: "Define extrusion bounding box" TCM->>TCM: "Get slice planes (left and right)" loop "For each structure in simulation" TCM->>Structure: "Get geometry intersections with slice planes" Structure-->>TCM: "Shapely polygons" loop "For each intersecting polygon" TCM->>PolySlab: "Create outer shell from exterior vertices" PolySlab-->>TCM: "Outer PolySlab" alt "Polygon has holes" loop "For each hole" TCM->>PolySlab: "Create hole PolySlab from interior vertices" PolySlab-->>TCM: "Hole PolySlab" end TCM->>GeoGroup: "Create GeometryGroup(hole_polyslabs)" GeoGroup-->>TCM: "Holes geometry group" TCM->>ClipOp: "ClipOperation(difference, outer_shell, holes)" ClipOp-->>TCM: "Extruded geometry with holes" else "No holes" TCM->>TCM: "Use outer shell as extruded geometry" end TCM->>TCM: "Add extruded geometry to new_geoms list" end TCM->>TCM: "Add original structure geometry to new_geoms" TCM->>GeoGroup: "Create GeometryGroup(new_geoms)" GeoGroup-->>TCM: "Combined geometry group" TCM->>Structure: "Create new Structure with combined geometry" Structure-->>TCM: "Extended structure" TCM->>TCM: "Add to new_structures list" end end TCM->>Sim: "updated_copy(structures=new_structures)" Sim-->>TCM: "Simulation with extruded structures" TCM-->>User: "SimulationMap with extruded structures"