From the Programming submenu for solver sequences, you can select
For to add two nodes to the end of the sequence, a
For node (
) and an
End For node (
). You can then move these node where you want to create a for loop that iterates some part of the solver sequence. When the sequence is run, the for loop runs the node in between the
For and
End For nodes a fixed number of steps. You can add more than one
For node to create nested for loops. The model tree displays the loop structure by indenting the description text for the nodes. The for loops must be balanced; otherwise an error occurs. For loops can be useful, for example, for solving particle-field interactions in particle tracing by iterating between a stationary and a time-dependent solver.
The End For node has no settings. The
Settings window for the
For node contains the following setting:
Select an option from the Defined by study step list. The default is
User defined. If any instances of the
Bidirectionally Coupled Particle Tracing or
Bidirectionally Coupled Ray Tracing study step are present in the study then they can also be selected from the list.
Select an option from the Termination method list:
Fixed number of iterations (the default) or
Convergence of global variable. For
Fixed number of iterations enter a positive integer for the
Number of iterations (default 5). Any nodes between this
For node and the following
End For node will be repeated a number of times equal to the specified
Number of iterations.
where g0 is the value of the global variable from the previous iteration,
g1 is the value of the global variable from the current iteration, and
gt is the
Relative tolerance threshold. A new iteration of the loop is started if the iteration number is less than the
Maximum number of iterations, and if either the relative error is less than the
Relative tolerance or the iteration number is less than the
Minimum number of iterations.