Maxwell’s equations govern light propagation and its interaction with matter. Therefore, the solution of Maxwell’s equations using computational electromagnetic simulations plays a critical role in understanding light–matter interaction and designing optical elements. Such simulations are often time-consuming, and recent activities have been described to replace or supplement them with trained deep neural networks (DNNs). Such DNNs typically require extensive, computationally demanding simulations using conventional electromagnetic solvers to compose the training dataset. In this paper, we present a novel scheme to train a DNN that solves Maxwell’s equations speedily and accurately without relying on other computational electromagnetic solvers. Our approach is to train a DNN using the residual of Maxwell’s equations as the physics-driven loss function for a network that finds the electric field given the spatial distribution of the material property. We demonstrate it by training a single network that simultaneously finds multiple solutions of various aspheric micro-lenses. Furthermore, we exploit the speed of this network in a novel inverse design scheme to design a micro-lens that maximizes a desired merit function. We believe that our approach opens up a novel way for light simulation and optical design of photonic devices.
Maxwell’s equations describe how light propagates and interacts with materials and account for basic light properties, such as refraction, diffraction, and scattering.1–3 The computational electromagnetic simulations that numerically solve Maxwell’s equations are essential in understanding light–matter interactions near or below the scale of wavelength.3 There have been active research studies in manipulating light by designing an optical element at such scales.4–9 The performance of the optical elements can be optimized by inverse design approaches that are algorithmic techniques to discover the optical structures to optimize the performances as recently reviewed.10 The conventional inverse design processes usually rely on the iterative computation of electromagnetic simulations to optimize the structure in the optimization scheme.10–14 In doing so, it is critical to accurately predict the optical field given an optical element design to guarantee the performance of it using high fidelity electromagnetic solvers, such as the finite difference time domain (FDTD) method15 at the cost of expensive computation. As the total inverse design process requires numerous iterations, it becomes very laborious to perform the electromagnetic simulation at each iteration in the design process. In addition, the design space is highly nonlinear, which makes the inverse problem highly challenging.
Recently, various deep neural networks (DNNs)16 have been very successful in inverse-designing photonic structures as summarized in a recent review paper.17 Most approaches involve the training of a network that can predict certain optical properties when given the structural parameters.18–21 In addition, there have been demonstrations of inverse design using generative adversarial networks.22,23 In both cases, they require datasets of input–output (optical design–optical property) examples while training the networks. As a result, these networks require numerous simulations to construct the training datasets, which is very laborious. Instead of directly predicting the optical properties, DNNs have also been used to speed up the convergence of the generalized minimal residual algorithm, but the output from the network should be followed by iterative calculations to find the electromagnetic field.24
One possible solution to circumvent the burden in the dataset preparation is to utilize DNNs to solve partial differential equations in an indirectly supervised manner.25–33 The key idea is to use the residual of the target differential equation as a loss function and train the network parameters to find the solution. To the best of our knowledge, this approach has not been applied to solve Maxwell’s equations for inhomogeneous dielectric material distribution.
In this contribution, we propose to use the residual of Maxwell’s equations as a physics-driven loss function to train a DNN that finds the electric field given the material property distribution as its input. We demonstrate our approach by training a network that finds the electric field distributions for various aspheric micro-lenses. Furthermore, using the DNN trained for various micro-lenses, we demonstrate that we can inverse design a micro-lens that maximizes the light focusing at a target point. To do so, another DNN is introduced to encode and represent the shape of lenses at a low-dimensional latent space,34,35 and we optimize the shape in this latent space. Latent space is a low-dimensional vector space where the latent vectors embed important features of data. Latent vectors that capture similar features are located closer to each other. Therefore, we can efficiently compress and represent different data in the low-dimensional latent space.
Maxwell’s equations can be written as
for linear, non-magnetic, and isotropic materials without electric and magnetic current densities. E represents the electric field vector, k0 = 2π/λ is the wavevector given a wavelength in the air (λ), and ɛr(r) represents the relative electric permittivity distribution that is related to the refractive index (RI) distribution (n(r)); ɛr(r) = n(r)2. Given the electric field and relative permittivity distributions, Eq. (1) can be used as a strong physics-based metric to evaluate the validity of the electric field. We carried out a simple example where we calculated the electric field for the same material property distribution using two methods that are expected to have different levels of accuracy to visualize what the physics-driven loss function looks like. We present this in Fig. 1(a). The illumination is a plane wave propagating in z and polarized along the y-axis, and the sample is a 2D plano-convex spheric microlens. The physics-driven loss [Eq. (1)] was calculated on the Yee grid36 with the high order approximation of the gradient operator37 to increase the accuracy of differential operators, especially at the sharp changes in dielectric values. The Born field was calculated assuming the first-order Born approximation that assumes that the electric field within the sample is the same as the incident electric field. See the supplementary material for detailed information. As the Born approximation is not valid in this case, we can see that the subtraction of two terms in Eq. (1) does not cancel each other and leaves signals in the residual map within the sample. The ground truth in Fig. 1(a) was acquired using a commercial finite element method solver COMSOL. We can confirm that the physics-driven loss calculated with the ground truth solution shows negligible discrepancy in the residual map.
Examples of the physics-driven loss and description of the main idea: (a) Residuals of Maxwell’s equations calculated under two electric fields: the electric field calculated under the first-order Born approximation (Born field) and the ground truth solution acquired using COMSOL (ground truth). (b) Normalized electric permittivity values are given as input to the network, and the residual of Maxwell’s equations is calculated under the output electric field distributions, which is used as a physics-driven loss function to train the network parameters.
Examples of the physics-driven loss and description of the main idea: (a) Residuals of Maxwell’s equations calculated under two electric fields: the electric field calculated under the first-order Born approximation (Born field) and the ground truth solution acquired using COMSOL (ground truth). (b) Normalized electric permittivity values are given as input to the network, and the residual of Maxwell’s equations is calculated under the output electric field distributions, which is used as a physics-driven loss function to train the network parameters.
We use Eq. (1) as a physics-driven loss function to train a DNN. Since Maxwell’s equations are true for all electromagnetic fields, we expect to converge to a network that predicts the field accurately by minimizing this loss function even in the absence of the ground truth field. As shown in Fig. 1(b), the output of the network is the 3D distribution of the electric field vector, with ɛr(r) as the input. In fact, the normalized relative permittivity distribution ɛr(r) = (ɛr(r) − ɛmin)/(ɛr(r) − ɛmax) is used, where ɛmax and ɛmin denote the maximum and minimum relative permittivity values. We implemented the network using Pytorch, and see the supplementary material for details. We refer to this network as MaxwellNet, and this type of learning takes place in MaxwellNet as indirect training. An alternative approach to finding a DNN that can calculate the fields given the material distribution consists of a first step where highly accurate electromagnetic simulators are used to generate a database of input–output pairs followed by a DNN that uses this database to learn to predict the field. We would refer to this as direct training since the network has access to the desired output for each input in the training set. In MaxwellNet, we only provide the inputs, and the network learns to indirectly infer the correct solution (field) due to the physics-driven loss. Indirect training can be done without access to a large database of input–output pairs that are either experimentally or computationally generated. This can be a big advantage in cases where measuring the 3D field distribution experimentally is not possible or calculating it computationally is not practical.
In the following, we use the MaxwellNet to design lenses to accomplish a specific task. We do this by using examples of multiple lens designs as a training set to search for new lenses. Therefore, we would like the MaxwellNet to be trained to predict the correct field for various index distributions in a class of aspheric lens. Unlike the spherical lens whose shape is described by one parameter (radius of curvature), the sag of an aspheric lens is defined by multiple parameters as follows when we neglect higher order terms:38
where r is the radial coordinate, R represents the radius of curvature, and κ denotes the conic constant. We generated multiple aspheric lenses in 2D by changing these parameters (assuming no variation of ɛr(r) along the y-axis). See the supplementary material for details. We separately trained two networks for transverse electric (TE) and transverse magnetic (TM) modes using this dataset.
Figure 2 demonstrates the results for four different examples, two each for the TE and TM modes. We can see the changes in the electric field distributions for the different lens shapes, and the results from the network show great consistency with the ground truth solutions. The marginal error can be attributed to various factors, such as different discretization schemes between COMSOL and MaxwellNet, the limited network parameters, and the short training time. For the TM mode where two polarized fields couple with each other, the incident light is polarized along the x-axis; however, the resulting fields are polarized along both x and z axes. The networks did not access any of the target solutions but were trained only using the physics-driven loss for both TE and TM modes. We calculated the accuracy of MaxwellNet using the following metric:
where fCOMSOL and fMaxwellNet represent the electric field distributions calculated from COMSOL and MaxwellNet, respectively, and fincident represents the incident field. In addition, we measured the calculation time of COMSOL and MaxwellNet and summarize them in Table I. For the model training, it took about 37 and 63 hours to train the models for TE and TM modes, respectively. At the cost of the training time, once trained, we can simulate the light scattering rapidly (6.4 ms vs 4 s as shown in this table).
Results for four different examples, two each for the (a) TE and (b) TM modes. The outputs of the networks are presented and compared with the ground truth solutions. For the TE mode, the output field only exists in the same polarization of the illumination (Ey). By contrast, the TM mode results present the fields not only in the incident polarization (Ex) but also in z polarization (Ez) due to the polarization coupling.
Results for four different examples, two each for the (a) TE and (b) TM modes. The outputs of the networks are presented and compared with the ground truth solutions. For the TE mode, the output field only exists in the same polarization of the illumination (Ey). By contrast, the TM mode results present the fields not only in the incident polarization (Ex) but also in z polarization (Ez) due to the polarization coupling.
Comparison of computational time and accuracy.
. | TE . | TM . |
---|---|---|
COMSOL | 4 s | 4 s |
MaxwellNet | 6.4 ms accuracy: 0.0117 (Ey) | 12 ms accuracy: 0.0077 (Ex) 0.003 9 (Ez) |
. | TE . | TM . |
---|---|---|
COMSOL | 4 s | 4 s |
MaxwellNet | 6.4 ms accuracy: 0.0117 (Ey) | 12 ms accuracy: 0.0077 (Ex) 0.003 9 (Ez) |
In a recent paper,35 the authors trained a computational fluid dynamic simulator and used it to optimize the shape of a car to minimize the drag on it. In a similar way, thanks to the physics-driven loss, we can train a light-scattering simulator in the indirectly supervised manner and use it to design an optical element to maximize a certain figure of merit (FOM). We demonstrate it using the trained MaxwellNet for various aspheric lenses to design an aspheric lens to focus light at the desired point. We should point out that this lens design problem is not something that can be done with standard ray optics tools since the dimensions are only 10λ and wave analysis must be used. The full-wave equation solver that might be used to optimize the shape of the lens is the FDTD method to calculate forward and backward propagations.11 By exploiting the fast computation speed of MaxwellNet, we can accelerate the inverse design process by replacing FDTD with MaxwellNet.
Since our goal is to design the shape of the lens, we introduce a second DNN, DeepSDF, which is trained to classify each pixel as either being the lens material or air. This is depicted in Fig. 3. Each sample in the training set consisting of aspheric lenses is assigned a latent vector, , where the subscript i denotes the index of the sample. The network takes an input vector that is the concatenation of a latent vector, vi, and a coordinate vector, , and returns a scalar value, . The output value is trained to be either −0.5 or +0.5 to represent the material at the point, (x, z), for the ith sample. The pixel value at a certain position, (x, z), can be either the background or lens material depending on the lens shape that is determined using Eq. (2). DeepSDF is trained in a supervised way using the aspheric lens dataset, and each latent vector is also updated to encode the shape of the assigned lens. See the supplementary material for additional details. Once the network is trained, each latent vector encodes the shape of the assigned lens and returns it when given to the network. In other words, latent vectors that capture similar features are located closer to each other. Therefore, we can efficiently compress and represent different data in the low-dimensional latent space. We selected two latent vectors assigned to two lenses in the training dataset and reconstructed the shapes of corresponding lenses as shown in Fig. 3(b). We only trained half of the lenses as they are x-symmetric. Comparing with the ground truth lens shapes, we can confirm that the latent vectors along with DeepSDF can represent the lens shape with high accuracy. The significance of the latent space representation is that it is a compressed version of the complete shape of the lens, and therefore, it becomes computationally efficient to carry out the optimization in the latent space.
DeepSDF training. (a) The input to DeepSDF is the concatenated vector of a latent vector, vi, and a position vector, (x, z). The network is trained to give a scalar value as output to represent whether the position is filled with the material (+0.5) or not (−0.5). (b) Two different lens shapes were reconstructed by giving two latent vectors to DeepSDF and compared with the corresponding target shapes.
DeepSDF training. (a) The input to DeepSDF is the concatenated vector of a latent vector, vi, and a position vector, (x, z). The network is trained to give a scalar value as output to represent whether the position is filled with the material (+0.5) or not (−0.5). (b) Two different lens shapes were reconstructed by giving two latent vectors to DeepSDF and compared with the corresponding target shapes.
Here, we propose a novel inverse design scheme by combining the MaxwellNet and DeepSDF. We demonstrate it by designing a micro-lens to maximize the light intensity at a target position. The inverse design scheme is described in Fig. 4(a). Given a latent vector, vi, along with the position values, DeepSDF produces the corresponding lens shape, and it serves as an input to MaxwellNet (TE mode) to calculate the corresponding electric field distribution. Since the focal point is located out of the computation domain of MaxwellNet, we efficiently calculate the electric field outside of the sample by convolving the homogeneous medium Green’s function (details are given in the supplementary material) and define a figure of merit (FOM) function as the intensity at the target focal point. Usual inverse design approaches maximize the FOM function by taking the derivative with respect to the sample shape, ∂FOM/∂s, and the solution is usually neither discrete nor manufacturable. Unlike the conventional inverse design approaches, the proposed scheme maximizes the FOM with respect to the latent vector, ∂FOM/∂v. In other words, since DeepSDF learned to represent the various lens shapes when given the latent vectors that encode the shapes, we can optimize the lens design by finding a latent vector that maximizes the FOM. See the supplementary material for additional details.
Description of the inverse design idea. (a) The input to DeepSDF is the concatenated vector of a latent vector, vi, and a position vector, (x, z), which produces a micro-lens shape, and it is followed by MaxwellNet to predict the electric field distribution. Using Green’s function, we can expand the computation domain. We optimize the lens shape in the latent space of DeepSDF to maximize the figure of merit function. (b) Starting from the initial spheric lens, we inverse-designed an aspheric lens that maximizes the light intensity value at 8 μm. The 1D profile plots at the center are presented for the initial and inverse-designed solutions. We further performed a COMSOL simulation on the inverse-designed solution to validate.
Description of the inverse design idea. (a) The input to DeepSDF is the concatenated vector of a latent vector, vi, and a position vector, (x, z), which produces a micro-lens shape, and it is followed by MaxwellNet to predict the electric field distribution. Using Green’s function, we can expand the computation domain. We optimize the lens shape in the latent space of DeepSDF to maximize the figure of merit function. (b) Starting from the initial spheric lens, we inverse-designed an aspheric lens that maximizes the light intensity value at 8 μm. The 1D profile plots at the center are presented for the initial and inverse-designed solutions. We further performed a COMSOL simulation on the inverse-designed solution to validate.
Figure 4(b) shows an example of designing a micro-lens to focus light at 8 µm from the center of the lens. The initial lens design is a spheric lens, and it forms its focus after 12 µm from the center of the lens. With the spheric lens as an initial solution, we optimized the latent vector to maximize the intensity pixel value at 8 µm, and we can confirm that the optimized aspheric lens focuses the light at the desired target location. To validate the result, we ran a COMSOL simulation for the optimized aspheric lens and compared the intensity profiles at the central line. We can see in the intensity profiles from the MaxwellNet and COMSOL that the results show great consistency. In the supplementary material, we analyzed the shape of the inverse-designed lens sag function by performing a curve fitting with Eq. (2) and compared the found parameters with those of the training dataset.
To summarize, we have described a physics-driven loss to train a DNN. The main idea is to penalize the residual of Maxwell’s equations as a loss function to train a network that predicts electric field distributions when given the permittivity distribution of a sample. We applied the idea to simultaneously train the network parameters to predict the electric field distributions of a collection of aspheric lenses. The outputs from the network show great consistency with the ground truth solutions. Therefore, we can use the trained MaxwellNet as an extremely rapid light scattering simulator for the trained lenses and other samples that share the same statistical distribution of the training dataset. Here, we emphasize that the training process does not require any access to the target solutions but only uses the physics-driven loss based on Maxwell’s equations.
There are a few points worth noting regarding MaxwellNet. For various aspheric lenses, MaxwellNet accurately finds the solutions, but we also observed that MaxwellNet struggles to find the correct solution for a certain type of sample. We present this example in the supplementary material where there exist resonant signals widely distributed over the surface of the sample, and it is challenging to generate these resonant signals using the residual error map. In addition, in our case, MaxwellNet was trained only for aspheric lenses. If we give a sample that is statistically very different from the training set (aspheric lenses), the current network will not simulate it accurately since the network did not see this kind of sample during the training at all. However, we expect that it would be possible to use the network trained for aspheric lenses to efficiently transfer-learn light scattering to different but similar cases. Transfer learning is an active branch of research in deep learning where we exploit the previously learned features and knowledge and transfer them efficiently to a similar task.39 We expect to transfer-learn features of light scattering from the previously trained network for aspheric lenses to different light scattering problems as both of them are governed by Maxwell’s equations.
We also proposed a novel inverse design scheme using MaxwellNet as the forward simulator. In conventional inverse design schemes based on the adjoint method, the calculated gradient values are continuous while we can only use specific materials whose permittivity values are discrete and distinct in most cases. It therefore requires additional steps to be integrated during the optimization process to guarantee that the final solution is manufacturable. To circumvent this problem, we trained DeepSDF along with the latent vectors to encode and represent the different lens shapes. By doing so, we can update the solution that maximizes the FOM function in the latent vector space rather than the shape space itself. We demonstrated it by designing a micro-aspheric lens to maximize the light intensity at a desired focal point and validated the final lens design using COMSOL. Here, we have demonstrated the proposed scheme only for the microlens design; however, we believe that it can be further extended to other types of photonic design applications and pave a new way of inverse design.
SUPPLEMENTARY MATERIAL
See the supplementary material for additional details.
ACKNOWLEDGMENTS
This work was funded at the EPFL by Swiss National Science Foundation (Grant No. 514481).
AUTHOR DECLARATIONS
Conflict of Interest
The authors have no conflicts to disclose.
DATA AVAILABILITY
The data that support the findings of this study are available from the corresponding author upon reasonable request.