Amrita Pati
Ansys Employee

Hi Saurav,

You are welcome! I had a quick look at the example you mentioned. I would just like to point out that it calculates the mean of R and T in the sweep and optimizes the thickness of the structure for the maximum mean (single value) of R over a set of angles (rather than maximizing the value of R at each angle). 

For setting up sweeps using code, please refer to the following link:Creating parameter sweeps using a script 

For setting up optimization task using code, please refer to the following:Creating optimization tasks using a script

I did a quick search and didn't find any published code for nested sweeps, here is a simple example code, but you can combine it with the resources above.


This creates a nested loop as shown: