New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meep adjoint optimization plugin / gmeep extension #749
Comments
I actually wrote a function to get gdsfactory components from meep sims for doing exactly this, accessing the epsilon grid from the simulation object:
Never got around to adding it to gdsfactory but feel free to use it as a starting point :) The issue I ran into was that using |
|
Hi Skandan, this looks great, can you send a link to the GDS? have you made sure it passes some min width and min gap DRC rules using klayout? |
Cool! How are you specifying the design region, FOM, optimization algorithm, beta scheduling, constraints, etc from within gdsfactory? Or is the optimization done externally, and the geometry simply imported after the fact? We have some contour extraction routines that have yielded numerous fab-friendly results. (cc @joelslaby). |
@joamatab, I stopped the optimization before it could be done, because I didn't think my old laptop can handle more 😅. That explains why it has self - intersecting polygons and some features smaller than what foundries may accept. I will try to let it run for longer, and then send a link for the updated GDS file. @smartalecH, as of now, the user defines the objective functions, FOM, optimization algorithm, etc. GDSFactory simply takes in the component, creates a Meep Simulation object, and then runs the optimization. Then the component can be generated from the Simulation object that is returned. I am sure there's a better way to do it, but I will need a couple of days to figure it out. |
Here is an updated pic after the optimization was complete (I ran it for 97 iterations). Here is the updated GDS file link I think if I play around with the optimization hyperparameters I can eventually get a geometry with no DRC errors. |
Note that the filters alone don't enforce DRC. You also need to add the corresponding optimization constraints that work with the filters. We don't have an end to end tutorial yet, but are working on it. |
What version of meep are you using? Essentially the simulation hasn't been initialized right. There are some checks in the step routine that ensures everything is as expected. |
(Also you want more space between your PML and device) |
(Also your monitors and source lines are too narrow. They won't calculate the proper mode) |
Thanks Alec! I did some more playing around and found out that generating the I also adjusted the port margins and the cell size. |
Also, I am using Meep version 1.24.0 |
Figured out what the issue was, the source generated for the Simulation object by gdsfactory couldn't be used in the optimization for some reason. I added a bit of code to generate a source that can, and it runs fine. I am running this simulation one last time, and then I will add this to the gmeep docs, and open a PR @joamatab |
Very cool! Nice job, @SkandanC! |
Thank you! |
It would be nice to extend gmeep's capabilities to include Meep's adjoint optimization features. This way, we can optimize some of gdsfactory's primitive components such as mmi1x2, generate a gdsfactory component from them, and eventually gds files.
Things to do:
For the latter, we can convert the PNG's to a numpy array, and then use gf.read.from_np to generate a gdsfactory component, as per @joamatab's suggestion. Or, if there's a way to create gds files straight from Meep, we can just turn those into a gdsfactory component.
The text was updated successfully, but these errors were encountered: