This part of the tutorial will introduce how to use structure groups, analysis groups, and parameter sweeps to perform parametric analysis in Lumerical FDTD. A parametric waveguide bend structure group will be used to calculate the transmission through the waveguide bend as a function of bend radius. The complete simulation file waveguide_bend_parameterized.fsp can be downloaded from the link at the top right of this page.
This is the third part of a three part tutorial. The other parts of the tutorial can be found on these pages:
- Getting Started with Lumerical FDTD for Photonic Integrated Circuits - Part 1
- Getting Started with Lumerical FDTD for Photonic Integrated Circuits - Part 2
Parameter Sweeps
The parameter sweep utility can be used to vary the value of an object property and run a simulation for each iteration of the value. Therefore, it can be used to determine the performance of a device for different values of a geometric parameter. For example, it could be used to calculate the coupling coefficient of a directional coupler as a function of coupling length.
Object properties can be used as the parameters, and the results returned by objects can be used as the sweep results.
Often, multiple object properties need to be changed when a geometric parameter is changed. For example, if the position of an input waveguide changes, the position of a port placed on that waveguide must also be changed. Coordinating multiple object properties with a single property can be done with structure groups and analysis groups.
Structure Groups
A structure group combines multiple geometry primitive objects into a single object with user-defined properties. These user-defined properties can be used as parameters for the parameter sweep utility.
The properties of the group’s child objects are set based on the group’s user properties using the setup script, written using Lumerical’s scripting language. The user properties of the structure group are passed to the setup script as variables with names that match the names of the properties.
There are many examples of structure groups in the Object Library. These can be useful starting points for your own structure groups.
Construction Groups
If the construction group property of the structure group is enabled, it will become a construction group. Construction groups delete all child objects and recreate them from scratch each time the setup script is run. This means all non-default child object properties must be defined in the setup script. The properties of the child objects of a construction group cannot be modified through the graphical interface:
If the "construction group" property is not enabled, the child objects will not be deleted every time the setup script is run. This means that properties that don’t depend on the group’s user properties only need to be set once, and don’t need to be set in the setup script. The child object properties not set by the setup script can also be changed through the graphical interface.
Analysis Groups
Analysis groups are similar to structure groups, but in addition to geometry objects, they can include other simulation objects like monitors and sources. Analysis groups also have an analysis script along with analysis properties that runs after the simulation is finished to post-process results returned by their child objects into new results.
The "model" object at the root of the Object Tree is an analysis group. Examples of prebuilt analysis groups can be found in the Object Library.
Analysis groups can also be construction groups.
Example: Parameter Sweep
In this part of the example, the average transmission across the simulation bandwidth will be calculated as a function of the bend radius using a parameter sweep. A structure group will be used to create a parameterized waveguide bend geometry, and the model analysis group will be used to keep the FDTD object and ports aligned with the bend geometry. It will also be used to post-process the results returned by the ports.
Geometry Structure Group
Starting from the simulation at the end of part 1 or generated from the script in part 2:
- If in Analysis Mode, switch to Layout Mode by pressing the Layout button in the toolbar.
- Delete the Ring and Rectangle objects by right-clicking on them and selecting Delete.
-
Add a structure group to the simulation by pressing the Structure button in the Design tab of the toolbar.
- Open the Edit structure group window by right-clicking on the structure group in the Objects Tree and selecting Edit object.
- Set the name of the structure group to "waveguide bend".
-
Add the following user properties to the structure group by clicking the Add button three times and editing the table in the Properties tab of the Edit structure group window:
- Name: "bend_radius", Type: Length, Value: 3, Unit: um
- Name: "waveguide_width", Type: Length, Value: 0.5, Unit: um
- Name: "waveguide_height", Type: Length, Value: 0.22, Unit: um
- In the Script tab of the Edit structure group window, select construction group and copy and paste the following into the setup script after the "deleteall" command added after selecting construction group:
addring({"name": "waveguide bend",
"z span": waveguide_height,
"outer radius": bend_radius + 0.5*waveguide_width,
"inner radius": bend_radius - 0.5*waveguide_width,
"theta stop": 90,
"material": "Si (Silicon) - Palik"});
addrect({"name": "input waveguide",
"x max": 0, "x min": -2e-6,
"y": bend_radius, "y span": waveguide_width,
"z": 0, "z span": waveguide_height,
"material": "Si (Silicon) - Palik"});
addrect({"name": "output waveguide",
"x": bend_radius, "x span": waveguide_width,
"y max": 0, "y min": -2e-6,
"z": 0, "z span": waveguide_height,
"material": "Si (Silicon) - Palik"});
- Click OK to close the window.
This script is mostly the same as the section of the script from part 2 that created the Ring and Rectangle objects. Instead of setting the object properties using variables defined in the script, it uses the values defined by the structure group’s user properties, bend_radius, waveguide_width, and waveguide_height.
The deleteall command at the beginning deletes all of the objects in the group. This command is automatically added when the construction group property is selected.
When a user property of the structure group is changed, the setup script will run with the new user properties, creating or modifying the child geometry objects. For example, if the bend_radius property of the structure group in this example is changed to 4 um, the Ring and Rectangle child objects will be created with this new bend radius:
Coordinating Simulation Objects With "model" Analysis Group
However, now if the bend radius is increased the FDTD region will be too small and the port objects will not be centered on the waveguides, as seen in the above screenshot.
The "model" analysis group can be used to set the properties of the FDTD object, ports, and waveguide bend structure group to make sure they are all properly aligned according to the guidelines discussed in Part 1 of this tutorial.
To do this:
- Right-click the "model" analysis group in the Objects Tree and select Edit object to open the Edit analysis group dialog window.
-
Add these user properties to the model analysis group by clicking the Add button four times and editing the table:
- Name: "bend_radius", Type: Length, Value: 3, Unit: um
- Name: "waveguide_width", Type: Length, Value: 0.5, Unit: um
- Name: "waveguide_height", Type: Length, Value: 0.22, Unit: um
- Name: "waveguide_mode_buffer", Type: Length, Value: 2, Unit: um
- Copy and paste the following script into the Setup Script of the model analysis group in the Setup/Script tab of the Edit analysis group window:
select("FDTD");
set("x max", bend_radius + 0.5*waveguide_width + waveguide_mode_buffer);
set("y max", bend_radius + 0.5*waveguide_width + waveguide_mode_buffer);
set("z span", waveguide_height + 2*waveguide_mode_buffer);
select("FDTD::ports::port 1");
set("y", bend_radius);
set("y span", waveguide_width + 2*waveguide_mode_buffer);
set("z span", waveguide_height + 2*waveguide_mode_buffer);
select("FDTD::ports::port 2");
set("x", bend_radius);
set("x span", waveguide_width + 2*waveguide_mode_buffer);
set("z span", waveguide_height + 2*waveguide_mode_buffer);
select("waveguide bend");
set("bend_radius", bend_radius);
set("waveguide_width", waveguide_width);
set("waveguide_height", waveguide_height);
This script sets the properties of the FDTD and port objects based on the geometric properties of the waveguide bend (bend_radius, waveguide_height, and waveguide_width) and the spacing between the edges of the waveguide and the port boundaries (waveguide_mode_buffer).
The script also passes the bend_radius, waveguide_width, and waveguide_height properties to the "waveguide bend" structure group. This means that setting the user properties of the "waveguide bend" structure group directly will do nothing, as the new properties will be overwritten by the "model" setup script. Therefore, the waveguide bend geometry in the simulation must now be set by changing the user properties of the "model" analysis group.
Since the "model" analysis group is not a construction group, the simulation objects are not deleted and rebuilt from scratch each time the setup script is run. Therefore, any child object properties not set by the "model" setup script can be set by editing the child object directly, and the change will not be overwritten by the "model" setup script.
Now when the user properties of the "model" analysis group are changed, all of the simulation objects are updated according to the setup scripts of the analysis and structure groups, keeping them all properly positioned.
Post-processing Results With "model" Analysis Group
The "model" analysis group will also be used to postprocess the results in the simulation to calculate an average transmission across the simulation spectrum. To do this:
- Add a new result to the analysis group by clicking the Add button in the Results section of the Analysis/Variables tab of the model analysis group’s edit dialog window.
-
Double click on the new result to set the name of the result to "T_avg".
- Open the Analysis/Script tab and copy and paste this script into the Analysis Script:
S21 = getresult("FDTD::ports::port 2", "S");
T = abs(S21.S)^2;
T_avg = mean(T);
- Click OK to close the window.
This analysis script will get the S-parameter result dataset from port 2, calculate the absolute value squared of the S-parameter for each wavelength then average them with the mean command. The result is assigned to a variable named "T_avg". Because the name of this variable matches the name of the "T_avg" result of the analysis group, its value at the end of the script will be assigned to that result.
Creating a Parameter Sweep
A parameter sweep can now be used to sweep the bend radius and calculate the average transmission as a function of bend radius. The bend_radius property of the model analysis group will be used as the sweep parameter and the T_avg result of the model analysis group will be used as the sweep result.
-
Press the Add New Parameter Sweep button in the Optimizations and Sweeps window to create a new parameter sweep.
- Open the Edit Parameter Sweep window by right-clicking on the sweep and selecting Edit.
- Set the Number of points for the parameter sweep to 5.
- Press the Add button in the Parameters section to add a new parameter to the sweep.
- Set following values for the newly added parameter:
- Name: "bend_radius"
- Parameter: "::model::bend_radius". This value can be set by selecting model>Properties>bend_radius in the dropdown list.
- Type: "Length (microns)"
- Start: 2
- Stop: 6
- Press the Add button in the Results section to add a new result to the sweep.
-
Set following values for the newly added parameter:
- Name: "T_avg"
- Result: "::model::T_avg". This value can be set by selecting model>Results>T_avg in the dropdown list.
- Click OK to close the window.
The parameter sweep is now completed and ready to run.
Running the Parameter Sweep
This parameter sweep will run the simulation for each value of the parameter, then save the specified result. Since there are 5 points between a bend_radius of 2 um and 6 um, it will run for values of 2, 3, 4, 5, and 6 um. A new simulation file will be created for each simulation run and saved in a subdirectory named after the sweep.
To run the sweep:
- Select either CPU or GPU from the dropdown list in the Optimizations and Sweeps window to run the parameter sweep simulation using the CPU or GPU resource specified in the toolbar.
-
Either select the sweep in the parameter sweep list and press the Run button in the Optimizations and Sweeps window, or right-click on the sweep and select Run.
The parameter sweep will run and save the results as a dataset. Multiple simulations can be run concurrently by increasing the Capacity in the Resource Configuration. The status of the simulations in the sweep can be seen in the Job Manager.
Visualizing Results
Once the sweep simulations have finished running, the result dataset can now be visualized:
-
Right-click on the sweep in the Optimizations and Sweeps window and select Visualize > T_avg to plot the result in the Visualizer.
From this plot, the average transmission value through the waveguide as a function of the bend radius can be seen.