Solving Maxwell's Equation in 2D with Neural Networks with Local
  Converging Inputs
In this paper we apply neural networks with local converging inputs (NNLCI),
originally introduced in [arXiv:2109.09316], to solve the two dimensional
Maxwell's equation around perfect electric conductors (PECs). The input to the
networks consist of local patches of low cost numerical solutions to the
equation computed on two coarse grids, and the output is a more accurate
solution at the center of the local patch. We apply the recently developed
second order finite difference method [arXiv:2209.00740] to generate the input
and training data which captures the scattering of electromagnetic waves off of
a PEC at a given terminal time. The advantage of NNLCI is that once trained it
offers an efficient alternative to costly high-resolution conventional
numerical methods; our numerical experiments indicate the computational
complexity saving by a factor of $8^3$ in terms of the number of
spatial-temporal grid points. In contrast with existing research work on
applying neural networks to directly solve PDEs, our method takes advantage of
the local domain of dependence of the Maxwell's equation in the input solution
patches, and is therefore simpler, yet still robust. We demonstrate that we can
train our neural network on some PECs to predict accurate solutions to
different PECs with quite different geometries from any of the training
examples.
Harris Cobb, Hwi Lee, Yingjie Liu
# Solving Maxwell's Equation in 2D with NNLCI

###### Abstract

In this paper we apply neural networks with local converging inputs (NNLCI), originally developed in [11], to solve the two dimensional Maxwell's equation around perfect electric conductors (PECs). The input to the networks consist of local patches of low cost numerical solutions to the equation computed on two coarse grids, and the output is a more accurate solution at the center of the local patch. We apply the recently developed second order finite difference method [16] to generate the input and training data which captures the scattering of electromagnetic waves off of a PEC at a given terminal time. The advantage of NNLCI is that once trained it offers an efficient alternative to costly high-resolution conventional numerical methods; our numerical experiments indicate the computational complexity saving by a factor of \(8^{3}\) in terms of the number of spatial-temporal grid points. In contrast with existing research work on applying neural networks to directly solve PDEs, our method takes advantage of the local domain of dependence of the Maxwell's equation in the input solution patches, and is therefore simpler, yet still robust. We demonstrate that we can train our neural network on some PECs to predict accurate solutions to different PECs with quite different geometries from any of the training examples.

## 1 Introduction

In recent years, applications of artificial neural networks have permeated the broad realm of computational science thanks to the advances in computing powers such as Graphical Processing Units (GPUs) as well as the expansion of data availability. Some specific examples encompass biological applications [24], image processing [15], uncertainty quantification [35] among a plethora of existing work. The utility of the neural networks (NNs) can be attributed to the classical result on its universal approximation property [5, 10], of which our current work is yet another demonstration in the context of numerically solving partial differential equations (PDEs). More specifically we are interested in the so-called forward problem of computing numerical solutions as opposed to the backward problems of identifying the underlying PDEs, although the latter has received as much attention in scientific computing literature [20, 14, 9].

An approach to using NNs to solve PDEs is to approximate the mapping from all known information (such as the initial value, boundary values etc) to the unknown solution by a deep neural network and use many existing solutions for training, see e.g [17]. Another approach is to approximate the mapping from a space-time location to the solution there with a deep neural network and define the loss function as certain form of the residual error of a PDE,
plus penalty terms enforcing the physical data such as initial and boundary conditions. The deep Galerkin method [34] introduces a loss function which contains the residue error of a finite difference approximation to the PDE. The deep Ritz method [7] introduces a loss function which contains the Ritz energy of the finite element approximation of the PDE. The physics informed neural network (PINN) [31] exploits the exact auto-differentiation [1] in computation of the loss function which is designed to enforce consistency with the governing PDE. These methods harness the approximation property of NNs as an ansatz for the solutions to the PDEs. Besides the solution learning, researchers have also investigated the possibilities of training NNs to learn the solution operators as a function of the parameters of the PDE [39]. The domains for successful application of PINN are far-reaching, including but not limited to fluid flows, heat transfer and optics [19, 2, 3]. The ongoing research efforts have resulted in some modifications of PINN itself as in [27], incorporating information from partially known solutions in low and high fidelities in the loss function [21] and the emergence of related approaches like physics-informed convolutional neural networks used in [38]. We would like to refer to [4] and the references therein for an overview of PINN and more classical NN-based approaches. We also point out some alternatives such as those based on Gaussian processes [28], and NN augmented time-stepping strategies [33].

The accuracy enhancement by NNs has been illustrated in existing literature [29], and the growing number of studies is geared towards complexity-reduction hybrid methods combining NNs and conventional numerical methods [18, 23]. In this work we pursue a different NN-based approach, adopting the architecture of recently developed neural networks with local converging inputs (NNLCIs) [11, 12]. The NNLCIs have been successfully applied to nonlinear Euler equations for gas dynamics in one and two spatial dimensions as a black-box tool to generate high fidelity solutions containing complicated interactions of shocks and contacts from two converging, low-cost, low-fidelity numerical solutions. Our work pursues another application of the NNLCIs as a computational saving tool, instead of investigating the high expressivity and intricate inner workings of which have yet to be fully and rigorously understood. The onus is on the NNs to acquire the predictive ability for accuracy improvement when the users work on careful design of the inputs to the network inputs rather than the network architectures such as choices for activation functions.

We demonstrate the utility of NNLCIs in the case of solving Maxwell's equations around curved perfect electric conductors with corners. The scattering of electromagnetic waves is of practical importance with industrial applications as in antenna designs [22], for which one may need to do repeated computations with various shapes of PEC objects. It is indeed the high complexity of possible variations in PEC boundary geometries that distinguishes our work from the earlier applications of NNLCIs. We illustrate that it is sufficient for the NNLCIs to be trained locally with respect to some PEC shapes to be able to extract more accurate solutions from the two coarse grid solutions for different shapes of PECs. The parameter space of local geometries of PECS is expected to be more tractable than that of global ones, and after all the analytical, hence numerical, solutions to the Maxwell's equations have local domains of dependence. We fully exploit such locality in approximation of the underlying unknown multivariate mapping, steering away from more conventional approach of taking as a single input all the known data from the entire computational domain.

Our proposed NNLCI-based approach benefits largely from the recently developed numerical scheme [12] which is used to compute the inputs to our network. What makes the
scheme attractive is its simple and systematic treatment of boundary conditions for general curved PEC shapes that may even have corners. More specifically the scheme is based on automatic construction of ghost values by means of the level set framework [25], the PDE-based extension technique [30, 8] and the so-called guest values. Another merit of the scheme is its second order accuracy which is what the popular Yee scheme [37] can achieve in free space without any PECs. We also point out that our underlying numerical scheme is based on uniform rectangular grids, which are particularly well-suited to NNLCIs since the inputs are finite difference stencils at two different resolutions that need to be aligned at the same spatial and temporal locations.

The rest of the paper is organized as follows. In Section 2, we introduce the scattering problem and the numerical scheme we use to produce the training and testing data. We then present our NNLCI focusing on how its inputs are to be formatted. In Section 3, we provide the results of our numerical experiments to illustrate the effectiveness of our approach. We conclude our paper in Section 4.

## 2 Problem Formulation

### The governing PDEs and underlying numerical method

The classical Maxwell's equations govern the dynamics of electromagnetic fields through a medium which we assume in this work is isotropic and homogeneous. In particular we consider the scattering of electromagnetic waves off of a PEC in free space, that is,

\[\epsilon_{r}\frac{\partial\mathbf{E}}{\partial t} =\nabla\times\mathbf{H}\] \[\mu_{r}\frac{\partial\mathbf{H}}{\partial t} =-\nabla\times\mathbf{E}\]

subject to some initial conditions and the PEC boundary conditions that are given by

\[\mathbf{E}\times\mathbf{n}=\mathbf{0}\text{ and }\mathbf{H}\cdot\mathbf{n}= \mathbf{0}.\]

Here \(\epsilon_{r}\) and \(\mu_{r}\) denote the relative permittivity and permeability, respectively, and \(\mathbf{n}\) denotes the outward unit normal vector to the PEC interface. Without loss of generality we set \(\epsilon_{r}=\mu_{r}=1\), and assume for simplicity that the waves are transmagnetic polarized in the \(z-\)direction, thereby obtaining the following two dimensional system of equation

\[\frac{\partial H_{x}}{\partial t} = -\frac{\partial E_{z}}{\partial y}\] \[\frac{\partial H_{y}}{\partial t} = \frac{\partial E_{z}}{\partial x} \tag{1}\] \[\frac{\partial E_{z}}{\partial t} = \frac{\partial H_{y}}{\partial x}-\frac{\partial H_{x}}{\partial y}.\]

In order to numerically simulate the dynamics (1) in free space, we first choose the unit square \([0,1]^{2}\) as our computational domain. We superimpose on the domain uniform rectangular
grids \(\{(x_{i},y_{j})\}\) with \(\Delta x=\Delta y\). We adopt the implementation of perfectly matched layer as done in [32] to enforce the far field absorbing boundary conditions so that the reflected waves off the PEC do not re-enter the computational domain. To this end we follow the total/scatter formulation [13] with the prescription of the incident waves.

We apply the finite difference method [16] to compute the numerical solutions to (2), which will serve as training and test data to our NNLCI. The method is mainly composed of three elements, the first of which is the first order scheme

\[U_{i,j}^{n+1}=\left(\frac{1}{5}\mathcal{C}+\frac{4}{5}\mathcal{F}\right)U_{i, j}^{n}. \tag{2}\]

where \(U_{i,j}^{n}\) denotes the numerical scheme at the time level \(t=n\Delta t\) and at the spatial location \((x_{i},y_{j})\). Here \(\mathcal{C}\) denotes the forward-in time, centered-in-space numerical scheme while \(\mathcal{F}\) denotes the classical Lax-Friedrichs scheme. We choose scheme (2) as it has already been used in [16, 40] to simulate the scattering of electromagnetic waves about PECs, but one may instead consider a more general scheme \((\theta\mathcal{C}+(1-\theta)\mathcal{F})\) with \(0\leq\theta\leq 1\)[36]. The second element is the construction of ghost values inside the PECs via a level-set based PDE extension technique as well as the introduction of guest values. The constructed ghost values are to be locally second order accurate to ensure the first order accuracy of the scheme (2). The last ingredient is the Back and Forth Error Compensation and Correction (BFECC) method [6] which in general increases the order of accuracy by one for odd order schemes [26]. Therefore in our current setting our numerical solutions are computed to second order accuracy. Moreover BFECC provides enhanced numerical stability by allowing a larger CFL number, hence we choose \(\Delta t=\Delta x\) which would otherwise not be allowed. An example of the computed numerical solutions is shown in Figure 1 which contains only the total field region.

The question of interest to us is whether it is possible for a neural network to produce high fidelity numerical solutions from numerical solutions computed on two coarse grids. The affirmative answer, at least in the cases we demonstrate, is made possible by the NNLCI which we present in the sequel.

Figure 1: \(H_{x}\) scattering around a cylinder after 0.8 seconds.
### Application of NNLCIs

We follow the architecture of the neural network used in [11, 12] which is a simple fully connected feed-forward network based on multiple steps of Adams optimizer and a final step of L-BFGS for each iteration instead of stochastic gradient descent. We modify the hyperparameters of the optimizer used in their work so that the learning rate of L-BFGS is 3e-6 and the learning rate of Adams is 1e-5. Our network consists of 4 layers with 50 neurons in each layer, hence it can be trained readily yet we observe highly predictive capabilities of the network in our numerical experiments.

We iterate the numerical scheme introduced above until a fixed terminal time, \(T=0.8\) in most of our experiments unless stated otherwise, on three different numerical resolutions, two low-fidelity resolutions and one high-fidelity resolution. In particular, we take \(\Delta x=1/40,1/80\) for the two low fidelity solutions and \(\Delta x=1/640\) for the high-fidelity solution which we regard as the "exact" reference solution. We store all the numerical solutions only at the terminal time, as opposed to the two different time levels as done in the earlier work [11]. This is because the Maxwell's equations (1) are time reversible, hence the solutions at the previous time step are uniquely determined by the solutions at the current time step, so we omit any notation that denotes the time.

From the stored numerical solutions, we prepare the input data to our network as follows. Let us write \((i^{\prime},j^{\prime}),(i^{\prime\prime},j^{\prime\prime})\), and \((i,j)\) to denote the same location in space for the coarsest, finer and the reference grids respectively. We consider a \(3\times 3\) window in the coarsest grid centered at \((i^{\prime},j^{\prime})\). In this paper, we restrict to the case where the center, \((i^{\prime},j^{\prime})\), and all its 8 neighboring grid points belong to the total-field region outside the PEC. In the future, we will consider relaxation of this restriction. From the coarsest grid we reshape the \(3\times 3\) windows for each of \(H_{x},H_{y},E_{z}\) into \(1\times 9\) vectors

\[\{(H_{x})_{i^{\prime}-1,j^{\prime}-1},(H_{x})_{i^{\prime},j^{\prime}-1},(H_{x })_{i^{\prime}+1,j^{\prime}-1},\ldots,(H_{x})_{i^{\prime}-1,j^{\prime}+1},(H_{ x})_{i^{\prime},j^{\prime}+1},(H_{x})_{i^{\prime}+1,j^{\prime}+1}\}\]

\[\{(H_{y})_{i^{\prime}-1,j^{\prime}-1},\ldots,(H_{y})_{i^{\prime}+1,j^{\prime}+ 1}\},\{(E_{z})_{i^{\prime}-1,j^{\prime}-1},\ldots,(E_{z})_{i^{\prime}+1,j^{ \prime}+1}\}\]

and concatenate all 27 of the values into a single vector. Similarly we take from the finer grid

\[\{(H_{x})_{i^{\prime\prime}-2,j^{\prime\prime}-2},(H_{x})_{i^{\prime\prime},j ^{\prime\prime}-2},(H_{x})_{i^{\prime\prime}+2,j^{\prime\prime}-2},\ldots,(H_{ x})_{i^{\prime\prime}-2,j^{\prime\prime}+2},(H_{x})_{i^{\prime\prime},j^{ \prime\prime}+2},(H_{x})_{i^{\prime\prime}+2,j^{\prime\prime}+2}\}\]

\[\{(H_{y})_{i^{\prime\prime}-2,j^{\prime\prime}-2},\ldots,(H_{y})_{i^{\prime \prime}+2,j^{\prime\prime}+2}\},\{(E_{z})_{i^{\prime\prime}-2,j^{\prime\prime}- 2},\ldots,(E_{z})_{i^{\prime\prime}+2,j^{\prime\prime}+2}\}\]

and concatenate all the values. As a result the input vector consists of 54 input values

\[\{(H_{x})_{i^{\prime}-1,j^{\prime}-1},\ldots,(E_{z})_{i^{\prime\prime}+2,j^{ \prime\prime}+2}\},\]

which is then to be fed into our network to produce the output vector

\[\{(H_{x})_{i,j},(H_{y})_{i,j},(E_{z})_{i,j}\}.\]

We illustrate how the input data are prepared in Fig. 2 where \(\mathbf{U}\) represents the vector containing all three components \(H_{x},H_{y},E_{z}\).
The ordering of the input data is immaterial so far as it is consistent across all \(3\times 3\) windows. Following the approach in [12], one may include the time step size \(\Delta t\) as part of the input data. However in the present work the simpler input format we choose is sufficient to produce accurate solutions.

We train the network until the training error is 1e-5. The training and testing data consist of perturbations of the incident wave given by

\[\begin{split} H_{x}(x,y,t)&=0\\ H_{y}(x,y,t)&=-\sin(\omega(x-t)))\chi(t-x)\\ E_{z}(x,y,t)&=\sin(\omega(x-t))\chi(t-x)\end{split} \tag{3}\]

where \(\omega=2\pi/0.3\) is the angular frequency and \(\chi(z)\) denotes the heaviside step function. We also consider different shapes of the PECs to illustrate the robustness of the network. Once the network is trained, we measure its performance by comparing the relative errors (over the total field region) of the predicted numerical solutions and the finer grid input solutions.

## 3 Numerical Experiments

### Different source waves

We first demonstrate the performance of our network to predict high-fidelity solutions when the incident waves in (3) are perturbed with respect to their amplitudes or the angular frequencies. Unless stated otherwise, we fix the geometry of the PEC to a circular PEC

Figure 2: Procedure for preparing input to 2CGNN.
centered at \((0.5,0.5)\) with the radius \(0.2\). Moreover both the training and testing input vectors are taken from all \(3\times 3\) admissible input windows over the entire computational domain.

#### 3.1.1 Varying amplitudes

We consider up to \(10\%\) perturbations of the amplitude of the incident waves. More specifically we compute the two coarse grid and reference solutions subject to the perturbations of \(0,\pm 2,\pm 3,\pm 4,\pm 5,\pm 6,\pm 7,\pm 8,\pm 10\%\) corresponding to the 17 data sets of amplitudes from \(0.9\) to \(1.1\). The computed data are then separated into either the training or testing sets. The first experiment consists of training on the even perturbations and testing on the odd perturbations. The second is to train on \(0,\pm 10\%\) perturbations, and test on the rest of the perturbations. Lastly we train on \(0,\pm 5\%\) perturbations and test on the rest. In all the cases we consider throughout this paper, we decrease to the same network training loss, \(2.5e-5\). We compute the relative errors in \(l_{2}\) norm of the predicted and finer grid input solutions with respect to the reference solutions. The averaged errors with respect to the number of perturbations in the testing data are shown in Table (1).

Since the Maxwell's equations (1) are scaling invariant, one may hence use a small set of training data with fairly large training gaps so far as the perturbed amplitudes are concerned. We note that in the first two experiments (training on the even perturbations, and \(0\%,\pm 10\%\)) all the testing vectors belong to the convex hull of the training data, hence the corresponding outputs are linearly interpolated from the training data. However the last case is concerned with some testing vectors for which the desired outputs are to be linearly extrapolated, which suggest one of the robust features of our method which was not considered in the earlier work [11].

#### 3.1.2 Varying frequencies

We next consider modifying the angular frequencies of the incident waves. It is of interest to demonstrate the performance of the network when the effects of the perturbed frequencies are nonlinear on the corresponding solutions. We generate the training and testing data up to \(\pm 10\%\) as in the amplitude case. The results are displayed in Figures 3 and 4. We observe from Table 2 that the accuracy gain is significant when the training gap is small, covering all the even perturbations. However, there is not much improvement in accuracy when the training gap is enlarged to \(\pm 10\%\) when the network is expected to quadratically interpolate the training data. On the other hand we do not observe better accuracy improvement when the training gap alone is narrowed to the \(\pm 5\%\) perturbations without increasing the number of the training data. To rule out the possibility of limited accuracy gain due to extrapolation,

\begin{table}
\begin{tabular}{|c|c|c|c|c|} \hline \multicolumn{5}{|c|}{Circular PEC: modifying amplitudes} \\ \hline Even Perturbations & \multicolumn{2}{c|}{\(0\%,\pm 10\%\)} & \multicolumn{2}{c|}{\(0\%,\pm 5\%\)} \\ \hline Finer Input Err. & 0.1634 & Finer Input Err. & 0.1634 & Finer Input Err. & 0.1634 \\ Pred. Err. & 0.0031 & Pred. Err. & 0.0029 & Pred. Err. & 0.0042 \\ \hline \end{tabular}
\end{table}
Table 1: Accuracy of the predicted solutions to a circular PEC with varying amplitudes.
we have limited the testing data only to \(\pm 7\%\) and \(\pm 8\%\) subject to two training cases, the first on \(0\%,\pm 10\%\) and the second on \(0\%,\pm 5\%\). We observe in Table 5 that the number of training data plays a more critical role than the training gap as it caps the complexity of the NN approximation.

Note that in following and subsequent graphs the \(H_{x}\) field appears to be non-zero within the boundary of the PEC. This is only due to the limitation of how MatLab generates surface plots: The color of each cell is determined by the value of the top-left corner, so the interior conditions of the PEC are not violated. Also, since we only use as input \(3\times 3\) windows which are entirely contained within the total field, we cannot as of yet predict values which are within \(\Delta x\) of the PEC. To this end for the purposes of graphical clarity, we take the values around the PEC which cannot be predicted from the high-fidelity solution. However in future work, we will attempt to predict values all the way up to and including the boundary of the PEC which will be owed to the modification of our numerical scheme which will give a higher-order recovering of the ghost values.

Figure 4: Cross-sections of the computed \(H_{x}\) at different \(y\) values.

Figure 3: Predicted values of \(H_{x}\) scattering off a circle for the \(+5\%\) perturbed frequency in the plane at 0.8 seconds after training the network on all the even perturbations.
We next change the circular PEC to a square centered at \((0.5,0.5)\) with the side length of \(0.4\). We demonstrate that the network can still predict high-fidelity solutions despite the corner singularities of the analytic solutions. We use the same training and testing data of perturbed frequencies as in the circular case. The results are displayed in Figures 6 and 7. We observe from Table 8 that the results are similar to those of the circular case, although the errors for each of the training gaps are more pronounced.
#### 3.1.3 Rotations

It is well known that the Maxwell's equations (1) are rotation invariant. If the PEC object is also symmetric with respect to rotation as in the circular case, then the solutions are simply rotated when the planar incident waves are rotated. However, we observe poor accuracy improvement when the network is trained on one orientation of the incident waves and tested on another configuration. This can be explained by the fact that the training is entirely local, hence the network is not expected to discern the global rotation invariance of the training and testing data. On the other hand one can easily enrich the training data set with the rotated numerical solutions that do not need to be re-computed. Moreover many practical applications involve general shapes of PECs for which the rotational symmetry of the solutions is absent or unknown a priori. Hence the training of the neural networks is expected to involve incident waves entering the domain at various incident angles, regardless of whether the training itself is local or global.

### Varying PEC boundaries

We now consider applications of our neural network when the training and testing data involve the PECs of different shapes. The complexity of the associated geometric parameter space is more complicated than that of the perturbed incident waves. The local training of the network is expected to play a crucial role of rendering model order reduction to variations in local boundary geometries of the PECs. Unless stated otherwise the incident waves are the unperturbed ones prescribed in (3).

#### 3.2.1 Modification of the circular PEC

We first consider varying the radius of the circular PEC. We generate the data corresponding to the perturbations of the unperturbed radius of \(0.2\) with perturbations of \(0,\pm 2\%,\pm 3\%,\pm 4\%,\)\(\pm 5\%,\pm 6\%,\pm 7\%,\pm 8\%,\pm 10\%,\) just as for the previously considered cases. Similar to the case of varying amplitudes, we separate the generated data into either training or testing data. We observe significant accuracy improvement even when the number of training data is quite small.

\begin{table}
\begin{tabular}{|c|c|c|c|c|c|} \hline \multicolumn{6}{|c|}{Square PEC: modifying frequency} \\ \hline Even Perturbations & \multicolumn{2}{c|}{\(0\%,\pm 10\%\)} & \multicolumn{2}{c|}{\(0\%,\pm 5\%\)} \\ \hline Finer Input Err. & 0.1500 & Finer Input Err. & 0.1501 & Finer Input Err. & 0.1505 \\ Pred. Err. & 0.0095 & Pred. Err. & 0.1006 & Pred. Err. & 0.0761 \\ \hline \end{tabular}
\end{table}
Table 3: Accuracy of predicted solutions subject to changing radius

Figure 8: Accuracy of the predicted solutions to square PEC with varying frequencies.
We next truncate the circular PEC to circular sectors which subtends the angles of various magnitudes (see Figures 9 and 10). At first, we generated the solutions corresponding to the angles from 30 to 360 degrees in 30 degree increments. We found however that our neural network, regardless of our testing and training sets, was unable to produce accurate predictions due to the large training gap. On the other hand, our network manages to improve the accuracy of the low fidelity solutions when the increments in angles are 5 degrees. More specifically we train when the increments in angles are 10 degrees, that is \(45^{\circ},55^{\circ},\ldots,125^{\circ},135^{\circ}\), and then test on the even perturbations \(50^{\circ},60^{\circ},\ldots,120^{\circ},130^{\circ}\), see Figures 11 and 12. We then consider enlarging the training gap to \(15^{\circ}\) increments since in some practical applications it may not be ideal to enforce smaller training gaps. Namely we train on \(45^{\circ},60^{\circ},\ldots,120^{\circ},135^{\circ}\) and test on the rest of the perturbations to obtain the similar accuracy improvement as in the case of \(5^{\circ}\) increments, see Table 4.
#### 3.2.2 Between circular and square PECs

We consider the circular PEC as well as the square PEC from subsection 3.1.2. The two PECs are topologically equivalent, yet it is to the best of our knowledge that the corresponding solutions need to be computed separately for each case. To illustrate the effectiveness of our NNLCI-based approach, we generate three different sets of training data for each parameter considered above, namely all the perturbations (up to \(\pm 10\%\)) in frequencies, amplitudes, and radii of the circular PEC. For each training data, we use the unperturbed case for the square PEC as the testing case. We can see from Table 5 that both the frequencies and the radius cases perform similarly well while the amplitude data performs poorly due to the degeneracy of the training data. The results show that our approach of local training is able to cope

\begin{table}
\begin{tabular}{|c|c|c|} \hline \multicolumn{3}{|c|}{Sectors from 45 to 135 degrees with 5 degree increments} \\ \hline \(10^{\circ}\) Increments in Training & \(15^{\circ}\) Increments in Training \\ \hline Finer Input Err. & 0.1987 & Finer Input Err. & 0.1991 \\ Pred. Err. & 0.0344 & Pred. Err. & 0.0459 \\ \hline \end{tabular}
\end{table}
Table 4: Accuracy of the predicted solutions to PEC sectors of varying angles

Figure 11: Predicted values of \(H_{x}\) scattering off a \(90^{\circ}\) sector in the plane at 0.8 seconds after training the model on \(10^{\circ}\) angle increments.

Figure 12: Cross-sections of the above case at different \(y\) values comparing the predicted values with the input and reference values.
with the qualitative differences in the scattering around the corners of the rectangular PEC.

Conversely, we train on the square PEC subject to all perturbations in the frequencies and side lengths of the rectangle. Then we test on the unperturbed case for the circular PEC, and we observe limited accuracy improvement (Table 6). One possible explanation is that the training data for the square PEC cover a small range of the angles at which the incident waves are interacting with the PEC, which may fall short of rendering the predictive power for a broader range of the angles for the circular PEC. On a related note, we leave it for future work to explore the possibility of accurately predicting the cases for arbitrary PEC shapes with only a handful of relatively simple training data.
#### 3.2.3 Quarter Circle Predicts the Square

In this last test case, we aim at predicting the unperturbed case for the square PEC using the unperturbed (in frequency and amplitude) data for the quarter circle PEC. At first, we considered the training data that consisted of the unperturbed solutions to the original quarter circle as well as to the reflected (about \(y=0.5\)) quarter circle, both subject to the incident waves (1) at the terminal time \(T=0.8\). The reflected PEC was included in the training data in order to better capture the corners of the square PEC, yet we observed that our NNLCI was not able to yield accurate predictions.

As a remedy we modify the training data as follows: We shift both the original and reflected quarter circle PECs in the direction of negative \(x\)-axis by \(0.2\) so that the incident

\begin{table}
\begin{tabular}{|c|c|c|} \hline \multicolumn{3}{|c|}{Predictions on Circular PEC from Square PEC} \\ \hline Square Frequency & \multicolumn{2}{|c|}{Square Side Length} \\ \hline Finer Input Err. & 0.1634 & Finer Input Err. & 0.1634 \\ Pred. Err. & 0.1442 & Pred. Err. & 0.1274 \\ \hline \end{tabular}
\end{table}
Table 6: Accuracy of the predicted solutions to circular PEC via training for square PEC

Figure 16: Cross-sections of the above case at different \(y\) values comparing the predicted values with the input and reference values

Figure 15: Different shape prediction of \(H_{x}\) scattering off a circle in the plane at 0.8 seconds after training the model on all the even frequency perturbations of a square
waves are in the same phases (with respect to each of the three grid sizes) when they first hit the square and the quarter circle PECs. Then we further enrich the training data by including the three additional training data, namely perturbed frequency cases, 0 and \(\pm 2\%\), for the circular PEC. We do this because two training examples (here and in general) are insufficient to give accurate predictions. The result thus obtained is shown in Figs. 17 and 18, and Table 7. We remark that the shifted quarter circle PECs may be replaced by the unshifted quarter circles with adjusted terminal times to match the phases of the incident waves for the high-fidelity solution. However, the waves travel at different speeds depending on the grid size due to the dispersive error in our numerical scheme [16] so we must ensure we have training data that covers all three phases. In future work, we wish to carefully examine the propagation of numerical error in our scheme and how that affects the implementation of NNLCI.
Conclusion

In this work, we have applied NNLCI to predict accurate solutions to the scattering of electromagnetic waves around PECs. Once the network is trained, it takes as its inputs two low cost, yet 2nd order accurate, numerical solutions in a converging sequence to generate higher fidelity solutions to PECS of different shapes. Central to the robustness of our approach is the local training of the network which is still effective despite the presence of the PECs. We are interested in theoretical analysis of the NNLCI which may in turn offer insights into choices of suitable grid sizes for the network inputs, as well as possible modifications of the network architecture for enhanced performance.

## 5 Acknowledgements

The authors thank Haoxiang Huang for his help in the coding of NNs.
