8/5/2014 EE 5390 – Special Topics Electromagnetic Analysis Using Finite‐Difference Time‐Domain Lecture #15 Implementation of Two‐ Dimensional FDTD These notes may contain copyrighted material obtained under fair use rules. Distribution of these materials is strictly prohibited Lecture 15 Slide 1 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 Total‐Field/Scattered‐Field Source Lecture 15 Slide 2 1 8/5/2014 Review Lecture 15 Slide 3 Uniaxial PML Reflections can be prevented at all angles, all frequencies, and for all polarizations if we allow our absorbing material to be diagonally anisotropic. s x y s Lecture 15 Slide 4 2 8/5/2014 Derivation of Update Equation for Hx 1. Governing Equation in the Frequency‐Domain y c0 E z E y z j 1 x 1 1 H x j 0 j 0 j 0 xx y z 1 F g t G F ag t aG 2. Prepare equation for conversion to time‐domain j H x da a F a g t j G dt t 1 F g d G j y z c 1 y z 1 c0 x E H x H x 0 C xE C x j 02 j 0 xx 0 xx 3. Convert each term to the time‐domain y z H x t y z H x t 2 0 0 t t H x d c0 xx C xE t c0 x 0 xx t C xE d 4. Approximate the equation for numerical implementation i , j ,k i , j ,k H x t t 2 H x t t 2 t yH i , j ,k zH 0 i , j ,k H x i , j,kt H x i , j,kt t t 2 2 2 H y i , j ,k H i , j ,k z t 1 H 4 02 c0 xx i , j ,k C xE i , j ,k t x t 2 i , j ,k t H i , j ,k t x t 2 c0 t xH 0 xx t t 2 i , j ,k Hx T T 0 i , j ,k i , j ,k t C T 0 E i , j ,k x T 5. Solve for H at the future time value i , j ,k H x t t 2 mHx1 i , j ,k H i , j ,k x t t 2 mHx 2 i , j ,k C E i , j ,k x t mHx 3 i , j ,k I i , j ,k CEx t mHx 4 i , j ,k I i, j,k Hx t Lecture 15 Slide 5 Code Development Sequence Step 1 – Basic Update + Dirichlet Step 2 – Basic Update + Periodic BC Step 5 – Calculate Response Lecture 15 Step 3 – Add PML Step 4 – TF/SF Step 6 – Add a Device and Benchmark Slide 6 3 8/5/2014 Numerical Boundary Conditions for 3D Lecture 15 Slide 7 Boundary Conditions We have formulated our update equations so that the curl can be calculated separate from the update equation. Boundary condition problems occur only in these equations. C xE i , j ,k C yE i , j ,k C t t E i , j ,k z t E z E H i , j 1, k t E z i , j ,k t y i , j , k 1 i , j ,k E x E x t t z i 1, j , k Ey E y t x i , j ,k t i , j , k 1 i , j ,k E y E y t t z E z i 1, j , k t E z t y Special boundary conditions are required at the high grid boundaries when computing the curl of the E field. Lecture 15 i , j ,k i , j ,k t x i , j 1, k i , j ,k Ex E x t C H i , j ,k x t t 2 Hz i , j ,k t 2t Hz y C t 2t H i , j ,k z t t 2 H x t t H x t t 2 2 z Hy i , j ,k t 2t i , j , k 1 i , j ,k C yH i , j 1, k t 2t Hy x i 1, j , k t 2t Hy i , j ,k t 2t Hy t 2t z Hz i, j ,k t 2t Hz i 1, j , k t 2t x i , j 1, k i , j ,k i , j , k 1 H x t t H x t t 2 2 y Special boundary conditions are required at the low grid boundaries when computing the curl of the H field. Slide 8 4 8/5/2014 Handling the Boundary Conditions Boundary conditions are handled by calculating 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, C xE i , j ,k t E i , j 1,k E i , j ,k E i , j ,k 1 E i , j ,k z t y t y t zt y z i ,1,k i , N y ,k i , N y , k 1 i , N y ,k E z E z E y E y t t t t y z i , j 1, N i, j, Nz i , j ,1 i, j, Nz z Ez Ez Ey E y t t t t y z i ,1, N z i,N y ,Nz i , N y ,1 i,N y ,Nz E y E z E y E z t t t t y z j N y and k N z j N y and k N z j N y and k N z j N y and k N z Calculating the curl terms separate from the update equations is an excellent way to isolate and modularize the boundary condition problem. Lecture 15 Slide 9 MATLAB Code Implementation (1 of 3) First, we blindly try to calculate the curl. % Compute CEx for nx = 1 : Nx for ny = 1 : Ny for 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; end end end We see that we run into two problems at the y‐hi and z‐hi sides of the grid. Lecture 15 Slide 10 5 8/5/2014 MATLAB Code Implementation (2 of 3) Next, we handle the z‐hi problem explicitly outside of the nz‐loop. We copy the code inside the nz‐loop and past it after the nz‐loop. % Compute CEx for nx = 1 : Nx for ny = 1 : Ny for 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; end CEx(nx,ny,Nz) = (Ez(nx,ny+1,Nz) - Ez(nx,ny,Nz))/dy ... - (Ey(nx,ny,1) - Ey(nx,ny,Nz))/dz; end end We still have the problem at the y‐hi side of the grid, but now the problem occurs in two places. Lecture 15 Slide 11 MATLAB Code Implementation (3 of 3) Finally, we handle the y‐hi problem explicitly outside of the ny‐loop. We copy all of the code inside the ny‐loop and paste it after the ny‐ loop. % Compute CEx for nx = 1 : Nx for ny = 1 : Ny-1 for 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; end CEx(nx,ny,Nz) = (Ez(nx,ny+1,Nz) - Ez(nx,ny,Nz))/dy ... - (Ey(nx,ny,1) - Ey(nx,ny,Nz))/dz; end for 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; end CEx(nx,Ny,Nz) = (Ez(nx,1,Nz) - Ez(nx,Ny,Nz))/dy ... - (Ey(nx,Ny,1) - Ey(nx,Ny,Nz))/dz; end Lecture 15 Slide 12 6 8/5/2014 Reduction to Two Dimensions Lecture 15 Slide 13 3D 2D (Exact) 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. absorbing BC z periodic BC periodic BC x absorbing BC y Lecture 15 Slide 14 7 8/5/2014 2D Grids are Infinite in the 3rd Dimension Anything represented on a 2D grid, is actually a device that is of infinite extent along the 3rd dimension. absorbing BC x periodic BC periodic BC y absorbing BC Lecture 15 Slide 15 What is Different in Two Dimensions? • We will assume it is the z direction that is uniform. • All derivatives in the z direction are zero 0 z • We do not need a PML to terminate the z axis z z 0 sz z 1 Lecture 15 Slide 16 8 8/5/2014 Revisions for Update Equation for Hx The update coefficients are computed before the main FDTD loop. i , j ,k mHx 0 i , j ,k mHx 2 H 1 y t i , j ,k 2 0 H y c0 1 mHx 0 i , j ,k zH i , j ,k xx i , j ,k 4 mHx3 i , j ,k H i , j ,k z t mHx1 2 0 i , j ,k c0 t 1 mHx 0 i , j ,k 1 mHx 0 i , j ,k 1 t H y H i , j ,k x mHx 4 0 xx i , j ,k i , j ,k i , j ,k zH H y i , j ,k 2 0 i , j ,k t 1 mHx 0 i , j ,k 02 i , j ,k 4 H i , j ,k y H i , j ,k z 2 0 t H i , j ,k z The integration terms are computed inside the main FDTD loop, but before the update equation. t i , j ,k I CEx t C t E i , j ,k x t I T 0 i , j ,k t Hx t 2 t 2 i , j ,k T t 2 Hx T C E i , j ,k x t E z i , j 1, k t E z i , j ,k t y E y i , j , k 1 t E y i , j ,k t z The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. i , j ,k H x t t 2 mHx1 H i , j ,k i , j ,k x t t 2 C i , j ,k mHx 2 E i , j ,k x t mHx 3 i , j ,k I i , j ,k CEx t mHx 4 i , j ,k I i , j ,k Hx t Lecture 15 Slide 17 2D Update Equation for Hx The update coefficients are computed before the main FDTD loop. mHx 0 i, j mHx 2 i, j H i, j 1 y t 2 0 mHx1 c0 1 mHx 0 i, j xx mHx 3 i, j i, j i, j 1 i, j mHx 0 H i, j y 2 0 H i, j c0 t x 1 mHx 0 1 t i, j 0 xx i , j The integration terms are computed inside the main FDTD loop, but before the update equation. t i, j I CEx t C E i, j x t C E i, j x t E z i , j 1 t T 0 E z i, j t y The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. i, j H x t t 2 mHx1 Lecture 15 i, j H i, j x t t 2 mHx 2 i, j C E i, j x t mHx 3 i, j I i, j CEx t Slide 18 9 8/5/2014 2D Update Equation for Hy The update coefficients are computed before the main FDTD loop. i, j mHy 0 i, j mHy 2 H i, j 1 x t 2 0 mHy 0 i, j yy i, j mHy1 c0 1 mHy 3 i, j i, j 1 t 1 mHy 0 i, j H i, j x 2 0 H i, j c0 t y 1 0 yy i , j i, j mHy 0 The integration terms are computed inside the main FDTD loop, but before the update equation. i, j I CEy t t C E i, j y t C E i, j y t E z i 1, j t E z i, j t x T 0 The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. Hy i, j t t 2 i, j mHy1 H i, j mHy 2 y t t 2 i, j C E i, j y t mHy 3 i, j I i, j CEy t Lecture 15 Slide 19 2D Update Equation for Hz The update coefficients are computed before the main FDTD loop. mHz 0 i, j mHz 2 i, j H i, j H 1 x y t 2 0 xH i, j t H i, j H y 1 x mHz1 i, j 2 0 mHz 0 t 1 t H i , j i, j mHz 4 x yH i, j 2 mHz 0 0 H i, j y i, j zz 1 i, j 4 02 c0 1 mHz 0 i, j i, j i, j i, j xH i, j t H i, j y 4 02 The integration terms are computed inside the main FDTD loop, but before the update equation. t I Hz i, j t t 2 t 2 T t 2 i, j CzE Hz T i, j t E y i 1, j t E y i, j t x i , j 1 i, j E x E x t t y The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. Hz Lecture 15 i, j t t 2 mHz1 i, j H z i, j t t 2 mHz 2 i, j C E i, j z t mHz 4 i, j I Hz i, j t 2 t Slide 20 10 8/5/2014 2D Update Equation for Dx The update coefficients are computed before the main FDTD loop. D i, j mDx 0 i, j mDx 2 i, j 1 y t 2 0 c0 mDx 0 i, j mDx1 i, j mDx 3 i, j i, j D 1 y t 2 0 1 mDx 0 i, j c0 t xD 1 mDx 0 i, j 0 i, j The integration terms are computed inside the main FDTD loop, but before the update equation. t I i, j t CHx t 2 t 2 CxH i, j i, j CxH T t 2t T t 2 Hz i, j i , j 1 Hz t 2t t 2t y The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. i, j i, j i, j i, j D x mDx1 D x mDx 2 CxH t t t i, j t mDx 3 t 2 i, j I CHx i, j t 2 t Lecture 15 Slide 21 2D Update Equation for Dy The update coefficients are computed before the main FDTD loop. mDy 0 mDy 2 i, j i, j D i, j 1 x t 2 0 mDy1 c0 mDy 0 mDy 3 i, j i, j i, j 1 mDy 0 i, j c0 t yD 1 mDy 0 i, j D 1 x t 2 0 i, j i, j 0 The integration terms are computed inside the main FDTD loop, but before the update equation. t I i, j CHy t t 2 t 2 C yH i, j C yH T T t 2 i, j t 2t Hz i, j t 2t Hz i 1, j t 2t x The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. D y Lecture 15 i, j t t mDy1 i, j D i, j y t mDy 2 i, j C H i, j y t t 2 mDy 3 i, j I i, j CHy t t 2 Slide 22 11 8/5/2014 2D Update Equation for Dz The update coefficients are computed before the main FDTD loop. D i, j mDz 0 i, j mDz 2 i, j 1 x t yD i, j 2 0 t D i, j x D i, j y 4 02 c0 mDz 0 i, j mDz1 mDz 4 i, j i, j i, j i, j D i, j D i, j xD yD t 1 x y i, j 2 0 4 02 mDz 0 t 1 t D i , j D i, j x y i, j 2 mDz 0 0 1 The integration terms are computed inside the main FDTD loop, but before the update equation. I Dz i, j t t D z T 0 i, j C T H i, j z t t 2 Hy i, j Hy t 2t i 1, j t 2t x i , j 1 i, j H x t t H x t t 2 2 y The update equation is computed inside the main FDTD loop immediately after the integration terms are updated. D z i, j t t mDz1 i, j D i, j z t mDz 2 i, j C H i, j z t t 2 mDz 4 i, j I i, j Dz t t Lecture 15 Slide 23 2D Update Equations for Ex, Ey, and Ez The update coefficients are computed before the main FDTD loop. mEx1 i, j 1 xx mEy1 i, j i, j 1 yy i, j mEz1 i, j 1 zz i, j The update equations are computed inside the main FDTD loop. i, j i, j i, j E x mEx1 D x t t E y i, j E z i, j t t t t mEy1 mEz1 i, j i, j D D t t i, j y t t i, j z t t No changes here! Lecture 15 Slide 24 12 8/5/2014 MATLAB Code for Update Equations The update equation for Hx was i, j H x t t 2 mHx1 i, j H i, j x t t 2 mHx 2 i, j C E i, j x t mHx 3 i, j I i, j CEx t This could be implemented in MATLAB as follows for ny = 1 : Ny for nx = 1 : Nx Hx(nx,ny) = mHx1(nx,ny)*Hx(nx,ny) + mHx2(nx,ny)*CEx(nx,ny) + mHx3(nx,ny)*ICEx(nx,ny); end end However, it is much simpler and faster to implement it using “vectorized” MATLAB commands. Hx = mHx1.*Hx + mHx2.*CEx + mHx3.*ICEx; Lecture 15 Slide 25 Calculating the PML Parameters Lecture 15 Slide 26 13 8/5/2014 MATLAB Code to Calculate PML Parameters To calculate the PML parameters x and y we employ the 2× grid concept. First, we calculate x and y on the 2× grid. 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. % COMPUTE PML PARAMETERS Nx2 = 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; end for 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; end for ny = 1 : 2*NPML(4) ny1 = Ny2 - 2*NPML(4) + ny; sigy(:,ny1) = (0.5*e0/dt)*(ny/2/NPML(4))^3; end x x y y 0 x 3 2t Lx 0 y 3 2t Ly Lecture 15 Slide 27 Visualizing the PML Parameters If calculated correctly, the PML conductivity terms should look like: x y y x x y e0 = 8.8542e-12 dt = 1.6678e-10 Lecture 15 0.0265 0.0194 0.0136 0.0091 0.0057 0.0033 0.0017 0.0007 0.0002 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0002 0.0007 0.0017 0.0033 0.0057 0.0091 0.0136 0.0194 0.0265 Slide 28 14 8/5/2014 MATLAB Code to Calculate Update Coefficients Next, we overlay the PML functions onto the 1× grid to calculate the update coefficients containing PML terms. % COMPUTE UPDATE COEFFICIENTS sigHx = 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 sigHy mHy0 mHy1 mHy2 mHy3 = = = = = = sigx(2:2:Nx2,1:2:Ny2); sigy(2:2:Nx2,1:2:Ny2); (1/dt) + sigHx/(2*e0); ((1/dt) - sigHx/(2*e0))./mHy0; - c0./URyy./mHy0; - (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; mHx 0 i, j mHx 2 i, j mHy 0 mHy 2 i, j i, j H i, j 1 y t 2 0 i, j xx i, j i, j mDx1 i, j mDz 2 i, j mDz 4 i, j 1 x t 1 mDx 0 i, j yy D i, j mDz 0 mHx 3 i, j mHy 3 i, j yD i, j 2 0 i, j i, j mHy1 c0 1 mHy 0 i, j mHx1 c0 1 mHx 0 H i, j 1 x t 2 0 i, j 1 mHx 0 i, j i, j i, j 0 xx i , j 1 t H i, j x 2 0 H i, j c0 t y 1 mHy 0 H i, j 1 H i, j y 2 0 c0 t x 1 mHx 0 mHy 0 1 t i, j 0 yy i , j t D i, j x D i, j y 4 2 0 i, j i, j D i, j D i, j xD yD t 1 x y 2 t 2 0 4 0 c0 mDz 0 i, j t 1 mDz 0 i, j 02 D i, j x D i, j y Lecture 15 Slide 29 Implementation Ez Mode Lecture 15 Slide 30 15 8/5/2014 Block Diagram for Ez Mode (1 of 2) Define Device Parameters Initialization… Define FDTD Parameters Compute Grid Parameters Build Device on Grid Compute Update Coefficients mHx1, mHx2, mHx3 mHy1, mHy2, mHy3 mDz1, mDz2, mDz4 mEz1 Compute Time Step Initialize Fields Compute Source Hx, Hy, Dz, Ez Compute PML Parameters Initialize Curl Arrays CEx, CEy, CHz Initialize Integration Arrays ICEx, ICEy, IDz Lecture 15 Slide 31 Block Diagram for Ez Mode (2 of 2) Done? yes Main loop… Finished! no BC’s Compute Curl of E CEx, CEy Update H Integrations ICEx = ICEx + CEx ICEy = ICEy + CEy Update H Field Hx = mHx1.*Hx + mHx2.*CEx + mHx3.*ICEx; Hy = mHy1.*Hy + mHy2.*CEy + mHy3.*ICEy; Compute Curl of H CHz Update D Integrations IDz = IDz + Dz Update Dz Dz = mDz1.*Dz + mDz2.*CHz + mDz4.*IDz; Inject Source Dz(nxs,nys) = Dz(nxs,nys) + g(T); Update Ez Ez = mEz1.*Dz; Visualize Fields Lecture 15 Slide 32 16 8/5/2014 Block Diagram for Hz Mode (1 of 2) Initialization… Define Device Parameters Define FDTD Parameters Compute Update Coefficients Compute Grid Parameters Compute Time Step Compute Source mHz1, mDx1, mDy1, mEx1, mHz2, mHz4 mDx2, mDx3 mDy2, mDy3 mEy1 Initialize Fields Hz, Dx, Dy, Ex, Ey Compute PML Parameters Initialize Curl Arrays CEx, CEy, CHz Initialize Integration Arrays ICHx, ICHy, IHz Lecture 15 Slide 33 Block Diagram for Hz Mode (2 of 2) Done? yes Finished! Main loop… no BC’s Compute Curl of E CEz Compute Curl of H CHx, CHy Update H Integrations IHz = IHz + Hz Update H Field Update D Integrations ICHx = ICHx + CHx; ICHy = ICHy + CHy; Hz = mHz1.*Hz + mHz2.*CEz + mHz4.*IHz; Update D Field Inject Source Hz(nxs,nys) = Hz(nxs,nys) + g(T); Dx = mDx1.*Dx + mDx2.*CHx + mDx3.*ICHx; Dy = mDy1.*Dy + mDy2.*CHy + mDy3.*ICHy; Update E Field Visualize Fields Lecture 15 Ex = mEx1.*Dx; Ey = mEy1.*Dy; Slide 34 17 8/5/2014 Total‐Field/Scattered‐Field Plane Wave Source Lecture 15 Slide 35 Total‐Field / Scattered‐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 – Ensures waves at the boundaries are only travelling outward – 100% of power injected by the source is incident on the device being simulated. Lecture 15 total‐field • Needed for calculation of reflection • Minimizes power incident on PML Slide 36 18 8/5/2014 Typical 2D FDTD Grid Layout For Modeling Periodic Structures PML TF/SF Interface 20cells 2 cells x Periodic Boundary The position of the TF/SF source really can be anywhere above the device. It cannot slice through the device. Periodic Boundary y PML 20cells Lecture 15 Slide 37 Typical 2D FDTD Grid Layout For Modeling General Scatterers 20 cells 20 cells 20cells PML 2 cells PML 2 cells x PML y 2 cells 2 cells TF/SF Interface PML Lecture 15 20cells Slide 38 19 8/5/2014 The Total‐Field/Scattered‐Field Framework scattered‐field 2D FDTD Grid x jsrc 1 jsrc total‐field y Problem Points! Lecture 15 Slide 39 Correction to Finite‐Difference Equations at the Problem Cells (1 of 2) 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 E used in the H field update equations. C E i , jsrc 1 x t E z i , jsrc t i , jsrc 1 E z This is an equation in the scattered‐field, but E zjsrc is a total‐field quantity. t y Ezj We must subtract the source from to make it look like a scattered‐field quantity. src C E i , jsrc 1 x t C E i , jsrc 1 x t E E z i , jsrc z t Ezsrc E i , jsrc 1 z t y i , jsrc t E z i , jsrc 1 t y standard curl equation Lecture 15 i , jsrc t 1 src i , jsrc Ez t y This is a correction term that can be implemented after calculating the curl to inject a source. Slide 40 20 8/5/2014 Correction to Finite‐Difference Equations at the Problem Cells (2 of 2) 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 an D field. In fact, this only occurs in the computation of the curl of H used in the D field update equations. C H i , jsrc z t t 2 Hy i , jsrc t 2t Hy i 1, jsrc t 2t x i , j 1 i, j H x t srct H x t srct 2 This is an equation in the scattered‐field, but H xjsrc 1 is a total‐field quantity. 2 y H xj 1 make it look like a total‐ We must add the source to to field quantity. src C H i , jsrc z t t 2 C H i , jsrc z t t 2 Hy i , jsrc t 2t Hy i 1, jsrc t 2t x Hy i , jsrc t 2t Hy x i 1, jsrc t 2t i , jsrc 1 i, j i , j 1 H x t srct H x t srct H xsrc t 2 2 y i , j 1 i, j t 2 H x t srct H x t srct 2 2 y standard update equation 1 src i , jsrc 1 H x t t 2 y This is a correction term that can be implemented after calculating the curl to inject a source. Lecture 15 Slide 41 The Two Source Terms From the previous slides, we now know that we need to calculate two source functions before the main FDTD loop. These are: i , jsrc 1 H xsrc t t 2 Ezsrc i , jsrc t We need to make a few observations that must be accounted for before we can calculate these source functions correctly. 1. The amplitude of these functions can be different as E and H 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. Lecture 15 Slide 42 21 8/5/2014 Calculation of the Source Functions (Ez Mode) We calculate the electric field as Ezsrc jsrc t g t We calculate the magnetic field as H xsrc jsrc 1 t 2t r nsrc y t g t 2c0 2 r Amplitude due to Maxwell’s equations Delay through one half of a grid cell Half time step difference Lecture 15 Slide 43 TF/SF Block Diagram for Ez Mode Done? yes Finished! Main loop… no Compute Curl of E Compute Curl of H Inject TF/SF Source into curl of E Inject TF/SF Source into curl of H Update H Integrations Update D Integrations Update H Field Update Dz Update Ez Visualize Fields Lecture 15 Slide 44 22 8/5/2014 TF/SF Block Diagram for Hz Mode Done? yes Finished! Main loop… no Compute Curl of E Compute Curl of H Inject TF/SF Source into curl of E Inject TF/SF Source into curl of H Update H Integrations Update H Field Update D Integrations Update D Field Update E Field Visualize Fields Lecture 15 Slide 45 23