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 12 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.

No, in any case this is handled under the hood. Your objective function should be scalar-valued. But if it depends on multiple frequency outputs, this is detected automatically, and the adjoint simulations will be created as needed. It's just that in some cases (e.g. a single ModeMonitor in the objective function) we can even use a single adjoint simulation, but again, this is detected automatically.