Inverse Design of Grating Coupler 2D/3D Question

graemebargengraemebargen Member Posts: 9
edited May 5 in Photonics


I am trying to run the Inverse design of grating coupler 3D ( from my results from the inverse design of grating coupler 2D ( and I am a bit confused as to the setup of the initial parameters. For my 2D model i created a geometry with 11 grating trenches. So the output file (pid_optim_final.json) would contain 22 entries for the starting point of the grating and the parameters for the polygons.

However i see for the 3D model it says this on the page:

So if i run my current output parameters from the 2D model it only draws 10 of the trenches, not 11. Do i need to add another entry to my 2D output (pid_optim_final.json) file to get it to draw all the trenches properly? If so, how can i amend the (pid_optim_final.json) file to add an entry?


  • graemebargengraemebargen Posts: 15Member
    edited May 5

    So i understand now that I need to add the X(n-1) value at the end for the 3D optimization to count the correct number of etches. But could you please explain how to properly format the .json file for the initial parameters as per the picture above, im not sure what the size (n) value should be here, (with 11 etches the file will have 23 entries after i add the X_n-1) term. This was my attempt at the code but it does not seem to be working when the function is run:

    the calls this file via the following script

    and when i run it i get the following error

    thanks in advance, im sure its something small I am missing/doing wrong

  • trobertstroberts Posts: 60Ansys Employee

    Hello Graeme,

    What does the optimized_2D.json file look like after saving? I would modify this in a text editor.

    I think if you edited the json file it should look like that, but json save is meant to convert your lumerical datatypes into that format From what I can tell size should be num_entries +1?


Sign In or Register to comment.