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
                    _ _ _| _ _ _ _ _ _  _
                         |
        nclad            | top_clad_thickness
                    _ _ _| _ _ _ _ _ _  _
     _|-|_|-|_|-|___     |              _| etch_depth
      ncore        |     |core_thickness
     ______________|_ _ _|_ _ _ _ _ _ _ _
                         |
      nbox               |box_thickness
     ______________ _ _ _|_ _ _ _ _ _ _ _
                         |
      nsubstrate         |substrate_thickness
     ______________ _ _ _|
[1]:
import matplotlib.pyplot as plt
import numpy as np
import gdsfactory as gf
import gdsfactory.simulation.gmeep as gm
import gdsfactory.simulation as sim
2022-06-28 17:03:29.902 | INFO     | gdsfactory.config:<module>:52 - Load '/home/runner/work/gdsfactory/gdsfactory/gdsfactory' 5.11.4
2022-06-28 17:03:30.911 | INFO     | gdsfactory.simulation.gmeep:<module>:28 - Meep '1.23.0' installed at ['/usr/share/miniconda/envs/anaconda-client-env/lib/python3.9/site-packages/meep']
Using MPI version 4.0, 1 processes
[2]:
df = 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/notebooks_plugins_meep_002_gratings_2_1.png
[3]:
df = 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/notebooks_plugins_meep_002_gratings_3_1.png
[4]:
df = 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/notebooks_plugins_meep_002_gratings_4_1.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.

[5]:
df20 = gm.write_sparameters_grating()  # fiber_angle_deg = 20
2022-06-28 17:03:32.875 | INFO     | gdsfactory.simulation.gmeep.write_sparameters_grating:write_sparameters_grating:111 - sparameters loaded from '/home/runner/work/gdsfactory/gdsfactory/gdslib/sp/fiber_99914b93.csv'
[6]:
sim.plot.plot_sparameters(df20)
../../../_images/notebooks_plugins_meep_002_gratings_7_0.png
[7]:
df = gm.write_sparameters_grating(fiber_angle_deg=15)
sim.plot.plot_sparameters(df)
2022-06-28 17:03:33.002 | INFO     | gdsfactory.simulation.gmeep.write_sparameters_grating:write_sparameters_grating:111 - sparameters loaded from '/home/runner/work/gdsfactory/gdsfactory/gdslib/sp/fiber_d072751b.csv'
../../../_images/notebooks_plugins_meep_002_gratings_8_1.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

[ ]: