Skip to content

Commit f60bc0d

Browse files
committed
Address PR feedback and add warning when wave port path/boundary are not perpendicular
1 parent 6487f3e commit f60bc0d

File tree

5 files changed

+31
-11
lines changed

5 files changed

+31
-11
lines changed

examples/SingleTransmon/SingleTransmon.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function single_transmon(;
9292
bridge=BRIDGE_STYLE
9393
)
9494
## Readout path
95-
readout_length = 2700μm
95+
readout_length = wave_ports ? 4mm : 2700μm
9696
p_readout = Path(
9797
Point(0μm, 0μm);
9898
α0=π / 2,
@@ -134,7 +134,7 @@ function single_transmon(;
134134

135135
#### Prepare solid model
136136
# Specify the extent of the simulation domain.
137-
substrate_x = wave_ports ? readout_length : 4mm # wave port domain boundary needs to touch the readout line
137+
substrate_x = 4mm # wave port domain boundary needs to touch the readout line
138138
substrate_y = 3.7mm
139139

140140
center_xyz = DeviceLayout.center(floorplan)
@@ -149,7 +149,7 @@ function single_transmon(;
149149
render!(floorplan.coordinate_system, chip, LayerVocabulary.CHIP_AREA)
150150

151151
# Add wave ports
152-
wave_ports && add_wave_ports!(floorplan, [floorplan.graph.node_dict[:p_ro]], sim_area, 0.6mm, LayerVocabulary.WAVE_PORT)
152+
wave_ports && add_wave_ports!(floorplan, [p_readout_node], sim_area, 0.6mm, LayerVocabulary.WAVE_PORT)
153153

154154
check!(floorplan)
155155

@@ -287,7 +287,7 @@ function configfile(sm::SolidModel; palace_build=nothing, solver_order=2, amr=0,
287287
),
288288
"Solver" => Dict(
289289
"Order" => solver_order,
290-
"Eigenmode" => Dict("N" => 2, "Tol" => 1.0e-6, "Target" => 3, "Save" => 2),
290+
"Eigenmode" => Dict("N" => 2, "Tol" => 1.0e-6, "Target" => 2.5, "Save" => 2),
291291
"Linear" => Dict("Type" => "Default", "Tol" => 1.0e-7, "MaxIts" => 500)
292292
)
293293
)

src/polygons.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,10 @@ abstract type D1{T} <: GeometryEntity{T} end
15231523

15241524
ab(p0, p1) = Point(gety(p1) - gety(p0), getx(p0) - getx(p1))
15251525

1526+
to_polygons(::D1{T}) where {T} = Polygon{T}[]
1527+
1528+
transform(d1::T, f::Transformation) where {T <: D1} = T(f(d1.p0), f(d1.p1))
1529+
15261530
"""
15271531
LineSegment{T} <: D1{T}
15281532

src/schematics/ExamplePDK/utils.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ function add_wave_ports!(
148148
wave_port_width::T,
149149
wave_port_layer::SemanticMeta
150150
) where {T}
151+
angle_tol = 1e-1
151152
for node in nodes
152153
# Check component type
153154
node_component = component(node)
@@ -173,6 +174,19 @@ function add_wave_ports!(
173174
!(Paths.curvature(path.nodes[node_idx].seg, t) Point(0 / nm, 0 / nm))
174175
@warn "Placing a wave port in curved segment of node $(node.id) can lead to erroneous results."
175176
end
177+
# Warn if the path intersection is not perpendicular to the domain boundary
178+
path_direction = Paths.direction(trans(path).nodes[node_idx].seg, t) % 360°
179+
if (
180+
dir == :x &&
181+
!isapprox_angle(90°, path_direction; atol=angle_tol) &&
182+
!isapprox_angle(270°, path_direction; atol=angle_tol)
183+
) || (
184+
dir == :y &&
185+
!isapprox_angle(0°, path_direction; atol=angle_tol) &&
186+
!isapprox_angle(180°, path_direction; atol=angle_tol)
187+
)
188+
@warn "Placing a wave port in segment of node $(node.id) which is not perpendicular to the domain boundary can lead to erroneous results."
189+
end
176190
if dir == :x
177191
line = LineSegment(
178192
Point(loc.x - wave_port_width / 2, loc.y),

src/schematics/solidmodels.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ function intersection_ops(t::SolidModelTarget, sch::Schematic)
9999
wave_ports = []
100100
for m in element_metadata(sch.coordinate_system)
101101
if iswaveportlayer(t, layer(m))
102-
levelstr = layer(m) in levelwise_layers(t) ? "_L$(level(m))" : ""
103-
push!(wave_ports, string(layer(m)) * levelstr * "_$(layerindex(m))")
102+
layer_name = _map_meta_fn(t)(m)
103+
!isnothing(layer_name) && push!(wave_ports, layer_name)
104104
end
105105
end
106106
isempty(bv) && return []
@@ -160,10 +160,10 @@ function layer_extrusions_dz(target, sch)
160160
dim = iswaveportlayer(target, ly) ? 1 : 2
161161
sgn = issublayer(target, ly) ? -1 : 1
162162
if isempty(size(t))
163-
if iswaveportlayer(target, ly)
163+
if ly in indexed_layers(target)
164164
for m in element_metadata(sch.coordinate_system)
165165
if layer(m) == ly
166-
t_dict[string(ly) * "_$(layerindex(m))"] = (sgn * t, dim)
166+
t_dict[_map_meta_fn(target)(m)] = (sgn * t, dim)
167167
end
168168
end
169169
else
@@ -172,11 +172,10 @@ function layer_extrusions_dz(target, sch)
172172
else
173173
for (lev, t_level) in pairs(t)
174174
sgn = isodd(lev) ? sgn : -sgn
175-
if iswaveportlayer(target, ly)
175+
if ly in indexed_layers(target)
176176
for m in element_metadata(sch.coordinate_system)
177177
if layer(m) == ly && level(m) == lev
178-
t_dict[string(ly) * "_L$lev" * "_$(layerindex(m))"] =
179-
(sgn * t_level, dim)
178+
t_dict[_map_meta_fn(target)(m)] = (sgn * t_level, dim)
180179
end
181180
end
182181
else

test/test_schematicdriven.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,9 @@
12031203
@test_logs (
12041204
:warn,
12051205
"Placing a wave port in curved segment of node path5 can lead to erroneous results."
1206+
) (
1207+
:warn,
1208+
"Placing a wave port in segment of node path5 which is not perpendicular to the domain boundary can lead to erroneous results."
12061209
) add_wave_ports!(
12071210
floorplan,
12081211
[floorplan.graph.nodes[5]],

0 commit comments

Comments
 (0)