In this example, a slanted surface relief grating (SRG) is designed for coupling light into a waveguide for a monochrome augmented reality (AR) system using the RCWA solver. The geometry of the grating is optimized to direct normally incident light into the -1 grating order.

The grating characteristics are then exported into the Lumerical Sub-Wavelength Model (LSWM) JSON format for modelling this SRG in a system-level simulation in Speos (see Augmented Reality Optical System).

## Overview

Understand the simulation workflow and key results

The SRG geometry is parameterized in terms of its slant angle, fill factor, and height, as shown below:

The refractive index of the grating and the substrate is 1.8. The grating is surrounded by air. The period is fixed at 393 nm.

The grating will be optimized to transmit light at a wavelength of 550 nm into the -1 grating order. The RCWA solver is used for both the optimization and full characterization of the SRG. The RCWA solver object is used to define the simulation parameters and run the simulation for both steps.

### Step 1: Optimization of the In-Coupling Grating

The slant angle, fill factor, and grating height of the SRG are optimized to maximize the transmission into the -1 grating order for the S polarization at a wavelength of 550 nm at normal incidence using the built-in Particle Swarm Optimization (PSO) utility.

### Step 2: Full Characterization and Data Export

The grating optimization is performed with normally incident light from above the grating. However, once an optimized geometry has been chosen, the full grating characteristics must be calculated for the range of incident angles expected in the ray tracing simulation, as well as both forward and backward directions. The results are then exported to a JSON file that can be used in Speos or Zemax using a script.

## Run and Results

Instructions for running the model and discussion of key results

### Step 1: Optimization of the SRG Geometry

- Open and run the simulation file ar_srg.fsp.
- Right-click on the "grating_orders" result and select
**Visualize**>**New Visualizer**. - Click and drag on the plot to zoom in on the "Ts_grating" results (green line).

These results show that the initial design directs about 56% of the normally incident S-polarized light into the -1 grating order. Now we will optimize the grating geometry to increase this value using the optimization utility.

- Run the optimization object “optimization” in the
**Optimizations and Sweeps**window. - When the optimization is finished, apply the optimum geometry by right-clicking on the “optimization” object and selecting
**Apply best solution**.

The “optimization” object will optimize the slant angle, fill factor, and grating height of the SRG, which are defined as parameters of the “slanted_grating” Structure Group. The power transmitted into the -1 grating order for the S polarization is used as the figure of merit (FOM), as defined in the FOM script of the "optimization" object. The results are shown below:

The diffraction efficiency for the -1 grating order with the optimized geometry is about 94.7%.

Note that this type of grating can have multiple local maxima for this FOM [1]. While the built-in PSO tool is a convenient method for quick optimization, more advanced optimization methods can be used to fully explore the parameter space. See the Taking the Model Further section for more information.

### Step 2: Full Characterization and Data Export

- In the same simulation file, set the following properties for the "RCWA" object:
**propagation direction**: both**incident angle**: range**minimum theta**: 0**maximum theta**: 85**theta points**: 18**minimum phi**: 0**maximum phi**: 360**phi points**: 37

- Run the RCWA simulation by clicking the
**Run**button in the toolbar. - Run the script LSWM_JSON_export.lsf.

In this step, the S parameters of the optimized SRG are calculated for the specified range of incident angles for both forward and backward directions. These results are then exported to the LSWM JSON format suitable for import into Speos or Zemax using a script file.

To see an example of how this JSON file can be used in Speos, see Augmented Reality Optical System.

## Updating the Model With Your Parameters

Instructions for updating the model based on your device parameters

### Grating Geometry

The SRG geometry is defined as a Structure Group, which makes it easier to create user-specified geometry parameters like the slant angle and fill factor. The user can modify this SRG geometry by changing the setup script of the Structure Group, for example to add under- or over-etching to the grating. Alternatively, a different grating geometry can be created by adding a new Structure Group and writing a custom setup script.

### Optimization Parameters

The parameters varied by the optimization as well as their bounds are defined in the optimization sweep object. These can be changed by right-clicking on the "optimization" object and selecting “Edit”. Almost any of the properties of the simulation objects can be used as optimization parameters, though typically user-created geometry parameters in Structure Groups or Analysis Groups are used.

## Taking the Model Further

Information and tips for users that want to further customize the model

### Custom Optimization Figure of Merit

The SRG was optimized for a single wavelength and incident angle in this example. However, a FOM that includes a range of wavelengths or incident angles can also be used, for example to optimize over the entire field of view.

To do this, specify the wavelengths and incident angles you want to include in your FOM in the RCWA solver object. The results of the RCWA solver will be returned as a dataset with the wavelength/frequency, theta, and phi as parameters. The results can then be processed in the FOM script of the optimization sweep object to calculate a FOM that includes the full range. Note that the FOM must ultimately be a single real number for the optimization utility.

### Alternative Optimization Techniques

The built-in optimization utility, which uses the particle swarm optimization method, was used for the optimization of this grating. However, more advanced optimization techniques can be used through Ansys optiSLang or using Python libraries through the Lumerical Python API. Users can also define a different optimization method with the built-in utility through scripting. Initial explorations of the parameter space can also be performed with the parameter sweep tool.

## Additional Resources

Additional documentation, examples and training material

### Related Publications

- Jonathan S. Maikisch and Thomas K. Gaylord, "Optimum parallel-face slanted surface-relief gratings," Appl. Opt. 46, 3674-3681 (2007)