File:Forward Scattering.gif

Summary

Description
English: A set of sharp changes in the refractive index will scatter an incident wave in every direction. But if the same changes are made smoother, the wave will mostly be scattered forward, until the overall effect is better described in terms of aberrations
Date
Source https://twitter.com/j_bertolotti/status/1462748967687667713
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 12.0 code

\[Lambda]0 = 0.5; k0 = N[(2 \[Pi])/\[Lambda]0]; (*The wavelength in vacuum is set to 1, so all lengths are now in units of wavelengths*)
\[Delta] = \[Lambda]0/10; \[CapitalDelta] = 30*\[Lambda]0; (*Parameters for the grid*) \[Sigma]s = 4 \[Lambda]0;
ReMapC[x_] := RGBColor[(2 x - 1) UnitStep[x - 0.5], 0, (1 - 2 x) UnitStep[0.5 - x]];
d = \[Lambda]0/2; (*typical scale of the absorbing layer*)

imn = Table[
   Chop[5 (E^-((x + \[CapitalDelta]/2)/d) + E^((x - \[CapitalDelta]/2)/d) + E^-((y + \[CapitalDelta]/2)/d) + E^((y - \[CapitalDelta]/2)/d))], {x, -\[CapitalDelta]/2, \[CapitalDelta]/2, \[Delta]}, {y, -\[CapitalDelta]/2, \[CapitalDelta]/2, \[Delta]}]; (*Imaginary part of the refractive index (used to emulate absorbing boundaries)*)
dim = Dimensions[imn][[1]];
L = -1/\[Delta]^2* KirchhoffMatrix[GridGraph[{dim, dim}]]; (*Discretized Laplacian*)

sourcef[x_, y_] := E^(-(x^2/(2 \[Sigma]s^2))) E^(-((y + \[CapitalDelta]/2)^2/(2 (\[Lambda]0/2)^2))) E^(I k0 y);
\[Phi]in = Table[Chop[sourcef[x, y] ], {x, -\[CapitalDelta]/2, \[CapitalDelta]/2, \[Delta]}, {y, -\[CapitalDelta]/2, \[CapitalDelta]/2, \[Delta]}];
ren0 = 2; nscatterers = 100;
scatterers = Table[{RandomInteger[Round /@ {-dim/2, dim/2}], RandomInteger[Round /@ {-dim/8, dim/8}]}, nscatterers];
basicren = Clip[Sum[RotateRight[DiskMatrix[2, dim], scatterers[[j]] ], {j, nscatterers}], {0, 1}] ;

frames = Table[
   ren = 0.5 GaussianFilter[basicren, \[Sigma]]/Max[GaussianFilter[basicren, \[Sigma]]] + 1;
   n = ren + I imn;
   b = -(Flatten[n]^2 - 1) k0^2 Flatten[\[Phi]in]; (*Right-hand side of the equation we want to solve*)
   M = L + DiagonalMatrix[ SparseArray[Flatten[n]^2 k0^2]]; (*Operator on the left-hand side of the equation we want to solve*)
   \[Phi] = Partition[LinearSolve[M, b], dim]; (*Solve the linear system*)
   
   Grid[{{Style["Re(E)", White, Bold, Large], Style["|E\!\(\*SuperscriptBox[\(|\), \(2\)]\)", White, Bold, 
       Large]}, {
      ImageAdd[
       ArrayPlot[ Transpose[(Re[\[Phi]][[(4 d)/\[Delta] ;; (-4 d)/\[Delta], (4 d)/\[Delta] ;; (-4 d)/\[Delta]]])/0.075], DataReversed -> True, Frame -> False, PlotRange -> {-1, 1}, LabelStyle -> {Black, Bold}, ColorFunctionScaling -> True, ColorFunction -> ReMapC, ClippingStyle -> {Blue, Red}, ImageSize -> 300, Background -> Black]
       ,
       ArrayPlot[Transpose[(ren - 1)/1] , DataReversed -> True , ColorFunctionScaling -> False, ColorFunction -> GrayLevel, Frame -> False]
       ]
      ,
      ImageAdd[
       ArrayPlot[ Transpose[((Abs[\[Phi]][[(4 d)/\[Delta] ;; (-4 d)/\[Delta], (4 d)/\[Delta] ;; (-4 d)/\[Delta]]])/0.075)^2], DataReversed -> True, Frame -> False, PlotRange -> {0, 1}, LabelStyle -> {Black, Bold}, ColorFunctionScaling -> True, ColorFunction -> "AvocadoColors", ClippingStyle -> White, Background -> Black, ImageSize -> 300]
       ,
       ArrayPlot[Transpose[(ren - 1)/1] , DataReversed -> True , ColorFunctionScaling -> False, ColorFunction -> GrayLevel, Frame -> False]
       ]
      }}, Background -> Black]
   , {\[Sigma], 1, 50, 2}];

ListAnimate[ Join[Table[frames[[1]], {5}], frames, Table[frames[[-1]], {5}], Reverse[frames]] ]

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Forward%20Scattering.gif
Category:Self-published work Category:Animated GIF files Category:Scattering Category:Animations of interference Category:Images with Mathematica source code
Category:Animated GIF files Category:Animations of interference Category:CC-Zero Category:Images with Mathematica source code Category:Pages using deprecated source tags Category:Scattering Category:Self-published work