Question about using specific designs in the adjoint optimizer #2759
-
The examples for the adjoint optimizer (https://github.com/NanoComp/meep/tree/master/python/examples/adjoint_optimization) all seem to use either a single fixed value or a random array of 0's and 1's for the initial guess of the design region. Is there a way to feed in a specific design as the initial guess? I just wanted to see if there was an easier built-in mechanism rather than having to do something like:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There's no in-place machinery to make this easier, unfortunately. At least not for now. (If you have a gds file, read in the polygons and use a point-in-polygon algorithm to sample the geometry onto the grid. No need to export using a separate simulation, etc) A tutorial along these lines would be useful. Do you have a design in mind that would be good for a tutorial? |
Beta Was this translation helpful? Give feedback.
-
I've been playing around with it, and this is the basic idea I've come up with: create a dummy simulation with the objects you want to use as the initial design, convert it to an array with get_epsilon(), then convert that to a [0,1] vector that can be read as the initial design of the optimizer. It gets complicated because the objects seem to scale differently in the design region and the main sim; I'm still trying to get a handle on how it works, but it doesn't like there's any way to have a non-square design region, at least not at this point. Here is an example, based off of https://github.com/NanoComp/meep/blob/master/python/examples/adjoint_optimization/01-Introduction.ipynb:
|
Beta Was this translation helpful? Give feedback.
I've been playing around with it, and this is the basic idea I've come up with: create a dummy simulation with the objects you want to use as the initial design, convert it to an array with get_epsilon(), then convert that to a [0,1] vector that can be read as the initial design of the optimizer. It gets complicated because the objects seem to scale differently in the design region and the main sim; I'm still trying to get a handle on how it works, but it doesn't like there's any way to have a non-square design region, at least not at this point.
Here is an example, based off of https://github.com/NanoComp/meep/blob/master/python/examples/adjoint_optimization/01-Introduction.ipynb: