Taylor Robertson
Ansys Employee

Hello Coulson,

It sounds like you are trying to 'hack' the lumopt module to match a specified E field? This is not exactly what the overlap FOM calculations are doing - Understanding the mode overlap calculation. In the modematch case it is measuring power carried in the specified mode. Although this seems similar to what you are doing you will need to reformulate the gradient calculations for this type of merit function. To get this to work I think that focusing on the modematch class and also how the adjoint simulation is set-up. The other modules you should be able to port most of their functionality, but I cannot say for sure. 

It sounds like the optimizer cannot calculate the gradient correctly, which is not surprising given that the adjoint calculation is not set-up properly.  Basically it calculates something checks to see if this is better, and finds that it is not. If you are not using the merit functions as inteneded, this is not surprisng.

I would recommend looking into to the literature to see if you can find any similar examples. This may be a good place to start.

Inverse Design of Plasmonic Structures with FDTD