formulation of finite‐difference frequency‐domain
TRANSCRIPT
8/24/2019
1
Advanced Computation:
Computational Electromagnetics
Formulation of Finite‐Difference Frequency‐Domain
Outline
• Periodic boundary conditions
• Matrix wave equations
• Plane wave source by total‐field/scattered‐field
• Formulation summary and examples
• Calculating transmittance and reflectance
Slide 2
1
2
8/24/2019
2
From Last Time
Slide 3
, , 1 , ,, 1, , ,
, , 1 , , 1, , , ,
1, , ,
, ,
, ,
,
,
, , 1,
,
, ,
, ,, ,
,
i j k i j ki j k i j ky yz z
i j k i j k i j k
i j
i j
i j kx
i j ky
i j k
kx x z z
i j k i j k
kxx
i j k
i j k i j ky y x
yy
i j kzz z
x
y z
z x
HE EE E
E
x y
H
H
E E E
E E E E
, , , , 1, , , 1,
, , , , 1 , , 1, ,
,
, ,
, ,
, 1, , , , , 1,
, ,
,
, ,,
,
,
i j k i j ki j k i j ky yz z
i j k i j k i j k i j kx x z z
i j k
i j kxx
i j kyy
i j k i j k i ji j kzz
k
i j kx
i j k
y y x
y
i j kz
x
H HH H
H
y z
z x
H H H
H H
y
HE
H
x
E
E
xx
yy
x
y
zy x z
z
z
y
x z
y z
z x
x y
H
H
E E
E E
E E H
xx
yy
zz
z y
x z
y x
x
y
z
y z
z
E
E
E
H H
Hx
yH H
x
H
e e
e e
e e
x
y
zy
y z xx
z x yy
x y
y
zz
z
x z
x
D D μ
D D μ
D
h
e
D h
e e
e
e μe
h
h h
h h
h h
y z xx
z x
z
yy
z y
x z
yx y z
y
z
x
x
D h h
h e
D eε
D D ε
D Dh ε
h
h e
Sign Convention for FDFD
Slide 4
jkze
3
4
8/24/2019
3
Slide 5
Periodic Boundary Conditions
Problem with the PBC Discussed Until Now
Slide 6
Suppose we wish to simulate a periodic structure with the source wave incident at an angle.
Is the problem still periodic?
field is NOT continuous
5
6
8/24/2019
4
k
Revisiting Bloch’s Theorem
Slide 7
Waves in a periodic structure take on the same symmetry and periodicity as the structure itself.
Actually, waves in a periodic structure obey Bloch’s theorem.
j rE r A r e
Overall E FieldCombines the periodic envelope with the “plane wave” like phase term.
Periodic Envelope, AIt is this part that takes on the same symmetry and period as the structure the wave is in.
“Plane Wave” Phase TermThis has the same form as a plane wave with wave vector . This incorporates an overall “phase tilt.”
We recognize that x = x6 – x1.
Revised Periodic Boundary Condition
Slide 8
Suppose we have the following grid…
We need to relate E1 to E6 in a way that is consistent with Bloch’s theorem.
1
66
1 1
6
j x
j x
E Ae
E A e
x56E E
x
x
We can write expressions for Ei at each point using Bloch’s theorem.
11 1
j xA E e Solve for A1.
6 1
6 1j x xE E e
6 1xjE E e
We now have our revised boundary condition.
66 1
j xE Ae Bloch’s theorem states that A1 = A6.
616 1
j xj xE E e e Replace A1 with expression from above.
7
8
8/24/2019
5
The Final Periodic Boundary Condition
Slide 9
We can think of the grid this way
,inc
1 1 0 0 0
0 1 1 0 01 0 0 1 1 0
0 0 0 1 1
0 0 0 1x x
E
x
jk
x
e
D
For FDFD analysis, inck
56 5 1xjE E
x
E e E
x
x
x
Names for this BCPeriodic BCPseudo‐periodic BCFloquet BCBloch‐Floquet BC
2D Derivative Matrices for 1D Grids With Source Wave at an Oblique Angle
Slide 10
When Nx=1 and Ny>1 ,inc
,ince h
,inc
0
0
x
xx x
x
jk
jk
jk
D D
When Nx>1 and Ny=1e h
e h,inc
and are standard for 1D gridx x
y y yjk
D D
D D I
e h,inc
e h and are standard for 1D grid
x x x
y y
jk D D I
D D
,inc
,ince h
,inc
0
0
y
y
y y
y
jk
jk
jk
D D
9
10
8/24/2019
6
USE SPARSE MATRICES!!!!!!!
Slide 11
WARNING !!The derivative operators will be EXTREMELY large matrices.
For a small grid that is just 100200 points:
Total Number of Points: 20,000Size of Derivate Operators: 20,000 20,000Total Elements in Matrices: 400,000,000Memory to Store One Full Matrix: 6 GbMemory to Store One Sparse Matrix: 1 Mb
NEVER AT ANY POINT should you use FULL MATRICES in the
finite‐difference method. Not even for intermediate steps. NEVER!
Header for yeeder() Function
Slide 12
function [DEX,DEY,DHX,DHY] = yeeder(NGRID,RES,BC,kinc)% YEEDER Construct Yee Grid Derivative Operators on a 2D Grid%% [DEX,DEY,DHX,DHY] = yeeder(NGRID,RES,BC,kinc);%% Note for normalized grid, use this function as follows:%% [DEX,DEY,DHX,DHY] = yeeder(NGRID,k0*RES,BC,kinc/k0);%% Input Arguments% =================% NGRID [Nx Ny] grid size% RES [dx dy] grid resolution of the 1X grid% BC [xbc ybc] boundary conditions% -2: periodic (requires kinc)% 0: Dirichlet% kinc [kx ky] incident wave vector% This argument is only needed for periodic boundaries.%
11
12
8/24/2019
7
Block Diagram for yeeder() Function
Slide 13
NGRID, RES, BC, and optional kinc
If kinc not given, let kinc = [0 0]
DEX = jkx,incINx = 1?
Initialize DEX as sparse
Place two diagonals(1’s and ‐1’s)
Make corrections
PBC?
Insert exp(jkx,incx) terms
no
yes
yesNy = 1?
Initialize DEY as sparse
Place two diagonals(1’s and ‐1’s)
Make corrections
PBC?
Insert exp(jky,incy) terms
no
yes
yes
no
DEY = jky,incI
h e
h e
H
x x
H
y y
D D
D D
CalculateDHX and DHY
Finished
Note:The finite‐difference equation for point (nx,ny) on the grid is located in row mwhere m = (ny – 1)*Nx + nx
no
33 Grid Numerical Example
Slide 14
k0 = 2*pi;theta = 20*degrees;kinc = k0*[sin(theta);cos(theta)];
NGRID = [3 3];RES = [1 1];BC = [-2 -2];[DEX,DEY,DHX,DHY] = yeeder(NGRID,RES,BC,kinc);
DEX =
-1.0000 1.0000 0 0 0 0 0 0 0 0 -1.0000 1.0000 0 0 0 0 0 0
0.9866 + 0.1630i 0 -1.0000 0 0 0 0 0 0 0 0 0 -1.0000 1.0000 0 0 0 0 0 0 0 0 -1.0000 1.0000 0 0 0 0 0 0 0.9866 + 0.1630i 0 -1.0000 0 0 0 0 0 0 0 0 0 -1.0000 1.0000 0 0 0 0 0 0 0 0 -1.0000 1.0000 0 0 0 0 0 0 0.9866 + 0.1630i 0 -1.0000
DEY =
-1.0000 0 0 1.0000 0 0 0 0 0 0 -1.0000 0 0 1.0000 0 0 0 0 0 0 -1.0000 0 0 1.0000 0 0 0 0 0 0 -1.0000 0 0 1.0000 0 0 0 0 0 0 -1.0000 0 0 1.0000 0 0 0 0 0 0 -1.0000 0 0 1.0000
0.4205 - 0.9073i 0 0 0 0 0 -1.0000 0 0 0 0.4205 - 0.9073i 0 0 0 0 0 -1.0000 0 0 0 0.4205 - 0.9073i 0 0 0 0 0 -1.0000
,inc
,inc
inc ,inc ,inc
2.1490 3
5.9043 3
ˆ ˆ ˆ ˆ2.1490 5.9043
3 1 3
3 1 3
0.9866 0.1630
0.4205 0.9073
x x
y y
x x y y x y
x x x
y y y
jk j
jk j
k k a k a a a
N
N
e e i
e e i
13
14
8/24/2019
8
44 Grid Numerical Example (1 of 2)
Slide 15
k0 = 2*pi;theta = 20*degrees;kinc = k0*[sin(theta);cos(theta)];
NGRID = [4 4];RES = [1 1];BC = [-2 -2];[DEX,DEY,DHX,DHY] = yeeder(NGRID,RES,BC,kinc);
1 1
1 1
1 1
0.68 0.73 1 0
1 1
1 1
1 1
0.68 0.73 1 0
1 1
1 1
1 1
0.68 0.73 1 0
1 1
1 1
1 1
0.68 0.73 1
ex
i
i
i
i
D
,inc
inc ,inc ,inc
2.1490 4
ˆ ˆ ˆ ˆ2.1490 5.9043
4 1 4
0.6757 0.7372x x
x x y y x y
x x x
jk j
k k a k a a a
N
e e i
44 Grid Numerical Example (2 of 2)
Slide 16
k0 = 2*pi;theta = 20*degrees;kinc = k0*[sin(theta);cos(theta)];
NGRID = [4 4];RES = [1 1];BC = [-2 -2];[DEX,DEY,DHX,DHY] = yeeder(NGRID,RES,BC,kinc);
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
0.05 0.99 1
0.05 0.99 1
0.05 0.99 1
0.05 0.99 1
ey
i
i
i
i
D
,inc
inc ,inc ,inc
5.9043 4
ˆ ˆ ˆ ˆ2.1490 5.9043
4 1 4
0.0551 0.9985y y
x x y y x y
y y y
jk j
k k a k a a a
N
e e i
15
16
8/24/2019
9
Slide 17
Matrix Wave Equations
3D FDFD in Block Matrix Form
Slide 18
e e
e e
e e
h h
h h
h h
y z z y xx x
z x x z yy y
x y y x zz z
y z z y xx x
z x x z yy y
x y y x zz z
D e D e μ h
D e D e μ h
D e D e μ h
D h D h ε e
D h D h ε e
D h D h ε e
e e
e e
e e
z y x xx x
z x y yy y
y x z zz z
0 D D e μ 0 0 h
D 0 D e 0 μ 0 h
D D 0 e 0 0 μ h
h h
h h
h
z y x xx x
z x y yy yh
y x z zz z
0 D D h ε 0 0 e
D 0 D h 0 ε 0 e
D D 0 h 0 0 ε e
e C e μ h
h C h ε e
rE H
rH E
We can write our matrix equations in block matrix form.
17
18
8/24/2019
10
3D‐FDFD Formulation
Slide 19
Block Matrix Form
er
hr
C e μ h
C h ε e
r
h h
h h h
h h
x
y
z
xx
yy
zz
z y
z x
y x
h
h h
h
μ 0 0
μ 0 μ 0
0 0 μ
0 D D
C D 0 D
D D 0
Matrix Wave Equations
1e hr r
1h er r
C ε C μ h 0
C μ C ε e 0
Ae 0
For 3D analysis, A is usually too big to solve by simple means.
For more information on 3D FDFD analysis, see
R. C. Rumpf, A. Tal, S. M. Kuebler, “Rigorous electromagnetic analysis of volumetrically complex media using the slice absorption method,” J. Opt. Soc. Am. A 24, 3123‐3134 (2007).
r
e e
e e e
e e
x
y
z
xx
yy
zz
z y
z x
y x
e
e e
e
ε 0 0
ε 0 ε 0
0 0 ε
0 D D
C D 0 D
D D 0
3D FDFD Usually Too Big to Solve
Slide 20
Typical grid required to model a 3D device.
20
20
100
x
y
z
N
N
N
Number of points in grid:Complex #’s for ex, ey, and ez:
Real #’s for ex, ey, and ez:
Size of matrix A:Number of complex elements:
Number of real elements:Memory to store full A:
Size of ex:Memory for ex:
Size of full Dx:Memory for full Dx:
Density of Dx:Memory for sparse Dx:
Size of full CE:Memory for full CE:
Density of CE:Memory for Sparse CE:
Memory for direct solution:
40,000 points120,000 complex #’s240,000 real floating‐point #’s
120k 120k complex #’s14.4 billion complex #’s28.8 billion real #’s214.6 Gb
40k complex numbers625 kb
40k 40k complex numbers23.8 Gb0.005% non zero elements1.5 Mb
120k 120k complex numbers214.6 Gb0.0033% non zero elements8.2 Mb
110 Gb
19
20
8/24/2019
11
Recall Diffraction Configurations
Slide 21
Planar Diffraction from a Ruled Grating
Conical Diffraction from a Ruled Grating
Crossed Grating Configurations
Requires a full 3D simulationModel can be reduced to a 2D simulation
• Simplest model• Two independent modes
• Analytically, about the same complexity as 3D
• No independent modes
Advice: Don’t bother developing a 2D code for conical diffraction. Develop a 3D code and use it for 2D.
0 0E H
z z z z
0 z
E Hjk
z z z z
0 0E H
z z z z
z
y
x
Reducing Planar Diffraction to 2D
Slide 22
h h
e
e
x y y x zz z
y z xx x
x z yy y
D h D h ε e
D e μ h
D e μ h
For problems uniform along the z‐direction and propagation restricted to the x-y plane,
e h0 z zz
D D 0
Maxwell’s equation decouple into two distinct modes:
EMode: HMode:
e e
h
h
x y y x zz z
y z xx x
x z yy y
D e D e μ h
D h ε e
D h ε e
e ey z z y D e D e
e
xx x
z x
μ h
D e
e e
e
x y y x zz z
x z yy y
D e D e h
e
μ
D μ h
h hy z z y D h D h
h
xx x
z x
ε e
D hh h
h
x y y x zz z
x z yy y
D h D h ε
D h ε
e
e
x
y
z
21
22
8/24/2019
12
Matrix Wave Equation (EMode)
Slide 23
h h
e
e
x y y x zz z
y z xx x
x z yy y
D h D h ε e
D e μ h
D e μ h
The matrix equations for the Emode were
1 e 1 e x xx y z y yy x z
h μ D e h μ D e Following matrix algebra rules, the second two equations are solve for hx and hy.
h 1 e h 1 e
E z
E x yy x y xx y zz
A e 0
A D μ D D μ D ε
AE = DHX/URyy*DEX + DHY/URxx*DEY + ERzz;
Now substitute these new expressions into the first matrix equation.
h h
h 1 e h 1 e
h 1 e h 1 e
h 1 e h 1 e
h 1 e h 1 e
x y y x zz z
x yy x z y xx y z zz z
x yy x z y xx y z zz z
x yy x z y xx y z zz z
x yy x y xx y zz z
D h D h ε e
D μ D e D μ D e ε e
D μ D e D μ D e ε e
D μ D e D μ D e ε e 0
D μ D D μ D ε e 0
Two Matrix Wave Equations
Slide 24
EMode
HMode
h 1 e h 1 eE x yy x y xx y zz
A D μ D D μ D ε
e 1 h e 1 hH x yy x y xx y zz
A D ε D D ε D μ
23
24
8/24/2019
13
TE and TM (Framework #1)
Slide 25
For the Emode, the electric field is always transverse to waves propagating in the x‐y plane.
EMode = TE Mode
For the Hmode, the magnetic field is always transverse to waves propagating in the x‐y plane.
HMode = TM Mode
TE and TM (Framework #2)
Slide 26
We use the labels “TE” and “TM” when we are trying to describe the orientation of a linearly polarized wave relative to a device.
TEaTMa
TE/perpendicular/s – the electric field is polarized perpendicular to the plane of incidence.
TM/parallel/p – the electric field is polarized parallel to the plane of incidence.
In the limit as 90°, we have
EzMode = TM ModeHzMode = TE Mode
This is exactly the opposite of Framework #1 when propagation is restricted to be in the x‐y plane.
n
25
26
8/24/2019
14
Our Matrix Equations Cannot Yet Be Solved
Slide 27
Solution to our matrix wave equation
1 E z z E A e 0 e A 0 0 trivial solution!!
A source bmust be incorporated.
1 E z z E A e b e A b
Slide 28
Plane Wave Source ByTotal‐Field/Scattered‐Field
27
28
8/24/2019
15
The Total‐Field/Scattered‐Field Framework
Slide 29
Problem rows
total‐field
scattered‐field
The Source Field
Slide 30
1,1
src ,inc ,inc
,
exp
x y
x y
N N
f
j k k
f
f X Y
Compute the source as it would exist in a completely homogeneous grid.
incsrc
jk rE r e
Unit amplitude plane wave
Generated by meshgrid()
fsrc = exp(1i*(kxinc*X + kyinc*Y));
29
30
8/24/2019
16
Scattered‐Field Masking Matrix, Q
Slide 31
total‐field
scattered‐field 1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1
1
0
0
0
Q
0
0
Reshape data from a 2D grid to a 1D array, then insert the 1D array into the center diagonal of a sparse matrix.
Q = diag(sparse(Q(:)));
Note: The TF/SF interface must completely enclose the source in order to completely describe it.
Calculating the Source Vector b (1 of 2)
Slide 32
Quantities that must be subtracted from TF terms to
make them look like SF terms…
totAf
srcfSource field
QSF masking function
tot src f I Q fSource isolated to TF
scat srcf QfSource isolated to SF
Quantities that must be added to SF terms to make them look like TF terms…
scatAf
…but only from SF equations:
totQAf…but only to TF equations:
scatI Q Af
SFTF
SFTF
Combine corrections:
tot scat Ae QAf I Q Af 0 SF
correctionsTF
corrections
Note, we get non‐zero numbers here where ftot or fscat fails to satisfy Maxwell’s equations.
SFTF
31
32
8/24/2019
17
Calculating the Source Vector b (2 of 2)
Slide 33
tot scat Ae QAf I Q Af 0
Our matrix equation incorporating the TF/SF corrections is
These are known quantities that can be brought to the right‐hand side of the equation.
tot scat Ae QAf I Q Af
We now have an equation from which to determine the source vector b.
b
We can write b in terms of just Q, A, and fsrc by substituting in our expressions for ftot and fscat.
tot scat
src src
src
b QAf I Q Af
QA I Q f I Q AQf
QA AQ f
Famous QAAQ Equation
Slide 34
src Ae = b b QA AQ f Quack!
All of the complexities of the total‐field/scattered‐field method are easily implemented using the famous QAAQ (pronounced “quack”) equation.
• Very easy to implement!• TF and SF regions can be arbitrary.• Works regardless of grid (i.e. uniform, nonuniform, unstructured, etc.).• Works regardless of order of accuracy of the finite‐differences.• Should work independent of the numerical method used to construct A.
33
34
8/24/2019
18
Visualizing the Data in b
Slide 35
We see that b is non‐zero only at the interfaces between the total‐field and scattered‐field. This is where the finite‐difference equations contain quantities from both regions and correction terms are needed to make the quantities compatible.
Strictly speaking, the source field fsrc really only needs to be calculated at the points immediately adjacent to the TF/SF interface.
Example Simulation #1
Slide 36
Materials Field Q
Materials Field Q
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
Scattered‐FieldScattered‐Field
Scattered‐FieldScattered‐Field
Total‐FieldTotal‐Field
Total‐FieldTotal‐Field
1 1.0n
1 1.0n
2 3.0n
35
36
8/24/2019
19
Example Simulation #2
Slide 37
Materials Field Q
Materials Field Q
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
PML
Scattered‐FieldScattered‐Field
Scattered‐FieldScattered‐Field
Total‐FieldTotal‐Field
Total‐FieldTotal‐Field
1 1.0n
1 1.0n
2 3.0n
Slide 38
Formulation Summaryand Examples
37
38
8/24/2019
20
FDFD Formulation Summary
Slide 39
h 1 e h 1 eE x yy x y xx y zz
A D μ D D μ D ε
e 1 h e 1 hH x yy x y xx y zz
A D ε D D ε D μ
Matrix wave equations
src b QA AQ f
Source vector
FDFD Matrix Problem
EA e = b
HA h = b
Periodic Structures in FDFD
Slide 40
39
40
8/24/2019
21
Cylindrical Source
Slide 41
Modal Sources (i.e. Waveports)
Slide 42
This is a simulation of an anti‐reflective waveguide termination. This required that the fundamental mode be launched into the waveguide as well as calculation of the energy reflected back into the fundamental mode.
41
42
8/24/2019
22
Slide 43
Calculating Transmittance and Reflectance
Process of Calculating Transmittance and Reflectance
Slide 44
1. Perform FDFD simulation2. Extract cross sections of the field on the reflected and
transmitted side.3. Calculate the wave vector components of the spatial
harmonics4. Calculate the complex amplitude of the spatial harmonics5. Calculate the diffraction efficiency of the spatial
harmonics6. Calculate over all reflectance and transmittance7. Calculate energy conservation.
For each frequency of interest…
43
44
8/24/2019
23
Step 1: Perform FDFD Simulation
Slide 45
TF/SF Interface
Periodic BCx
y
Reflection record plane
Transmission record plane
Spacer
Spacer
Step 2: Calculate Wave Vector Components
Slide 46
x Nx points across
Transverse Components
,
2
floor , , 2, 1,0,1,2, , floor2 2
x x incx
x x
mk m k
N Nm
Longitudinal Components
2 20 ref
2 20 trn, n
, ef
tr
ry
xy
xk n k mk m
m nk k k m
Note: transverse wave vector components are the same throughout the entire grid.
Note: the longitudinal components vary throughout the grid and are calculated from the dispersion relation.
45
46
8/24/2019
24
Step 3: Extract Reflected and Transmitted Fields
Slide 47
Step 4: Remove Phase Tilt
Slide 48
Field calculated from FDFD
Phase across grid due to angle of incidence
Field with phase tilt removed.
Bloch amplitude.
,inc
ref refxjk xE x A x e
,inc
trn trnxjk xE x A x e
47
48
8/24/2019
25
2 1 0 1 2FFT M MS S S S S S S
Step 5: Calculate Amplitudes of Spatial Harmonics
Slide 49
, x yj k m x k m y
m
E x y S m e
0S 1S 2S1S2S
Note: This operation is performed for every frequency of interest.
FFT
Step 6: Calculate Diffraction Efficiencies
Slide 50
2
ref ,ref r,inc
DE 2,inc r,incinc
2
trn ,trn r,trn
DE 2,inc r,incinc
Re
Re
Re
Re
y
y
y
y
S m k mR m
kS
S m k mT m
kS
This equation assumes the Emode was solved.
Notes1. This calculation is performed for every frequency of interest.2. is the amplitude of the source. This is usually set equal to 1.0 and dropped from
the above equations.3. We can neglect the negative sign in the equation by also ignoring the negative
sign when calculating .
incS
DER m ,refyk m
2
ref r,inc
DE 2,inc r,incinc
,refRe
Re
y
y
S mR
S
k
k
mm
2 2rref f, 0 e xy k nk k mm
49
50
8/24/2019
26
Step 7: Reflectance and Transmittance
Slide 51
Reflectance is the total fraction of power reflected from a device. Therefore, it is equal to the sum of all the reflected modes.
DE
xN
R R m
DE
xN
T T m
Transmittance is the total fraction of power transmitted through a device. Therefore, it is equal to the sum of all the transmitted modes.
Reflectance and Transmittance on a Decibel Scale
dB 10 dB 1010log 10 logR R T T Be careful NOT to use 20log10!
Step 8: Calculate Power Conservation
Slide 52
Assuming loss or gain is not incorporated into the simulation, the reflectance plus transmittance should equal 100%.
100%R T
It is ALWAYS good practice to calculate this total to check for conservation of power. This may deviate from 100% when:
•The boundary conditions are not working properly and need to be corrected.•Rounding errors are too severe and greater grid resolution is needed.•Simulation incorporates loss or gain in the materials.
The general equation for conservation must also include the absorptance A.
100%A R T
51
52