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-08-16 06:15:59.035 | INFO     | gplugins.gmeep:<module>:39 - Meep '1.29.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/588bf3215978ed586aac81f18f4a965b5997039c5e330ae4f158e5ce0fae2338.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/e7751e7e7c59e8564a4765b5277633e5ec858d069f7237a61e3998ea04688a37.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/39f0f664737a78f7aa5752511f070d24b1a7ab158e17e4959260080c75dc71b1.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
sim.plot.plot_sparameters(sp20)

../_images/6791383a696d13ed17a1fb83e0ebcc191beac0675dd5b8cce6dc19cd27b7b596.png
sp = gm.write_sparameters_grating(fiber_angle_deg=15)
sim.plot.plot_sparameters(sp)

../_images/030ae022b75d180feae22a51c1128d19c2c41b27622f99a1967c91c8778d3eb6.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