MEEP is an open-source FDTD electromagnetic simulator. This notebook demonstrates using the gsim.meep API to run an S-parameter simulation on a photonic Y-branch.

Requirements:

  • UBC PDK: uv pip install ubcpdk
  • GDSFactory+ account for cloud simulation

Load a pcell from UBC PDK

from ubcpdk import PDK, cells

PDK.activate()

c = cells.ebeam_crossing4()

c

png

Configure and run simulation

from gsim import meep

sim = meep.Simulation()

sim.geometry(component=c, z_crop="auto")
sim.materials = {"si": 3.47, "SiO2": 1.44}
sim.source(port="o1", wavelength=1.55, wavelength_span=0.04, num_freqs=51)
sim.monitors = ["o1", "o2", "o3", "o4"]
sim.domain(pml=1.0, margin=0.5)
sim.solver(resolution=20, save_animation=True, verbose_interval=5.0)
sim.solver.stop_when_energy_decayed()

print(sim.validate_config())
Stack validation: PASSED
Warnings:
  - No stack configured. Will use active PDK with defaults.
  - Stopping: energy_decay (dt=20.0, decay_by=0.01, cap=2000.0)
sim.plot_2d(slices="xyz")

png

Run simulation on cloud

# Run on GDSFactory+ cloud
result = sim.run()
  meep-f816ba68  completed  2m 00s


Extracting results.tar.gz...
Downloaded 207 files to sim-data-meep-f816ba68
result.plot_interactive()
result.plot_interactive(phase=True)
result.show_animation()