May 27, 2024 at 9:25 pm
Amrita Pati
Ansys Employee
Hi Rabeeya,
The user-defined scripting option in the Optimization Utility has limited capabilities similar to the scripting options within model, analysis, and structure groups. Some functions won't work from within these environments.Â
I believe there is a workaround, but I haven't tested it fully myself. You can try and let me know if there are any issues. The getindex script works within "model", the root class in the objects tree.Â
- You can edit "model".
- Go to "Analysis" and then "Variables".
- In the Results section, define a varaible called "n".
- Copy and paste the getindex commands in the Analysis-->Script of "model".
- Now model should return "n" as a result after FDTD is run:
- Moving on to the optimization task, in the "Figures of merit", you can select "n" as shown below, in addition to any other result you might have:
- Next, you can use this "n" in the user defined fom section directly. A random code is shown as an example below:
Please feel free to let me know if you have any questions.
Regards,
Amrita