Ansys Learning Forum Forums Discuss Simulation Photonics Python to lumerical optimization FOM script Reply To: Python to lumerical optimization FOM script

anna.wirth-singh
Ansys Employee

Hi, Thanks for clarifying - I apologize, I initially thought you were using lumopt for a more complicated structure. To optimize a simple strucutre it would be much more straightforward to use the built-in optimization and sweep utilities. Please see these pages if you have not already: 

Optimization utility – Ansys Optics

Creating optimization tasks using a script – Ansys Optics

I think that defining an Analysis group would be the best way to define a custom figure of merit, so it sounds like you are on the right track. In the Analysis group script, you can perform calculations and if you specify those variable to be results, then they can be used as FoM for optimization.

While this example is not for RCWA, this example has both an analysis group and an optimization that uses the result from that analysis so it will be useful to have a look: 

Plasmonic gap waveguide – Ansys Optics

Specifically, 'T1' here is later set as the FOM for optimization. This script is very simple but a more complex script could be used instead. 

I hope this is helpful; feel free to reply back with follow-up questions.

Best,

Anna