# spectral range of the unit cell study
lambdas = np.linspace(0.4, 0.8, 81)
freqs = td.C_0 / lambdas
freq_src = (freqs.max() + freqs.min()) / 2
fwidth_uc = (freqs.max() - freqs.min()) / 2
# unit-cell model: free-standing gold film in air (gold film 0 < z < d_uc), period pitch_uc
pitch_uc = 350 * nm
d_uc = 58 * nm
z_min, z_max = -0.8, 0.8
z_src = -0.5
z_mon_t = 0.5
gold_film = td.Structure(
geometry=td.Box.from_bounds(rmin=(-td.inf, -td.inf, 0), rmax=(td.inf, td.inf, d_uc)),
medium=au,
)
def slot_vertices(L, B, rc, n_arc=12):
# rounded rectangle L x B with corner radius rc, long axis along x
xc, yc = L / 2 - rc, B / 2 - rc
pts = []
for cx, cy, t0 in ((xc, yc, 0.0), (-xc, yc, np.pi / 2), (-xc, -yc, np.pi), (xc, -yc, 1.5 * np.pi)):
for t in np.linspace(t0, t0 + np.pi / 2, n_arc):
pts.append((cx + rc * np.cos(t), cy + rc * np.sin(t)))
return np.array(pts)
# the slot: long axis along x, filled with air
slot = td.Structure(
geometry=td.PolySlab(vertices=slot_vertices(L_slot, B_slot, rc_slot).tolist(), slab_bounds=(0, d_uc), axis=2),
medium=air,
)
# transmission through a diffraction monitor; sum of orders = power normalized to the incident wave
monitor_t = td.DiffractionMonitor(
center=(0, 0, z_mon_t), size=(td.inf, td.inf, 0), freqs=freqs, name="T", normal_dir="+"
)
# field monitors in the propagation plane (xz) and in the transverse plane (xy, mid-film)
monitor_xz = td.FieldMonitor(center=(0, 0, 0), size=(td.inf, 0, td.inf), freqs=[freq0], name="xz")
monitor_xy = td.FieldMonitor(
center=(0, 0, d_uc / 2), size=(td.inf, td.inf, 0), freqs=[freq0], name="xy"
)
# uniform cells in and around the gold film
dl_film = 1.25 * nm
dz_film = 0.5 * nm
mesh_film = td.MeshOverrideStructure(
geometry=td.Box.from_bounds(
rmin=(-td.inf, -td.inf, -50 * nm), rmax=(td.inf, td.inf, d_uc + 50 * nm)
),
dl=(dl_film, dl_film, dz_film),
)
def make_sim_unit_cell(pol_angle):
source = td.PlaneWave(
source_time=td.GaussianPulse(freq0=freq_src, fwidth=fwidth_uc),
center=(0, 0, z_src),
size=(td.inf, td.inf, 0),
direction="+",
pol_angle=pol_angle,
)
return td.Simulation(
center=(0, 0, (z_min + z_max) / 2),
size=(pitch_uc, pitch_uc, z_max - z_min),
structures=[gold_film, slot],
sources=[source],
monitors=[monitor_t, monitor_xz, monitor_xy],
grid_spec=td.GridSpec.auto(
wavelength=wavelength, min_steps_per_wvl=20, override_structures=[mesh_film]
),
boundary_spec=td.BoundarySpec(
x=td.Boundary.periodic(), y=td.Boundary.periodic(), z=td.Boundary.pml()
),
run_time=3e-13,
)
# E along x = long axis of the slot (T_L); E along y = short axis (T_S)
sim_L = make_sim_unit_cell(pol_angle=0)
sim_S = make_sim_unit_cell(pol_angle=np.pi / 2)