In this article, a workflow for the design and simulation of a cm-scale metalens is presented.

The nano-element are modeled in Lumerical and the RCWA method is used to create a database of the phase and amplitude induced by a single cell as a function of its diameter. The data are passed to OpticStudio for integration into a ray tracing system, where a collimated beam is focused by the metalens.

[[NOTE:]] This feature is only available in Ansys Zemax OpticSudio Premium/Enterprise. For the generation of the .h5 file, Ansys Lumerical of version 2023R2 or higher is required.

## Overview

* Understand the simulation workflow and key results *

Metalenses are advanced optical structures composed of nano-elements. By adjusting locally the individual cells, it is possible to create complex optical functions. However, it is a real challenge to simulate this kind of device on a large scale because it is not periodic, and it is composed of a large number of nano-elements. In addition, metalenses are intrinsically based on wave optics, but there is a need to integrate them into ray-tracing systems.

Details on the method to create a metalens, with the validation of the RCWA computation, can be found in the article Small-scale metalens - Field propagation . That workflow presenting a smaller scale metalens was suitable to simulate the beam propagation through the optical system with the Physical Optics Propagation (POP) tool of OpticStudio. However, it presents the limitation in the maximum size of the lens that can be simulated, essentially due to the memory required. In this article, a different workflow to design a large metalens with a diameter of 20mm is presented. In this workflow, we demonstrate that we can design a metalens at the nano-element level and assemble it up to the centimeter-scale. The metalens is then integrated into a ray-tracing system in OpticStudio. We also provide a process to extract the metalens information into a GDS file for manufacturing.

### Step 1: Target phase definition

The first step is to define the target phase profile for the metalens. For a scale beyond a few hundreds of microns, the memory requirement to produce, store, and use a full phase map is too great for typical CPU. In this workflow, we use a target phase profile that can be defined analytically, such as a spherical or cylindrical profiles. Ansys OpticStudio can also be used to optimize the wavefront desired in the metalens plane within the full optical system, so that the target phase can be defined with a function with a discrete number of coefficients (e.g. a polynomial).

### Step 2: Unit cell simulations – Height and radius sweep (Not covered)

In Lumerical, a sweep of the parameters of the unit cell (e.g. radius of a nanorod) is performed to generate a database of parametric nano-element responses . For more details, see step 2 in the article Small-scale metalens - Field propagation .

### Step 3: Generation of the nano-elements map and integration in OpticStudio

Based on the target phase profile and the database defined in the previous steps, a large metalens is defined. The database is written into a file that includes a map with indexes, pointing at a discrete list of possible values for the phase and amplitude of every cell. This file is then used in the Zemax plugin included in the download package to integrate the large lens into a ray-tracing system.

### Step 4: GDS generation

The GDS export is still supported at this scale, see the article Small-scale metalens - Field propagation for more details.

## Run and Results

Instructions for running the model and discussion of key results

### Step 1: Target phase definition

- Open the script [[generate_metalens_data.lsf]], set the focal length to 300 mm and the lens radius to 10 mm, and run Part 1 to observe the 1D profile.

At a scale of several millimeters in diameter with a resolution at a nanoscale given by the size of the nano-elements, generating a file containing a full map of the desired target phase would require additional effort in memory. Instead, we restrict the target phase profile to a map that can be described analytically by a function. In this article, we target a spherical lens with a radius of 10mm and a focal length of 300mm.

Note that it is important to maintain the numerical aperture (NA) at a reasonable value. If the metalens is designed to target a lens profile that is very fast, the phase variation on the edges may exceed what can be achieved considering the resolution of the nano-elements. In order to ensure a \(2 \pi\) phase coverage between unit cells, the numerical aperture should satisfy the Nyquist sampling criteria [1] as follows:

$$\text{NA}<\frac{\lambda}{2p}$$

Where \(p\) is the size of a unit cell, \(\lambda\) is the design wavelength, and NA=Radius/focal. Beyond this fundamental limit, limitations in the metalens model are expected when the gradient of the wrapped phase is too steep and experiences rapid jumps. See the discussion in Step 3 of this article for further details.

### Step 2: Unit cell simulations – Height and radius sweep (Not covered)

This step consists of performing a sweep on the cell parameters (e.g. the radius of the nanorod) to determine the relation between the local characteristic of the cell element and its output phase and amplitude. The procedure is not impacted by the final scale of the metalens. For more details, see step 2 in the article Small-scale metalens - Field propagation . The output file for this sweep containing the database information of phase and amplitude is [[phase_amp_vs_theta_phi_radius_interp_multiangle.mat]].

Note that the sweep is performed for a discrete number of phases, which implies a discrete number of possible radii for the nanorods. This brings a certain level of quantization to the final profile, and should also be related to the manufacturing constraints regarding the nano-elements.

It is also important to set the RCWA solver parameters. The sweep is performed for a given wavelength and a given angular range.

### Step 3: Generation of the nano-elements map and integration in OpticStudio

#### Generation of the Phase map with Lumerical

- Run Part 2 of the script [[generate_metalens_data.lsf]]
- Locate the [[.h5]] file that was generated by the script and copy it in the folder
**Zemax>DLL>Surfaces**

Based on the target phase profile and the phase library defined in the previous steps, a lens with a cm-scale is defined. The .h5 file contains a map with indexes, pointing at a discrete list of possible values for the phase and amplitude of every cell.

The database of amplitude and phase values is independent of the scale, but the index map increases with the size of the lens. As the file size increases with the number of nano-elements in the design, it is recommended to perform preliminary tests with smaller diameters.

#### Integration in OpticStudio

- Locate the 3 [[.dll]] files [[lumhdf5.dll]], [[lumhdf5_hl.dll]], and [[zlib1.dll]] in the install folder of Lumerical and copy them in the installation folder of Zemax. (Note that for Lumerical version above 2023R2 the files should already be in the install folder by default)
- Open the file [[metalens_20mm_multiangle.zprj]] and see how the metalens is defined

The metalens is set in OpticStudio on a ** User Defined ** surface, with the DLL [[lumerical-metalens-XXXX.dll]](where 'XXXX' represents the version and time-stamp). The data are then read by inserting in the Comment column the name of the [[.h5]] file that was generated (including the extension). It may take a couple of minutes for the data to load.

The integration into the ray tracing is using an interpolation around the surrounding phase value at the spatial location where the ray hit the metalens, in order to determine the local phase gradient. The output direction of the ray for the m ^{ th } order is then computed as follows:

$$n_2 X_2 = n_1 X_1 + \frac{m\lambda}{2\pi}\frac{dP}{dx}$$

$$n_2 Y_2 = n_1 Y_1 + \frac{m\lambda}{2\pi}\frac{dP}{dy}$$

$$Z_2 = \sqrt{1-X_2^2-Y_2^2}$$

Where (\(X_i, Y_i, Z_i\)) are the ray unit vectors for the input and output rays, \(n_1\) and \(n_2\) are the refractive indexes of the approach and exit media, \(\lambda\) is the wavelength, \(m\) is the diffraction order, and \(P(x,y)\) is the local phase in radian. Note that \(z\) is assumed to be the normal vector to the surface.

The spot diagram shows that the rays are not focusing as well as if we were using an ideal lens. One reason is that the radius of the nano-elements we use to compose the metalens is fixed, which induces a quantization of the phase, and therefore a departure from the ideal phase. In addition, the cells are structured in a 2D grid that introduces a cross pattern in the vertical and horizontal directions in the spot.

Two different interpolation methods are made available to compute the bending of the rays from the phase gradient. The method can be selected in the parameters of the surface in OpticStudio. The value 1 calls for bilinear interpolation while the value 3 corresponds to a bicubic interpolation. The bicubic interpolation may be a little more accurate while the bilinear method is expected to be a little more robust to the phase jumps.

It is important to ensure that the wavelength of the system matches the wavelength used for the generation of the database. Additional Fields can also be added in Zemax to analyze the metalens response over different angle of incidence. Once again, the angular range should match what was used in the RCWA sweep when generating the database to ensure the most accurate result.

### Step 4: GDS Generation

- Open the script [[gds_export.lsf]]. Set the focal length to 300mm and the lens radius to 10mm, and run the script

The export into GDS format is an essential final step for manufacturing. This feature is still supported at this large scale, please take a look at the article Small-scale metalens - Field propagation for more details.

## Important model settings

Description of important objects and settings used in this model

- Even with this updated workflow, the maximum size that can be simulated is limited by the RAM of the computer. With a 64Gb of RAM, the maximum size that can be generated is a metalens with a radius of a little over 10mm.
- The metalens is comprised of a unit cell with a finite dimension, and the library is generated with a discrete value of possible phase. The F-number of the lens should be such that the phase profile does not vary faster than what can be resolved by the unit cells.
- In the current workflow, the system is only demonstrated for a single wavelength and a given angular range set in the RCWA sweep.
- Interpolation of the phase gradient at the edge of the metalens is not well defined and may induce rays hitting the border of the lens to not be deflected as desired. It is therefore recommended to set the aperture size a little smaller than the actual size of the metalens. In our case the aperture diameter of the system is set to 19.9mm since the diameter of the metalens is 20mm.

## Updating the Model with Your Parameters

Instructions for updating the model based on your device parameters

- The focal length, size of the lens, and phase function defined in Step 1 may be customized to generate different functions
- In this example, the radius of the nanorods is used as the main parameter to induce the desired phase. Different custom unit cells may be defined, and parameters such as height and duty cycle may also be part of the sweep to generate the desired database library similar to what is demonstrated in Step 2.

## Taking the Model Further

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

The [[.h5]] file only provides wrapped phase information. This is sufficient for computing the ray bending since only the phase gradient is used. However, there could be advantages to unwrap the phase for further analysis, such as the OPD. Since unwrapping the phase is not trivial, we provide an option in the parameters that allows to set a reference phase profile that can be used by Zemax to unwrap correctly the phase profile of the metalens. The equation for the reference phase map works as follows:

$$\Phi = \Phi_{sphere,cylinder}+\Phi_{radial\,polynomial}+\Phi_{xy\,polynomial}$$

where

$$\Phi_{sphere,cylinder}= Order * \frac{2\pi}{\lambda}(f-\sqrt{f^2+c_x x^2+c_y y^2})$$

$$\Phi_{radial\,polynomial}= Order * \frac{2\pi}{\lambda} \sum\limits_{i=1}^{N} A_i r^i $$

$$\Phi_{xy\,polynomial}=Order * \frac{2\pi}{\lambda} \sum\limits_{i=1}^{N,M} B_{i,j} x^i y^j$$

For the case of our example with a simple spherical profile, it should look like this:

## Additional Resources

### Related Publications

- Mu Ku Chen, Yongfeng Wu, Lei Feng, Qingbin Fan, Minghui Lu, Ting Xu, and Din Ping Tsai "Principles, Functions, and Applications of Optical Meta-Lens", Advanced Optical Materials, Volume 9, Issue 4 (January 2021); https://doi.org/10.1002/adom.202001414