Waveguide-to-fiber grating coupler¶
Launch a guided mode and calculate coupling into a 10° Gaussian fiber mode from saved complex fields.
from math import radians, sin
import gdsfactory as gf
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import SymLogNorm
from gsim import fdtd
Build the apodized grating¶
pdk = gf.gpdk.PDK
layer_stack = pdk.layer_stack.model_copy(deep=True)
layer_stack.layers["substrate"].background = True
pdk = pdk.model_copy(update={"name": "generic_soi_grating", "layer_stack": layer_stack})
pdk.activate()
# Apodize the fill fraction and chirp the period across 24 teeth.
position = np.linspace(0.0, 1.0, 24)
fill_fraction = 0.55 + (0.91 - 0.55) * (1 - position) ** 1.8
index_model = 2.732 + 0.35 * (fill_fraction - 0.343 / 0.667)
in_plane_index = 1.443 * sin(radians(10.0))
periods_um = 0.6255 * (2.732 - in_plane_index) / (index_model - in_plane_index)
periods_um *= 1 - 0.01 * (position - 0.5)
widths_um = np.round(periods_um * fill_fraction, 3)
gaps_um = np.round(periods_um - widths_um, 3)
component = gf.Component()
grating = component.add_ref(
gf.components.grating_coupler_elliptical_arbitrary(
gaps=tuple(gaps_um),
widths=tuple(widths_um),
fiber_angle=10.0,
taper_length=14.0,
taper_angle=40.0,
wavelength=1.554,
layer_slab="SLAB150",
taper_to_slab_offset=-3.0,
)
)
straight = component.add_ref(gf.components.straight(length=3.0))
straight.connect("o2", grating.ports["o1"])
component.add_port("o1", port=straight.ports["o1"])
silicon_layer = pdk.layer_stack.layers["core"]
silicon_middle_um = silicon_layer.zmin + silicon_layer.thickness / 2
silicon_top_um = silicon_layer.zmin + silicon_layer.thickness
Record the fields¶
Capture tangential E/H above the grating for fiber overlap, guided input power, and Ey along the vertical grating centerline.
fiber_center_x_um, fiber_y_um = 20.5, 0.0
fiber_size_um = (26.0, 26.0, 0.0)
half_aperture_um = 26.0 / 2
simulation = fdtd.Simulation(pdk=pdk)
simulation.materials(background="sio2", overrides={"si": 3.47, "sio2": 1.443})
simulation.geometry(component, mesh_size_nm=500, geometry_tolerance_nm=20.0)
simulation.source(
port="o1", wavelength_um=1.554, wavelength_span_um=0.1, num_wavelengths=101
)
simulation.monitors.add_plane(
name="radiation",
center_um=(fiber_center_x_um, fiber_y_um, 1.05),
size_um=fiber_size_um,
normal="+z",
flux=True,
fields=fdtd.Fields(components=["ex", "ey", "hx", "hy"]),
)
simulation.monitors.add_plane(
name="input_power",
center_um=(
component.xmin + 1.5,
float(component.ports["o1"].center[1]),
silicon_middle_um,
),
size_um=(
0.0,
float(component.ports["o1"].width) + 2 * 0.5,
silicon_layer.thickness + 2 * 0.5,
),
normal="+x",
flux=True,
)
grating_x_bounds = (component.xmin, component.xmax + 0.5)
side_z_bounds = (-4.0, 1.55)
simulation.monitors.add_plane(
name="grating_side",
center_um=(
sum(grating_x_bounds) / 2,
fiber_y_um,
sum(side_z_bounds) / 2,
),
size_um=(
grating_x_bounds[1] - grating_x_bounds[0],
0.0,
side_z_bounds[1] - side_z_bounds[0],
),
normal="+y",
flux=False,
fields=fdtd.Fields(components=["ey"], wavelengths_um=[1.55]),
)
simulation.domain(
padding=0.5,
x_bounds=(
component.xmin,
max(component.xmax, fiber_center_x_um + half_aperture_um) + 0.5,
),
y_bounds=(
min(component.ymin, fiber_y_um - half_aperture_um) - 0.5,
max(component.ymax, fiber_y_um + half_aperture_um) + 0.5,
),
z_bounds=side_z_bounds,
pml_cells=16,
clip_geometry=True,
)
simulation.solver(cell_size_nm=50, energy_decay_fraction=0.0004);
api.py:88: GeometryClippingWarning: Explicit domain bounds trim or omit material geometry on layers: core (x). Enlarge the bounds to retain this material.
return self._resolver() if self._resolver is not None else self
3409209938.py:48: DeprecationWarning: clip_geometry is deprecated. Its default remains False in 0.10.0: explicit bounds must contain the geometry unless clip_geometry=True. Automatic clipping and removal target 0.12.0 or later, and only after two feature releases and at least 12 months since the first released warning in 0.10.0. Keep the switch wherever clipping is required until then.
simulation.domain(
workflow.py:471: GeometryClippingWarning: Explicit domain bounds trim or omit material geometry on layers: substrate (z), core (x). Enlarge the bounds to retain this material.
resolved = self._resolve_geometry()