You can use the custom field settings of the EME solver to add a radius of curvature to certain waveguide sections in order to simulate waveguide bends. Let’s see how the results compare to an FDTD simulation for an S-bend and then see if we can optimize a 90-degree bend using the Python API with EME.

Please note that the accuracy of bent waveguide mode overlaps has recently been improved and you should use at least version **2019b R6** for this example.

## S-bend simulation and comparison with FDTD

We’ll study an S-bend that has a 1-micron radius of curvature using an SOI waveguide that supports both TE and TM modes so we can look at TE/TM coupling. Initially, we’ll use air as our background material to break the vertical symmetry of the waveguide to increase TE and TM coupling in the S-bend.

The basic FDTD setup is shown below and saved in test_[[S_bend.fsp]]

After running the simulation, we can plot the E field from the monitor called field.

The port1 source is set to excite the TE mode. The following lines of the script will plot the TE and TM S-parameter magnitudes vs wavelength, as shown below, and save the results to a file to compare with EME:

S = getresult("FDTD::ports::port2","S");

plot(S.lambda*1e9,abs(S.S(:,1)),abs(S.S(:,2)),"lambda (nm)","|S|","","linewidth=3");

legend("TE-to-TE","TE-to-TM"); matlabsave("FDTD_results",S);

Now let’s try the same simulation using EME. Open [[EME_S_bend.lms]]. The waveguide is drawn completely straight but the simulation is divided into 4 cells.

The first and last cells are straight, while the 2nd cell has a bend radius and bend orientation of 1 micron and 0 degrees, respectively, while the 3rd cell has values of 1 micron and 180 degrees, which reproduces the S-bend design of FDTD. The boundary conditions at y and z boundaries are PML. The simulation time is comparable to FDTD because we calculate 30 modes for each cell.

To change the radius of curvature, first, check the setting called “allow custom eigensolver settings” in the EME setup tab. Then, after selecting a cell group you can click the button called “Custom settings for cell group n”. This opens an eigensolver window where you can adjust eigensolver settings and choose to “Take Settings”.

Alternatively, you can set with the script by first selecting the desired cell group with the select command, and then the set eigensolver command, for example like this:

select(“EME::Cells::cell_2”);

seteigensolver(“bent waveguide”,true);

seteigensolver(“bend radius”,5e-6);

After running the EME engine, we can verify that the modes are clearly bent in cells 2 and 3 by looking at the fields (expand EME and the Cells in the Object Tree, right-click on cell_2 or cell_3 and view mode fields.)

Then we can run a mode convergence sweep to be sure we have enough modes. Because there are 2 modes supported in the port waveguides (TE and TM), we should start with at least 2 modes, and visualize the convergence of S31 and S41. We can see that about 20 modes are required for convergence.

We can perform a broadband EME sweep to look at the result from 1500nm to 1600nm, the same range used in FDTD, using 50 points, and we see the results agree well with FDTD.

We can plot them on the same curve with the script file [[compare_EME_FDTD.lsf]].

We also plot the absolute value of the difference between magnitudes of the S parameter and find it is within about 0.01. The agreement improves slightly by running FDTD at a finer mesh size.

In this particular case, we see that the simulation times are comparable between the two solvers, but EME can scale much better when larger bend radii are used.

It’s worth noting that the TEtoTM coupling can be greatly reduced by using a background index that matches the oxide substrate. This creates a plane of symmetry around the z-plane in the middle of the waveguide and the TE and TM modes have opposing symmetries with respect to this plane (symmetric and anti-symmetric respectively). This greatly reduces the amount of coupling.

If we switch the background index to 1.45 instead of 1 to match the substrate, then we get the following result.

The discrepancy between FDTD and EME is slightly larger in this case, but it can be improved by increasing the thickness of the PML used in EME and reducing the size of the mesh in FDTD. For example, the results with 32 layers of PML in EME and a mesh accuracy of 4 in FDTD are:

And the maximum difference between results is:

**Optimizing a 90 degree bend using EME and the Python API**

The above results make it encouraging to attempt to design an optical waveguide bend using EME and the Python API. This is very similar to the example Optimizing a taper using EME from Python to minimize the length while remaining adiabatic 11.

Open the file *EME_optimize_bend.lms*. The script file *setup_EME_bends.lsf* shows how the N cell bends are setup. The first (and last cells are straight), the cells then have a radius of curvature of 10, 9, 8, …, 2, 1 microns and then back up to 10 microns. N must be odd so that the central cell with the minimum radius of curvature has no matching cell.

*EME_optimize_bend.lms* is already configured, therefore it is optional to run the script file *setup_EME_bends.lsf*, but ** you must run the simulation before running the python file**.

Now open the script file called *bend_fom_function.lsf*. This file contains a FOM function that uses input parameters to construct the response of a 90 degree bend. The details of the parameters are described in the file but they should all be between 0 and 1. This function calculates a FOM to minimize which is the product of three terms:

- The first term is (2+L/L0)^4 where L is the total length of the bend and L0 = 2
*pi*1micron. In other words this term penalizes longer lengths. - The second term is atan(-500*(T-0.98))/pi+0.5, where T is the transmission of the TE mode from a TE mode in. This term greatly penalizes any device where the transmission falls below 98%.
- The third term is atan(500*(T_TM-0.0001))/pi+0.5, where T_TM is the transmission to the fundamental TM mode from a TE mode input. This term greatly penalizes any devices where the TE to TM coupling is above 1e-4.

Initially, on line 72, keep the value of test_fom_function to true and run the file. This will sweep the parameters from 0 to 1 (keeping them all equal) and calculate the figures of merit. It then plots the FOM vs device length:

as well as the radius of curvature vs position for the best device.

Now set the value of test_fom_function to false, and save the file. Open the file *bend_opt.py*. This file sets up an optimization using the fom function we already created. It starts with the optimal value we found from the quick sweep. It is limited to 8 iterations but this could be increased. After 8 iterations, it finds a figure of merit of approximately 1.44, a TE transmission of about 0.994, a TE to TM transmission of less than 2e-4 (37 dB) in a total length of only 5.1 microns. It also plots the radius of curvature vs length of the device in MODE Solutions.

Note that to keep things running quickly we only used 10 modes, which is likely not enough. There may be some variability in results until the number of modes is increased.