How do I set an inverse design problem?#
Date |
Category |
|---|---|
2023-12-21 19:01:14 |
Inverse Design |
With Tidy3Dโs integration with Autograd, setting up an inverse design workflow is straightforward.
All you need to do is define a function to create the Simulation object as a function of the optimization parameters, run the simulation, post-process the data, and return the cost function. Once this function is defined, you can call autograd.value_and_grad to run the simulation and obtain the gradients.
General Workflow#
Create a
make_simfunction
This function takes in the optimization parameters and returns aSimulationobject.Define a post-processing function
This function calculates the objective (cost) function from the resultingSimulationDataobject.Wrap it all in a single function
This wrapper receives the optimization parameters, creates and runs the simulation, applies the post-processing, and returns the objective function.Use
autograd.value_and_grad
Input the wrapper function intoautograd.value_and_gradto obtain both the cost function value and its derivatives. These gradients can then be used in a gradient-based optimization algorithm to guide the inverse design process.
We highly recommend watching the Inverse Design lectures if youโre new to the adjoint method. You can also explore this tutorial for an introduction to automatic differentiation and adjoint optimization.