This video is taken from the INT 100 course on Ansys Innovation Courses.
Transcript
Everything that we've done through the graphical user interface, setting up the simulation,
running, and analyzing results, can also be done through the script.
For an introduction to the scripting environment and basic script commands,
the Scripting 100 course is available through Lumerical University,
and there is a link to the course registration page below the video if you want to enroll.
In the script file editor, open the associated script file.
This script file modifies the simulation setup, runs it, then plots the gain, and free spectral range.
Let's walk through the script.
The switchtolayout script command can be used to switch back to layout mode
if the simulation has been run and is in analysis mode.
Then the length property of Straight Waveguide 1 is modified by using the setnamed command,
which takes as arguments the name of the element, the property to set, and the value to set the property to.
Note that when setting values from the script, the units are always in SI base units,
so even though we set the units in the length property to millimeters when we were setting up the straight waveguide element,
we need to specify the length in meters when setting from the script.
The run command runs the simulation.
The getresult script command collects results.
The arguments include the object name to collect results from and the name of the result to collect.
The result name to specify here is the same as the name of the result shown in the table view of the Result View window
so here we are collecting the gain result from input 1, mode 1, and from input 2, mode 1,
as well as the free spectral range result from the peak analysis for input 2, mode 1.
Next, the visualize command is used to plot the gain spectrum from the through and drop ports in the same plot
and the free spectral range in a separate window.
As a comparison, we calculate the theoretical free spectral range using the formula FSR = c/(ng*L)
where ng is the group index, and L is the total perimeter length of the ring.
We print this result to the script prompt by using the "?" operator.
Details about the syntax for the script commands used in this script file
and some example code can be found in the related links below this video.