Obtaining the phase from field monitor for inverse design problem #3201
-
|
Hello, I am a little bit confused about how i can extract some data from a field monitor in a way that is differentiable for autograd for an inverse design issue. In more detail I face the following problem. I use which calls an error function that tries to obtain the phase of the fields from a monitor and compare them to a desired broadband phase profile. The issue is I am not sure how I can obtain this data in a way suitable for autograd as does not seem to properly provide the data in the correct form for this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 22 replies
-
|
Could you clarify the problem: |
Beta Was this translation helpful? Give feedback.
-
|
Hello, I apologize for the very unclear first comment. At first I thought I was retrieving the data in a wrong way that caused a variety of errors with autograd. In reality, I was making an error on how I handled the data later in my code and the result ended up being non differentiable. I believe I have fixed this issue now but I have some other questions. For example for a broadband optimization (like for achieving a suitable phase profile for an achromatic metalens) does the adjoint solver run an adjoint simulation for each of the wavelengths captured by the monitor? Are the results then weighted together somehow? I am a little bit confused on how the adjoint method is implemented here for such simulations. Thank you very much for your time. |
Beta Was this translation helpful? Give feedback.
-
|
Good that you got it to work! Your question is pretty good and the details are actually complicated. In the worst case, we do need one adjoint simulation per monitor frequency. In some cases even with broadband, a single adjoint simulation can be used with some tricks. However I think (at least currently) if you are differentiating a FieldMonitor, it would be one adjoint sim per frequency.. so use as few as possible. @groberts-flex can confirm if this is true. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, sorry to revive this thread but I am having a related issue, probably due to my lack of experience with autograd. I have tried several types of loss functions to achieve a target phase (mse, cosine loss, etc) but I seem to be facing issues such as, 0 gradients, value getting stuck at the worst value, value getting stuck in plateaus, etc. Phase is wrapped so this can cause issues and I probably haven't found an ideal way to overcome this, unwrapping seems to cause issues also. I was wondering if you have could offer some advice on how to handle loss functions that have phase instead of intensity as a target if you have any relative experience. Thank you very much in advance. |
Beta Was this translation helpful? Give feedback.

Happy to hear that looks good and curious to hear about what you find out in our test.
I think this may be a good example notebook to check out for those other types of material: https://www.flexcompute.com/tidy3d/examples/notebooks/Autograd15Antenna/
You can set up custom medium type media that are dispersive or lossy. You can set up a custom pole residue or a custom Drude model for example and compute gradients with respect to their parameters. Let me know if that sounds right for your application and if you run into any issues with it!