Repeat Loops

This feature allows BPM to run repeatedly for different parameters. Values such as wavelength, refractive index, grating period, or even the location of the objects can be varied for each run. The list of values to be used for each run is specified via a text file. Each line (row) in the text file corresponds to a separate BPM run. If the file contains 10 lines (rows), it will result in 10 separate runs using the values specified in each line. The first column in each line contains the wavelength, and the second column is named 'a', and the third column is named 'b' etc... These values are used in objects with the variables 'a', 'b' or 'c' etc.. instead of numeric values. In other words, if an alphabetic character is used instead of a numeric value in the object descriptions, the program will look for their values in this user-defined file. If only the wavelength is being varied, then the text file will have a single column of numbers. If wavelength and some other parameter are being varied, the text file will have two column. The maximum number of columns is 27 (wavelength + a through z).

Example 1
0.4000<----- Run 1
0.4100<----- Run 2
0.4200<----- Run 3
0.4300<----- Run 4
0.4400<----- Run 5
0.4500<----- Run 6
0.4600<----- Run 7
0.4700<----- Run 8
0.4800<----- Run 9
       ^
Wavelength
In this csae, the program will run nine times using the wavelength values specified in each row.
Example 2
0.4000       1.8       10.0<----- Run 1
0.4100       1.75       12.0<----- Run 2
0.4200       1.7       13.0<----- Run 3
0.4300       1.65       14.0<----- Run 4
0.4400       1.6       15.0<----- Run 5
0.4500       1.55       16.0<----- Run 6
0.4900       1.5       17.0<----- Run 7
0.5500       1.32       18.0<----- Run 8
0.6700       1.2       19.0 <----- Run 9
0.7800       1.15       20.0<----- Run 10
        ^       ^        ^
WavelengthColumn aColumb b
In this example, the text file contains three columns. The first column is the wavelength, and the objects can reference the two other columns as 'a' and 'b'. For example, a slab object with a relief grating on top defined as
sw 0.05 1.0 -1.0 a 35.0 b 0.0 -0.5 0.0 0.5 0.0 0.5 1000.0 -0.5 1000.0
will cause the grating height and grating angle to change as specified in columns 'a' and 'b' respectively.


When running loops, output files such as cross-section plots and movie files are generated for the first loop only. Subsequent loops do not generate output files. The exception is the Output Integration Polygon at each z. This integral is evaluated as a function of z for all loops. Therefore, it is important to choose this polygon carefully such that it represents the parameter being sought as the loops are being run.