In this example, we will determine the optimal Radius Of Curvature (ROC) of the microlens that maximizes power transmission to the photodiode detectors.

Note: This figure is intended to show the range of lens ROC tested in this example. It is NOT meant to suggest that the simulation will be setup exactly as shown above. Each simulation in the parameter sweep will use a single ROC.

## Simulation setup

The simulation setup is based on the initial simulation example, with the following changes:

- The simulation z max position was increased to allow for thicker microlenses
- The microlens surface definition was changed to a simple spherical lens with a Radius of Curvature (ROC)
- A mesh override region was used over the microlenses to ensure that the mesh does not change as the microlens radius of curvature changes. This helps remove small discontinuities that appear in the results when the mesh changes between simulations.

The parameter sweep object ROC_sweep will run a parameter sweep of the microlens ROC, varying it between 1.0mm and 1.5mm. For each ROC, there will be two angles simulated: 0 and 15 degrees. For each angle, there are 2 polarizations. The lens diameter will be kept constant at 2mm.

The script file CMOS_lens_sweep_analysis.lsf will plot the results of the parameter sweep. This script is written so that the weighting factor between the normal incidence light and the 15 degree light can be changed.

## Run and results

### Parameter sweep of the radius of curvature

When the simulations are complete, run CMOS_lens_sweep_analysis.lsf to analyze the results. It will generate the following figure.

This figure shows an optimal ROC around 1.3mm. This result is obtained by averaging the normal incidence results with the 15 degree angle of incidence. The results from the individual angular contributions are also shown. As expected, the transmission is higher at normal incidence than it is at 15 degrees.

Note: Angle of incidence correction The analysis script that combines the normal incidence and 15 degree light can include the cos(theta) factor that should be applied to the transmission results. However, since we are trying to represent the integral of the light over all incident in-plane wave vectors, this correction of cos(15) is small and can be ignored. |

### Particle swarm optimization of the radius of curvature

The optimization object ROC_optimize will optimize the radius of curvature using the particle swarm optimization method. This algorithm is not really necessary for a single parameter optimization, however it becomes much more efficient than parameter sweeps when more than one parameter is varied. In this example, the figure of merit is defined for each radius of curvature as the average of the unpolarized optical efficiency at 0 and 15 degrees. Therefore for each radius of curvature 4 simulations are required because we need 2 angles and 2 polarizations. The cos(15) factor that should normally applied to the optical efficiency at 15 degrees has been ignored in this example, but it makes very little difference to the results since cos(15) ~ 0.97. We set the Generation Size to 10 which means that each generation will involve 10x4 = 40 simulations.

When running this optimization task, you will see the graph on the right of the figure of merit as a function of generation. The exact graph may vary as the first generation parameters are randomly selected. In this case, the optimal result is approximately 1.29mm and was already found in the first generation. The convergence as more parameters are added is not typically so fast.

This simulation was run with a mesh accuracy of 1. It would make sense to perform some convergence testing and rerun the optimization at a higher mesh accuracy, while restricting the range of radius of curvature values to something smaller.