This tutorial will show how to set up, run, and view, collect, or export results for an S-parameter matrix sweep using the graphical user interface as well as from the scripting environment in FDTD and in MODE with the EME solver.
Lumerical FDTD R2017a or newer (for S-parameter matrix sweep in FDTD)
Lumerical R2020a or newer (for S-parameter matrix sweep in EME)
A 3-port symmetric y-branch device is used in this example where the fundamental TE and TM mode has been selected in each port. The associated simulation file contains an S-parameter matrix sweep task that has already been set up. Note that the example file is only meant to demonstrate the method for using the S-parameter matrix sweep tool and more accurate results can be obtained with a finer simulation mesh.
- NAME: S-parameter matrix sweep name.
S-matrix Setup tab
This table lists the ports and modes to include in the S-parameter matrix. By default this table is automatically populated with all of the modes in all of the ports in the current Objects Tree when a new S-parameter matrix sweep task is added from the graphical user interface.
The settings have slight difference in the FDTD solver and in the EME solver. Following are the details:
- EXCITE ALL PORTS: This option is checked by default. When the "Excite all ports" option is checked, the sweep will launch as many simulations as there are defined rows in the S-Matrix Setup table, effectively exciting all modes in all ports. When the "Excite all ports" is un-checked, the user can selectively choose which ports and modes to excite.
- S-MATRIX INDEX: S-parameter index that will correspond to the selected port and mode in the same row of the table. This field cannot be edited by the user.
- ACTIVE: Selects which rows of the S-matrix setup table to excite. The number of "Active" rows determine the number of simulations spawn by the sweep. This option is available when "Excite all ports" option is un-checked.
- PORT: Name of the port. This field reflects the names given to port objects located under the Objects Tree.
- MODE: Name of the mode as selected from the mode list in the port objects.
- MAP FROM: This option is available only for in-active rows of the S-Matrix setup table. It accepts an integer value corresponding to an "S-Matrix Index" of an "Active" row. This field remains editable after the sweep has data enabling the user to re-map the S-Matrix if needed without re-running any simulations.
- INVERT SIGN: Sets the sign to be used for the S-parameter mapping scheme and is only available for rows where the "Map from" option has been defined. This option should be checked when a 180 degree rotation in the fields is anticipated between associated ports for mapping.
- ADD: Adds a new row to the S-matrix setup table.
- DELETE: Deletes the selected row from the S-matrix setup table. If no elements of the table are selected, this button will have no effect.
- LOAD DEFAULT TABLE: This will re-populate the S-matrix setup table with the full list of ports and modes in the current Objects Tree.
- SWITCH AND DISCARD: Discards all sweep data and returns the S-parameter matrix sweep back to full edit mode. This option is only available after sweep has data. Users are warned that by clicking this button the discarded sweep data is unrecoverable except by re-running the sweep.
- NUMBER OF POINTS: Number of sweep points.
- CALCULATE GROUP DELAY: This check box property decides to calculate the group delay or not. Once the check box is selected, the following parameter will be enabled:
- wavelength/frequency: Combo-choice box to decide at what frequency/wavelength point the group delay calculation is based on.
- NAME: Name of the sweep parameter. By default set to "wavelength".
- PARAMETER: The sweep parameter. This parameter is fixed to "::model::EME::wavelength" and cannot be modified.
- TYPE: Sweep parameter type. This parameter is fixed to "Length (microns)" and cannot be modified.
- START: Start wavelength for the sweep. This value can be modified by users.
- STOP: Stop wavelength for the sweep. This value can be modified by users.
INTERCONNECT Export Setup tab
This table lists the port names, mode labels, mode IDs and port locations included in the exported .dat file that can be loaded by the Optical N-Port S-parameter element in INTERCONNECT. The settings are defined the same for both FDTD solver and EME solver except that in the EME solver, there is an option to include the group delay in the exported file.
- AUTO-DEFINE: This option will select the default "Mode Label", "Mode ID" and "Port Location" values to be included in the exported s-parameter .dat file for INTERCONNECT. When this option is checked, the properties in the INTERCONNECT SPAR Layout table are not editable.
- CUSTOM DEFINE: This option will select the user defined "Mode Label", "Mode ID" and "Port Location" values to be included in the exported s-parameter .dat file for INTERCONNECT. When this option is checked, the "Mode Label", "Mode ID" and "Port Location" properties in the INTERCONNECT SPAR Layout table are editable.
- PORT: Name of the port. This field reflects the names given to port objects located under the Objects Tree.
- MODE: Name of the mode as selected from the mode list in the port objects. This is the default value used in the "Mode Label" property when the "Auto-define" option is selected.
- MODE LABEL: Defines the Mode label in the exported s-parameter .dat file for INTERCONNECT. This field is editable by the user when the "Custom Define" option is selected.
- MODE ID: Defines the Mode ID in the exported s-parameter .dat file for INTERCONNECT. This field is editable by the user when the "Custom Define" option is selected and accepts positive integers. When the "Auto-define" option is selected, this field takes the default values from the mode selected in the port objects.
- PORT LOCATION: Defines the port position in the exported s-parameter .dat file for INTERCONNECT. This property is not editable in the EME solver.
- INCLUDE GROUP DELAY: Defines whether or not to include the group delay in the exported file. This option is only available in the EME solver.
Creating the S-parameter matrix sweep project
Make sure you can see the Optimization and Sweeps window. This can be done by going to the menu View->Windows->Optimization and Sweeps, or by right clicking on the upper menu bar and making sure that Optimization and sweeps is selected.
Click the Create New S-Parameter Matrix Sweep button to create a new parameter sweep task. Click the edit button to open the Edit sweep dialog window.
Running only a select number of simulations
The rows in the S-Matrix Setup table can be activated/de-activated individually to reduce the number of simulations ran by the sweep when appropriate. This mode is enabled by un-checking the option "Excite all ports", and selectively choosing rows in the table by checking the corresponding "Active" check box option. The sweep will then run simulations only for the rows that have been selected as "Active" and collects data from all ports including that of in-active ports. Zeros will appear in the S-Matrix results where some rows were not excited.
Reconstructing the full S-matrix from a minimum number of simulations
In the S-Matrix Setup table, the user can reconstruct a full S-matrix by running only a minimum number of necessary simulations. With the "Excite all ports" option un-checked, user can select "Auto symmetry" option to automatically set the ports for symmetric simulations. The "Map from" and "Invert sign" properties will be used to setup the appropriate association between in-active rows and active rows in the S-Matrix setup table. The "Map vector" will be an array where its elements are mapped from corresponding active ports (see here for more details). This association sets up the automated mapping scheme that reconstructs the full S-Matrix from the partial simulation results available in the sweep. This mapping approach provides a time efficient method for extracting s-parameter by allowing the user to take advantage of symmetries present in a structure.
The S-parameter matrix sweep task is automatically set up to sweep through all selected modes of all ports of the device at the time when the task is added. In the edit window you can check the S-matrix Setup table that has been automatically populated with the "Excite all ports" option checked.
If you don't want to run simulations for all modes of all ports you can un-check the "Excite all ports" option and start by choosing "Auto symmetry" to automatically detect the symmetry and assign the active and inactive ports. You can also manually change the settings, and modify the rows by un-checking the "Active" property for those rows in the S-matrix setup table.
If you want to reconstruct the full S-Matrix from a partial one, you can use our automated one-to-one mapping scheme to map the S-matrix index of inactive rows to active rows in the S-matrix setup table using the "Map from" and "Invert sign" properties set by the user. In the image shown on the right, the sweep will run 4 simulations each excited by the mode source as defined by its corresponding "Active" row in the S-matrix setup table. In this example rows 5 and 6 are mapped to rows 3 and 4 respectively. The mapping scheme requires that all inactive rows be mapped to a unique active row as a result at least half of the rows in the S-matrix setup table need to be set to "Active".
If you make any changes to the port objects after adding the S-parameter matrix sweep, you can update the S-matrix setup table by clicking the "Load default table" button. This updates the S-matrix setup table to use all of the modes of all of the ports in the current Objects Tree.
To modify the parameters in the "Port", "Mode" or "Map from" columns, double click the entry in the table to open a combo box where you can choose from the available options as shown in the image on the right.
If there are duplicate entries in the S-matrix setup table, a warning message will appear when you run the task.
Running the S-parameter matrix sweep
To run the S-parameter sweep, select the task in the Optimizations and Sweeps window and click the run button, or right-click on the task and select the Run option from the context menu.
To distribute the sweep between several local computers, you must configure the computation Resources before running.
Viewing the results
The S-parameter sweep data is saved in a similar way to monitor data. One can right-click on the results in the Result View or the parameter sweep project to select any of the sweep results to be displayed in the Visualizer.
Sweep results can also be collected and plotted from the script as described in the "Scripted setup and analysis" section below.
Results that are available from the S-parameter matrix sweep are:
- S MATRIX: Dataset with attribute S containing the NxN matrix of complex S-parameters as a function of frequency and wavelength.
- S PARAMETERS: Dataset which contains N2 S-parameter attributes where N is the number of entries in the S-matrix setup table (ie. S11, S12,..., SNN). Each attribute is a complex array as a function of frequency and wavelength.
- S DIAGNOSTICS: Dataset that returns passivity and reciprocity violation as a function of wavelength and frequency. The passivity and reciprocity definitions are the same as those which can be retrieved from the Optical N-Port S-parameter element in INTERCONNECT:
- Passivity: The induced 2-norm or the spectral norm of the S-parameters.
- Reciprocity: The induced 2-norm or the spectral norm of (S-S'), where S is the S-parameters matrix.
The visualizer window for the S matrix result is shown below, where the S matrix elements are plotted at a single wavelength. To plot the data at different wavelengths, select the "lambda" parameter and use the slider or arrows to select the wavelength.
Since the S matrix contains complex scattering parameters, the "Abs^2" Scalar operation may be applied in order to display the magnitude squared.
The values of the plotted data can also be viewed in a table by double-clicking on "View Data" in the attributes list. This opens a new window with the table of data which can then be sent to the script workspace, copied, or exported to a text file.
It is possible to make changes to the mapping after the sweep has data. To do this, the s-parameter sweep can be opened for edit and the mapping can be changed by simply changing the S-matrix index set in the "Map from" property. The S-parameter matrix sweep data will be updated accordingly when the "OK" button is clicked.
The visualizer window for the S parameters result is shown on the right where each S parameter is plotted against wavelength.
To pair down the number of results that are plotted, you can select attributes from the attributes list and use the "Remove" button to remove them. In the image on the right, only S31, S51, S42, and S62 (which give the relationship between the input fundamental TE and TM modes of port 1 and the output in the same mode in ports 2 and 3) are plotted and the remaining S-parameters have been removed.
To plot the results against frequency instead of wavelength, you can double-click on the "lambda" parameter in the Parameters list and select "f" from the drop down menu.
Exporting results to INTERCONNECT
S-parameter results can be exported to a .dat file which has a format that can be loaded by the Optical N-Port S-parameter element in INTERCONNECT.
The values of port names, mode labels, mode IDs and port locations included in the exported .dat file can viewed & edited under the "INTERCONNECT Export Setup" tab found in the S-Parameter Matrix Sweep dialog window. The image to the right shows how to select the default properties to be used in the exported s-parameter file for INTERCONNECT by choosing the "Auto-define" option.
The values of mode labels, mode IDs and port locations can also be set by the user, when the "Custom define" option is selected. To modify the parameter in the "Mode label" column, double click the entry in the table and type in the text field. To modify the parameters in the "Port location" or "Mode ID" columns, double click the entry in the table to open a combo box where you can choose from the available options as shown in the image on the right.
Right-click on the task in the Optimizations and Sweeps window and select the Export to INTERCONNECT option. This will open up a window where you can specify the file name and location to save the data to.
You can also perform the export from the script using the exportsweep script command.
Note: If the maximum passivity over the frequency range is larger than 1.03 or the maximum reciprocity error over the frequency range exceeds 0.03, a warning message will appear when you export the data.
Scripted setup and analysis
The same s-parameter sweep task shown above can be set up, run, and the results can be visualized entirely using the script using the code below:
# if a sweep task named s-parameter sweep already exists, remove it
# add s-parameter sweep task
# un-check "Excite all ports" option
setsweep("s-parameter sweep", "Excite all ports", 0);
# use auto-symmetry to populate the S-matrix setup table
setsweep("S sweep", "auto symmetry", true);
# run s-parameter sweep
# collect results
S_matrix = getsweepresult("s-parameter sweep","S matrix");
S_parameters = getsweepresult("s-parameter sweep","S parameters");
S_diagnostic = getsweepresult("s-parameter sweep","S diagnostic");
# visualize results
# export S-parameter data to file named s_params.dat to be loaded in INTERCONNECT
See the links below for information about the syntax of the relevant script commands: