Running MEEP Simulations¶
MEEP is an open-source FDTD electromagnetic simulator. This notebook demonstrates using the gsim.meep API to run an S-parameter simulation on a 2x2 MMI from the Cornerstone SOI 220 nm PDK.
Requirements:
- Cornerstone PDK:
uv pip install cspdk - GDSFactory+ account for cloud simulation
Make sure you have gsim installed by uncommenting this code
Load a pcell from the Cornerstone PDK¶
import gdsfactory as gf
from cspdk.si220 import PDK, cells
PDK.activate()
c = gf.Component()
mmi = c << cells.mmi2x2()
bend = cells.bend_s()
r1 = c << bend
r1.connect("o1", mmi.ports["o1"])
r2 = c << bend
r2.mirror()
r2.connect("o1", mmi.ports["o2"])
r3 = c << bend
r3.connect("o1", mmi.ports["o3"])
r4 = c << bend
r4.mirror()
r4.connect("o1", mmi.ports["o4"])
c.add_port(name="o1", port=r1["o2"])
c.add_port(name="o2", port=r2["o2"])
c.add_port(name="o3", port=r3["o2"])
c.add_port(name="o4", port=r4["o2"])
c
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)
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())