Skip to content

Directional Coupler with GDSFactory FDTD

Simulate power transfer between two coupled silicon waveguides and compare the through and cross ports.

Requirements: GDSFactory+ cloud simulation access.

You will: build the component, configure the solver, preview the 3D setup, run one cached cloud simulation, and inspect its wavelength response.

1. Build the component

Python
import gdsfactory as gf

from gsim import fdtd

gf.gpdk.PDK.activate()
component = gf.components.coupler(gap=0.236, length=20.0)
component

svg

2. Configure the simulation

Python
simulation = fdtd.Simulation()
simulation.materials(background="SiO2", overrides={"si": 3.4757})
simulation.geometry(component)
simulation.source(
    port="o1",
    wavelength_um=1.55,
    wavelength_span_um=0.1,
    num_wavelengths=101,
)
simulation.domain(padding=1)
simulation.solver(cell_size_nm=50, energy_decay_fraction=1e-5)
Solver(cell_size_nm=50.0, max_timesteps=None, energy_decay_fraction=1e-05, max_wall_seconds=3600.0)

Preview the resolved layer stack, ports, and simulation domain before submitting the job.

Python
simulation.plot_3d()
3488129338.py:1: UserWarning: Material dispersion is not sent to GDSFactory FDTD; these materials use their index at the source wavelength across the 1500 to 1600 nm band: SiO2 (0.1 % permittivity change). materials(dispersion=True) sends dispersive models instead.
  simulation.plot_3d()

Inspect the 2D cross-section

View the XY plane at the middle of the 220 nm silicon core. Colors show the real refractive index at the source wavelength; hatched regions mark the PML.

Python
simulation.plot_2d_static(axis="z", position_um=0.11, legend=False);

svg

3. Run and inspect the result

Python
result = simulation.run(check_cache=True)
  fdtd-759a043b  [####################]  Job completed  elapsed 0m 00s


Extracting results.tar.gz...
Downloaded 2 files to sim-data-fdtd-759a043b
Python
result.s_parameters.plot_plotly()

The o3 and o4 traces show wavelength-dependent through and cross coupling. Their powers should remain close to energy conserving for this lossless model.