Discussion today
• Today we will cover a basic introduction to the Lumerical
scripting language
• We will revisit the ZnO nanowire as an example
• Lumerical software shares a common scripting language that
makes it possible to automate all aspects of simulation
1
EE232 Discussion 4/20/2017
Setup and analysis scripts
• Setup scripts are used for setting up structures
• Analysis scripts process data after simulation runs
• Can also have standalone scripts that can do both
2
EE232 Discussion 4/20/2017
Groups
• Groups are used to organize structures in a hierarchical fashion
– Container groups hold objects but have no scripts
– Structure groups have a Setup script
– Analysis groups have both Setup and Analysis scripts
• Useful if you have many structures (eg. array of objects) or
complex structure with many components (eg. grating coupler)
• Top-level model object is an Analysis group and contains both
Setup and Analysis scripts
3
EE232 Discussion 4/20/2017
Setup and analysis scripts
• Open disc11_ZnO_nanowire_laser_mirror.fsp
• Right-click model object, Edit object
Setup script tab Analysis script tab
Origin of group
Structures’ coordinates are
relative to this origin
Script variables
Can be lengths, materials, numbers, etc.
4
EE232 Discussion 4/20/2017
Setup script
• Two length parameters are set for the total simulation
dimensions
• Click Script tab
If “construction group”, group is
designed to create its structures
instead of modifying them
deleteall; command will be added,
which deletes all existing structures Can test first to see errors below
in group
5
EE232 Discussion 4/20/2017
Setup script
Semicolons required
select selects an existing object
Note that SI units are
To refer to an object in a subgroup,
used regardless of
use the notation “group::object”
simulation settings.
Therefore this length
is in meters
set sets a property of the object
Any property seen in the Edit
menu can be set, including Use “?” to print things: useful for debugging
materials
For boolean values use true or
false.
• Press Test and ensure there are no errors.
6
EE232 Discussion 4/20/2017
Example: grating coupler structure
group
• Double click Grating coupler from Object Library to create
• This is what we used in past simulations
• Expand object in tree, you will see many polygons called post
and coating comprising the grating coupler
• Setup script contains many examples of script syntax: if
statements, for loops, matrices, creating objects, etc.
7
EE232 Discussion 4/20/2017
Optimizations
• Lumerical FDTD has built-in feature to optimize a figure of
merit using Particle Swarm optimization
– Optimizer randomly generates n simulations (“particles”), n=
generation size
– Each particle moves towards best result to produce next
generation
• Usually converges after <5 generations (depends on complexity)
• Can only optimize a scalar (not array or matrix), so usually need
Analysis script to extract a single element of array
8
EE232 Discussion 4/20/2017
Analysis script
• Delete grating coupler object
• Right-click model, Edit, go to Analysis tab
• Result called R has been added
– These results are set in script and will show up in result list of
parameter sweeps and optimizations
• Go to Script tab:
Monitor name
The transmission function gets
Get the middle element transmission normalized to
(=middle frequency) source power, as an array for all
frequencies
9
EE232 Discussion 4/20/2017
Optimization
• Create new optimization
• Right-click, Edit
Optimize nanowire radius
Maximize reflection
10
EE232 Discussion 4/20/2017
Optimization
• Click Run button to start optimization (same button as for sweep)
Optimized reflectance after
1 generation is 5%, much
better than initial 0.7%
(your results may vary)
Radius is 37 nm
Diameters varied from
20 to 150 nm in the
paper
11
EE232 Discussion 4/20/2017
12
EE232 Discussion 4/20/2017
Reflectivity is higher, but mode confinement is much weaker due
to smaller wire
13
EE232 Discussion 4/20/2017
Optimization
• For single variable such as this, sweep is probably better
• In this case we would also like to optimize reflection from air
interface, and confinement factor
14
EE232 Discussion 4/20/2017
Other resources
• Scripting language reference:
[Link]
• Example simulations: [Link]
15
EE232 Discussion 4/20/2017