This example demonstrates the basic functions of the RCWA solver. The reflection and transmission from a silicon photonic crystal slab is calculated, as well as the electric field inside the slab. The results with different number of k-vectors will be compared to simulation results from the literature through convergence testing. Lastly, the reflection and transmission are calculated as a function of frequency, incident angle, and polarization.

## Overview

Understand the simulation workflow and key results

The simulations in this example are performed with the RCWA solver, available in FDTD starting with release 2022 R1. The simulation is set up and run through a script file, accessing the RCWA solver through the use of the rcwa script command.

### Step 1: Initial Calculation

Typical simulation parameters are used for computing transmission and reflection from the photonic crystal slab at normal incidence with the RCWA solver. The electric field values at the center of the slab are also calculated.

### Step 2: Convergence Tests

Convergence testing is performed using a sweep of the number of k-vectors used by the RCWA solver to determine how the transmission peak positions converge to the results from [1]. The time required for each simulation is recorded as well to view how simulation time depends on the number of k-vectors.

### Step 3: Incident Angle Sweep

The RCWA solver is used to calculate the reflection and transmission from the photonic crystal slab at a range of incident angles.

## Run and Results

Instructions for running the model and discussion of key results

### Step 1: Initial Calculation

- Open the script file pc_slab_rcwa.lsf in FDTD.
- Run the first section of the script (lines 1-83). You can do this by highlighting these lines in the Script File Editor, right clicking, and choosing
**Run Selection**. You can also run this section by placing the text cursor in this section, clicking the**Select current code block**button , and then clicking the**Run current code block and advance**button .

The script pc_slab_rcwa.lsf creates the geometry, sets the simulation and source properties of the RCWA solver, runs the simulation with the rcwa script command and plots the results. One unit cell of the photonic crystal, consisting of a slab of silicon with a single hole in the middle, is created using the polygon geometry object. The RCWA solver assumes that the structure is periodic in the directions transverse to the injection axis of the source.

The calculated transmission and reflection results are shown below:

The transmission results are similar to the results in Fig. 7 in [1]. Due to the symmetry of the geometry these results are the same for both S and P polarizations. Similar to the results in [1], the frequency is normalized to the period of the photonic crystal:

$$Normalized frequency = f\left(\frac{a}{c}\right)$$

Where \(f\) is the frequency, \(a\) is the period, and \(c\) is the speed of light.

The square magnitude of the electric field at the center of the slab (\(z = 0\)) at a frequency of \(149.896\) THz for the S polarized source is also plotted by the script:

### Step 2: Convergence Testing

- Run the next section (lines 84-118) of the script file pc_slab_rcwa.lsf in FDTD.

In this step, the geometry and source settings from step 1 are reused and a loop changes the number of k-vectors used in the simulation before running the RCWA solver. The script then finds the frequencies of the three peaks in the transmission spectrum and calculates the relative error compared to the approximate converged peak locations from Fig. 8 in [1]. These reference values were chosen to be 0.5058, 0.526, and 0.542 for peak 1, peak 2 and peak 3, respectively. The relative error \(\sigma\) is defined as

$$\sigma = \left|\frac{f_{sim} - f_{ref}}{f_{ref}}\right|$$

Where \(f_{sim}\) is the frequency of the peak in the simulation results and \(f_{ref}\) is the approximate frequency of the peak from [1]. The results are plotted below:

We can see that the peak locations converge to values in good agreement with the values in [1] as the number of k-vectors is increased. The accuracy of the RCWA simulation increases as the number of k-vectors increases, so these are the expected results.

The simulation time as a function of the number of k-vectors is recorded as well. The results are plotted below.

We can see that the time required for each simulation increases with the number of k-vectors, as expected.

### Step 3: Incident Angle Sweep

- Run the next section (lines 119-135) of the script file pc_slab_rcwa.lsf in FDTD. The script may take a few minutes to run.

In this section of the script, the RCWA solver is run for a range of frequencies and incident radial angles with the same geometry from steps 1 and 2. Based on the results from step 2, the maximum number of k-vectors was set to 40 to achieve a balance between accuracy and simulation time. The transmission results for both the S and P polarizations are plotted by the script. The results are shown below:

## Updating the Model With Your Parameters

Instructions for updating the model based on your device parameters

### Geometry

The structure of the model can be changed by adjusting the properties of the geometry objects. Additional geometry objects can be added to create a more complex model. It is also important to ensure that the dimension of the layer position property makes sense with the new geometry. If the number of layers has been changed, the `geometry.layer_positions`

object must be updated.

### Plane Wave Source

The properties defining the incident plane wave can be modified by changing the `excitation`

struct in the script file. The frequency range, angle of incidence, and polarization of the incident light can be changed. See the rcwa script command documentation page for more information.

### Other Options

The performance of the solver in terms of accuracy and simulation time can be adjusted by changing the `options`

object in the pc_slab_rcwa.lsf script file. To get a more accurate solution, it is possible to increase the number of k-vectors: `max_N`

. The required simulation time will increase as the maximum number of k-vectors is increased.

## Taking the Model Further

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

### Changing the Slab Thickness

The RCWA simulation can be run again with a different slab thickness using the rcwasweeppropagation command. This command will use the modes calculated in the initial RCWA simulation, which means it will run faster than simply using the rcwa command again.

## Additional Resources

Additional documentation, examples and training material

### Related Publications

- Liu and S. Fan, "S4: A free electromagnetic solver for layered periodic structures", Computer Physics Communications, 183, 2233-2244, 2012