How do I set an adjoint shape optimization?

How do I set an adjoint shape optimization?#

Date

Category

2023-12-21 21:54:09

Inverse Design

To create an adjoint shape optimization setup, you need to provide jax-compatible geometries such as tidy3d.plugins.adjoint.JaxBox or tidy3d.plugins.adjoint.JaxPolySlab when creating objects of type tidy3d.plugins.adjoint.JaxStructure. The structures should then be included in the .input_structures parameter of the tidy3d.plugins.adjoint.JaxSimulation object. In addition, you must specify an adjoint compatible monitor in .output_monitors, which 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 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 example on adjoint shape optimization.