Meep has a density-based adjoint solver 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.
This module 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.