How do I set an inverse design problem?#
Date |
Category |
---|---|
2023-12-21 19:01:14 |
Inverse Design |
To create an adjoint inverse design setup, you need to use a special Simulation
subclass called tidy3d.plugins.adjoint.JaxSimulation, which is a jax
-compatible stand in for Simulation
and behaves almost entirely the same, except for a few important differences:
- This feature allows for the inclusion of an extra field (
.input_structures
) consisting ofjax
-compatible Tidy3D structures. For example, the tidy3d.plugins.adjoint.JaxStructure, which contains a.medium
and a.geometry
field, both of which may depend on the design parameters. The final gradients of the objective function will be given with respect to the values of the fields mentioned above. - It accepts the additional field
.output_monitors
, that defines the set of monitors and corresponding data that the objective function will depend on.
Once the adjoint simulation is defined, you must use the tidy3d.plugins.adjoint.web.run method to send the simulation to our servers. After computing the forward and adjoint simulations, a tidy3d.plugins.adjoint.JaxSimulationData is returned so that you can compute the objective function value.
Lastly, use jax.value_and_grad
to both compute the objective function and the gradient with respect to the design parameters. The objective function gradients can then feed a gradient-based optimization algorithm to drive the inverse design process.
We highly recommend watching the Inverse Design lectures if you are new to the adjoint method. You can also go through this tutorial for an introduction to the basic concepts related to automatic differentiation and adjoint optimization.