inf = wl_LN * 10000
slab = td.Structure(
geometry=td.Box.from_bounds(
rmin=(-design_size[0] / 2, -inf, -t_slab), rmax=(inf, inf, 0)
),
medium=LN_bulk,
name="slab",
)
box = td.Structure(
geometry=td.Box.from_bounds(
rmin=(-design_size[0] / 2, -inf, -t_slab - inf), rmax=(inf, inf, -t_slab)
),
medium=SiO2,
name="box",
)
cladding = td.Structure(
geometry=td.Box.from_bounds(
rmin=(-design_size[0] / 2, -inf, 0), rmax=(inf, inf, h_clad)
),
medium=SiO2,
name="cladding",
)
def make_output_waveguide(x_left):
return td.Structure(
geometry=td.PolySlab(
axis=2,
sidewall_angle=sidewall_angle,
reference_plane="top",
slab_bounds=(0, t_etch),
vertices=(
(x_left, -wg_width / 2),
(sim_size[0] * 1.1 / 2, -wg_width / 2),
(sim_size[0] * 1.1 / 2, wg_width / 2),
(x_left, wg_width / 2),
),
),
medium=LN_bulk,
name="output_waveguide",
)
# wg: reference device; wg_short stops early for the GDS reconstruction.
wg = make_output_waveguide(-design_size[0] / 2 + dilation_radius)
wg_short = make_output_waveguide(design_size[0] / 2 * 0.9)
gauss_source = td.GaussianBeam(
center=(x_src, 0, 0),
size=(0, td.inf, td.inf),
source_time=td.GaussianPulse(freq0=freq0, fwidth=fwidth),
direction="+",
pol_angle=0,
num_freqs=5,
waist_radius=waist_radius,
waist_distance=-buffer[0] / 2,
)
mnt_mode = td.ModeMonitor(
center=(x_mnt, 0, 0),
size=(0, wg_width * 5, t_LN * 7),
freqs=freq_sweep,
mode_spec=td.ModeSpec(target_neff=n_e, num_modes=1),
name="mode",
)
# Only 3 opt frequencies needed during optimization.
mnt_mode_reduced = mnt_mode.updated_copy(freqs=freqs_opt)
mnt_field_h = td.FieldMonitor(
center=(0, 0, 0), size=(inf, inf, 0), name="field_h", freqs=freqs_opt
)
mnt_field_v = td.FieldMonitor(
center=(0, 0, 0), size=(inf, 0, inf), name="field_v", freqs=freqs_opt
)
grid_spec = td.GridSpec.auto(min_steps_per_wvl=20, wavelength=wl_min)
sim_base = td.Simulation(
size=sim_size,
grid_spec=grid_spec,
structures=[slab, cladding, box, wg],
sources=[gauss_source],
monitors=[mnt_mode, mnt_field_h, mnt_field_v],
boundary_spec=td.BoundarySpec.all_sides(boundary=td.PML()),
run_time=td.RunTimeSpec(quality_factor=5.0),
symmetry=(0, -1, 0),
)