FDTD Meep gratings#

Meep can also compute grating coupler Sparameters and far field.

grating sparameters#

                fiber_xposition
                     |
                fiber_core_diameter
             /     /  /     /       |
            /     /  /     /        | fiber_thickness
           /     /  /     /    _ _ _| _ _ _ _ _ _  _
                                    |
                                    | air_gap_thickness
                               _ _ _| _ _ _ _ _ _  _
                                    |
                   clad_material            | top_clad_thickness
                               _ _ _| _ _ _ _ _ _  _
                _|-|_|-|_|-|___     |              _| etch_depth
               core_material        |     |core_thickness
                ______________|_ _ _|_ _ _ _ _ _ _ _
                                    |
                 nbox               |box_thickness
                ______________ _ _ _|_ _ _ _ _ _ _ _
                                    |
                 nsubstrate         |substrate_thickness
                ______________ _ _ _|
import gdsfactory as gf
from gdsfactory.generic_tech import get_generic_pdk

import gplugins as sim
import gplugins.gmeep as gm

gf.config.rich_output()
PDK = get_generic_pdk()
PDK.activate()
Using MPI version 4.1, 1 processes
2024-05-10 10:18:00.438 | INFO     | gplugins.gmeep:<module>:39 - Meep '1.28.0' installed at ['/home/runner/micromamba/lib/python3.11/site-packages/meep']
sp = gm.write_sparameters_grating(plot=True)
Warning: grid volume is not an integer number of pixels; cell size will be rounded to nearest pixel.

../_images/1b279b4ce72c0a7cbf3e61e9b73343e17d2df0b048d12aee577c086c88f8877b.png
sp = gm.write_sparameters_grating(plot=True, plot_contour=True)
Warning: grid volume is not an integer number of pixels; cell size will be rounded to nearest pixel.

../_images/6b4851ba6fb113ce7a8a2643842a29ab793478ea666a22bbee8f0552b5535648.png
sp = gm.write_sparameters_grating(plot=True, plot_contour=True, fiber_angle_deg=45)
Warning: grid volume is not an integer number of pixels; cell size will be rounded to nearest pixel.

../_images/eae56d1193560173101a6e574884f72e0ec6b5f941b9e70236abe813d26d4082.png

plot=True only plots the simulations for you to review that is set up correctly

However the core and cladding index of the fiber are very close to 1.44, so it’s hard to see. You can also use

plot_contour=True to plot only the contour of the simulation shapes.

sp20 = gm.write_sparameters_grating()  # fiber_angle_deg = 20
2024-05-10 10:18:02.514 | INFO     | gplugins.gmeep.write_sparameters_grating:write_sparameters_grating:139 - sparameters loaded from '/home/runner/.gdsfactory/sp/fiber_99914b93.npz'
sim.plot.plot_sparameters(sp20)

../_images/5e4ace7da9bb492ef7f58f3159d34b8575d02b961121cfa176a620c15473e629.png
sp = gm.write_sparameters_grating(fiber_angle_deg=15)
sim.plot.plot_sparameters(sp)
2024-05-10 10:18:02.637 | INFO     | gplugins.gmeep.write_sparameters_grating:write_sparameters_grating:139 - sparameters loaded from '/home/runner/.gdsfactory/sp/fiber_d072751b.npz'

../_images/0da92a2b5eaee3956d02e0c7bd0bffcfb54ab0d8bcec5024ec053837541df95b.png

Single core#

Running on a single CPU core can be slow as the a single core needs to update all the simulation grid points sequentially.

Multicore (MPI)#

You can divide each simulation into multiple cores thanks to MPI (message passing interface)

Batch#

You can also run a batch of multicore simulations

Far field#

TODO