Introduction

Just as the intrinsic properties of any material are determined by the chemical and physical arrangement of constituent atoms, the metamaterial is an artificial material composed of an arrangement of “meta-atoms”1—sub-wavelength engineered structures tailored to impart an amplitude and phase change upon an incident electromagnetic wave. While any number of distinct meta-atoms might be flexibly arranged to create a wide range of spatial and frequency responses as in disordered2 or multifunctional3 metamaterials, the resulting complexity due to field coupling between meta-atoms typically demands that a single meta-atom or unit cell is designed and infinitely replicated across a periodic array to form a homogenized metamaterial4. The two-dimensional subset of bulk metamaterials are metasurfaces, where tailoring surface impedance of a patterned metal/dielectric layer customizes the reflection and transmission of an incident wave in amplitude, phase, and polarization5. Metamaterials and metasurfaces have been shown to demonstrate unique physical properties, including left-handedness6, electromagnetic band-gap behavior7, frequency selectivity8, nonlinearity9, and polarizability10. Many years of intuition-based design have yielded a library of canonical metasurfaces, e.g., the split-ring resonator11, square loop12, Jerusalem cross13, etc., capable of producing these properties. However, there is no expectation that these designs—a small subset of the entire possible design space of materials arranged in the electromagnetic volume of the meta-atom—represent the optimal solution. Although fundamental limits on transmission and reflection varying over angle, frequency, and polarization can be derived from causality and other physical first principles14,15, no standard design process exists to direct a metasurface’s performance to these fundamental limits.

Design of increasingly advanced metasurfaces therefore benefits from global topology optimization techniques to explore the design space for an optimal solution. Design space parameterization is required because the computational cost of simulations limits the possible number of cost function evaluations, which in turn significantly limits the number of design variables which can be tuned by optimization algorithms. For example, the canonical metasurface shapes described above have few design variables which are optimized quickly, but only locally optimal solutions are attained.

A more expressive design space parameterization for metamaterials is the “fragmented” or “coded” basis16,17 shown in Fig. 1a. The material distribution function for fragmented structures is parameterized by a set of binary design variables, with each variable determining the presence or absence of material on a grid. While the fragmented parameterization offers the designer clarity in its one-to-one mapping of parameters to material features, discrete design variables used for material placement are necessarily non-convex and hence detrimental to many optimizers18,19,20.

Figure 1
figure 1

Metasurface optimization is performed with fragmented and periodic level set function (P-LSF) parameterizations for topology optimization of a metasurface. The objective for both designs is a bandpass filter from 15-30 GHz. (a) The fragmented parameterization consists of binary-valued design variables which determine the presence or absence of metal at each grid location.(b) The P-LSF parameterization consists of real-valued design variables. Negative values are denoted with parentheses. Metal is placed at locations where the P-LSF values are greater than 0. The P-LSF design achieves improved bandpass performance.

Evolutionary approaches such as genetic algorithms21,22 (GAs) and particle swarm optimization23 (PSO) have been used to optimize fragmented structures. Other nature-inspired optimizations demonstrated on metamaterials include ant colony optimization24 (ACO) and wind driven optimization25 (WDO). Given the sample inefficiency of these optimizers, it is sometimes desirable to use more judicious strategies such as Bayesian optimization. One approach proposed by Hou et al.26 is to first remap the binary design variables to a set of continuous design variables using a compression mapping and then apply Bayesian optimization to the new variables. However, Bayesian optimization becomes more computationally intensive as data is added, which limits the number of function evaluations. Bayesian optimization is also a sequential design strategy, so multiple function evaluations cannot be run in parallel to take advantage of high-performance computing developments.

The convergence of metamaterial optimizations may be accelerated by employing adjoint methods to compute the gradient of the cost function with respect to the design variables. Used in conjunction with gradient-based optimizers, adjoint methods quickly converge to an optimum27,28,29. However, adjoint analysis has not been widely adopted in commercial electromagnetics solvers, and in some cases the adjoint operator is simply not computable, highlighting a need for robust gradient-free optimization techniques. Surrogate-based optimization22,30 (SBO) precludes the need to derive an adjoint operator, and a cheap forward or inverse model is learned from data instead. Surrogate models have challenges with model architecture, data representation, and generalization. But more prohibitively, tens of thousands of samples, each generated by a computationally expensive full-wave electromagnetic simulation, are required to train an accurate model for high-dimensional nonlinear cost functions31.

Level set functions (LSFs) are a promising continuous basis for gradient-free optimization of metamaterials. LSFs have been applied to gradient-based optimization for electrostatic systems32, antennas33, acoustic metamaterials34,35, nanophotonic devices36, and multi-port microwave networks37. Mansouree and Arbabi38 leverage the level set method and gradient descent techniques to design an optical metasurface, using a constant boundary value to avoid problems with discontinuities at the boundary between meta-atoms. These gradient-based optimizations require the derivation of a shape derivative for the LSF boundary, also called the velocity field, which continuously reshapes the LSF towards an optimal solution for a given cost function39. The level set method has also been used to design dielectric metamaterials40 and metasurfaces41 with the gradient-based adjoint variable method. Use of LSFs for gradient-free optimization has been found in civil engineering with structural optimization of load-bearing structures such as bridges and cantilevers42,43.

In this paper, we present a method to improve metamaterial optimization that focuses on the design space parameterization. Our improved basis—the periodic level set function (P-LSF) shown in Fig. 1b—provides numerous benefits over the fragmented basis, including design space convexity, improved electromagnetic performance, and reduced iterations for convergence. The implicitly periodic nature of the P-LSF allows variation in material along the edges of the unit cell, in turn allowing freedom in optimizing continuity in currents and coupling of fields between unit cells. We use the P-LSF and fragmented parameterizations with finite-difference time-domain (FDTD) simulations to design two frequency selective surfaces: a bandpass filter and a high-Q notch filter. Gradient-free optimization is performed using evolutionary algorithms and parallelized with high-performance computing resources. We compare the two parameterizations based on optimization results for the two design objectives and finally manufacture a metasurface designed with the periodic level set method to measure its real-world performance.

Results

Topology optimization for metasurfaces

Figure 2
figure 2

A flowchart for a general topology optimization problem. (a) A smooth material distribution function \(\rho\) is defined on a subset \(\Omega\) of \(\mathbb {R}^2\). The contour lines represent regions of constant material. For binary designs, the material can be thresholded based on the zero level (red). (b) The forward operator \(\mathscr {H}\) is problem dependent but typically consists of a PDE/ODE simulation with pre- and post-processing. (c) The simulated system response \(\mathscr {H}(\rho )\) is compared against a desired system response \(\varvec{y}\). (d) The simulated and desired responses are fed through an objective function to provide feedback to an optimizer. The optimizer then updates the material distribution function for the next evaluation.

The metamaterial design problem can be formulated as a special case of a general topology optimization problem. We define a design region \(\Omega \subset \mathbb {R}^D\) and a material distribution function \(\rho \in L_2(\Omega )\) which is defined on \(\Omega\). The vector space in which the distribution function resides is paired with a forward operator that maps distribution functions to points in another vector space which we call the “system response”: \(\mathscr {H}: L_2(\Omega )\rightarrow \mathbb {R}^M\), where M is the number of samples. We formulate a topology optimization problem to design a material distribution function minimizing the error between the resulting system response and a target response \(\varvec{y}\in \mathbb {R}^M\) subject to inequality constraints \(c_i:L_2(\Omega )\rightarrow \mathbb {R}\)

$$\begin{aligned} \mathop {\mathrm {\text {minimize}}}\limits _{\rho } \hspace{5pt} \sum _{m=1}^M \hspace{5pt} L\left( \mathscr {H}_m(\rho ), ~y_m\right) \hspace{25pt}\text {subject to}\hspace{10pt} c_i(\rho )\le 0 \hspace{10pt}\forall i, \end{aligned}$$
(1)

where \(L(\cdot , \cdot )\) is a loss function such as mean squared error. We summarize the topology optimization framework in Fig. 2.

The general framework can be specialized to metasurfaces by taking \(\Omega =\mathbb {R}^2\) and constructing a distribution function with a periodicity constraint of period \(\varvec{s}=[s_1, s_2]\):

$$\begin{aligned} \rho (\varvec{x}) = \rho \left( \varvec{x}+ \begin{bmatrix}m*s_1\\ n*s_2\end{bmatrix}\right) \hspace{20pt} \forall m,n\in \mathbb {Z}\end{aligned}$$
(2)

The region \(\varvec{x}\in \left( [0,s_1]\times [0,s_2]\right)\) is representative of the infinite structure and is called the unit cell. The design of metasurfaces is challenging because the forward operator \(\mathscr {H}\) often requires a computationally intensive full-wave electromagnetic simulation that does not compute gradients with respect to the material distribution function. To make metasurface optimization tractable, the material distribution function can be parameterized with a set of design variables that are tuned by an optimization algorithm.

Metasurface parameterization with level set functions

Figure 3
figure 3

The metasurface material distribution is determined by the level set of the sum of weighted radial basis functions (RBFs). (a) A set of N RBFs is defined, with centers \(\varvec{c}_i\) such that they are spaced uniformly across a 2D plane. (b) The set of radial basis functions is weighted by coefficients \(\varvec{\alpha }\in [-1, 1]\). Negative values are denoted with parentheses. (c) The sum of weighted RBFs plus the threshold term T forms the level set function, and the material distribution on the 2D plane is determined by \(f(\varvec{x})>0\). Negative threshold values tend to produce material distributions dominated by metal, while those with large threshold levels have very little metal.

The optimization of metamaterials and metasurfaces benefits from suitable design space parameterizations. The aim of a parameterization is to produce a range of suitable material distribution functions while maintaining favorable properties for gradient-free optimization algorithms, i.e., a small number of design variables, a continuous and convex design space, and a Lipschitz continuous cost function. We address all of these goals simultaneously through level set functions.

For any scalar function \(f(\varvec{x})\) for \(\varvec{x}\in \mathbb {R}^D\), a level set of f is a hypersurface in \(\mathbb {R}^D\) where the function takes on a constant value. For instance, given the 2-dimensional function \(f(x, y)=\sqrt{x^2+y^2}\), the level set for any nonnegative level \(f(x, y) = r\) is a circle of radius r. Without loss of generality, we will consider level set functions of the form \(f(\varvec{x}) = g(\varvec{x}) - T\), where T is the threshold, and the level set is always taken at \(f(\varvec{x})=0\). For the metasurface designs in this work, we define a binary material distribution of metal and air, where the zero level set defines the boundary between the two materials. However, the level set is applicable to continually varying material parameters, e.g. graded dielectrics44, as well as the multiple material systems (air, resistive sheet, metal) found in absorbing metasurfaces45.

A common choice of level set function for topology optimization is composed of a sum of Gaussian radial basis functions (RBFs)41,42,43 with coefficients \(\varvec{\alpha }\). Rounding is done relative to the zero level set.

$$\begin{aligned} f_{\varvec{\alpha }}(\varvec{x}) = -T+\sum _{i=1}^N \alpha _i e^{-\gamma _i^2 \Vert \varvec{x}-\varvec{c}_i\Vert ^2} \hspace{40pt} \rho _{\varvec{\alpha }}(\varvec{x}) = {\left\{ \begin{array}{ll} 1 \hspace{10pt}\text { if } f_{\varvec{\alpha }}(\varvec{x}) > 0 \\ 0 \hspace{10pt}\text { otherwise} \end{array}\right. } \end{aligned}$$
(3)

where T is the threshold, \(\varvec{c}_i\) are the RBF centers, and \(\gamma _i\) are the scale factors (which are typically inversely proportional to the distance to adjacent centers). The norm used is nearly always the Euclidean \(\mathcalligra {l}_2\) norm, but we experiment with the \(\mathcalligra {l}_1\) and \(\mathcalligra {l}_{\infty }\) norms in this work as well. The basis coefficients and threshold determine the shape of the level set function and the resulting material distribution after rounding. For most problems, it is helpful to bound the basis coefficients since a single large positive or negative coefficient can result in a trivial one-material solution42. Figure 3 shows examples for a uniformly spaced RBF basis, an LSF composed of a sum of RBFs, and the rounded material distribution functions for three different thresholds.

For topology optimization, the RBF basis coefficients \(\varvec{\alpha }\) are the design variables presented to an optimization algorithm. The RBF parameters \(\gamma _i\) and \(\varvec{c}_i\) are initialized and kept fixed, and the threshold T is often determined by a constraint on the volume of material in the material distribution function42. For our metasurface design problems, we do not have a material constraint, so we simply fix the threshold at zero. For simulation and manufacturing, the parameterized material distribution function \(\rho _{\varvec{\alpha }}\) is sampled at a set of grid points in \(\varvec{x}\), which produces a binary image that we call the mask.

Periodic level set functions

Figure 4
figure 4

Level set functions (LSFs) used for periodic structures like metamaterials result in sharp material discontinuities on unit cell boundaries. We define the periodic LSF (P-LSF) which applies distance wrapping around unit cell boundaries to create continuous material features. (a) An LSF and P-LSF are defined with sparse basis coefficients, and the resulting function values are shown. (b) An LSF and P-LSF are defined with random basis coefficients and then rounded to binary-valued masks. When converted to a periodic structure, the LSF mask has material discontinuities on the unit cell boundaries, whereas the P-LSF mask removes the discontinuities.

To make level set functions more suitable for periodic structures like metamaterials, we propose a new formulation that wraps the distance from the topology variable \(\varvec{x}\) to the RBF centers around the unit cell boundaries. Given an RBF center \(\varvec{c}\) and a D-dimensional unit cell of size \(\varvec{s}=[s_1,\ldots ,s_D]\), we consider periodic shifts of \(\varvec{x}\) to all other unit cells, and then take norm of the shift with the minimum distance to \(\varvec{c}\). The wrapped \(\mathcalligra {l}_2\), \(\mathcalligra {l}_1\), and \(\mathcalligra {l}_{\infty }\) norms are defined as follows:

Norm

Wrapped norm

\(\Vert \varvec{x}-\varvec{c}\Vert _2\)

\(\sqrt{\sum _{d=1}^D \hspace{5pt} \min _{n \in \mathbb {Z}} \hspace{5pt} (x_d + n * s_d - c_d)^2}\)

\(\Vert \varvec{x}-\varvec{c}\Vert _1\)

\(\sum _{d=1}^D \hspace{5pt} \min _{n \in \mathbb {Z}} \hspace{5pt} |x_d + n * s_d - c_d|\)

\(\Vert \varvec{x}-\varvec{c}\Vert _{\infty }\)

\(\max _{d=1}^D \hspace{5pt} \min _{n \in \mathbb {Z}} \hspace{5pt} |x_d + n * s_d - c_d|\)

The proposed distance wrapping enables RBF features to flow continuously around the boundaries of the unit cell. Without this modification, material features do not align across the unit cell boundaries, which results in discontinuities when the LSF is converted to a periodic structure as shown in Fig. 4b. In addition to distance wrapping, the spacing of RBF centers must account for wrapping as well to avoid crowding RBFs at the edges of the unit cell. We term the LSF formulation with distance wrapping the “periodic level set function” (P-LSF).

We note that sinusoids could also be used to construct level set functions with inherent periodicity on the unit cell. Such a basis would cause each parameter to impact material distribution globally across the unit cell with larger changes from lower-frequency basis functions; use of RBFs with added periodicity maintains the locality of each parameter. For small changes in basis coefficients, a cost function varies less (i.e., has a smaller Lipschitz constant) due to localized material placement with RBFs rather than global material placement with sinusoids.

Upsampling level set function coefficients

An effective approach to gradient-free topology optimization is multi-stage optimization, where an initial coarse problem with a reduced design space is solved quickly and iteratively refined to a fine-grained solution42,43. We experiment with multi-stage optimization for metasurfaces with the P-LSF basis, which requires upsampling coefficients from coarse to fine bases. We construct a coarse P-LSF basis as a set of M RBF functions \(\{\phi _m\}\) centered at \(\{\varvec{c}_m\}\) with basis coefficients \(\varvec{\alpha }\in \mathbb {R}^M\). Likewise, we construct a fine basis with N RBF functions \(\{\psi _n\}\) centered at \(\{\varvec{c}^{\prime }_n\}\) with basis coefficients \(\varvec{\beta }\in \mathbb {R}^N\). The goal of upsampling is to take a fixed coefficient vector \(\varvec{\alpha }\) from the coarse basis and find a suitable coefficient vector \(\varvec{\beta }\) in the fine basis which most closely emulates the level set function from the coarse basis coefficients.

We first attempt the matrix inverse method proposed by Guirguis et al.43 to upsample P-LSF basis coefficients. The method attempts to match the coarse and fine P-LSF values at the N centers for the fine basis, which results in a system of N equations to solve for the N fine coefficients. We first construct a vector \(\varvec{y}\) of length N by sampling the coarse P-LSF at the center location of each basis function for the fine P-LSF:

$$\begin{aligned} \varvec{y}= \begin{bmatrix} \sum _m \alpha _m\phi _m(\varvec{c}^{\prime }_1),&\sum _m \alpha _m\phi _m(\varvec{c}^{\prime }_2),&\ldots ,&\sum _m \alpha _m\phi _m(\varvec{c}^{\prime }_N) \end{bmatrix}^T \end{aligned}$$
(4)

We also construct an \(N\times N\) sampling matrix \(\varvec{G}\) for the fine basis, and vector \(\varvec{\beta }\) of the unknown fine basis coefficients:

$$\begin{aligned} \varvec{G}= \begin{bmatrix} \psi _1(\varvec{c}^{\prime }_1) &{} \psi _2(\varvec{c}^{\prime }_1) &{} \ldots &{} \psi _N(\varvec{c}^{\prime }_1) \\ \psi _1(\varvec{c}^{\prime }_2) &{} \psi _2(\varvec{c}^{\prime }_2) &{} \ldots &{} \psi _N(\varvec{c}^{\prime }_2) \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \psi _1(\varvec{c}^{\prime }_N) &{} \psi _2(\varvec{c}^{\prime }_N) &{} \ldots &{} \psi _N(\varvec{c}^{\prime }_N) \\ \end{bmatrix} \hspace{20pt} \varvec{\beta }= \begin{bmatrix} \beta _1,&\beta _2,&\ldots ,&\beta _N \end{bmatrix}^T \end{aligned}$$
(5)

We intend to solve the system of equations \(\varvec{G}\varvec{\beta }=\varvec{y}\), so we find the fine basis coefficients by inverting \(\varvec{G}\) and taking \(\varvec{\beta }= \varvec{G}^{-1}\varvec{y}\).

The matrix inverse method works well when the \(\mathcalligra {l}_2\) norm is used for the radial basis functions, but it fails when applied to upsampling with the \(\mathcalligra {l}_1\) and \(\mathcalligra {l}_{\infty }\) norms, where the resulting sampling matrix is ill-conditioned and results in large upsampled basis coefficients. We instead derive a more robust P-LSF upsampling process using an overdetermined system of equations and the pseudo-inverse of the resulting rectangular sampling matrix.

Figure 5
figure 5

A \(16\times 16\) P-LSF is upsampled to \(32\times 32\). (a) A set of 256 parameters in \([-1,1]\) is randomly chosen. (b) P-LSF functions with a \(16\times 16\) basis are created with the \(\mathcalligra {l}_2\), \(\mathcalligra {l}_1\), and \(\mathcalligra {l}_{\infty }\) norms. The P-LSFs are binarized based on the zero level. (c) The proposed pseudo-inverse upsampling method is artifact-free when upsampling to \(32\times 32\), while the matrix inverse method43 is not, especially in the \(\mathcalligra {l}_1\) and \(\mathcalligra {l}_{\infty }\) norms. (d) Coordinate system.

The pseudo-inverse method solves a least-squares problem matching the coarse and fine P-LSF values at \(P>N\) mask positions \(\{\varvec{z}_p\}\), instead of at the N fine basis centers. The number of mask positions to sample may be arbitrarily selected; the spacing in a uniformly spaced grid of mask positions is generally chosen based on the resolution required for a discretized simulation or manufacturing process. We first construct a vector \(\varvec{t}\) by sampling the coarse basis at the P mask positions \(\varvec{z}_p\), which is equivalent to the coarse P-LSF mask values before rounding:

$$\begin{aligned} \varvec{t}= \begin{bmatrix} \sum _m \alpha _m\phi _m(\varvec{z}_1),&\sum _m \alpha _m\phi _m(\varvec{z}_2),&\ldots ,&\sum _m \alpha _m\phi _m(\varvec{z}_P) \end{bmatrix}^T \end{aligned}$$
(6)

We then construct a \(P\times N\) sampling matrix \(\varvec{H}\) and solve for the upsampled coefficients \(\varvec{\beta }\) with the pseudo-inverse:

$$\begin{aligned} \varvec{H}= \begin{bmatrix} \psi _1(\varvec{z}_1) &{} \psi _2(\varvec{z}_1) &{} \ldots &{} \psi _N(\varvec{z}_1) \\ \psi _1(\varvec{z}_2) &{} \psi _2(\varvec{z}_2) &{} \ldots &{} \psi _N(\varvec{z}_2) \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \psi _1(\varvec{z}_P) &{} \psi _2(\varvec{z}_P) &{} \ldots &{} \psi _N(\varvec{z}_P) \\ \end{bmatrix} \hspace{30pt} \varvec{\beta }= \varvec{H}^{\dagger }\varvec{t}\end{aligned}$$
(7)

We find that this formulation works well for both the \(\mathcalligra {l}_1\) and \(\mathcalligra {l}_{\infty }\) LSF upsampling. Additionally, we find the pseudo-inverse method matches masks with the \(\mathcalligra {l}_2\) norm more closely than the matrix inverse method. Upsampling examples for masks with each norm are shown in Fig. 5.

System and cost function construction

As a case study, we construct representative geometries for a microwave metasurface using both fragmented and periodic level set function parameterizations and optimize them for two different objectives: a broadband 2:1 bandpass frequency-selective filter and a multi-resonance narrowband one. Optimization is performed solely on the material distribution function for a thin metal layer on dielectric substrate. For fragmented designs, we divide a \(120\times 120\) metal mask into staggered fragments of size \(4\times 4\) pixels which results in \(N=915\) binary design variables. To complement this, we define a P-LSF basis composed of \(32\times 32\) RBF functions arranged uniformly across the unit cell for a total of \(N=1024\) continuous design variables bounded in the range \([-1,1]\). The metasurface optimization problem is:

$$\begin{aligned} \mathop {\mathrm {\text {maximize}}}\limits _{\varvec{\alpha }} \hspace{5pt} \sum _{m=1}^M \hspace{5pt} L\left( \mathscr {H}_m(\rho _{\varvec{\alpha }}), ~y_m\right) \hspace{15pt}\text {subject to} {\left\{ \begin{array}{ll} -1\le \alpha _i\le 1, \hspace{10pt} &{} 1\le i\le N\hspace{10pt}\text {(P-LSF)} \\ \alpha _i\in \{0,~1\}, &{} 1\le i\le N\hspace{10pt}\text {(fragmented)} \end{array}\right. } \end{aligned}$$
(8)

We use the maximization convention to align with genetic algorithm notion of maximizing a fitness function. We construct the forward operator \(\mathcal {H}\) by first mapping the parameterized material density function \(\rho _{\varvec{\alpha }}\) to a metal mask on the simulated metasurface geometry. We perform a full-wave electromagnetic simulation of an incident plane wave followed by a near-field to far-field transform and Fourier transform to compute the metasurface scattering parameters (S-parameters) at M different frequencies. The resulting S-parameters are scored with a target system response \(\varvec{y}\) and loss function L designed to describe the desired performance of the metasurface for each objective.

The first objective aims to design a 2:1 bandpass filter which minimizes the reflectance (\(S_{11}\)) between the passband frequency range of 15-30 GHz while maximizing the reflectance outside this band. We use the weighted mean absolute error (MAE) as the loss function and define the target system response as an \(S_{11}\) of less than -10 dB in the passband and greater than -0.5 dB in the stopband. \(S_{11}\) values exceeding the design goal are considered to have an error of zero and hence optimal. We negate this objective to construct the maximization problem. The objective function given a sampled reflectance \(S_{11}(f)\) in dB is:

$$\begin{aligned} L_{BP}(S_{11})~=~&\frac{-1}{N_{pass}}~ \sum _{f\in \textrm{passband}} ~|-10~\text {dB} ~-~ \max (-10~\text {dB},~S_{11}(f))| \quad + \end{aligned}$$
(9)
$$\begin{aligned}&\frac{-1}{N_{stop}}~ \sum _{f\notin \textrm{passband}} ~|-0.5~\text {dB} ~-~ \min (-0.5~\text {dB},~S_{11}(f))| \end{aligned}$$
(10)

where \(N_{pass}\) and \(N_{stop}\) are the number of frequency bins in the passband and stopbands, respectively. This objective is maximized with a value of 0 when the passband \(S_{11}\) is entirely below \(-\,\)10 dB, and the stopbands are entirely above \(-\,\)0.5 dB.

As a second objective, we design a highly resonant metasurface for materials characterization46. We specify two frequency bands from 8 to 16 GHz and 24–32 GHz and maximize the Q-factor of one notch filter in each band. Techniques for Q-factor computation using half-power bandwidth or Q-circle fitting47 can be unstable for frequency responses with closely spaced resonances, so we compute a cost function which emulates Q-factor maximization. We construct a design-dependent loss function which selects the frequency of minimum transmittance (\(S_{21}\)) in each design band as the predicted notch location. The cost function value is computed as the MAE between the minimum and average transmittance in a 1 GHz range around the two predicted notch locations, which is to be maximized. \(S_{21}\) values outside of the range are ignored. Concretely:

$$\begin{aligned} L_Q\left( S_{21}\right) ~=~ - \min _{f\in \textrm{notch}} ~S_{21}\left( f\right) ~+~ \frac{1}{N_{notch}}~ \sum _{f\in \textrm{notch}} ~S_{21}\left( f\right) \end{aligned}$$
(11)

Where \(N_{notch}\) is the number of frequency bins around the notch. As an example, a notch of -60 dB with -20 dB average gain in a 1 GHz band around it would achieve a cost of 60-20=40. The objective for our design is simply composed of two of these notch objectives in the frequency bands of 8-16 GHz and 24-32 GHz. We find that this cost function encourages the optimizer to both maximize notch depth and minimize the notch width, which effectively maximizes the Q-factor.

Optimization algorithms

Figure 6
figure 6

(a) A convergence comparison between six different optimization algorithms from the Nevergrad library48. Optimizations are run on the notch objective (Eq. 11) using the P-LSF parameterization. The tested optimizers are the Nevergrad optimizer (NGOpt), covariance matrix adaptation (CMA), sequential quadratic programming CMA (SQPCMA), particle swarm optimization (PSO), Bayesian optimization (BO), and random search. NGOpt and CMA yield similar results, significantly outperforming the other optimizers by comparison. BO was stopped early as the computational expense of individual generation became prohibitive. (b) Convergence of the CMA algorithm is compared over 5 separate optimizations on the notch objective. CMA reaches objective values ranging from 125 to 150 and exhibits consistent performance across optimizations.

The continuous design space of the P-LSF parameterization lends itself to a variety of optimizers other than genetic algorithms. We use the package Nevergrad48 to flexibly test various single- and multi-threaded optimization algorithms and found the most success with covariance matrix adaptation (CMA)49. CMA is an effective gradient-free optimizer for nonlinear functions on continuous domains which models the acquisition function with a multivariate Gaussian distribution. As progressive function evaluations are acquired, the Gaussian covariance matrix is updated and used to select successive sample points. CMA has previously been applied to optimizing geometric parameters for antenna design50.

We begin by evaluating the performance of different optimization algorithms on the P-LSF parameterization for the notch objective. We use several optimizers from the Nevergrad package48, namely the Nevergrad optimizer (NGOpt), covariance matrix adaptation (CMA), particle swarm optimization (PSO), Bayesian optimization (BO), and random search. A comparison of the performance of each optimizer is shown in Fig. 6a. We observe that NGOpt and CMA perform similarly, whereas the other optimizers perform worse. In particular, Bayesian optimization takes too long to compute and stalls after \(\sim 2000\) iterations. PSO and random search also did not exceed 100 in objective value. Both CMA and NGOpt were able to design notch filters with objective values in excess of 125.

Figure 7
figure 7

(a) For the broadband design objective, the LSF method converged more quickly and to a higher value than the fragmented method. Lines indicate best function evaluations over the course of the optimization. Innovations appear as vertical jumps in the solid lines and are marked. (b) The resulting best mask from each optimization is displayed. (c) The reflection coefficient for each best case is shown. The fragmented design fails to meet the desired objective at multiple sub-bands, whereas both LSF designs produce favorable reflectivity over the full bandwidth.

The NGOpt optimizer uses active algorithm selection to choose from a portfolio of CMA, PSO, and genetic differential evolution (DE), selecting based on several factors including problem size, budget, and parameter types48,51. The similar performance of NGopt and CMA, consistent with NGOpt’s choice of CMA from its portfolio of choices, has led us to proceed with CMA for subsequent results. To evaluate the repeatibility of CMA optimizations, we compare the convergence of multiple CMA notch filter optimizations in Fig. 6b. We observe that all 4 optimizations proceed at a similar pace and reach a consistent final objective value ranging from 125 to 150. Each of the optimizations also shows steady improvement in objective value over the course of optimization. Perfect reproducibility would of course result in convergence to identical designs (the global maximum), but the large parametric space and presence of many local minima makes this improbable; as seen in the figure, similar performance is obtained for vastly different designs.

Next, we study optimization performance for filter design using different parameterizations—the P-LSF and fragmented. We apply the non-dominated sorting genetic algorithm II52 (NSGA-II) to optimize microwave metasurface designs with both parameterizations for both bandpass and notch objectives. To improve algorithm convergence, we also implement multi-stage optimization with both design parameterizations, which divides optimization into stages with incrementally higher granularity. In this work, we apply a two-stage optimization procedure. The first stage of optimization uses a reduced number of coarse-grained design variables to quickly converge to an acceptable solution set. The coarse solutions are upsampled to a finer basis and used as seeds for a fine-grained optimization to find the final solution. The same optimization algorithm (either GA or CMA) is used for both the first and second rounds of optimization, with the final population from the first round being fed directly into the second round. For both fragmented and P-LSF parameterizations, the coarse basis has approximately \(25\%\) the number of parameters as the fine basis. Though the coarse optimization stage may bias the fine stage towards a locally optimal solution, this is favorable, since optimization directly in the fine basis may not converge in the allocated time.

A comparison between the convergence of different parameterizations for the bandpass design objective is shown in Fig. 7. The metasurface designed with the P-LSF basis and two-stage optimization achieves the best cost function value, followed closely by the P-LSF metasurface with one-stage optimization. Though applying two-stage optimization did not significantly increase the final bandpass cost function value, two-stage optimization converged closely to the final value in approximately 1/3rd the iterations as one-stage optimization. Applying the CMA optimizer to the P-LSF metasurface did not fully converge within the allocated function evaluations but still produced a comparable P-LSF design. The fragmented metasurfaces with both one-stage and two-stage optimization perform worse than the P-LSF based metasurfaces for the bandpass design objective. For the fragmented basis, introducing two-stage optimization showed improvement in the final objective value as well as accelerated convergence to the final value.

Convergence for the notch objective is shown in Fig. 9 with the final design shown in Fig. 10. Applying two-stage optimization to the P-LSF based metasurface offered little benefit and slowed down optimization convergence. Similarly for the fragmented designs, two-stage optimization detracted from the final achieved cost function value, likely from premature convergence to a local optimum. The fragmented design outperformed the original P-LSF design, so we attempted a different P-LSF parameterization. As opposed to using the \(\mathcalligra {l}_2\) norm in the RBFs constituting the P-LSF which results in round material features, we instead apply the \(\mathcalligra {l}_{\infty }\) norm, which tends towards rectangular features similar to fragmented designs. Optimizing the \(\mathcalligra {l}_{\infty }\) P-LSF metasurface resulted in a design that performed better than the best fragmented design. Additionally, we applied the CMA optimizer to both the \(\mathcalligra {l}_{2}\) and \(\mathcalligra {l}_{\infty }\) norm P-LSF metasurfaces. CMA improved the final cost function value in both cases, and the resulting \(\mathcalligra {l}_{2}\) norm design substantially outperformed the \(\mathcalligra {l}_{\infty }\) norm design.

Figure 8
figure 8

Broadband 2:1 bandpass metasurface. (a) Field maps generated from FDTD data are shown at discrete frequencies. Navy represents void, dark gold represents metal, and bright yellow represents areas of strong electric or magnetic field. (b) S-parameters measured in the focused beam system (dashed lines) show good agreement with simulated FDTD outputs (solid lines). Reflectivity is labeled \(S_{11}\) and transmittance is labeled \(S_{21}\). (c) The fabricated metasurface is shown with a detailed view of a few periods of the structure. Void appears as grey where metal appears dark gold.

Measurement

To validate the design process, we fabricated the optimized 2:1 bandpass filter metasurface suggested by the P-LSF GA multi-stage optimization. We measured transmission and reflection scattering parameters in a free-space focused beam system, and close agreement between the full-wave simulation and measured results is shown in Fig. 8.

Discussion

For topology optimization problems, the interplay between material distribution functions and the design variables presented to gradient-free optimization algorithms determines algorithm convergence and the performance of optimized designs. Canonical metasurface designs—Jerusalem cross, split-ring resonator, etc.11,12,13—offer well-behaved, convex design spaces but are too heavily constrained to push the boundaries of achievable frequency responses. The fragmented parameterization offers many more degrees of freedom, but has a discrete, non-convex design space (the vertices of a unit hypercube, \(\varvec{\alpha }\in \{0, 1\}^N\)) which is completely disjoint and poses a difficult combinatorial optimization problem. A new basis for periodic structures like metasurfaces is defined using the periodic level set function (P-LSF), which creates a continuous, convex design space (the interior of a hypercube, \(\varvec{\alpha }\in [-1, 1]^N\)) that facilitates optimization. Moving from a non-convex to a convex design space improves the performance of applied optimization algorithms18,19,20. Genetic algorithms in particular benefit from a continuous, convex design space since the mutation and mating operators can perturb and interpolate between individuals more effectively53, and our results demonstrate accelerated genetic algorithm convergence with the P-LSF basis.

The P-LSF basis also produces more sophisticated material distribution functions than either the fragmented basis or canonical designs. Considering bases with the same number of parameters, a fragmented basis can only construct rectangular material features which are integer multiples of the fragment size, whereas a P-LSF basis can realize continuously varying features as well as diagonal or rounded edges that are unattainable in the fragmented basis. Masks constructed with the P-LSF basis can be arbitrarily resampled at higher or lower resolutions to account for simulation regridding or manufacturing constraints on the mask. As shown in Figs. 7 and 9, the P-LSF basis can realize both large and small material features as guided by the design objective, whereas the fragmented basis is restricted in the range of achievable features.

Figure 9
figure 9

The convergence plot for the design of a dual-band high-Q notch filter shows improved performance using the LSF method in conjunction with the CMA optimizer. Lines indicate best function evaluations over the course of the optimization. Innovations appear as vertical jumps in the solid lines and are marked.

Using the \(\mathcalligra {l}_2\) norm when defining the P-LSF results in rounded features which are suitable for broadband cost functions. For narrowband problems, the P-LSF basis can produce sharper features by redefining the basis with the \(\mathcalligra {l}_{\infty }\) norm. Multi-stage optimization can be applied to both P-LSF and fragmented designs to accelerate convergence by solving an initial coarse problem and incrementally refining the coarse solution to a fine one.

The P-LSF can be used as a drop-in replacement for fragmented designs with few changes to existing evolutionary algorithm infrastructure. Additionally, the P-LSF facilitates the use of more efficient optimization algorithms such as the covariance matrix adaptation evolution strategy (CMA) which can converge to better solutions in fewer iterations. The P-LSF method is broadly applicable to array technologies including microwave spatial filters as shown in this work, optical elements for super-resolution imaging54, graded metasurfaces55, and antenna arrays56.

The metasurface designs attained by the P-LSF optimization are comparable to state-of-the-art designs. Hong et al.57 design single-layer metasurface arrays using annealing with a fragmented parameterization and provide comparison to multiple other designs in the literature. Their bandpass and bandstop filters use a thinner substrate (0.05 mm vs. our 0.127 mm). In comparison, our bandpass design (Fig. 8) achieves a broader passband which extends to lower frequencies, and our dual notch design (Fig. 10) has comparable performance to the bandstop filter. Additionally, the work by Genovesi et al.58 demonstrates a broadband bandpass filter with 64% fractional bandwidth, whereas our bandpass metasurface in Fig. 8 has a fractional bandwidth of 78%.

Figure 10
figure 10

Electric/magnetic field intensities and S-parameters for the dual-band high-Q notch filter, demonstrating that the optimization efficiently arranges multiple independent resonant elements within the available space of the periodic cell. The cost function (Eq. 11) is the difference between the minimum and average transmittance (\(S_{21}\)) in a 1 GHz band around one notch in each frequency band.

Methods

FDTD modeling

We performed electromagnetics simulations using FDTD software developed at Georgia Tech Research Institute (GTRI); however, a working example using the open-source FDTD solver Meep59 is available60. We discretized each metasurface design onto a \(\varvec{N} = [120, 120, 62]^T\) grid with a uniform grid cell size of 0.051 mm (0.002 in) in each dimension. The resulting periodicity of the proposed metasurface is 6.1 mm (0.240 in) in both planar dimensions. The supporting substrate for the metasurface is chosen to be .127 mm (0.005 in) Rogers RO3003 (\(\varepsilon _r^{\prime }=3.0\pm 0.04, \tan {\delta }=0.001\))61. Periodic boundary conditions were used on \(x-\) and \(y-\)faces, and the simulation excited with a normally incident differentiated Gaussian pulse (\(f_p = {15}\,\mathrm{{GHz}}\)) plane wave. We ran each simulation for 8000 time steps (\(\Delta t = {95.876}\,\mathrm{{fs}}\)) and used Prony’s method to extrapolate accurate frequency domain data from any residual energy due to resonance in the grid62. The imaginary permittivity of the dielectric substrate was modeled in FDTD as a constant conductivity \(\sigma = {0.00167}\,{\hbox {S\,m}^{-1}}\).

Optimization parameters

For the genetic algorithm optimizations, we define a mating operator for both the fragmented and P-LSF parameterizations with uniform crossover for binary parameters and intermediate recombination (\(\alpha =0.5\)) for continuous parameters. For fragmented designs, we define an entry-wise binary mutation with a \(10\%\) probability of flipping the value of each fragment. For the P-LSF, we define an entry-wise continuous mutation which has a \(10\%\) chance of triggering for each individual RBF basis coefficient. If a mutation is triggered, there is an \(80\%\) chance to apply a uniform random mutation which is bounded in a small range around the current basis coefficient, and a \(20\%\) chance to redraw the basis coefficient from the full range of values. We use a population size of 200 and performed 40,000 total cost function evaluations.

CMA is applied to the P-LSF designs using the ParameterizedCMA implementation found in the Nevergrad package48, which wraps the pycma algorithm63. The default optimization parameters were used. A total of 40,000 cost function evaluations were performed, but we found no improvement after 10,000 evaluations.

Fabrication and S-parameter measurement

The broadband metasurface was made by printed circuit board processes by etching the pattern on .127 mm (0.005 in) thick Rogers RO3003 (\(\varepsilon _r^{\prime }=3.0\pm 0.04, \tan {\delta }=0.001\))61 with ½ oz. electrodeposited copper foil. The final finish of the board was bare copper.

Scattering parameters for the metasurface were measured in GTRI’s free-space focused beam system as described by Howard et al.46 The time gate width used for the gated reflect line64 calibration was 4 ns.