Wave phenomena play very important role in many aspects of physics of our world. They arise in acoustics, radio and optical telecommunications and take major role in many devices, from car acoustics to MRI and nanooptical systems on chip. Engineers from many fields need to be able to model them properly.
Full equations for those phenomena differ (Maxwell's equations, continious media equations and Shroedinger's equations), under some simplifying assumptions. However, in case of time-harmonic solution and right-hand side ($u({\bf r},t) \sim \rho ({\bf r},t) \sim exp(i \omega t)$), they all become equivalent to scalar or vector Helmholtz equation (in Electromagnetic community it is also called Vector Wave equation):
$$\nabla ^2 u({\bf r}) + k_0^2 \epsilon_r({\bf r}) u({\bf r}) = \rho({\bf r}), $$$$\nabla \times \nabla \times \vec{E}({\bf r}) + \epsilon_r({\bf r}) \mu_r({\bf r}) k_0^2 \vec{E}({\bf r}) = \vec J({\bf r}) ,$$$$k_0 = \frac{2 \pi}{\lambda_0}=\frac{\omega}{c},$$where $\lambda_0$ is wavelength in free space (usually one considers air or vacuum as free space), $\omega = 2\pi \nu$ is the angular frequency in radians per second, $c$ is speed of the wave in the free space (sound or light depending on the problem), $\epsilon_r$ - relative dielectric permittivity, $\mu_r$ - relative magnetic permeability, $E({\bf r})$ electric field strength, $J({\bf r})$ dipole current density and ${\bf r} = (x,y,z)$ is the vector defining the location of the observation point. Everything is taken in Gaussian units.
In case of (infinite) translational symmetry along one of the axis (Z) those equations become two-dimensional. For the vector Helmhotz equation one also needs to consider additional assumptions so that the equation becomes scalar:
After all this simplifications made only $E_z({\bf r})$ component of the solution can be non-zero and one obtains the final scalar system of equations in 2D:
$$ \nabla ^2 E_z({\bf r}) + k_0^2 \epsilon_r({\bf r}) E_z({\bf r}) = J_z({\bf r}), $$$${\bf r}\in \Omega,\space \Omega=[-1,1] \times [-1,1]$$Sommerfeld (or Radiation) boundary conditions $$\lim_{|{\bf r}| \to \infty} |{\bf r}| \left( \frac{\partial E_z({\bf r})}{\partial |{\bf r}|} - i k_0 |{\bf r}| \right) = 0.$$ emulate placing our objects in the free space (or perfect noise chamber). In the physical sense, they mean that far fields look like escaping plane waves with the same frequency, and amplitudes are decaying according to the energy conservation law.
When Sommerfeld boundary conditions are used, it is often called a scattering problem, or open-space scattering problem.
One should note that $\epsilon_r({\bf r})=1$ corresponds to empty space. Due to relatively general setup of the equation, one can re-discover many interesting well-known effects even with this simplified 2D solver.
In [4]:
import h5py
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
n = 512
data_parab = h5py.File('PS1.mat')['x_fft'][()]
data_cyl = h5py.File('PS1_cyl.mat')['x_fft'][()]
rp = data_parab['real'].reshape(n, n, order='f')
ip = data_parab['imag'].reshape(n, n, order='f')
rc = data_cyl['real'].reshape(n, n, order='f')
ic = data_cyl['imag'].reshape(n, n, order='f')
p = np.sqrt(rp ** 2 + ip ** 2).T
c = np.sqrt(rc ** 2 + ic ** 2).T
fig = plt.figure(figsize=(10, 10))
plt.suptitle('Focusing by', y=0.75, fontsize=17)
plt.subplot(1, 2, 1)
plt.imshow(p)
plt.title('(a) Parabolic mirror')
plt.subplot(1, 2, 2)
plt.imshow(c)
plt.title('(b) Glass cylinder')
Out[4]:
(3 pts) Strictly speaking, the right hand side $ f({\bf r}) $ of the integral equation may be taken from a wider class than just $f({\bf r})=\int J_z({\bf r'})G({\bf r}-{\bf r'}) d{\bf r'}$. If we need to simulate incoming plane wave $f({\bf r})=\text{exp}(i k_{0}^{(x)} x + i k_{0}^{(y)} y)$, what kind of source current distribution $J_z({\bf r'})$ one needs? What is the problem to have this distribution in our simulations?
(5 pts) Explain why the integral formulation is more preferrable for the open-space scattering problem as compared to the differential formulation
There are several methods to discretize our continious equation, most of which have second order of convergence with the step of discretization, but with different constants. Due to the fact that here we are dealing with 2D problem, we can afford to use reasonably fine grids, so even simple methods of discretization produce realistic results.
Let us consider uniform $N \times N$ pixel grid on our square domain $\Omega=\bigcup_{i=1}^{N^2} \Omega_i.$
Let us force our original continious equation to hold at central points of the right edges $ {\bf r^{edge}_i}$ ("receivers") of each pixel. Then our system becomes:
$$Ax=b$$$$A=I + k_0^2 \space G\space \text{diag}(\epsilon - 1)$$$$G_{ij}= \int_{\Omega_j} G \left( k_0\left| {\bf {\bf r^{edge}_i}}-{\bf r'} \right| \right) d{\bf r'} =$$$$=\frac{i}{4}\int_{x^{}_j-h/2}^{x^{}_j+h/2} \int_{y^{}_j-h/2}^{y^{}_j+h/2} H_0^{(2)}\left(k_0 \sqrt{ (x^{edge}_i - x)^2+(y^{edge}_i - y)^2 } \right) dydx \simeq \frac{ih^2}{4} H_0^{(2)} \left( k_0\left| {\bf r^{edge}_i}-{\bf r^{center}_j} \right| \right)$$$k_0=\frac{2\pi}{\lambda}$, lambda is given in the domain units.
This is a Nystrom-type discretization on shifted grids. With this formulation one avoids dealing with singular integrals.
Material distribution must be given by a function $\epsilon(x)$ on our pixel grid.
For devices made of solid homogenious material with $\epsilon_r=\epsilon_{device}$, the material distribution may be introduced using a binary mask of this device. $\text{mask}({\bf r})=1$ in points where the device is present and $\text{mask}({\bf r})=0$ elsewhere. So that $\epsilon_r({\bf r})=1+(\epsilon_{device} - 1) \text {mask}({\bf r})$, where $\text{mask}({\bf r})$ is a binary function.
Due to the using of pixel grid, for any device with distinct boundary (such as glass lens, for example) one will probably get ladder pixelization artefacts on the boundary of device, which will introduce fake sharp edges and create unwanted point-like reflections. To raise the precision in that case, one should use anisotropically smoothened material functions instead of hard (inequality-based) conditions.
In [5]:
# Comparison of hard and soft mask
N = 64
xmin = -1
xmax = 1
ymin = xmin
ymax = xmax
XX, YY = np.meshgrid(np.linspace(xmin, xmax, N),
np.linspace(ymin, ymax, N))
shape1 = XX + 2.5*YY - 0.7
shape2 = np.sqrt(XX**2 + YY**2) - 0.75
def smooth(f, alpha):
return 0.5*(1 + np.tanh(-alpha*f))
# using hard (inequality) conditions
mask1 = (shape1<0).astype(float) * (shape2<0).astype(float)
# anisotropically smoothened conditions
alpha = 1*N; # for a smoothened layer to be approximately equal to 2 pixels, one should take alpha~N
mask2 = smooth(shape1, alpha) * smooth(shape2, alpha)
fig = plt.figure(figsize=(10, 10))
plt.suptitle('Binary mask and anisotropically smoothened mask', y=0.75, fontsize=16)
plt.subplot(1, 2, 1)
plt.imshow(mask1)
plt.subplot(1, 2, 2)
plt.imshow(mask2)
Out[5]:
Invertion of the matrix directly with Gaussian elimination would cost $\mathcal{O}(N^3)$.
Fortunately, the G matrix part of our matrix $A$ has a block-Toeplitz structure that can be exploited to solve the linear system using an iterative method with $\mathcal{O}(N \log N)$ complexity per matvec by embedding $A$ into a block-circulant matrix with circulant blocks.
Now when you have the fast solver, it is interesting to obtain some well-known phenomena from optics. To simulate a device is to define a nontrivial distribution of complex dielectric permittivity $\epsilon (x)$. For example, $\epsilon = n^2= 2.25$ roughy corresponds to glass, $\epsilon = -100$ to Perfect Electric Conductor, $\epsilon = 16 + 20j$ may correspond to some metal, depending on the frequency.
Embed the matvec function from the bullet above into GMRES
, feed proper material distribution for your device and solve the integral equation for either of the following cases without explicitly forming the dense coupling matrix. Produce iteration-residual plots at both frequencies, and the scattered image.
In [6]:
from IPython.display import Image
Image("uberlens.png")
Out[6]: