As an extension of the Mie scattering example which involved computing the scattering cross section ($\sigma_{scat}$), we will compute the differential cross section ($\sigma_{diff}$) which is proportional to the radar cross section. Computing $\sigma_{diff}$ in a given direction involves three steps: (1) solve for the near fields on a closed box surrounding the object, (2) from the near fields, compute the far fields at a single point a large distance away (i.e., $R$ ≫ object diameter), and (3) calculate the Poynting flux of the far fields in the outward direction: $F = \hat{r}\cdot\Re[E^* \times H]$. The differential cross section in that direction is $R^2F$ divided by the incident intensity. The radar cross section is simply $\sigma_{diff}$ in the "backwards" direction (i.e., backscattering) multiplied by 4π.

The scattering cross section can be obtained by integrating the differential cross section over all spherical angles:

$$\sigma_{scatt} = \int_0^{2\pi} d\phi \int_0^{\pi} \sigma_{diff}(\phi,\theta)\sin(\theta)d\theta$$

In this demonstration, we will verify this expression for the lossless dielectric sphere at a single wavelength by comparing with the analytic theory via PyMieScatt.

In [1]:
import meep as mp
import numpy as np
import PyMieScatt as ps

r = 1.0  # radius of sphere

frq_cen = 1.0

resolution = 20 # pixels/um

dpml = 0.5
dair = 1.5 # at least 0.5/frq_cen padding between source and near-field monitor

pml_layers = [mp.PML(thickness=dpml)]

s = 2*(dpml+dair+r)
cell_size = mp.Vector3(s,s,s)

# circularly-polarized source with propagation axis along x
# is_integrated=True necessary for any planewave source extending into PML
sources = [mp.Source(mp.GaussianSource(frq_cen,fwidth=0.2*frq_cen,is_integrated=True),
center=mp.Vector3(-0.5*s+dpml),
size=mp.Vector3(0,s,s),
component=mp.Ez),
mp.Source(mp.GaussianSource(frq_cen,fwidth=0.2*frq_cen,is_integrated=True),
center=mp.Vector3(-0.5*s+dpml),
size=mp.Vector3(0,s,s),
component=mp.Ey,
amplitude=1j)]

sim = mp.Simulation(resolution=resolution,
cell_size=cell_size,
boundary_layers=pml_layers,
sources=sources,
k_point=mp.Vector3())

mp.FluxRegion(center=mp.Vector3(x=-2*r),size=mp.Vector3(0,4*r,4*r)))

mp.Near2FarRegion(center=mp.Vector3(x=-2*r),size=mp.Vector3(0,4*r,4*r),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(x=+2*r),size=mp.Vector3(0,4*r,4*r),weight=-1),
mp.Near2FarRegion(center=mp.Vector3(y=-2*r),size=mp.Vector3(4*r,0,4*r),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(y=+2*r),size=mp.Vector3(4*r,0,4*r),weight=-1),
mp.Near2FarRegion(center=mp.Vector3(z=-2*r),size=mp.Vector3(4*r,4*r,0),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(z=+2*r),size=mp.Vector3(4*r,4*r,0),weight=-1))

sim.run(until_after_sources=10)

input_flux = mp.get_fluxes(box_flux)[0]
nearfield_box_data = sim.get_near2far_data(nearfield_box)

sim.reset_meep()

n_sphere = 2.0
geometry = [mp.Sphere(material=mp.Medium(index=n_sphere),
center=mp.Vector3(),

sim = mp.Simulation(resolution=resolution,
cell_size=cell_size,
boundary_layers=pml_layers,
sources=sources,
k_point=mp.Vector3(),
geometry=geometry)

mp.Near2FarRegion(center=mp.Vector3(x=-2*r),size=mp.Vector3(0,4*r,4*r),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(x=+2*r),size=mp.Vector3(0,4*r,4*r),weight=-1),
mp.Near2FarRegion(center=mp.Vector3(y=-2*r),size=mp.Vector3(4*r,0,4*r),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(y=+2*r),size=mp.Vector3(4*r,0,4*r),weight=-1),
mp.Near2FarRegion(center=mp.Vector3(z=-2*r),size=mp.Vector3(4*r,4*r,0),weight=+1),
mp.Near2FarRegion(center=mp.Vector3(z=+2*r),size=mp.Vector3(4*r,4*r,0),weight=-1))

sim.run(until_after_sources=100)

npts = 100     # number of points in [0,pi) range of polar angles to sample far fields along semi-circle
angles = np.pi/npts*np.arange(npts)

ff_r = 10000*r # radius of far-field semi-circle

E = np.zeros((npts,3),dtype=np.complex128)
H = np.zeros((npts,3),dtype=np.complex128)
for n in range(npts):
ff = sim.get_farfield(nearfield_box, ff_r*mp.Vector3(np.cos(angles[n]),0,np.sin(angles[n])))
E[n,:] = [np.conj(ff[j]) for j in range(3)]
H[n,:] = [ff[j+3] for j in range(3)]

# compute Poynting flux Pr in the radial direction.  At large r,
# all of the flux is radial so we can simply compute the magnitude of the Poynting vector.
Px = np.real(np.multiply(E[:,1],H[:,2])-np.multiply(E[:,2],H[:,1]))
Py = np.real(np.multiply(E[:,2],H[:,0])-np.multiply(E[:,0],H[:,2]))
Pz = np.real(np.multiply(E[:,0],H[:,1])-np.multiply(E[:,1],H[:,0]))
Pr = np.sqrt(np.square(Px)+np.square(Py)+np.square(Pz))

intensity = input_flux/(4*r)**2
diff_cross_section = ff_r**2 * Pr / intensity
scatt_cross_section_meep = 2*np.pi * np.sum(diff_cross_section * np.sin(angles)) * np.pi/npts # trapezoidal rule integration
scatt_cross_section_theory = ps.MieQ(n_sphere,1000/frq_cen,2*r*1000,asDict=True,asCrossSection=True)['Csca']*1e-6 # units of um^2

print("scatt:, {:.16f}, {:.16f}".format(scatt_cross_section_meep,scatt_cross_section_theory))
-----------
Initializing structure...
time for choose_chunkdivision = 0.00184703 s
Working in 3D dimensions.
Computational cell is 6 x 6 x 6 with resolution 20
time for set_epsilon = 7.05405 s
-----------
Meep progress: 0.025/60.0 = 0.0% done in 8.0s, 19114.4s to go
on time step 1 (time=0.025), 7.95255 s/step
Meep progress: 1.425/60.0 = 2.4% done in 12.0s, 492.3s to go
on time step 57 (time=1.425), 0.0715737 s/step
Meep progress: 2.85/60.0 = 4.8% done in 16.0s, 320.9s to go
on time step 114 (time=2.85), 0.0706395 s/step
Meep progress: 4.3/60.0 = 7.2% done in 20.1s, 260.0s to go
on time step 172 (time=4.3), 0.0700726 s/step
Meep progress: 5.7250000000000005/60.0 = 9.5% done in 24.1s, 228.8s to go
on time step 229 (time=5.725), 0.0712843 s/step
Meep progress: 7.15/60.0 = 11.9% done in 28.2s, 208.1s to go
on time step 286 (time=7.15), 0.070579 s/step
Meep progress: 8.575000000000001/60.0 = 14.3% done in 32.2s, 193.1s to go
on time step 343 (time=8.575), 0.070755 s/step
Meep progress: 10.0/60.0 = 16.7% done in 36.2s, 181.2s to go
on time step 400 (time=10), 0.0708703 s/step
Meep progress: 11.425/60.0 = 19.0% done in 40.3s, 171.2s to go
on time step 457 (time=11.425), 0.0706575 s/step
Meep progress: 12.850000000000001/60.0 = 21.4% done in 44.3s, 162.6s to go
on time step 514 (time=12.85), 0.0708928 s/step
Meep progress: 14.275/60.0 = 23.8% done in 48.3s, 154.9s to go
on time step 571 (time=14.275), 0.0708588 s/step
Meep progress: 15.700000000000001/60.0 = 26.2% done in 52.4s, 147.8s to go
on time step 628 (time=15.7), 0.0706377 s/step
Meep progress: 17.125/60.0 = 28.5% done in 56.4s, 141.1s to go
on time step 686 (time=17.15), 0.0701739 s/step
Meep progress: 18.575/60.0 = 31.0% done in 60.4s, 134.8s to go
on time step 744 (time=18.6), 0.0700753 s/step
Meep progress: 19.975/60.0 = 33.3% done in 64.5s, 129.2s to go
on time step 800 (time=20), 0.0718821 s/step
Meep progress: 21.400000000000002/60.0 = 35.7% done in 68.5s, 123.5s to go
on time step 857 (time=21.425), 0.0706058 s/step
Meep progress: 22.825000000000003/60.0 = 38.0% done in 72.5s, 118.1s to go
on time step 914 (time=22.85), 0.0709217 s/step
Meep progress: 24.225/60.0 = 40.4% done in 76.5s, 113.0s to go
on time step 971 (time=24.275), 0.071352 s/step
Meep progress: 25.675/60.0 = 42.8% done in 80.6s, 107.8s to go
on time step 1029 (time=25.725), 0.07002 s/step
Meep progress: 27.1/60.0 = 45.2% done in 84.6s, 102.7s to go
on time step 1086 (time=27.15), 0.0704253 s/step
Meep progress: 28.525000000000002/60.0 = 47.5% done in 88.6s, 97.8s to go
on time step 1143 (time=28.575), 0.070285 s/step
Meep progress: 29.950000000000003/60.0 = 49.9% done in 92.6s, 92.9s to go
on time step 1200 (time=30), 0.0704149 s/step
Meep progress: 31.400000000000002/60.0 = 52.3% done in 96.7s, 88.1s to go
on time step 1258 (time=31.45), 0.0700102 s/step
Meep progress: 32.825/60.0 = 54.7% done in 100.8s, 83.4s to go
on time step 1315 (time=32.875), 0.0714932 s/step
Meep progress: 34.25/60.0 = 57.1% done in 104.8s, 78.8s to go
on time step 1372 (time=34.3), 0.0706952 s/step
Meep progress: 35.675000000000004/60.0 = 59.5% done in 108.8s, 74.2s to go
on time step 1429 (time=35.725), 0.0702772 s/step
Meep progress: 37.1/60.0 = 61.8% done in 112.8s, 69.7s to go
on time step 1486 (time=37.15), 0.0708871 s/step
Meep progress: 38.525000000000006/60.0 = 64.2% done in 116.9s, 65.2s to go
on time step 1543 (time=38.575), 0.0712132 s/step
Meep progress: 39.95/60.0 = 66.6% done in 120.9s, 60.7s to go
on time step 1600 (time=40), 0.0702636 s/step
Meep progress: 42.025000000000006/60.0 = 70.0% done in 125.0s, 53.4s to go
on time step 1684 (time=42.1), 0.0479748 s/step
Meep progress: 44.575/60.0 = 74.3% done in 129.0s, 44.6s to go
on time step 1786 (time=44.65), 0.0393623 s/step
Meep progress: 47.125/60.0 = 78.5% done in 133.0s, 36.3s to go
on time step 1888 (time=47.2), 0.039338 s/step
Meep progress: 49.675000000000004/60.0 = 82.8% done in 137.0s, 28.5s to go
on time step 1990 (time=49.75), 0.0392874 s/step
Meep progress: 52.225/60.0 = 87.0% done in 141.0s, 21.0s to go
on time step 2091 (time=52.275), 0.0396056 s/step
Meep progress: 54.75/60.0 = 91.2% done in 145.1s, 13.9s to go
on time step 2192 (time=54.8), 0.0397233 s/step
Meep progress: 57.25/60.0 = 95.4% done in 149.1s, 7.2s to go
on time step 2292 (time=57.3), 0.0400305 s/step
Meep progress: 59.6/60.0 = 99.3% done in 153.1s, 1.0s to go
on time step 2386 (time=59.65), 0.0428728 s/step
run 0 finished at t = 60.0 (2400 timesteps)
-----------
Initializing structure...
time for choose_chunkdivision = 0.000314951 s
Working in 3D dimensions.
Computational cell is 6 x 6 x 6 with resolution 20
sphere, center = (0,0,0)
dielectric constant epsilon diagonal = (4,4,4)
time for set_epsilon = 10.8833 s
-----------
Meep progress: 0.42500000000000004/150.0 = 0.3% done in 4.0s, 1422.1s to go
on time step 17 (time=0.425), 0.237267 s/step
Meep progress: 2.6/150.0 = 1.7% done in 8.1s, 457.9s to go
on time step 104 (time=2.6), 0.0463833 s/step
Meep progress: 4.4750000000000005/150.0 = 3.0% done in 12.1s, 393.5s to go
on time step 179 (time=4.475), 0.0536454 s/step
Meep progress: 6.65/150.0 = 4.4% done in 16.1s, 347.7s to go
on time step 266 (time=6.65), 0.0463018 s/step
Meep progress: 8.825000000000001/150.0 = 5.9% done in 20.2s, 322.4s to go
on time step 353 (time=8.825), 0.0462615 s/step
Meep progress: 11.0/150.0 = 7.3% done in 24.2s, 305.5s to go
on time step 440 (time=11), 0.0461603 s/step
Meep progress: 13.200000000000001/150.0 = 8.8% done in 28.2s, 292.4s to go
on time step 528 (time=13.2), 0.0459657 s/step
Meep progress: 15.375/150.0 = 10.2% done in 32.3s, 282.4s to go
on time step 615 (time=15.375), 0.0463664 s/step
Meep progress: 17.575/150.0 = 11.7% done in 36.3s, 273.2s to go
on time step 703 (time=17.575), 0.0454752 s/step
Meep progress: 19.775000000000002/150.0 = 13.2% done in 40.3s, 265.2s to go
on time step 791 (time=19.775), 0.0455843 s/step
Meep progress: 21.975/150.0 = 14.7% done in 44.3s, 258.1s to go
on time step 879 (time=21.975), 0.0458395 s/step
Meep progress: 24.175/150.0 = 16.1% done in 48.3s, 251.6s to go
on time step 967 (time=24.175), 0.0459351 s/step
Meep progress: 26.35/150.0 = 17.6% done in 52.4s, 245.8s to go
on time step 1054 (time=26.35), 0.0463769 s/step
Meep progress: 28.55/150.0 = 19.0% done in 56.4s, 240.0s to go
on time step 1142 (time=28.55), 0.0459144 s/step
Meep progress: 30.525000000000002/150.0 = 20.4% done in 60.4s, 236.5s to go
on time step 1221 (time=30.525), 0.0507661 s/step
Meep progress: 32.375/150.0 = 21.6% done in 64.4s, 234.1s to go
on time step 1295 (time=32.375), 0.0541184 s/step
Meep progress: 34.425000000000004/150.0 = 23.0% done in 68.5s, 229.9s to go
on time step 1377 (time=34.425), 0.0491044 s/step
Meep progress: 36.550000000000004/150.0 = 24.4% done in 72.5s, 225.1s to go
on time step 1462 (time=36.55), 0.0475878 s/step
Meep progress: 38.725/150.0 = 25.8% done in 76.5s, 220.0s to go
on time step 1549 (time=38.725), 0.0464091 s/step
Meep progress: 40.925000000000004/150.0 = 27.3% done in 80.6s, 214.8s to go
on time step 1637 (time=40.925), 0.0459186 s/step
Meep progress: 43.1/150.0 = 28.7% done in 84.6s, 209.8s to go
on time step 1724 (time=43.1), 0.0460059 s/step
Meep progress: 45.25/150.0 = 30.2% done in 88.6s, 205.2s to go
on time step 1810 (time=45.25), 0.0468385 s/step
Meep progress: 47.425000000000004/150.0 = 31.6% done in 92.6s, 200.4s to go
on time step 1897 (time=47.425), 0.0461295 s/step
Meep progress: 49.575/150.0 = 33.1% done in 96.6s, 195.8s to go
on time step 1983 (time=49.575), 0.046594 s/step
Meep progress: 51.75/150.0 = 34.5% done in 100.7s, 191.1s to go
on time step 2070 (time=51.75), 0.0461984 s/step
Meep progress: 53.925000000000004/150.0 = 36.0% done in 104.7s, 186.5s to go
on time step 2157 (time=53.925), 0.0463753 s/step
Meep progress: 56.1/150.0 = 37.4% done in 108.7s, 181.9s to go
on time step 2244 (time=56.1), 0.0459998 s/step
Meep progress: 58.25/150.0 = 38.8% done in 112.7s, 177.5s to go
on time step 2330 (time=58.25), 0.0465543 s/step
Meep progress: 60.425000000000004/150.0 = 40.3% done in 116.7s, 173.1s to go
on time step 2417 (time=60.425), 0.0463941 s/step
Meep progress: 62.6/150.0 = 41.7% done in 120.8s, 168.6s to go
on time step 2504 (time=62.6), 0.0464383 s/step
Meep progress: 64.8/150.0 = 43.2% done in 124.8s, 164.1s to go
on time step 2592 (time=64.8), 0.045902 s/step
Meep progress: 66.85000000000001/150.0 = 44.6% done in 128.9s, 160.3s to go
on time step 2674 (time=66.85), 0.0492217 s/step
Meep progress: 68.9/150.0 = 45.9% done in 132.9s, 156.4s to go
on time step 2756 (time=68.9), 0.0490496 s/step
Meep progress: 71.075/150.0 = 47.4% done in 136.9s, 152.1s to go
on time step 2843 (time=71.075), 0.0464664 s/step
Meep progress: 73.2/150.0 = 48.8% done in 141.0s, 147.9s to go
on time step 2928 (time=73.2), 0.0473208 s/step
Meep progress: 75.25/150.0 = 50.2% done in 145.0s, 144.0s to go
on time step 3010 (time=75.25), 0.0488515 s/step
Meep progress: 77.4/150.0 = 51.6% done in 149.0s, 139.7s to go
on time step 3096 (time=77.4), 0.046656 s/step
Meep progress: 79.575/150.0 = 53.1% done in 153.0s, 135.4s to go
on time step 3183 (time=79.575), 0.0463849 s/step
Meep progress: 81.75/150.0 = 54.5% done in 157.0s, 131.1s to go
on time step 3270 (time=81.75), 0.0460481 s/step
Meep progress: 83.92500000000001/150.0 = 56.0% done in 161.0s, 126.8s to go
on time step 3357 (time=83.925), 0.0460692 s/step
Meep progress: 86.10000000000001/150.0 = 57.4% done in 165.0s, 122.5s to go
on time step 3444 (time=86.1), 0.0462169 s/step
Meep progress: 88.275/150.0 = 58.9% done in 169.1s, 118.2s to go
on time step 3531 (time=88.275), 0.0462111 s/step
Meep progress: 90.45/150.0 = 60.3% done in 173.1s, 113.9s to go
on time step 3618 (time=90.45), 0.0460027 s/step
Meep progress: 92.60000000000001/150.0 = 61.7% done in 177.1s, 109.8s to go
on time step 3704 (time=92.6), 0.0465264 s/step
Meep progress: 94.775/150.0 = 63.2% done in 181.1s, 105.5s to go
on time step 3791 (time=94.775), 0.046465 s/step
Meep progress: 96.80000000000001/150.0 = 64.5% done in 185.1s, 101.7s to go
on time step 3872 (time=96.8), 0.0496786 s/step
Meep progress: 98.95/150.0 = 66.0% done in 189.2s, 97.6s to go
on time step 3958 (time=98.95), 0.0470932 s/step
Meep progress: 101.15/150.0 = 67.4% done in 193.2s, 93.3s to go
on time step 4046 (time=101.15), 0.0458597 s/step
Meep progress: 103.35000000000001/150.0 = 68.9% done in 197.3s, 89.0s to go
on time step 4134 (time=103.35), 0.0459114 s/step
Meep progress: 105.525/150.0 = 70.4% done in 201.3s, 84.8s to go
on time step 4221 (time=105.525), 0.0461203 s/step
Meep progress: 107.7/150.0 = 71.8% done in 205.3s, 80.6s to go
on time step 4308 (time=107.7), 0.0459904 s/step
Meep progress: 109.9/150.0 = 73.3% done in 209.3s, 76.4s to go
on time step 4396 (time=109.9), 0.0459388 s/step
Meep progress: 112.10000000000001/150.0 = 74.7% done in 213.4s, 72.1s to go
on time step 4484 (time=112.1), 0.0459383 s/step
Meep progress: 114.275/150.0 = 76.2% done in 217.4s, 68.0s to go
on time step 4571 (time=114.275), 0.0461357 s/step
Meep progress: 116.4/150.0 = 77.6% done in 221.4s, 63.9s to go
on time step 4656 (time=116.4), 0.0472109 s/step
Meep progress: 118.575/150.0 = 79.0% done in 225.4s, 59.7s to go
on time step 4743 (time=118.575), 0.0460147 s/step
Meep progress: 120.775/150.0 = 80.5% done in 229.4s, 55.5s to go
on time step 4831 (time=120.775), 0.045949 s/step
Meep progress: 122.95/150.0 = 82.0% done in 233.4s, 51.4s to go
on time step 4919 (time=122.975), 0.0459709 s/step
Meep progress: 125.10000000000001/150.0 = 83.4% done in 237.5s, 47.3s to go
on time step 5005 (time=125.125), 0.0466707 s/step
Meep progress: 127.25/150.0 = 84.8% done in 241.5s, 43.2s to go
on time step 5091 (time=127.275), 0.0465508 s/step
Meep progress: 129.425/150.0 = 86.3% done in 245.5s, 39.0s to go
on time step 5178 (time=129.45), 0.0460929 s/step
Meep progress: 131.6/150.0 = 87.7% done in 249.5s, 34.9s to go
on time step 5266 (time=131.65), 0.0460716 s/step
Meep progress: 133.8/150.0 = 89.2% done in 253.5s, 30.7s to go
on time step 5354 (time=133.85), 0.0458212 s/step
Meep progress: 135.975/150.0 = 90.6% done in 257.5s, 26.6s to go
on time step 5441 (time=136.025), 0.0461223 s/step
Meep progress: 138.125/150.0 = 92.1% done in 261.6s, 22.5s to go
on time step 5527 (time=138.175), 0.0469644 s/step
Meep progress: 140.3/150.0 = 93.5% done in 265.6s, 18.4s to go
on time step 5614 (time=140.35), 0.0463842 s/step
Meep progress: 142.5/150.0 = 95.0% done in 269.6s, 14.2s to go
on time step 5702 (time=142.55), 0.0459045 s/step
Meep progress: 144.55/150.0 = 96.4% done in 273.7s, 10.3s to go
on time step 5784 (time=144.6), 0.0489192 s/step
Meep progress: 146.65/150.0 = 97.8% done in 277.7s, 6.3s to go
on time step 5868 (time=146.7), 0.0480892 s/step
Meep progress: 148.775/150.0 = 99.2% done in 281.7s, 2.3s to go
on time step 5954 (time=148.85), 0.0470749 s/step
run 0 finished at t = 150.0 (6000 timesteps)
scatt:, 8.1554468215885674, 8.3429545590438750

The script is similar to the previous Mie scattering example with the main difference being the replacement of the add_flux with add_near2far objects. Instead of a linearly-polarized planewave, the source is circularly-polarized so that $\sigma_{diff}$ is invariant with the rotation angle $\phi$ around the axis of the incident direction (i.e., $x$). This way, the far fields need only be sampled with the polar angle $\theta$. A circularly-polarized planewave can be generated by overlapping two linearly-polarized planewaves ($E_y$ and $E_z$) which are 90° out of phase via specifying amplitude=1j for one of the two sources. Note, however, that there is no need to use complex fields (by specifying force_complex_fields=True in the Simulation object) which would double the floating-point memory consumption since only the real part of the source amplitude is used by default. The circularly-polarized source breaks the mirror symmetry which increases the size of the simulation. The size of the near-field monitor box surrounding the sphere is doubled so that it lies entirely within the homogeneous air region (a requirement of the near2far feature). After the near fields have been obtained for λ = 1 μm the far fields are computed for 100 points along a semi-circle with radius 10,000X that of the dielectric sphere. (Note: any such large radius would give the same $\sigma_{scat}$ to within discretization error). Finally, the scattered cross section is computed by numerically integrating the expression from above using the radial Poynting flux values.

The Meep results agree well with the analytic theory.

For resolution = 20, the error between the simulated and analytic result is 2.2%.

scatt:, 8.1554468215885674, 8.3429545590438750

For resolution = 25, the error decreases (as expected) to 1.5%.

scatt:, 8.2215435272741395, 8.3429545590438750