implementation two dimensional fdtd - empossible · 2020. 5. 14. · 5/14/2020 1 computational...

24
5/14/2020 1 Computational Science: Introduction to FiniteDifference TimeDomain Implementation of TwoDimensional FDTD Lecture Outline Review Update equations with PML Code development sequence Numerical Boundary Conditions for 3D Reduction to TwoDimensions Calculating the PML Parameters Implementation for Ez Mode Implementation for Hz Mode TotalField/ScatteredField Source Slide 2

Upload: others

Post on 02-Feb-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

  • 5/14/2020

    1

    Computational Science:Introduction to Finite‐Difference Time‐Domain

    Implementation ofTwo‐Dimensional FDTD

    Lecture Outline

    • Review• Update equations with PML• Code development sequence

    • Numerical Boundary Conditions for 3D• Reduction to Two‐Dimensions• Calculating the PML Parameters• Implementation for Ez Mode• Implementation for Hz Mode• Total‐Field/Scattered‐Field Source

    Slide 2

  • 5/14/2020

    2

    Slide 3

    Review

    Uniaxial PML

    Slide 4

    Reflections can be prevented at all angles, all frequencies, and for all polarizations if the absorbing material is made to be diagonally anisotropic.

    s

    s

    x

    y

  • 5/14/2020

    3

    Derivation of Update Equation for Hx

    Slide 5

    1

    0

    0 0 0

    1 1 1y yzx z xxx

    EEcj Hj j j y z

    1. Start with governing equation in the frequency‐domain.

    020

    0

    00

    1 1y z Ex

    x

    Exx

    xx

    yx xx

    x

    z H c Cj

    H c Cjj

    H

    2. Prepare equation for conversion to the time‐domain.  Want all terms multiplied by  𝑗𝜔 .

    3. Convert each term to the time‐domain one at a time. 0

    0

    0

    002

    tExx

    x

    ty E

    xxx

    xzzx y

    xx

    c CH d cH tH t

    tC t d

    4. Approximate the equation using finite‐differences and summations for numerical implementation.

    ,

    , , , ,,

    0

    , , , ,

    2

    , , , ,2

    0

    , , , , , ,2

    00 2

    ,, ,

    , , ,

    2

    2

    2 0,

    ,

    2

    214

    i j k i j ki j k i j kH H t tx xt t

    t

    ki j k i

    i

    j

    t

    i jHi j

    k tH H ty z i j k i j k i j k

    tx x x T

    iy

    ix

    j k j kx xt t Et k

    xj kx

    t

    t T

    z

    tx

    H H c tH

    H HH C

    t

    tH c

    , ,

    , ,00

    t i j kExi j k T

    Txx

    C

    5. Derive the update equation by solving for 𝐻 at the future time value.

    , ,, , , , , , , , , , , , , , , ,1 2 3 42 2 i j ki j k i j k i j k i j k i j k i j k i j k i j kEx Hx x Hx x Hx CEx Hx Hxt t t t t ttH m H m C m I m I

    1a

    aa

    t

    g t G

    ag t aG

    d g t j Gdt

    g d Gj

    F

    F

    F

    F

    Code Development Sequence

    Slide 6

    Step 1 – Basic Update + Dirichlet

    Step 2 – Basic Update + Periodic BC Step 3 – Add PML Step 4 – TF/SF

    Step 5 – Calculate Response Step 6 – Add a Device and Benchmark

  • 5/14/2020

    4

    Slide 7

    Numerical Boundary Conditions for 3D

    Boundary Conditions

    Slide 8

    The update equations were formulated  so that curl can be calculated separate from the update equation.  Boundary condition problems occur only in the curl calculations.

    , , , , , , , ,, ,

    , , , , , , , ,, ,

    ,

    1 1

    1 1

    1 1, , , , , , ,, ,

    i k i j k i j i j ki j k z z y yE t t t t

    x t

    i j i j k j k i j ki j k x x z zE t t t t

    y t

    j k i j k i k i j ki j k y y x xE t t t t

    z t

    j k

    k i

    i j

    E E E EC

    y z

    E E E EC

    z x

    E E E EC

    x y

    2 2 2 2

    2

    2 2 2 2

    2

    2 2 2

    2

    1, , , ,, , , ,, ,

    , , , , , , , ,, ,

    , , , , ,,

    1

    1

    1

    ,

    1

    t t t t

    t

    t t t t

    t

    t t t

    t

    i j k i ji j k i ky yi j k z zt t t tH

    x t

    i j k i j i j k j ki j k x x z zt t t tH

    y t

    i j k j k i jy yi j k xt t tH

    z t

    kj

    k i

    i

    H HH HC

    y z

    H H H HC

    z x

    H H HC

    x

    2

    , ,1,t

    k i kjx t

    H

    y

    E

    H

    Special boundary conditions are required at the high grid boundaries when computing the curl of 𝐸.

    Special boundary conditions are required at the low grid boundaries when computing the curl of 𝐻.

  • 5/14/2020

    5

    Handling the Boundary Conditions

    Slide 9

    A good way to handle the boundary conditions is to calculate the curl terms at the boundaries separate from the rest of the curl equation.  This should be done explicitly without using ’if‘ statements.For example, , 1, , , , , 1 , ,

    ,1, , , , , 1 , ,

    , ,

    , 1, , , , ,1

    and

    and y y y

    z z

    i j k i j k i j k i j k

    z z y yt t t ty z

    i k i N k i N k i N k

    z z y yt t t ty z

    i j kEx i j N i j N i jt

    z z yt t t

    E E E Ej N k N

    y z

    E E E Ej N k N

    y zC

    E E E

    y

    , ,

    ,1, , , , ,1 , ,

    and

    and

    z

    z y z y y z

    i j N

    y ty z

    i N i N N i N i N N

    z z y yt t t ty z

    Ej N k N

    z

    E E E Ej N k N

    y z

    Calculating the curl terms separate from the update equations is an excellent way to isolate and modularize the boundary condition problem.

    MATLAB Code Implementation (1 of 3)

    Slide 10

    % Compute CExfor nx = 1 : Nx

    for ny = 1 : Nyfor nz = 1 : Nz

    CEx(nx,ny,nz) = (Ez(nx,ny+1,nz) - Ez(nx,ny,nz))/dy ...- (Ey(nx,ny,nz+1) - Ey(nx,ny,nz))/dz;

    endend

    end

    First, blindly try to calculate the curl.

    Two problems arise at the y‐hi and z‐hi sides of the grid.

  • 5/14/2020

    6

    MATLAB Code Implementation (2 of 3)

    Slide 11

    Next, handle the z‐hi problem explicitly outside of the nz‐loop.  Copy the code inside the nz‐loop and paste it after the nz‐loop.

    % Compute CExfor nx = 1 : Nx

    for ny = 1 : Nyfor nz = 1 : Nz-1

    CEx(nx,ny,nz) = (Ez(nx,ny+1,nz) - Ez(nx,ny,nz))/dy ...- (Ey(nx,ny,nz+1) - Ey(nx,ny,nz))/dz;

    endCEx(nx,ny,Nz) = (Ez(nx,ny+1,Nz) - Ez(nx,ny,Nz))/dy ...

    - (Ey(nx,ny,1) - Ey(nx,ny,Nz))/dz;end

    end

    There is still a problem at the y‐hi side of the grid, but now the problem occurs in two places.

    MATLAB Code Implementation (3 of 3)

    Slide 12

    % Compute CExfor nx = 1 : Nx

    for ny = 1 : Ny-1for nz = 1 : Nz-1

    CEx(nx,ny,nz) = (Ez(nx,ny+1,nz) - Ez(nx,ny,nz))/dy ...- (Ey(nx,ny,nz+1) - Ey(nx,ny,nz))/dz;

    endCEx(nx,ny,Nz) = (Ez(nx,ny+1,Nz) - Ez(nx,ny,Nz))/dy ...

    - (Ey(nx,ny,1) - Ey(nx,ny,Nz))/dz;endfor nz = 1 : Nz-1

    CEx(nx,Ny,nz) = (Ez(nx,1,nz) - Ez(nx,Ny,nz))/dy ...- (Ey(nx,Ny,nz+1) - Ey(nx,Ny,nz))/dz;

    endCEx(nx,Ny,Nz) = (Ez(nx,1,Nz) - Ez(nx,Ny,Nz))/dy ...

    - (Ey(nx,Ny,1) - Ey(nx,Ny,Nz))/dz;end

    Finally, the y‐hi problem is handled explicitly outside of the ny‐loop.  Copy all of the code inside the ny‐loop and paste it after the ny‐loop.

  • 5/14/2020

    7

    Slide 13

    Reduction to Two Dimensions

    3D  2D (Exact)

    Slide 14

    Sometimes it is possible to describe a physical device using just two dimensions.  Doing so dramatically reduces the numerical complexity of the problem and is ALWAYS GOOD PRACTICE.

    z

    perio

    dic B

    C periodic BC

    absorbing BC

    absorbing BCx

    y

  • 5/14/2020

    8

    2D Grids are Infinite in the 3rd Dimension

    Slide 15

    perio

    dic B

    C periodic BCabsorbing BC

    absorbing BC

    Anything represented on a 2D grid, is actually a device that is of infinite extent along the 3rd dimension.

    x

    y

    What is Different in Two Dimensions?

    •Assume it is the z direction that is uniform.•All derivatives in the z direction are zero.

    • There is no need for PML at the z axis boundaries.

    Slide 16

    0z

    0

    1z

    z

    z

    s z

  • 5/14/2020

    9

    Revisions for Update Equation for Hx

    Slide 17

    , , , ,

    , ,0

    1i j k i j kH H

    y zi j kHxm t

    , , , ,2

    0 02 4

    i j k i j kH Hy z t

    , , , ,

    , ,1 , ,

    0

    1 1

    i j k i j kH Hy zi j k

    Hx i j kHx

    mtm

    , , , ,2

    0 02 4

    i j k i j kH Hy z t

    , ,

    , , , ,, , , , , ,0 02 3 4, , , , , , , , , , 2

    0 00 0 0

    1 1 1 i j kH

    i j k i j ki j k i j k i j kx H HHx Hx Hx y zi j k i j k i j k i j k i j k

    Hx xx Hx xx Hx

    c c t tm m mm m m

    , ,, , , , , , , , , , , , , ,1 2 3 42, , 2 i j ki j k i j k i j k i j k i j k i j k i j kEHx x Hx x Hi j kx x CEx Hx Hxt t t ttt t m H m C m I m IH

    2, ,, , , , , ,

    220

    ttti j ki j k i j k i j kE

    tCEx x Hx xt Tt t T tT

    I C I H

    , 1, , , , , 1 , ,

    , ,

    i j k i j k i j k i j ki j k z z y yE t t t t

    x t

    E E E EC

    y z

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

    2D Update Equation for Hx

    Slide 18

    , ,, ,

    0 1 ,0 00

    ,, ,0 0

    2 3, , , ,00 0

    1 1 1 2 2

    1 1

    i j i jH Hi j i jy y

    Hx Hx i jHx

    i jHi j i j x

    Hx Hxi j i j i j i jHx xx Hx xx

    m mt tm

    c c tm mm m

    , 2 ,, , , , ,1 2 32 i ji j i j i j i j i jEHx x Hx x Hx CExt ti jx t ttt m H mH C m I

    , 1 ,, ,,

    0

    i j i jt

    i j i j z zi j E E t tCEx x xt t t

    T

    E EI C C

    y

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

  • 5/14/2020

    10

    2D Update Equation for Hy

    Slide 19

    , ,, ,

    0 1 ,0 00

    ,, ,0 0

    2 3, , , ,00 0

    1 1 1 2 2

    1 1

    i j i jH Hi j i jx x

    Hy Hy i j

    Hy

    i jHi j i j y

    Hy Hyi j i j i j i j

    Hy yy Hy yy

    m mt tm

    c c tm mm m

    ,, , , , ,1 2 32 2

    , i ji j i j i j i j i jEtHy y Hy y Hy CEyt tt

    i jty t

    m H mH C m I

    1, ,, ,,

    0

    i j i jt

    i j i ji j z zE E t tCEy y yt t t

    T

    E EI C C

    x

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

    2D Update Equation for Hz

    Slide 20

    , , , ,, , , ,, ,0 1 ,2 2

    0 0 0 00

    , 02 , ,

    0

    1 1 1 2 4 2 4

    1

    i j i j i j i ji j i j i j i jH H H HH H H Hx y x yi j i jx y x y

    Hz Hz i jHz

    i jHz i j i j

    Hz zz

    t tm m

    t tm

    cmm

    , ,,4 , 200

    1 i j i ji j H H

    Hz x yi jHz

    tmm

    ,, , , , ,2 2

    ,1 2 4

    2

    i ji j i j i j i j i jEt tHz z Hz z Hz Hzt tt t

    i jz t

    mH H m C m I

    1, , , 1 ,2 ,, ,

    22

    t i j i j i j i jti j y y x xi j i j E t t t t

    tHz z zT tt T t

    E E E EI H C

    x y

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

  • 5/14/2020

    11

    2D Update Equation for Dx

    Slide 21

    , ,, ,

    0 1 ,0 00

    ,, , 00

    2 3, ,00 0

    1 1 1 2 2

    1

    i j i jD Di j i jy y

    Dx Dx i jDx

    i jDi j i j x

    Dx Dxi j i jDx Dx

    m mt tm

    c tcm mm m

    , ,, , , ,1 2 32

    ,

    2

    i j i ji j i ji j

    x t t

    i j i jHt tDx x Dx x Dx CHxtt t

    m mD D m C I

    2 2

    2

    , , 12, ,,

    2 2

    t t

    t

    tt i j i ji j i j z zi j t tH H

    tCHx x xT ttT t

    H HI C C

    y

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

    2D Update Equation for Dy

    Slide 22

    , ,, ,

    0 1 ,0 00

    ,, , 00

    2 3, ,00 0

    1 1 1 2 2

    1

    i j i jD Di j i jx x

    Dy Dy i j

    Dy

    i jDi j i j y

    Dy Dyi j i j

    Dy Dy

    m mt tm

    c tcm mm m

    , ,, , , ,1 2 322

    , i j i ji j i ji j

    y t t

    i j i jHttDy y Dy y Dy CHy ttt

    m D m C mD I

    2 2

    2

    , 1,2, ,,

    2 2

    t t

    t

    tt i j i ji j i j z zi j t tH H

    tCHy y yt T tT t

    H HI C C

    x

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

  • 5/14/2020

    12

    2D Update Equation for Dz

    Slide 23

    , , , ,, , , ,, ,0 1 ,2 2

    0 0 0 00

    , 02 ,

    0

    1 1 1 2 4 2 4

    i j i j i j i ji j i j i j i jD D D DD D D Dx y x yi j i jx y x y

    Dz Dz i jDz

    i jDz i j

    Dz

    t tm m

    t tm

    cm mm

    , ,,4 , 200

    1 i j i ji j D DDz x yi j

    Dz

    tm

    , ,, , , ,1 2 42

    , i j i ji j i j i j i jHtDz z Dz z Dz Dz t t

    i j

    z t t ttm D m C m ID

    2 2 2 2

    2

    , 1, , , 1, ,,

    0

    t t t t

    t

    i j i j i j i jt y yi j i j x xi j t t t tH

    Dz z zt tTT

    H H H HI D C

    x y

    The update coefficients are computed before the main FDTD loop.

    The integration terms are computed inside the main FDTD loop, but before the update equation.

    The update equation is computed inside the main FDTD loop immediately after the integration terms are updated.

    2D Update Equations for Ex, Ey, and Ez

    Slide 24

    ,, ,1 1 1, , ,

    1 1 1 i ji j i j

    Ex Ey Ezi j i j i jxx zzyy

    m m m

    ,,1

    ,,1

    ,

    ,

    ,

    ,1

    ,

    i ji jEx x t t

    i ji j

    i j

    Ey

    x t

    y t t

    i ji

    t

    jE

    i j

    y t t

    i j

    zz z tt tt

    E m D

    mE

    E

    D

    m D

    The update coefficients are computed before the main FDTD loop.

    The update equations are computed inside the main FDTD loop.

    No changes here!

  • 5/14/2020

    13

    MATLAB Code for Update Equations

    Slide 25

    , 2 ,, , , , ,1 2 32 i ji j i j i j i j i jEHx x Hx x Hx CExt ti jx t ttt m H mH C m I The update equation for Hx was

    This could be implemented in MATLAB as followsfor ny = 1 : Ny

    for nx = 1 : NxHx(nx,ny) = mHx1(nx,ny)*Hx(nx,ny) + mHx2(nx,ny)*CEx(nx,ny) + mHx3(nx,ny)*ICEx(nx,ny);

    endend

    However, it is much simpler and faster to implement it using “vectorized” MATLAB commands.

    Hx = mHx1.*Hx + mHx2.*CEx + mHx3.*ICEx;

    Slide 26

    Calculating the PML Parameters

  • 5/14/2020

    14

    MATLAB Code to Calculate PML Parameters

    Slide 27

    To calculate the PML parameters x and y we employ the 2× grid concept.First, we calculate x and y on the 2× grid.

    % COMPUTE PML PARAMETERSNx2 = 2*Nx;Ny2 = 2*Ny;

    sigx = zeros(Nx2,Ny2);for nx = 1 : 2*NPML(1)

    nx1 = 2*NPML(1) - nx + 1;sigx(nx1,:) = (0.5*e0/dt)*(nx/2/NPML(1))^3;

    endfor nx = 1 : 2*NPML(2)

    nx1 = Nx2 - 2*NPML(2) + nx;sigx(nx1,:) = (0.5*e0/dt)*(nx/2/NPML(2))^3;

    end

    sigy = zeros(Nx2,Ny2);for ny = 1 : 2*NPML(3)

    ny1 = 2*NPML(3) - ny + 1;sigy(:,ny1) = (0.5*e0/dt)*(ny/2/NPML(3))^3;

    endfor ny = 1 : 2*NPML(4)

    ny1 = Ny2 - 2*NPML(4) + ny;sigy(:,ny1) = (0.5*e0/dt)*(ny/2/NPML(4))^3;

    end

    3

    0

    2x xxx

    t L

    3

    0

    2y yyy

    t L

    This ‘2’ is here because we are calculating the fictitious conductivity terms on the 2× grid, but NPML contains the size of the PML on the 1× grid.

    Visualizing the PML Parameters

    Slide 28

    If calculated correctly, the PML conductivity terms should look like:

    x

    y

    x x y y

    0.02650.01940.01360.00910.00570.00330.00170.00070.00020.0000

    00000000000000000000

    0.00000.00020.00070.00170.00330.00570.00910.01360.01940.0265

    e0 = 8.8542e-12dt = 1.6678e-10

  • 5/14/2020

    15

    MATLAB Code to Calculate Update Coefficients

    Slide 29

    Next, overlay the PML functions onto the 1× grid to calculate the update coefficients containing PML terms.

    % COMPUTE UPDATE COEFFICIENTSsigHx = sigx(1:2:Nx2,2:2:Ny2);sigHy = sigy(1:2:Nx2,2:2:Ny2);mHx0 = (1/dt) + sigHy/(2*e0);mHx1 = ((1/dt) - sigHy/(2*e0))./mHx0;mHx2 = - c0./URxx./mHx0;mHx3 = - (c0*dt/e0) * sigHx./URxx ./ mHx0;

    sigHx = sigx(2:2:Nx2,1:2:Ny2);sigHy = sigy(2:2:Nx2,1:2:Ny2);mHy0 = (1/dt) + sigHx/(2*e0);mHy1 = ((1/dt) - sigHx/(2*e0))./mHy0;mHy2 = - c0./URyy./mHy0;mHy3 = - (c0*dt/e0) * sigHy./URyy ./ mHy0;

    sigDx = sigx(1:2:Nx2,1:2:Ny2);sigDy = sigy(1:2:Nx2,1:2:Ny2);mDz0 = (1/dt) + (sigDx + sigDy)/(2*e0) ...

    + sigDx.*sigDy*(dt/4/e0^2);mDz1 = (1/dt) - (sigDx + sigDy)/(2*e0) ...

    - sigDx.*sigDy*(dt/4/e0^2);mDz1 = mDz1 ./ mDz0;mDz2 = c0./mDz0;mDz4 = - (dt/e0^2)*sigDx.*sigDy./mDz0;

    , ,

    , ,0 1 ,

    0 00

    ,, ,0 0

    2 3, , , ,00 0

    1 1 1 2 2

    1 1

    i j i jH Hi j i jy y

    Hx Hx i jHx

    i jHi j i j x

    Hx Hxi j i j i j i jHx xx Hx xx

    m mt tm

    c c tm mm m

    , ,, ,

    0 1 ,0 00

    ,, ,0 0

    2 3, , , ,00 0

    1 1 1 2 2

    1 1

    i j i jH Hi j i jx x

    Hy Hy i j

    Hy

    i jHi j i j y

    Hy Hyi j i j i j i j

    Hy yy Hy yy

    m mt tm

    c c tm mm m

    , ,, ,,

    0 20 0

    , ,, ,,

    1 , 20 00

    , 02 ,

    0

    , ,,4 , 2

    00

    12 4

    1 12 4

    1

    i j i ji j i j D DD Dx yi j x y

    Dz

    i j i ji j i j D DD Dx yi j x y

    Dz i jDz

    i jDz i j

    Dz

    i j i ji j D DDz x yi j

    Dz

    tm

    t

    tm

    tm

    cmm

    tmm

    Slide 30

    ImplementationEz Mode

  • 5/14/2020

    16

    Block Diagram for Ez Mode (1 of 2)

    Slide 31

    Define Device Parameters

    Define FDTD Parameters

    Compute Grid Parameters

    Compute Time Step

    Compute Source

    Compute PML Parameters

    Compute Update CoefficientsmHx1, mHx2, mHx3mHy1, mHy2, mHy3mDz1, mDz2, mDz4mEz1

    Initialize FieldsHx, Hy, Dz, Ez

    Initialize Curl ArraysCEx, CEy, CHz

    Initialize Integration ArraysICEx, ICEy, IDz

    Initialization…

    Build Device on Grid

    Block Diagram for Ez Mode (2 of 2)

    Slide 32

    Compute Curl of ECEx, CEy

    Update H IntegrationsICEx = ICEx + CExICEy = ICEy + CEy

    Update H FieldHx = mHx1.*Hx + mHx2.*CEx + mHx3.*ICEx;Hy = mHy1.*Hy + mHy2.*CEy + mHy3.*ICEy;

    Update EzEz = mEz1.*Dz;

    Visualize Fields

    Main loop…

    Compute Curl of HCHz

    Update D IntegrationsIDz = IDz + Dz

    Inject SourceDz(nxs,nys) = Dz(nxs,nys) + g(T);

    Finished!yes

    Done?

    no

    Update DzDz = mDz1.*Dz + mDz2.*CHz + mDz4.*IDz;

    BC’s

  • 5/14/2020

    17

    Slide 33

    ImplementationHz Mode

    Block Diagram for Hz Mode (1 of 2)

    Slide 34

    Define Device Parameters

    Define FDTD Parameters

    Compute Grid Parameters

    Compute Time Step

    Compute Source

    Compute PML Parameters

    Compute Update CoefficientsmHz1, mHz2, mHz4mDx1, mDx2, mDx3mDy1, mDy2, mDy3mEx1, mEy1

    Initialize FieldsHz, Dx, Dy, Ex, Ey

    Initialize Curl ArraysCEx, CEy, CHz

    Initialize Integration ArraysICHx, ICHy, IHz

    Initialization…

  • 5/14/2020

    18

    Update E FieldEx = mEx1.*Dx;Ey = mEy1.*Dy;

    Block Diagram for Hz Mode (2 of 2)

    Slide 35

    Compute Curl of ECEz

    Update H IntegrationsIHz = IHz + Hz

    Update H FieldHz = mHz1.*Hz + mHz2.*CEz + mHz4.*IHz;

    Update D FieldDx = mDx1.*Dx + mDx2.*CHx + mDx3.*ICHx;Dy = mDy1.*Dy + mDy2.*CHy + mDy3.*ICHy;

    Main loop…

    Compute Curl of HCHx, CHy

    Update D IntegrationsICHx = ICHx + CHx;ICHy = ICHy + CHy;

    Inject SourceHz(nxs,nys) = Hz(nxs,nys) + g(T);

    Finished!yes

    Done?

    no

    Visualize Fields

    BC’s

    Slide 36

    Total‐Field/Scattered‐Field Plane Wave Source

  • 5/14/2020

    19

    Total‐Field / Scattered‐Field

    • The total‐field/scattered‐field (TF/SF) condition is a technique to inject a “one‐way” source.• Benefits• Eliminates backward propagating power• Needed for calculation of reflection• Minimizes power incident on PML

    • Ensures waves at the boundaries are only travelling outward• 100% of power injected by the source is incident on the device being simulated.

    Slide 37

    scattered‐fieldtotal‐field

    Typical 2D FDTD Grid Layout For Modeling Periodic Structures

    Slide 38

    20cells

    20cells

    TF/SF Interface2 cells

    Perio

    dic B

    ound

    ary Periodic Boundary

    PML

    PML

    x

    y

    The position of the TF/SF source really can be anywhere above the device.  It cannot slice through the device.

  • 5/14/2020

    20

    Typical 2D FDTD Grid Layout For Modeling General Scatterers

    Slide 39

    20cells

    20 cells

    20cells

    20 cells

    TF/SF Interface

    2 cells

    2 cells

    2 cells

    2 cells

    PML

    PML

    PML

    PMLx

    y

    The Total‐Field/Scattered‐Field Framework

    Slide 40

    Problem Points!

    total‐field

    scattered‐fie

    ld

    2D FDTD Grid

    srcjsrc 1j

    x

    y

  • 5/14/2020

    21

    It is necessary to subtract the source from 𝐸 to make it look like a scattered‐field quantity.

    Correction to Finite‐Difference Equations at the Problem Cells (1 of 2)

    Slide 41

    On the scattered‐field side of the TF/SF interface, the finite‐difference equation contains a term from the total‐field side.  Due to the staggered nature of the Yee grid, this only occurs in the update equation for a magnetic field.  In fact, this only occurs in the computation of the curl of 𝐸 used in the update equations for 𝐻.

    src

    src

    src , 1, 1

    ,i j i ji j zE t

    x t

    z tE

    CE

    y

    This is an equation in the scattered‐field, but 𝐸 is a total‐field quantity.

    srcsrc srcsrc , 1, 1 s c, ,r i jz i jzi j tEx

    t

    t

    i j

    z tEE E

    Cy

    src src

    s crc sr,sr

    1

    c

    , ,, 1 1

    i j i ji j z zE t t i j

    z tx t

    E EC

    y yE

    standard curl equation This is a correction term that can be implemented after calculating the curl to inject a source.

    Across entire row (all values of i)

    Correction to Finite‐Difference Equations at the Problem Cells (2 of 2)

    Slide 42

    On the total‐field side of the TF/SF interface, the finite‐difference equation contains a term from the scattered‐field side.  Due to the staggered nature of the Yee grid, this only occurs in the update equation for 𝐷. In fact, this only occurs in the computation of the curl of 𝐻 used in the update equations for 𝐷.

    src src src

    s

    src

    2rc 2 2 2

    2

    , 1, ,,

    , 1t t t t

    t

    i j i j i jy yi j xt t tH

    i j

    z

    x t

    t

    H H HC

    x

    H

    y

    This is an equation in the scattered‐field, but 𝐻 is a total‐field quantity.

    We must add the source to 𝐻 to make it look like a total‐field quantity.

    src src srcsrc 22 2 src2 22

    src, 1, 1, s,

    ,

    , rc1tt

    t

    tt t

    i j i j i jxy y t

    i ji

    i j t tHz t

    x t x t

    jHH H

    x

    HC

    y

    H

    src src

    src

    2

    src src

    src 2 2 2 2

    2

    , 1, , ,, 1src

    1, 1

    t

    t t t t

    t

    i j

    i j i j i j i jy yi j x xt t t t

    x t

    Hz t

    H H H HC

    x y yH

    standard update equation This is a correction term that can be implemented after calculating the curl to inject a source.

    entire row

  • 5/14/2020

    22

    The Two Source Terms

    Slide 43

    From the previous slides, two source functions must be calculated before the main FDTD loop.  These are:

    src,src i j

    z tEsrc

    2

    , 1srct

    i j

    x tH

    A few observations must be accounted for before these source functions can be calculated correctly.

    1. The amplitude of these functions can be different because 𝐸 and 𝐻 are related through the material impedance.

    2. These functions are a half grid cell apart and have a small time delay between them.3. These functions exist at different time steps.

    Across entire row (all values of i)

    Calculation of the Source Functions (Ez Mode)

    Slide 44

    Calculate the electric field as

    src,src i jz tE g t

    Calculate the magnetic field as

    src

    2

    r,src src

    r,src

    1r

    0

    ,s c

    2 2ti j

    x t

    n y tc

    H g t

    Half time step difference

    Delay through one half of a grid cell

    Amplitude due to Maxwell’s equations

  • 5/14/2020

    23

    Visualize Fields

    Update Ez

    Inject TF/SF Source into curl of E

    TF/SF Block Diagram for Ez Mode

    Slide 45

    Compute Curl of E

    Update H Integrations

    Update H FieldUpdate Dz

    Main loop…

    Compute Curl of H

    Update D Integrations

    Inject TF/SF Source into curl of H

    Finished!yes

    Done?

    no

    H Mode Curl Calculations

    Slide 46

    The curl calculations requiring modifications are

    2

    22

    1, , ,,

    ,,

    , 1

    , 1t

    t

    t

    i j

    x t

    i jz

    i j i j i ji j y y xE t t t

    z t

    i ji j z t tH

    x t

    E E EC

    x y

    HC

    y

    E

    H

    After correcting for TF/SF, these are

    c

    srsrc src src src

    src

    src sr

    src 2 2

    s

    2

    2

    c

    rc

    1, 1 , 1 , ,

    ,

    ,

    ,src

    ,, 1,

    1, 1

    1, srct t

    t

    t

    i j

    x t

    j

    i j i j i j i ji j y y x xE t t t t

    z t

    i i ji j z zt tH

    i jz t

    x t

    E E E EC

    x y y

    H HC

    y y

    E

    H

  • 5/14/2020

    24

    H Mode Source Functions

    Slide 47

    Calculate the electric field as

    src,

    ,src

    i j

    x tg tE

    Calculate the magnetic field as

    src

    2

    s, c1,

    r, rc sr

    r,src 0src 2 2t

    i jz t

    H tg t n yc

    Half time step difference

    Delay through one half of a grid cell

    Amplitude due to Maxwell’s equations

    Update E Field

    Inject TF/SF Source into curl of HInject TF/SF Source into curl of E

    TF/SF Block Diagram for Hz Mode

    Slide 48

    Compute Curl of E

    Update H Integrations

    Update H FieldUpdate D Field

    Main loop…

    Compute Curl of H

    Update D Integrations

    Finished!yes

    Done?

    no

    Visualize Fields