Simulating diffraction efficiency of surface-relief grating using the RCWA method

In this article, several Dynamic Link Library (DLL) files that have been added since OpticStudio 20.1 are introduced. They are all diffractive DLLs to model surface-relief 1D gratings.

In this article, the methodology used in the DLLs will first be briefly introduced, and then the DLL parameters will be explained. The last part demonstrates two examples.

This article will also explain how to use the Vizualisation tool to check the grating profiles.

These features are only available in the Premium Subscription edition of OpticStudio. 

Authored By Michael Cheng

Downloads

Article Attachments

Introduction

Surface-relief gratings (SRGs) are widely used in many types of traditional optical systems, such as spectrometers, beam splitters, 3D scanning systems, diffractive lenses, and pulse amplification systems. Recently, SRGs have become popular in modern applications, such as head-up displays (HUD), augmented reality (AR) and virtual reality (VR) head-mounted displays (HMD). Their ability to diffract rays in any desired angle, and their wavelength and angular selectivity allow the creation of optical systems that are more compact and lighter than traditional designs, where complicated and bulky structure with prisms and freeform surfaces are usually required to achieve the same performance.

OpticStudio has supported the simulation of gratings for a long time but without considering the diffraction efficiency. To accurately account for the diffraction efficiency and the polarization state of diffracted rays, characteristics of gratings like their microstructure is important to consider in the optical simulation.

In this article, two DLLs to model a Trapezoid and a Step grating profile will be discussed.

Surface-relief grating vs. volume holographic grating

Before introducing this model, let’s explain briefly the difference between a Surface-Relief Grating and a Volume Holographic Grating (VHG). These two gratings are almost the same in terms of their role in the optical system but are quite different in terms of their fabrication and simulation.

 

Figure 1. (a) Surface-relief grating has uniform refractive index distribution but periodic microstructure on its surface. (b) Volume holographic grating has periodically varying refractive index distribution but smooth surface. 

The SRG, as shown in Figure 1(a), can be fabricated by several methods, such like lithography, nanoimprinting, or diamond turning. Unlike the VHG, the SRG doesn’t have a spatially varying refractive index. Instead, the surface of the grating is made of periodic microstructures. To model a SRG, an algorithm like the Fourier Modal Method, also called RCWA [1], is required.

The VHG, as shown in Figure 1(b), is fabricated by exposing two or more beams on a light-sensitive emulsion film. The film is then chemically or thermally developed: that’s the grating. The surface on the grating is smooth, but the refractive index inside the grating varies sinusoidally. To model a VHG, algorithms such as efficient Kogelnik’s theory [2] or robust Rigorous Coupled-Wave Analysis (RCWA) are required [3].

OpticStudio provides DLLs for both. Presented in this article are tools for modelling the diffraction efficiency of SRGs.

See the knowledge base article, Simulating diffraction efficiency of volume holographic grating using the Kogelnik’s method, for tools for VHG.

Fourier Model Method (Rigorous Coupled Wave Analysis)

Let’s review quickly the theory used in the SRG DLLs.

Fourier Expansion

Figure 2. Maxwell’s equation is expanded in Fourier space. The permittivity ε and permeability µ are written in Fourier series, where the Λx and Λy are period in x and y directions, a and b are coefficients of each Fourier item, and (m,n) are integers. The electric field E and magnetic field H are written as a combination of plane waves, where S and U are intensity of each plan wave and k are wave vectors. E, H, S, U, and k are all vectors and represent (Ex,Ey,Ez), (Hx,Hy,Hz), (Sx,Sy,Sz), (Ux,Uy,Uz), and (kx,ky,kz).

Concept of layers

One important concept about the RCWA is layers. The theory assumes that the grating structure is uniform in the Z-direction and periodic in the XY direction. If the structure is not uniform in the Z direction, it’s considered as a combination of multiple “layers”. At each layer, the structure is uniform in the Z-direction as shown in Figure 3.

 

Figure 3. In algorithm of RCWA, the microstructure is sliced into several layers, where the structure is uniform in z direction at each layer.

Basically, the more layers that are used to sample the structure, the more accurate the simulated result will be, but the slower the calculation speed will be too. It’s a balance between accuracy and speed.

The DLL models contain parameters to control the number of layers.

  • In the srg_trapezoid_RCWA.dll, it is “# Layer”.
  • In the srg_step_RCWA.dll, it is “lays of 1 stp”.

See the following section for more explanations about these parameters.

Concept of harmonics (orders)

When a plane wave hits a grating surface, light is diffracted toward discrete directions, which is called a harmonic or an order. A Harmonic is like a layer; the more harmonics are included in the calculation, the more accurate but the slower the calculation will be. The number of harmonics is controlled by the parameter “Max Order” in both DLLs.

For example, if Max Order is set to 3, it means that harmonics of -3, -2, -1, 0, 1, 2, 3 are considered in the calculation. Usually some tests are required to find the best value to balance speed and accuracy. A rule of thumb for the Max Order initial value is to set it equal to 3*(grating period)/(light wavelength). Figure 4 shows an incident ray being diffracted into multiple orders with a 1D grating.

Figure 4. When a ray is incident on a grating, it splits into several orders.

Link to ray-tracing model

In the RCWA algorithm, the electromagnetic field is Fourier expanded. The electromagnetic fields are decomposed into multiple plane waves in the grating structure. After calculation, the RCWA gives the output wave’s electric field and the propagation direction for each order based on the input light and the grating structure.

OpticStudio simply links these plane waves to rays in the ray-tracing model.

Figure 5 shows how a ray in the ray-tracing model is considered as a plane wave in the RCWA model.

Figure 5. When a ray in ray-tracing code is incident on a grating, it’s considered as a plan wave and passed to RCWA code. The corresponded output plane waves calculated by RCWA are then converted to a ray again passed back to ray-tracing code again.

Note that the depth of the grating is only used by the RCWA code to calculate efficiency. In the ray-tracing code, the grating is still treated as an infinitely thin surface.

Figure 6 shows the relationship between incident, diffracted rays, and the grating in a macro view.

Figure 6. From viewpoint of ray-tracing code, the grating structure is considered as an infinitely thin surface. Any ray hitting the surface is diffracted into several order with different propagation direction and electric field given by RCWA code.

How to set up a grating with the DLLs

Add grating to the system

In this section how to set up a Step grating or a Trapezoid grating in Non-Sequential mode will be explained.

To add a grating in Non-Sequential mode, the Diffraction Grating Object or the User Defined Object with the DiffractionGrating.dll can be used. Other diffractive objects are not supported currently as the DLL assumes the diffractive surface is in the XY plane.

  • If the grating aperture is circular, the Diffraction Grating Object is used.
  • If the grating aperture is rectangular, the User Defined Object with the DiffractionGrating.dll is used.
  • If the aperture is arbitrary (neither circular nor rectangular), the Boolean Native or the Boolean CAD Objects can be used along with the Extruded object.

circular_and_rectangular_grating

Figure 7 For circular grating, use Diffraction Grating. For rectangular grating, use User Defined Object with DiffractionGrating.DLL.

Then in the Object Properties, click on Diffraction and select srg_step_RCWA.dll for the Step grating orsrg_trapezoid_RCWA.dll for the Trapezoid grating.

The parameters in the Reflect and Transmit columns should always be identical.

The parameters are described in the following section.

Figure 8. The DLLs introduced in the article can be applied by setting it up in Object properties.

Coordinates and orientation of the grating

The grating is on Face 1 of the object as shown in the Figure 9. Currently only 1D gratings are supported. It’s assumed that the grating is uniform in the Y-direction and has a periodic profile in the XZ plane. When setting up the grating in the optical system, users should pay attention to the grating orientation.

Figure 9. The grating is always on the Face 1. Currently it only supports to be applied on two objects: Diffraction Grating and User Defined Object reading DiffractionGrating.dll.

DLL parameters

In OpticStudio 20.3, there are totally 5 RCWA DLLs for simulating different shapes of 1D gratings:

  • srg_trapezoid_RCWA.dll
  • srg_step_RCWA.dll
  • srg_blaze_RCWA.dll
  • srg_GridWirePolarizer_RCWA.dll
  • srg_user_defined_RCWA.dll

This section describes the parameters of these DLLs, starting by the common parameters that all DLLs shared and then continuing with the specific parameters for each DLL.

Common parameters

The following parameters have same meaning in all the RCWA DLLs.

+Period/-Freq (µm)

This is the groove period in µm.

  • When the “+Period/-Freq(um)” value is positive, it corresponds to a groove period (µm). 
  • When it’s negative, it corresponds to a groove frequency (1/µm). Period and frequency are the reciprocal of each other.

Figure 10. The groove period of a 1D grating.

It's suggested the period not to be too large, like 100 times of the incident wavelength. This means the required Max Order is very large to have a accurate result. See the “Concept of harmonics (orders)” section for a suggestion of initial value for Max Order.

Max Order

See the “Concept of harmonics (orders)” section.

This is currently limited to 10 (totally 21 harmonics). When the number is larger than 10, it’s modified to 10 in the DLL. Contact support team to increase the limitation.

Rotate Grating (deg)

This parameter allows the user to rotate the grating lines’ direction. 

  • When it’s set to zero, the grating lines are along the Y direction, which means the rays are bent in the X direction.
  • When it’s set to non-zero, the grating lines rotate in counter-clockwise direction (+X  +Y) with positive value and clockwise with negative value. Note the X and Y directions described here are based on the local coordinate system of the object.

Figure 11 An example how the grating is rotated by 135 degrees.

Use Coating File

This parameter is a flag. If it’s a non-zero positive integer, it indicates that the dispersion data (index vs wavelength) is defined in a text file. The text file must be saved in {Zemax}\Coatings\COATING_xx.dat, where xx is a positive integer specified in the “Use Coating File” parameter. 

For example, if Use Coating File is set to 7, the dispersion data will be read COATING_7.dat.

In the COATING_xx.dat file, the dispersion data is defined as described in the Help files under The Libraries Tab > Coatings Group > Defining Coatings > The MATE Data Section. The material name should always start from RCWAxx, where xx is a two-digit integer. Any text can then follow. 

For example, we could define RCWA01TIO2. The DLL will read the RCWA material number 1 and will ignore the TIO2 text that follows. Figure 12 shows an example of a coating file with several material dispersion data.

Figure 12 An example of how dispersion data can be defined in COATING_xx.dat.

The material number can either be assigned to Index Grate (R), Index Env (R), or Index Coat (R). Use a negative integer equal to the material number multiplied by -1. 

For example, if we want to set RCWA02 as the index data for Grate region, we just set Index Grate Index (R) to -2. 

See sections “Index Grate (R), Index Grate (I), Index Env (R), Index Env (I)” and “Index Coat (R), Index Coat (I), Coat Thick Top (µm), Coat Thick Side(µm)” for further details about Grate, Env, and Coat regions.

Interpolation

This parameter should be an integer.

  • If it is zero, the DLL doesn’t use the interpolation mode.
  • If it’s set to a non-zero value, the DLL works in interpolation mode, meaning that the DLL will cache the RCWA data in the RAM when calculating. The data is then used to interpolate for further ray-tracing. This can dramatically increase ray-tracing speed when tracing many rays in the system, for example, tracing more than one million rays.
  • When Interpolation is set to 1, a 201 by 201 sampling grid is used. 
  • When it’s larger than 1, it means the size of the sampling grid. In other words, users can define the size of sampling grid by set Interpolation to a number larger than 1. Note however the minimum sampling grid size is 21.
  • When Interpolation is set to a negative integer, the DLL will take the absolute value to find the sampling grid, but will use a different method for interpolation. This interpolation method is more accurate but slower. 

Setting the Interpolation parameter is defining the right balance between the speed and accuracy.

Figure 13. When parameter Interpolation is non-zero integer, the interpolation mode is turned on. When it’s negative, a different interpolation method is used. This method for negative Interpolation is slower but more accurate.

How does the Interpolation Mode work?

Firstly, a sampling grid is defined in LM space. When a ray is incident on the grating, the ray direction can be represented by an unit vector written as (L,M,N). The LMN is also called direction cosines of the rays. When a ray hits the grating, its direction cosines in x and y directions, L and M, are mapped to the LM space. Then the nearest four sampling points are checked. If there is no RCWA data already calculated at any of the four points, the data is calculated and saved in the RAM for those points. The RCWA data for the incident ray is then linearly interpolated from the four points. Note that the interpolation is not only done for the diffraction efficiency, but it is done also for the electric field. In other words, the change of phase, polarization state, and amplitude are fully considered in the process of caching data and interpolation.

If the grating parameters or the wavelength of light changes, the DLL will create another sampling grid to save the RCWA data. Note that, for this reason, during optimization, if any grating parameter are variable, the cache will be re-calculated at each cycle. This means the interpolation still speed up the optimization when many rays (ex. > 1000) are traced through the grating. However, if only a few rays (ex. < 10) are traced through the grating during optimization, it’s suggested to turn off interpolation.

See the section “Optimization” for further discussion.

Figure 14. When working in interpolation mode, diffraction data is calculated as described in the figure.

Only these orders

When the parameter “Only these order” is 0 or negative, the DLL works as usual. All orders are traced. When it’s a positive integer, this parameter allows users to specify the diffraction orders in transmission and reflection that the user wants to trace.

The “Only these orders” is just an integer so here is how to define it. The table below maps the orders to unique positive integers.

The “Only these orders” is the sum of 2^(unique positive number). 

For example, if the user wants to trace the zero order in reflection (R0) and the 1st order in transmission (T+1), the “Only these orders” should be set to 2^0 + 2^5 = 1 + 32 = 33.

Figure 15 The parameter “Only these Orders” allows users to specify a specific set of orders to trace.

Note that when using this parameter, the Start Order and Stop Order should define a range that includes the orders defined by the “Only these orders” parameter.

This parameter can also be set up with the visualization tool. It is an easier way as no calculation is needed.

Figure 16 There is a tool in visualization tool to set up the Only these orders parameter.

Stochastic mode

  • This can also be called Monte Carlo method or probabilistic splitting.
  • When this parameter is 0, the DLL works as usual.
  • When it’s 1, 2, or 3, the Stochastic mode is turned on. When Stochastic mode is turned on, the DLL diffracts rays randomly as shown in Figure 17. The probability of each diffraction order to be traced is based on the energy ratio between diffraction orders.

Figure 17 Stochastic mode diffract rays randomly for any incident ray. Which diffraction order to diffract depends on energy ratio of in each order. This picture shows the case that only 1 ray is randomly diffracted.

  • For each incident ray, there can be any number of out rays. The number of rays to be diffracted is decided by calculating (Stop Order - Start Order + 1). In other words, users can set the parameters Start Order and Stop Order to define number of out rays. Similarly, during ray-tracing, the diffraction order of each out ray is randomly decided. Each out ray brings power of Pi/n, where Pi is the incident ray power and n is the number of out rays.

Figure 18 In Stochastic mode, 1 incident ray can be diffracted into several out rays.

Note that if “Only these orders” is not zero, the Stochastic mode works as below.

  • When Stochastic mode is 1, “Only these orders” are ignored.
  • When Stochastic mode is 2, the Stochastic mode works first and then the “Only these orders” parameter is considered. One ray may be randomized by the Stochastic mode but blocked by the rule set by “Only these orders”.
  • When Stochastic mode is 3, “Only these orders” works first and the Stochastic mode later. The grating still diffracts rays in a random manner, but diffracted rays will always be randomized within the set of orders specified by “Only these orders”.

Error Log

If this parameter is set to non-zero, a log text file(*.txt) will be written to report calculation errors. The log text file will be saved under {Zemax}\DLL\Diffractive\ and it will have the same filename as of the diffractive DLL. This parameter should normally be set to zero unless any unknown error occurs.

See the section “Geometric Error” for further information about how to check for parameter error.

Trapezoid parameters

The following parameters are specific to the Trapezoid Grating (“srg_trapezoid_RCWA.dll”).

Depth, Alpha (deg), Beta (deg), and Fill factor

These 4 parameters control the grating profile as shown below.

  • Depth is simply the grating height as shown in Figure 19.
  • Alpha and Beta are positive in direction rotating from -z to +x and negative in direction rotating from +x to -z. In Figure 19, for example, Alpha is positive, and Beta is negative.
  • The Fill factor is a number between 0 and 1, which represents the ratio of bottom-side base to the groove period.

Figure 19. Trapezoid grating’s 4 parameters that defines the shape. In this figure, Alpha is positive and Beta is negative.

Index Coat (R), Index Coat (I), Coat Thick Top (µm), Coat Thick Side(µm)

These 4 parameters are used to model a coating on the grating. The DLL allows users to define a top thickness (Coat Thick Top(µm)) and a side thickness (Coat Thick Side(µm)).

Note that the thickness of the coating is not included in the Depth parameter. For example, if the Depth is 5 µm and the Coating Top Thickness is 200 nm, the total thickness of the grating will be 5.2 µm.

Figure 20. The Coating thickness at top and side in trapezoid gratings.

 

As the coating material can be a metal, the DLL provides two other parameters to define the complex index of refraction of the coating material: Coat Index (R) for the real part and Coat Index (I) for the imaginary part. In OpticStudio, the convention is that the imaginary part of the index is negative for an absorbing material. Coat Index (I) cannot be positive. For example, the complex index of refraction of Aluminum is of 0.7-7.0i.

The Index Coat (R) cannot be zero but can be a negative integer. When it’s a negative integer, it means dispersion is defined separately in a text file. See section of Use Coating File for more details.

Index Grate (R), Index Grate (I), Index Env (R), Index Env (I)

The grating structure can be separated into 2 different regions as shown in Figure 21: Grate and Env, which represent the grating and its environment. The grating is surrounded by Outside and Substrate regions. The indices at the Substrate and Outside regions are defined by the optical system. The indices at Grate and Env are defined by the DLL parameters. 

The DLL contains four parameters to define the Grate and Env indices.

  • Both indices at Grate and Env regions are defined by a complex index. 
  • For the Grate region, the real and imaginary parts of the index are defined by the Index Grate (R) and Index Grate (I) parameters. 
  • For the Env region, the real and imaginary parts of the index are defined by the Index Env (R) and Index Env (I) parameters.
  • There is a special rule when the real part of the index is set to zero in the Grate and Env regions. If the Index Grate (R) is set to zero, it means the Index Grate is equal to the Substrate Index. The Substrate Index is defined in the optical system. Similarly, if the Index Env (R) is set to zero, the Index Env region is equal to the Outside Index.
  • The Index Grate (R) and Index Env (R) can be negative numbers, which means a dispersion data is separately defined in a text file. 

See the section Use Coating File for more information.

Figure 21 The trapezoid gratings are separated into to two areas: Grate and Env. The indices of the two areas can be separately defined.

Number of Layers

This parameter is the number of layers used to model the trapezoid shape. For more information, check the “Concept of Layers” section.

Blaze parameters

The following parameters of the Blaze Grating (“srg_blze_RCWA.dll”) are same as the Trapezoid Grating (“srg_trapezoid_RCWA.dll”) except there is no parameter “Depth”.

For Blaze Grating, the depth is automatically calculated inside depending on the given parameters Alpha and Beta as shown in Figure 22.

Figure 22 Shape of a blaze grating is defined by Fill factor, Alpha, and Beta.

Step parameters

The following parameters are specific to the Step Grating (“srg_step_RCWA.dll”).

Depth, Number of steps and Alpha (deg)

  • Depth is the height or thickness of the grating as shown in the Figure 22.
  • The “Number of steps” parameter controls how many steps the grating should have as shown in Figure 23. In reality, this is usually related to the fabrication process. Note the shape of the grating is “going down” toward +x direction as shown in the following picture. To reverse the direction, users should rotate the grating object by 180 degrees around the local z axis of the object.

Figure 23. The “Number of steps” parameter defines the number of steps to model the shape at each period.

  • The parameter Alpha defines an oblique angle at the other side as shown in the following picture. The sign of Alpha is positive when rotating in direction from +z to -x. The Figure 24 shows an example where Alpha is positive.

Figure 24. The parameter Alpha defines the oblique angle at the other side. In this figure, Alpha is positive.

Layers per step

This parameter defines the number of layers per step. This parameter should only be used when the parameter Alpha is not zero. Otherwise, it’s meaningless as the calculated result won’t change. The following picture shows how this parameter affects the sampling of the oblique surface.

Figure 25. The “Layers per step” parameter defines the number of layers per step.

Index Coat (R), Index Coat (I), Coat Thick Top (µm), Coat Thick Side(µm)

The definition of these parameters are the same as that for the Trapezoid Grating. See explanations in the section of the Trapezoid grating.

Figure 26 The Coating thickness at top and side in step gratings.

Index Grate (R), Index Grate (I), Index Env (R), Index Env (I)

The definition of these parameters are the same as that for the Trapezoid Grating. See explanations in the section of the Trapezoid grating.

Figure 27 The step grating is separated into two areas: Grate and Env. The indices of the two areas can be separately defined.

Grid Wire Polarizer parameters

The following parameters are specific to the Grid Wire Polarizer Grating (“srg_GridWirePolarizer_RCWA.dll”).

This grating is basically a binary grating. This DLL can be used to model a grid wire polarizer.

Depth (µm) and Fill factor

  • Depth is the height of the grating. 
  • Fill factor is a value in between 0 and 1 that represents the ratio between the width of the Grate area and the grating period as shown in Figure 28.

Index(R) and Index (I)

Similar to Trapezoid, Blaze, and Step grating, the structure of Grid Wire Polarizer grating can be separated into 4 regions. The two parameters define the complex refractive index of the Grate region as shown in Figure 28.

Refractive index at Env region cannot be defined in the DLL and is always same as the material at Outside area. The refractive index at Outside and Substrate regions are both defined in OpticStudio and cannot be changed with the DLL parameters.

Figure 28 The Grid Wire Polarizer grating can be separated into 4 areas: Outside, Grate, Env, and Substrate. The shape is defined by Depth and Fill factor.

User Defined Grating parameters

There is only one specific parameter for User Defined Grating (“srg_user_defined_RCWA.dll”).

File Number

The parameter must be an integer in range of 1~99. The DLL will read grating data from a text file “user_grating_data_xx.txt”, where xx is the “File Number” parameter, in the folder \Documents\Zemax\DLL\Diffractive\.

The DLL will only read the user defined grating text once and the data is saved in the memory. If the text is modified and a reload is desired, set the “File Number” parameter to negative. Make sure at least one ray is traced through the grating in the system to trigger the reloading: update the Layout plot or run a raytrace using the Ray Trace Control. Once the shape data is updated, remember to set the “File Number” parameter back to a positive value so that the DLL does not always reload the text file to update the grating data.

Figure 29 User defined grating data is written in a text file “user_grating_data_xx.txt”, where xx is an positive integer number, and can be read by using DLL “srg_user_defined_RCWA.dll”.

File format for user defined grating

The grating shape is defined by several layers. Each layer is defined by a background material and optionally contains several sections of other materials. For more information on layers, see the “Concept of layers” section

The user defined grating text file contains 3 keywords: “Number of layer”, “Layer”, and “Section”. When the DLL reads the file, it scans the text line by line to find these keywords. Once a keyword is found, it reads the data on the next line. The keyword line and the following line must follow the file format as explained below. Otherwise, any text can be added in the file for convenience.

Number of layer

The line following the “Number of layer” keyword should include one integer that represents the number of layers defined in the text.

Layer

The line following the “Layer” keyword includes 4 numbers for (1) number of sections to add in this section, (2) thickness of the layer in micron, (3) real part of the refractive index, and (4) imaginary part of the refractive index. The refractive index here is the “background index”.

Section

The line following the “Section” keyword includes 4 numbers for (1) shift amount of this section, (2) width of this section, (3) real part of the refractive index, and (4) imaginary part of the refractive index. Note that both the shift and the width have no unit. They represent a ratio to the period. The refractive index here is the “section index” which overwrites the background index. The value of shift defines the section the center position relative to left edge of a single period box. See Figure 30 for an example of shift = 0.5 and width = 0.5, which defines a section start from 0.25 and end at 0.75.

Example of user defined grating data

Figure 30 shows an example of a user defined grating data text file on the right-hand side and the resulting grating on the left-hand side. In this example, all layers have exactly one section, but a layer can have zero section or more than one section. Also note, when there are two materials exist in one layer, one should be defined as “background index” and the other is defined as a section. Which one to be the background index is arbitrary and up to users.

Figure 30 An example of user defined grating. Shift is relative to left edge of a single period box. Width is centered by the position defined by the shift.

A tool to edit user defined grating

While the user defined grating data can be directly edited in a text editor like Notepad, it can also be edited in a visualization tool as shown in Figure 31. Users need to set up a dummy system with the “srg_user_defined_RCWA.dll” DLL to read this text file. The visualization tool can also read out the grating data defined by other RCWA DLLs.

However, after editing, the data can only be exported as a user defined grating data.

Figure 31 The visualization tool includes a sub-tool for load, edit, and save user defined grating data.

Visualization tool

A visualization tool can be run to help users define the grating parameters. Click on Programming … User Extensions … RCWAvisualization.exe  as shown in Figure 32.

Figure 32 The visualization tool can be opened from the Programming tab > User Extensions.

The user interface of the tool is shown in Figure 33. 

Figure 33 The user interface of the visualization tool

The visualization includes 4 sections. Each section is introduced below.

Section “Step 1 - Load DLL”

The Object drop down menu will automatically list objects in the non-sequential editor that use a RCWA DLL. To change the object, select a different object and click on Load.

Section “Step 2 - Set parameters”

  • The Substrate material and Outside material are only used for drawing and don’t necessarily reflect the true settings of the system. Glass name like “N-BK7” can be used.
  • The parameters names and current values of the RCWA DLL on the selected object are shown. The parameters in the table can be modified and applied to system by clicking the “Set to object” button. Note that this button can generate several “undoes” in OpticStudio because setting each diffractive parameter is considered as a single action.
  • At the bottom of this section, a convenient tool can be used to set up the “Only these orders” parameter. See the section “DLL parameters > Common parameters > Only these orders” in this article for more information.
  • The “Create MCE” button can create operands in the multi-configuration editor for all DLL parameters. The transmit parameters will be set to pick data from the reflect parameters. This is useful for modifying systems. Also, this is required to optimize the grating parameters.
  • The Min and Max columns are explained in the section “Step 4 – Setup system” below.

Figure 34 The “Create MCE” button creates operands for DLL parameters in the multi configurations editor.

Section “Step 3 - Grating editor”

  • Click “Load from DLL” to read grating data from the DLL and to visualize the two charts. If the DLL parameters are incorrect and cannot be drawn, an error will show as in Figure 35. This is a very useful tool to check whether the DLL parameters are correct.
  • The top chart displays the defined profile of the DLL. It shows the index of refraction the grating profile.
  • The bottom chart displays the same profile which is rebuilt from Fourier series, used in the RCWA algorithm. This is mainly used for checking whether the RCWA algorithm “sees” correct data.
  • Note that, because of the limitation of the ZOS-API, currently the indices of the Outside and Substrate regions in the grating visualization chart need to be redefined. The tool cannot automatically read these values. To redefine them, use the two text boxes called “Substrate material material” and “Outside material” in the section “Step 2”.
  • If the “Load from text” button  is clicked, the grating data is read from a user defined grating data in a text file. See the section “DLL parameters > User defined grating Parameters” for more information.

There is an editor showing the grating data layer by layer in details, as shown in Figure 31. These data can be edited and the result will be updated in the charts in real-time. The “Insert” and “Delete” keys on the keyboard can be used to add or remove lines in the editor.

However, note that even if the grating data can be edited in the editor, the data cannot be directly pushed back to the system. It can only be exported to a text file. This text file then can be read by RCWA DLL “srg_user_defined_RCWA.dll”. See the section “DLL parameters > User defined grating Parameters” for more information.

Figure 35 A message box shows when a parameter errors are detected by the visualization tool.

Section “Step 4 - Setup system”

This section provides a convenient tool to generate a system for analysis or optimization of a single grating.

  • The first two tables allow users to set up incident angles and wavelengths to analyze. The field angle follows same convention as the Field Angle in sequential mode.
  • The “Field Wizard” is an experimental feature for defining the table of field angles. 
  • The polarization part defines which polarization to trace. If “Both” is selected, two rays will be built for each combination of field and wavelength for X and Y polarizations.
  • A single order in transmission or reflection need to be chosen to be analyzed or optimized in the system.
  • If the “Rays from substrate” option is checked, incident rays comes from the grating substrate. Otherwise rays come from outside the substrate and hit the grating.
  • After setting up the system, click “Create test system” and then a testing system file is generated in “\Zemax\Samples\RCWA_Analyze_x.zmx”, where x is an accumulated integer number. The system includes the grating, detectors, and several testing rays as shown in an example in Figure 36. A merit function is also generated to read the diffraction power for each incident ray and target to 100% as shown Figure 37..
  • In the “Step 2 - Set parameters” section, any parameter in the Max column is larger than in the Min column, then in the generated testing system, the parameter is set as variable and is constrained in the merit function as shown in Figure 37.

Figure 36 An example of how the testing system is created by the visualization tool.

Figure 37 When the visualization tool generates a testing system, the required operands are also created in the merit function editor and the multi configuration editor.

FAQ

Comparing to built-in diffraction model

As discussed above, the grating models are based on the RCWA algorithm. So what is the difference between this new RCWA model and the original built-in diffraction grating models?

The answer is that the models are identical in terms of diffraction direction but different in terms of electric fields for the diffracted rays.

Both RCWA core and built-in diffraction model calculate diffraction rays based on the following equation.

where  and  are unit vectors of incident and diffracted rays,  is the unit normal vector,  is the unit grating vector, Λ are period of the grating, n1 and n2 are refractive indices of materials in where the incident and diffracted rays are, and m is an integer representing the diffraction order.

The following figure shows these vectors on the grating.

Figure 38. In this diagram, the incident ray, diffracted rays, normal vector, and grating vector are drawn.

The main difference is that RCWA code will define the diffracted ray’s electric field while the built-in model cannot.

Optimization

One of the benefits of integrating RCWA code into OpticStudio is the ability to optimize grating parameters while fully considering the whole optical system. As the RCWA algorithm is computationally intensive, the following points are suggestions to get a faster and smoother optimization.

  • The first suggestion is about the Interpolation mode parameter. During optimization if the grating parameters or the wavelength are set as variable, it’s suggested to only turn on interpolation mode when many rays (ex. >1000) will be traced through the grating.
    The reason is, during optimization, if the grating parameters or the wavelength are set as variable, their value varies randomly and very frequently by the optimizer. Every time a new combination of grating parameters and wavelength is detected, the DLL will create a new sampling grid in the RAM and all efficiency data on the sampling grid will be re-calculated. This is OK if we will trace many rays through the grating. However, if we trace only 1 ray during optimization, and the grating parameters or wavelength are set as variable, it’s suggested not to turn on interpolation because it’s not faster.
  • The second suggestion is to only optimize the system with carefully selected rays. For example, for any beam, we can use a chief ray and a few marginal rays to represent the whole beam. We can use Source Ray to easily achieve this. The Source Ray is a source object that will always launch rays from a specified position (x,y,z) with a specified propagation direction (l,m,n).
    Also, remember the any polarization can be decomposed into two orthogonal one. Instead of “Random” polarization, we can specifically define the polarization for Jx and Jy to optimize. That can be more efficient than using random polarization. 
    By choosing rays carefully, the optimization be much faster than using a real source with thousands or millions of rays.

Figure 39. The polarization state of a source object in non-sequential mode can be defined in the Object property.

Geometric error

The DLLs have several errors checks inside the code to avoid a parameter error, which an  invalid combination of parameters combination, which is called parameter errors. When the DLL detects an parameter error, it stops the calculation and returns a “Geometric Error” message. The easiest way to findcheck if there is anya parameter error is to open the visualization tool. See the section “Visualization tool” for more information. 

In addition to parameter errors, there are some errors errors that also returns Geometric Error that  while cannot be spotted by the visualization tool. These are called calculation errors. To findcheck if there is anya calculation error happening inside the DLL during ray-tracing, the Error Log needs to be turned on. See “Error Log” for further information.

Listed below are the most common reasons for these geometric errors and how to solve them where possible.

  • License, OS version, OS edition, and expiry date

The two DLLs are implemented in OpticStudio version 20.1 (21/01/20). It’s only available for Premium subscription licenses. The DLLs will expire in about one year after the launch of OpticStudio 20.1. If the DLL detects that any of the above conditions are not met, it stops calculating and returns error. The error message can look like below.

Figure 40. The error message for invalid license, expiry date, or OpticStudio version.

  • Split NSC Rays

To use the DLL model, the option Split NSC Rays must be turned on. If not, the DLL stops calculating and returns error. Note the settings can be set up separately in the Ray Trace Control dialog, 3D Layout, and Shaded Model. Users should carefully check that all of them are correctly set up.

  • Grating parameters

One of the most common reasons for geometric errors are a non-physical grating parameter. This error can be reported by visualization error.

  • Maximum RAM space

As explained in the section “Interpolation” and “optimization”, internally there is an upper limit for the maximum RAM space used by the DLL. When the limit is reached, the DLL stops calculation and return geometric errors.

This problem can be solved by either turning off Interpolation mode or restarting OpticStudio to release the RAM spaces allocated by the DLL.

Note that normally this limitation won’t be reached as long as the system is not optimized with grating parameters or wavelengths as variable.

This error can be reported by Error Log.

  • Grazing incident angle

When the Interpolation is turned on, if rays are incident on the grating with too large angle, the DLL will return geometric error. This is because at the edge of the sampling grid, there is no extrapolation. The error happens when the incident angle is roughly larger than 89 degrees. The problem can be resolved by turning off the Interpolation.

  • Evanescent wave
    In a special case where the incident ray satisfies one of the following 3 conditions, the DLL cannot calculate and returns geometric error.
    • (L + m*λ/Λ)^2 + M^2 = 1
    • (L + m*λ/Λ)^2 + M^2 = n1^2
    • (L + m*λ/Λ)^2 + M^2 = n2^2

where (L,M) are incident rays’ x and y direction cosines relative to the grating’s local coordinate, λ is the wavelength of light, Λ is the grating period, n1 is the refractive index at incident side, n2 is the refractive index at transmission side, and m is an arbitrary integer number.

If any integer number m can make any of above 3 equations true, the DLL cannot calculate and returns a geometric error.

Note that this error is quite unlikely to happen as only a few rays will meet the conditions and are stopped. In our experience, the most probable situation where users will encounter this issue is when the wavelength of light is the same as the grating period and a ray is normally incident on the grating. In this case, the problem can be resolved by slightly changing the grating period, for example, from 0.55 µm to 0.55001 µm.

This error can be reported by Error Log.

  • Energy conservation

In the RCWA model, every time a calculation for a ray is done, the DLL code tests whether energy is conserved. This error can be reported by Error Log.

Limitations and feedbacks:

The current DLLs support only 1D gratings and on a planar substrate. They do not support diffractive lenses.

This is not a limitation of the RCWA algorithm, so if you are interested in any of these features, please send your feedback to the support team at support@zemax.com

On the other hand, this DLL is mainly designed for small period. If the period is larger than, for example, 100 times of the incident wavelength, many harmonics need to be considered in the calculation, which is very slow and requires much RAM in PC.

Examples

Example 1: Efficiency of the Trapezoid grating

This example reproduces the result found in Fig. 4(a) in the paper: "Design and fabrication of binary slanted surface-relief gratings for a planar optical interconnection." Applied optics 36.23 (1997): 5717-5727.

Open the file called “verify_1997_Design_and_fabrication.zar” in the attachments.

The file contains a Source Ray that emits a ray inside the Diffraction Grating Object (see the Inside Of flag for the source). The front face of the Object is diffractive and uses the “srg_trapezoid_RCWA.dll”. Two Detector polar Objects measure the transmitted (Object 4) and reflected (Object 5) light.

Figure 41. (a) shows the non-sequential component editor for example 1. (b) shows the layout for example 1.

  1. System wavelength = 0.633 µm
  2. Object 1 is a User-Defined Object reading the DiffractionGrating.dll. It is a rectangular volume with a simple linear grating on the front face with user definable dimensions in x, y and length. This example shows how to define and test a diffractive object. Any ray traced to the front face will call the associated diffraction DLL defined under Object Properties > Diffraction.

Under Object Properties > Diffraction, the DLL srg_trapezoid_RCWA.dll is selected and set as below.

  • The grating period is 0.943 * wavelength = 0.596919.
  • The grating depth is 1.058 * wavelength = 0.669714.
  • The Fill factor is 0.5.
  • The angle of Alpha and Beta are 30 degrees. Note the sign of the Alpha and Beta depends on how you set up the system. In the paper this angle is -30 degrees, but it’s 30 degrees in our system.

Figure 41. Settings of diffraction grating in example 1.

  1. Note both the Start Order and Stop Order are set to 1 in the above picture. It means that only the first diffraction order is traced. Other orders are ignored. It is helpful to observe the behavior of a specific order.
  2. A merit function is built as below. This is used to calculate the energy received on each detector.

Figure 42. Merit function in example 1. This is for calculating the energy detected by the detectors.

  1. The parameters of the diffraction DLL are entered in the Multi-Configuration Editor (MCE) as shown below. Note that the reflection parameters are simply picked up from transmission values.

Figure 43. The parameters for diffraction DLL can be exposed in multi-configuration editor. This is convenient because the transmission parameters can automatically pick up from reflection parameters as the line 28-40 in the figure.

  1. Finally, let’s use the Universal Plot 1D under Analyze > Universal Plot to verify the paper’s result.
  • The x axis in the following picture is the depth of the grating.
  • The y axis is the diffraction efficiency for different orders in reflection or transmission.

Note that when drawing the Reflected orders k=0 and k=2 (green and purple lines), the Start Order and Stop Order are changed to 0 and 2.

Figure 44. In the Universal Plot 1D, the y axis represents the diffraction efficiency, and the x axis represents the ray incident angle. Different lines represent different diffraction order in transmission or reflection.

The plot below shows the result from the reference paper.

Figure 45. Fig. 4(a) in the paper: "Design and fabrication of binary slanted surface-relief gratings for a planar optical interconnection." Applied optics 36.23 (1997): 5717-5727.

Example 2: Waveguide with Trapezoid gratings

This example will demonstrate the use of the Trapezoid grating in a waveguide system. Two Trapezoid gratings are on top of the waveguide. This file is attached as RCWA_trap_waveguide_addlens.zar.

As shown in the following pictures, on the left side, a Lambertian image source is located at the focal plane of a paraxial lens. The light from the image source is refracted by the paraxial lens and then coupled into the waveguide by the first grating. On the right side, a second grating is used to couple the light out. Finally, the out-coupled light is re-imaged by the second paraxial lens onto the detector, which is also at the focal plane.

Figure 46. The system layout for example 2.

They are some points that are worth mentioning in this example.

  1. In this file, we use the srg_trapezoid_RCWA.dll to build the gratings. Both gratings have the same shape, which is a binary grating with Fill factor = 0.5, Depth = 0.2 µm, and Period = 0.43 µm. The angles of Alpha and Beta are both 0. There is a 20 nm thick coating on top of the grating. Therefore, the total depth of the grating is 0.22 µm.

The following figure shows the structure at each period.

Figure 47. Refractive index distribution and thickness of each layers of the grating in example 2.

  1. The gratings are “User Defined Object” in the Non-Sequential Component (NSC) Editor. They are defined after the waveguide object, which is a Rectangular Volume. The gratings overlap Face 1 of the waveguide. Because they are defined after the waveguide, when a ray hits the overlapping surfaces, following the Nesting rule, the ray will see the gratings and be diffracted (See the Help Files section under The Setup Tab > Editors Group (Setup Tab) > Non-sequential Component Editor > Non-sequential Overview > Object Placement for more information).

Figure 48. The waveguide and the two gratings in the layout and the non-sequential component editor.

  1. Object 3 is a Source Rectangle that models a collimated beam with a rectangular shape. Object 2 is a Slide object. It is a color RGB transparent object defined by the “{Zemax}\IMAFiles\QR_code_Zemax.jpg” graphic file.

Figure 38. A testing picture used in the example 2. This is a QR code where the text inside is “http://zemax.com”.

The Slide object has Lambertian scattering properties. Importance Sampling is used so that only rays scattered to the paraxial lens are considered.

Figure 39. The scattering setting for the Slide (object #2) in the example 2.

The QR code is imaged through the waveguide. The simulated image on the detector is shown below.

Figure 40. Simulated image in the example 2 system.

References

  1. M. G. Moharam, Drew A. Pommet, Eric B. Grann, and T. K. Gaylord, "Stable implementation of the rigorous coupled-wave analysis for surface-relief gratings: enhanced transmittance matrix approach," J. Opt. Soc. Am. A 12, 1077-1086 (1995)
  2. Kogelnik, H., "Coupled wave theory for thick hologram gratings, " Bell Syst. Tech. J. 48, 2909-2947 (1969).
  3. Glytsis, E. N. and Gaylord, T. K., "Rigorous 3-D coupled wave diffraction analysis of multiple superposed gratings in anisotropic media," Appl. Opt. 28(12), 2401-2421 (1989).

KA-01898

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.