NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.16k stars 594 forks source link

Adjoint Optimization with Frequency Domain Solver #2851

Open ScopeX-ASU opened 2 weeks ago

ScopeX-ASU commented 2 weeks ago

I noticed the adjoint optimization only supports sim.run(), which is FDTD simulation. I was wondering whether I can use adjoint optimization with sim.solve_cw() for frequency-domain adjoint gradient calculation. Is there any example of how to use meep for FDFD adjoint gradient calculation with solve_cw()?

smartalecH commented 1 week ago

The adjoint isn't actually a time-domain adjoint, it's a frequency-domain adjoint implemented with a time domain solver (via the rolling DFT operator).

So all of the optimization FOMs are specified in the frequency-domain too.

The advantage to this approach is you get the practicality of a frequency domain adjoint, with the scalability of a time-domain solver (best of both worlds).

You can read more about this hybrid approach we pioneered in our paper: https://doi.org/10.1364/OE.442074

ScopeX-ASU commented 1 week ago

Thanks for your reply. Yes, the adjoint gradient calculation is based on frequency domain fields. I was wondering whether the forward simulation and adjoint simulation in meep can be FDFD(solve_cw), instead of FDTD+DFT_monitor. just like spins-b or angler. Currently I couldn’t figure out a way to calculate adjoint grad in meep with frequency domain solver for the two simulations. In my case, solve_cw run is much faster than FDTD run.

smartalecH commented 1 week ago

No that's not currently supported. But the operator for that is the same, so getting that to work is just a matter of "software engineering" to be compatible with the current pipeline.