Compute Methods@Cornell
Compute Methods@Cornell
Steven G. Johnson
MIT Applied Mathematics
Nano-photonic media (l-scale)
strange waveguides
& microcavities
[B. Norris, UMN] [Assefa & Kolodziejski,
MIT]
3d
structures
[Mangan,
Corning]
synthetic materials
optical phenomena
hollow-core fibers
Photonic Crystals
periodic electromagnetic media
1887 1987
1-D 2-D 3-D
photon frequency
Band Diagram
Bloch waves:
electron energy
wavevector wavevector
Electronic & Photonic Modeling
Electronic Photonic
• strongly interacting • non-interacting (or weakly),
—entanglement, Coulomb —simple approximations
—tricky approximations (finite resolution)
—any desired accuracy
• Frequency-domain eigensolver
— solve for source-free harmonic eigenfields
E(x), H(x) ~ e–iwt
— involves solving eigenequation Ax=w2x
Numerical Methods: Basis Choices
finite difference finite elements
in irregular “elements,”
discretize approximate unknowns
unknowns by low-degree polynomial
on regular grid
df f ( x + Dx) - f ( x - Dx)
ª + O(Dx 2 )
dx Dx
boundary-element methods
† discretize only the
spectral methods
boundaries between
complete basis of homogeneous media
+ smooth functions
(e.g. Fourier series)
…solve
+ integral equation
+ ….. via Green’s functions
Numerical Methods: Basis Choices
finite difference finite elements
in irregular “elements,”
discretize approximate unknowns
unknowns by low-degree polynomial
on regular grid
boundary-element methods
spectral methods
discretize only the
boundaries between
complete basis of homogeneous media
+ smooth functions
(e.g. Fourier series)
+ …solve
integral equation
+ …..
via Green’s functions
finite difference
• Time-domain simulation
— start with current J(x,t)
— run “numerical experiment” to spectral methods
simulate E(x, t), H(x, t)
df f ( x + Dx) - f ( x - Dx)
dx
ª
Dx
+ O(Dx 2 ) +
• Frequency-domain linear response
— start with harmonic current J(x, t) = e–iwt J(x) +
†
— solve for steady-state harmonic fields E(x), H(x) + …..
— involves solving linear equation Ax=b
finite elements
• Frequency-domain eigensolver in irregular “elements,”
approximate unknowns
— solve for source-free harmonic eigenfields
by low-degree polynomial
E(x), H(x) ~ e–iwt
— involves solving eigenequation Ax=w2x
boundary-element methods
discretize only the
boundaries between
homogeneous media
FDTD
Finite-Difference Time-Domain methods
∂H 1 r ∂E 1 r J
= - —¥ E = —¥ H -
∂t m ∂t e e
†
The Yee Discretization (1966)
a cubic “voxel”: ∆x ¥ ∆y ¥ ∆z (i, j+1)
(i+1, j+1, k+1)
Hz
Ey
(i, j, k+1) Hz
Hx
Ez Hy (i, j) (i+1, j)
(i+1, j+1, k)
Ex
Ey
(i, j, k) (i+1, j, k)
Ex
“staircasing”
a
Sub-pixel smoothing
Can eliminate
discontinuity
by “grayscaling”
— assign some average e
to each pixel
e?
= discretizing a smoothed structure
— that means we are changing geometry
— can actually add to error
Past sub-pixel smoothing methods
can make error worse!
& convergence is
Three previous smoothing methods
still only linear
[ Dey, 1999 ]
[ Kaneda, 1997 ]
[ Mohammadi, 2005]
A Criterion for Accurate Smoothing
1st-order errors È 2 1 2˘
from ~ Ú Í De E|| - D( ) D^ ˙
smoothing De Î e ˚
(notice that
ranking of
other methods
has shuffled!)
A qualitatively different case: corners
still ~lowest error, but not quadratic
zero-perturbation
criterion
not satisfied
due to E divergence
at corner
— analytically,
error ~ ∆x1.404
Yes, but what can you do with FDTD?
Some common tasks:
• Frequency-domain response:
— put in harmonic source and wait for steady-state
• Transmission/reflection spectra:
— get entire spectrum from a single simulation
(Fourier transform of impulse response)
a e = 12
a e = 12
Gaussian-pulse
current source J
Fourier-transform the fields at each x:
-iwt -iwnDt
Ew = Ú E(t)e dt ª Â E(nDt)e Dt
n
1 *
P(w ) =
2
Ú Re[Ew ¥ H w ]dx
†
Transmission Spectra in FDTD
must always do two simulations: one for normalization
electric P0(w)
field Ez:
P(w)
transmission = P(w) / P0(w)
Reflection Spectra in FDTD
e=1
e = 12
1
PR (w ) = Ú Re[(Ew - Ew0 )* ¥ (H w - H w0 )]dx
2
1 *
P(w ) =
2
Ú Re[Ew ¥ H w ]dx
Transmission/Reflection Spectra
e=1
a e = 12
T 1–T–R
wa / 2πc = a / l
Dimensionless Units
Theoretically reflectionless
finite difference
• Time-domain simulation
— start with current J(x,t)
— run “numerical experiment” to spectral methods
simulate E(x, t), H(x, t)
df f ( x + Dx) - f ( x - Dx)
dx
ª
Dx
+ O(Dx 2 ) +
• Frequency-domain linear response
— start with harmonic current J(x, t) = e–iwt J(x) +
†
— solve for steady-state harmonic fields E(x), H(x) + …..
— involves solving linear equation Ax=b
finite elements
• Frequency-domain eigensolver in irregular “elements,”
approximate unknowns
— solve for source-free harmonic eigenfields
by low-degree polynomial
E(x), H(x) ~ e–iwt
— involves solving eigenequation Ax=w2x
boundary-element methods
discretize only the
boundaries between
homogeneous media
A Maxwell Eigenproblem
r r 1∂ r w r
—¥E =- H =i H First task:
c ∂t c get rid of this mess
r r 1∂ r r0 w r
— ¥ H =e E + J = -i eE
c ∂t c
1 r Êw ˆ 2 r
+ constraint
—¥ —¥H =Á ˜ H r
Ë c¯ —⋅ H = 0
e
eigen-operator eigen-value eigen-state
Electronic & Photonic Eigenproblems
Electronic Photonic
Ê h2 2 ˆ 1 r Ê w ˆ 2 r
Á- — + V ˜y = Ey —¥ —¥H =Á ˜ H
Ë 2m ¯ e Ë c¯
nonlinear eigenproblem simple linear eigenproblem
(V depends on e density |y|2) (for linear materials)
—many well-known
computational techniques
dielectric “atom”
e=12 (e.g. Si)
square lattice,
period a
a
a
E
TM
H
Periodic Eigenproblems
if eigen-operator is periodic, then Bloch-Floquet theorem applies:
r r i ( k ⋅ x -wt ) r
r r
r
can choose: H( x ,t) = e Hkr ( x )
planewave
periodic “envelope”
a e = 12 y
x
band diagram / dispersion relation
w
find the normal modes light cone
(all non-guided modes)
of the waveguide:
i(kx-wt )
H(y,t) = H k (y)e
(propagation constant k
a.k.a. b)
k
Solving the Maxwell Eigenproblem
Finite cell Ë discrete eigenvalues wn 1 wn 2
(— + ik) ¥ (— + ik) ¥ H n = 2 H n
e c
Want to solve for wn(k),
& plot vs. “all” k for “all” n,
constraint: (— + ik) ⋅ H = 0
1
0.9
† where:
0.8
0.7
H(x,y)#ei(k⋅x – wt)
0.6
0.5
0.4
Photonic Band Gap
0.3
0.2
0.1
TM bands
†
0
2p ky
first Brillouin zone G X a
kx
= minimum |k| “primitive cell”
† reduced by symmetry
irreducible Brillouin zone:
N
H = H(xt ) = Â hm bm (x t ) ˆ 2
solve: A H = w H
m=1
2
finite matrix problem: Ah = w Bh
f g = Ú f* ⋅g Aml = bm Aˆ bl Bml = bm bl
frequency w (2πc/a) = a / l
0.9
0.8
0.7
0.6
0.5
0.4
Photonic Band Gap
0.3
0.2
TM bands
0.1
0.9
0.8
Ez 0.7
0.6
0.5
0.4
Photonic Band Gap
0.3
0.2
TM bands
lives in high e 0.1
0
G X M G
Ez
E gap for
TM
H n > ~1.75:1
– +
The Iteration Scheme is Important
(minimizing function of 104–108+ variables!)
2 h' Ah
w = min
0 = f (h)
h h' Bh
Conjugate-gradient: minimize (h + a d)
† — d is —f + (stuff): conjugate to previous search dirs
Preconditioned steepest descent: minimize (h + a d)
— d = (approximate A-1) —f ~ Newton’s method
Preconditioned conjugate-gradient: minimize (h + a d)
— d is (approximate A-1) [—f + (stuff)]
The Iteration Scheme is Important
(minimizing function of ~40,000 variables)
1000000
100000
E E E E E
10000 E EEE
EEEE
EEEEEE
EEE
EE
EE
E
1000 J E
EE
E
EE
EE
E
EE
EE
EE
E
Ñ E
EE
EE
E
EE
EE
E
EE
EE
E
EE
EE
E
E
100
Ñ
J
E
EE
E
EE
EE
E
EE
EE
E
E
no preconditioning
% error
Ñ Ñ
J E
EE
E
EE
EE
E
EE
E
10 J Ñ E
E
EE
EE
E
E
J ÑÑ E
EE
E
EE
E
J ÑÑ E
E
EE
E
J ÑÑ E
E
EE
E
1 JJ ÑÑÑÑ E
E
EE
EE
E
E
Ñ
JJJJJ ÑÑÑÑÑÑ E
E
EE
JJ ÑÑ
ÑÑ
ÑÑ
ÑÑ
Ñ
ÑÑ
ÑÑ
Ñ
ÑÑ
ÑÑ
Ñ EE
E
0.1 JJ Ñ
ÑÑ
ÑÑ
ÑÑ
Ñ
ÑÑ
ÑÑ EE
E
ÑÑ
Ñ
ÑÑ
ÑÑ
Ñ
ÑÑ E
E
J ÑÑ
Ñ
ÑÑ
ÑÑ
Ñ EE
E
J ÑÑ
ÑÑ
Ñ EE
E
E
0.01 ÑÑ
ÑÑ
Ñ EE
E
J ÑÑ
ÑÑ EE
E
Ñ
ÑÑ
Ñ EE
E
E
Ñ
Ñ
ÑÑ E
E
J ÑÑ
Ñ
0.001 ÑÑ
preconditioned J
J
ÑÑ
Ñ
ÑÑ
0.0001
conjugate-gradient J
J
no conjugate-gradient
0.00001 J
J
0.000001
1 10 100 1000
# iterations
The Boundary Conditions are Tricky
E|| is continuous
E^ is discontinuous
(D^ = eE^ is continuous)
H
H
backwards averaging
10 H H H H H
B
J B
B H H
H H
correct averaging
B H H
% error
J
J
B B B changes order
B no Baveraging
J
1 J J
B B of convergence
J
J J
B B
from ∆x to ∆x2
tensor averaging J J
0.1
J J
0.01
10 100 (similar effects
resolution (pixels/period) in other E&M
numerics & analyses)
Gap, Schmap?
1
a 0.9
0.8
0.7
frequency w
0.6
0.5
0.4
Photonic Band Gap
0.3
0.2
TM bands
0.1
0
G X M G
a
Microcavity Blues
For cavities (point defects)
frequency-domain has its drawbacks:
Dw
0.4 EE
E
350 fit to:
E E
E
0.2 E
EE
EE
E
E
E E E
E
EE
EE
E E
300 E E
A
0 E E E E E E E E E
EEE
E
EE
E
EE E
EE
E
EE
EE
E
EE
E
EEEE
E
EE
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
EE
E
EE
E
EE
E
EE
E
E
E
E E E
EE
E
(w - w 0 ) 2 + G 2
E
EEE
EE
E E
EE
E
E 250
EE E
E
E E EE
E
E E
E
-0.2 E 200
-0.4
E EE
EE
EE FFT 150
E E
E
-0.6 100 E E
E
-0.8 E E
E
50
EE
†
E E
EE
-1 E EE EEEE
EEEEEEEEEEEEEEEEEEE
0
0 1 2 3 4 5 6 7 8 9 10 0 0.5 1 1.5 2 2.5 3 3.5 4
0.6 EE
EE
EE EE
E
EE
EE
E
EE
E
actual
EE EE EE
E 30000
EE EE EE
E
0.4 EE EE E
EE
EE EE E
E
E
EE EE EE EE
E E E E EE
E E EE EE 25000
0.2 E E E E E E E E E E E E E E
0 E E E E E E E E E E E E E E E E E E E E 20000
E E E E E E E
-0.2 E E E E E E E
E E EE E
E E E E EE 15000
E EE EE EE E
EE EE E
-0.4 EE
EE EE EE
E
E
E
EE E E
EE EE E
-0.6 E
EE
EE
EE
EE
EE
E
E
EE
EE
E
E 10000
signal
EE
EE
-0.8 E
EE
E
EE
E
E 5000
portion
E E E
-1 E 0 E E E E E E E E
0 1 2 3 4 5 6 7 8 9 10 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
1000
E
sum of two peaks
There is a better
800
E
E
way, which gets
600
complex w
for both peaks
400
w = 1+0.033i E E to > 10 digits
E E
w = 1.03+0.025i
200
E E
E E
E EE
E
E E EE E EE
0 E E E EE E E E E EE E E E E E E E EE E E E E EE E E
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
Sum of two Lorentzian peaks (w)
Quantum-inspired signal processing (NMR spectroscopy):
Filter-Diagonalization Method (FDM)
[ Mandelshtam, J. Chem. Phys. 107, 6756 (1997) ]
k
…find complex amplitudes ak & frequencies wk
by a simple linear-algebra problem!
†
Filter-Diagonalization Method
[ Mandelshtam, J. Chem. Phys. 107, 6756 (1997) ]
(FDM)
Bloch-mode eigensolver:
http://ab-initio.mit.edu/mpb/
Filter-diagonalization:
http://ab-initio.mit.edu/harminv/
a e = 12 y
find the normal modes wn(k) x
of the waveguide:
i(kx-wt )
H(y,t) = H k (y)e
Need to specify:
• computational cell size/resolution
† • geometry, i.e. e(y)
• what k values
• how many modes (n = 1, 2, … ?)
A File Format Made of Parentheses
Need to specify:
• computational cell size/resolution
(set! geometry-lattice (make lattice (size no-size 10 no-size)
(set! resolution 32)
10 (320 pixels)
e=1
a e = 12 y
x
A File Format Made of Parentheses
Need to specify:
• computational cell size/resolution
• geometry, i.e. e(y)
(set! geometry (choose units of a)
(list
(make block (size infinity 1 infinity)
(center 0 0 0)
(material (make dielectric (epsilon 12))))))
• what k values
• how many modes (n = 1, 2, … ?)
e=1
a e = 12 y
x
A File Format Made of Parentheses
Need to specify:
• computational cell size/resolution
• geometry, i.e. e(y)
(units of 2π/a)
• what k values
(set! k-points
(interpolate 10 (list (vector3 0 0 0) (vector3 2 0 0))))
(built-in function)
• how many modes (n = 1, 2, … ?)
e=1
a e = 12 y
x
A File Format Made of Parentheses
Need to specify:
• computational cell size/resolution
• geometry, i.e. e(y) …Then run:
• what k values (run)
• how many modes (n = 1, 2, … ?)
(set! num-bands 5) or only TM polarization:
(run-tm)
e=1
a e = 12 y
x
Simple Example (MPB) Results
e=1
a e = 12 y
find the normal modes wn(k) x
of the waveguide:
red = even
blue = odd
Do try this at home
FDTD simulation:
http://ab-initio.mit.edu/meep/
Bloch-mode eigensolver:
http://ab-initio.mit.edu/mpb/
Filter-diagonalization:
http://ab-initio.mit.edu/harminv/