In this article, a static workflow using Ansys Zemax OpticStudio and Lumerical RCWA for accurately simulating 1D/2D gratings in a whole optical system is introduced. The methodology will be first briefly introduced. Then details about how to set up the system will be explained.
In this workflow, designers first simulate the grating in Lumerical FDTD or RCWA and then export data in a file with extension filename json. In OpticStudio, users can then import this data to accurately simulate for a grating in the whole macro system.
This static link workflow requires data generated from Lumerical and imported into OpticStudio. The two softwares work separately and don’t need to be on the same PC. To generate required data from Lumerical, users need a Lumerical FDTD license. To read the data into OpticStudio, users need a Pro, Premium or Enterprise license of Ansys Zemax OpticStudio. Note this feature does not support the legacy version of Opticstudio.
Static vs. dynamic workflows
It may be worth mentioning that there are two existing workflows to exchange data between Lumerical and OpticStudio. One is the static workflow that we are going to introduce in this article. Another is the dynamic workflow that works in a different way. The two workflows have different flexibilities, and no one is superior to the other. Users should consider which one to use based on their design case.
More details about dynamic link can be found in Dynamic workflow between Lumerical RCWA and Zemax OpticStudio.
Generate grating data from Lumerical
In this workflow, we use a file with extension filename json to pass the grating simulation result from Lumerical to OpticStudio. The json file can be given by a component supplier or generated by the same user who uses OpticStudio.
The operations to simulate and export json files in Lumerical will not be explained in this article. Users should refer to the following Lumerical knowledge base article for more information: Speos Lumerical Sub-wavelength Model.
Set up the gratings in Ansys Zemax OpticStudio
In OpticStudio, to set up a grating, it’s suggested to use one of the following 3 objects: Diffraction Grating, User Defined Object (DiffractionGrating.DLL), and User Defined Object (Polygon_grating.DLL). The Polygon_grating.DLL file is not provided in the installation folder by default, but it can be found in the article How to simulate exit pupil expander (EPE) with diffractive optics for augmented reality (AR) system in OpticStudio: part 4.
Note the grating is at Face 1 for these suggested objects.
After adding one of the above 3 objects, we then use the Object Properties…Diffraction tab to define the plugin DLL “lumerical-sub-wavelength-XXXXXX.dll”, where XXXXXX is the version, such like "2023R1". This DLL reads the grating data (.json) into OpticStudio. Note that the grating data (.json) should be saved in the \Document\Zemax\DLL\Diffractive\ folder.
The parameters of this DLL are explained in next section.
Parameters in Ansys Zemax OpticStudio
If this is set to non-zero, rays don’t split when hitting the surface. Instead, the ray will be randomly diffracted into one order, as shown below. This is useful when one ray will hit the diffractive surface multiple times and split into too many segments.
This parameter is normally not used. Users should keep it zero except they need some special behavior described below.
- When Test Mode is 0, the DLL works in normal mode.
- When we need some functions, we add a value on top of this value.
- +1 means the DLL will export log file in the \Document\Zemax\DLL\Diffractive\lumerical-sub-wavelength.log
- +8 means the DLL will work in CMOS mode. In this mode, the DLL considers the diffraction power of all transmission orders to be 0 except T(0,0). The diffraction power of T(0,0) is calculated by 1-R, where R is the summed diffraction power of all the reflection orders. This is a mode that is especially designed for CMOS diffraction. For a CMOS sensor, light will never “transmit” but absorbed by the silicon layer, which is further converted electric power. We need recalculated the “non-reflection” power to approximate the absorbed power and put them in T(0,0) order. More details about simulating CMOS will be discussed in a separate article.
For example, if we set the Test Mode parameter to 1+8=9, it means we need it to work in CMOS mode and export log file.
Tips and cautions
Stochastic Mode and Start/Stop X/Y Orders
When the Stochastic mode is turned on, we suggest users to set Start X=Stop X=Start Y=Stop Y=0. This is related to how the Diffraction DLL plugin works in OpticStudio. OpticStudio will always call the DLL for all the orders from (X Start, Y Start) to (X Stop, Y Stop). When Stochastic Mode is turned on, however, only the (X Start, Y Start) will be used by the DLL, all other calls for other orders are redundant and dramatically slows down the simulation speed.
On the other hand, if users wants to use X/Y Start/Stop Orders, the Stochastic mode needs to be 0, which means the Stochastic mode is turned. off.
Coming with this article, 8 examples are provided for users’ reference. The first example is a simple grating for demonstrating how to set up a grating. The next 3 examples (2-4) demonstrate the same json examples provided in the article Speos Lumerical Sub-wavelength Model. The final 4 examples (5-8) simulate the CMOS back diffraction effect. The system includes a cell phone lens model and a diffraction surface, which reads a json file for simulating the back diffraction effect on the CMOS sensor.
In this example, please especially check that we have used the same wavelength for the light source as the wavelength definition in the .json file. Also the refractive index at the two sides of the diffractive face is same as defined in the .json.
In this example, the json file is loaded on the object 2 Diffraction Grating's Face 1.
Since we have set the source to be with broadbanded wavelengths, we can see the "rainbow" caused by the diffraction grating.
This example is similar to the previous one. The only difference is we have replaced the json file by an 1D grating example.
In this example, we have a glass plate where a circular shaped grating placed on it. A collimated beam is incident on this grating. The grating will diffract the rays to a large angle which meets the TIR condition and then the diffracted rays propagate inside of the glass plate. This shows the very basic concept about how AR waveguide works.
It's worth to mention the set up of this example. As shown below the object 2 and 3 are overlapped as shown below. By Nest rule, the surface property at overlapped part will be dominated by the object with larger object number in the editor. In this case, the surface property at this overlap part will be dominated by object 3 which is the Face 1, providing the diffraction function.
It's also worth to mention that we have set up the system like this because of the coordinate system. First, we can check the local coordinate of object 3 by checking the option "Draw Local Axis" from the object property as shown below. It can be seen that the z axis of the object 3 is pointing to inner side.
On the other hand, if we look at the .json file, we can see it assumes the -z side (n_lower) has refractive index of 1.565 and the +z side (n_upper) has refractive index of 1.0. This is why we need to place the object 3 to be outside of the glass plate but overlap it to the glass plate (object 2). Note also this is why the Material of object 3 is blank which means refractive index is 1.0, which makes sure the index at +z side is 1.0. Similarly, the -z side of the object 3 has the refractive index of 1.565, which is from the Material of the object 2 (the glass plate).
By doing this we can make sure the refractive index condition in .json file matches to the settings in the OpticStudio. Note the data in json file is further from the settings in Lumerical. Fundamentally, we are matching the coordinate systems between Lumerical and the object in OpticStudio when assign the json file to an object.