Meep contains an adjoint-solver module for efficiently computing the gradient of an arbitrary function of the mode coefficients (S-parameters), DFT fields, and far fields (using the analytic near-to-far field transformation) with respect to on a discrete spatial grid (a
MaterialGrid class object) at multiple frequencies over a broad bandwidth. Regardless of the number of degrees of freedom for the grid points, just two separate timestepping runs are required. The first run is the "forward" calculation to compute the objective function and the DFT fields of the design region. The second run is the "adjoint" calculation to compute the gradient of the objective function with respect to the design variables. The adjoint run involves a special type of source distribution used to compute the DFT fields of the design region. The gradient is computed in post processing using the DFT fields from the forward and adjoint runs. This is all done automatically, and is described in:
- A. M. Hammond, A. Oskooi, M. Chen, Z. Lin, S. G. Johnson, and S. E. Ralph, “High-performance hybrid time/frequency-domain topology optimization for large-scale photonics inverse design,” Optics Express, vol. 30, no. 3, pp. 4467–4491 (2022).
This interface to this functionality is implemented entirely in Python using autograd and JAX. The adjoint solver supports inverse design and topology optimization by providing the functionality to wrap an optimization library around the gradient computation.
There are six Jupyter notebooks that demonstrate the main features of the adjoint solver.
More documentation will be available soon.