This notebook demonstrates 2D effective-index FDTD simulations using gsim.meep.

2D simulations collapse the z-dimension, making them 10–100× faster than full 3D. They use an effective-index approximation and enforce TE polarization.

When to use 2D: - Quick design-space exploration and parameter sweeps - Verifying port connectivity and mode coupling before committing to 3D - Components where vertical confinement is well-described by an effective index

Requirements:

Load a pcell from UBC PDK

import gdsfactory as gf

gf.gpdk.PDK.activate()

c = gf.components.coupler(gap=0.5)
c

png

Configure 2D simulation

The only difference from a 3D simulation is sim.solver.is_3d = False. This collapses the z-dimension, ignores sidewall angles, and enforces TE polarization.

from gsim import meep
from gsim.common.stack import get_stack

stack = get_stack()  # auto-detects active PDK

sim = meep.Simulation()

sim.geometry(component=c, stack=stack)
sim.materials = {"si": 3.47, "SiO2": 1.44}
sim.source(port="o1", wavelength=1.55, wavelength_span=0.01)
sim.monitors = ["o1", "o2", "o3"]
sim.domain(pml=1.0, margin=0.5)
sim.solver(resolution=25, is_3d=False)
sim.num_freqs = 21
sim.solver.stop_when_energy_decayed()

print(sim.validate_config())

Preview geometry

sim.plot_2d(slices="z")
simulation.py:713: UserWarning: Material 'Aluminum' has no optical properties (refractive_index) — layer will be omitted from simulation. Use sim.set_material('Aluminum', refractive_index=...) to include it.
  material_data = resolve_materials(
simulation.py:713: UserWarning: Material 'TiN' has no optical properties (refractive_index) — layer will be omitted from simulation. Use sim.set_material('TiN', refractive_index=...) to include it.
  material_data = resolve_materials(
simulation.py:713: UserWarning: Material 'ge' has no optical properties (refractive_index) — layer will be omitted from simulation. Use sim.set_material('ge', refractive_index=...) to include it.
  material_data = resolve_materials(
simulation.py:713: UserWarning: Material 'passive' has no optical properties (refractive_index) — layer will be omitted from simulation. Use sim.set_material('passive', refractive_index=...) to include it.
  material_data = resolve_materials(

png

Run 2D simulation on cloud

result = sim.run()
  meep-481d3a5a  completed  0m 29s


Extracting results.tar.gz...
Downloaded 4 files to sim-data-meep-481d3a5a
result.plot_interactive()
result.plot_interactive(phase=True)