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


    • Anish_Mondal


      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

    • Kyle
      Ansys Employee

      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.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.