How to make limits of nested loop dependent on parameters of parent loop?

Anish_MondalAnish_Mondal Member Posts: 7
edited May 6 in Photonics

Hello,

I am trying to simulate a structure where I am using a nanohole array. I want to do a nested sweep of the radius of the nanoholes (r) and the lattice constant (a). Now in the nested sweep, how do I ensure the lattice constant varies from 2*r to 5*r, i.e., 2*r < a <5*r using the sweep UI. If possible, could you show both scripting and non-scripting methods?

Thank You

Tagged:

Best Answer

  • kjohnsonkjohnson Posts: 172Ansys Employee
    Accepted Answer

    Hello @Anish_Mondal ,

    I don't think it would be possible to do this without some scripting. If you want to use the parameter sweep tool, you could put the nanohole array in a structure group and write a setup script to create the geometry. When you calculate the lattice constant in the script you would write it as, for example, "a = i*radius", then sweep the "i" variable from 2 to 5 in the nested parameter sweep. The "radius" variable would be swept in the parent sweep.

    Alternatively you could do the entire nested parameter sweep in a script file with for loops. In this case you can write the beginning/end points of the nested for loop to depend on the parent loop variable. But this would be a little more complicated, as you would have to set up, run, and save the data from the simulations with script commands. I think the first approach would be easier.

Sign In or Register to comment.