# Fdtd Stuff

Post on 24-Oct-2014

20 views

Embed Size (px)

TRANSCRIPT

<p>Chapter 3Introduction to the Finite-DifferenceTime-Domain Method: FDTD in 1D3.1 IntroductionThe nite-difference time-domain (FDTD) method is arguably the simplest, both conceptually andin terms of implementation, of the full-wave techniques used to solve problems in electromagnet-ics. It can accurately tackle a wide range of problems. However, as with all numerical methods, itdoes have its share of artifacts and the accuracy is contingent upon the implementation. The FDTDmethod can solve complicated problems, but it is generally computationally expensive. Solutionsmay require a large amount of memory and computation time. The FDTD method loosely ts intothe category of resonance region techniques, i.e., ones in which the characteristic dimensions ofthe domain of interest are somewhere on the order of a wavelength in size. If an object is verysmall compared to a wavelength, quasi-static approximations generally provide more efcient so-lutions. Alternatively, if the wavelength is exceedingly small compared to the physical features ofinterest, ray-based methods or other techniques may provide a much more efcient way to solvethe problem.The FDTD method employs nite differences as approximations to both the spatial and tem-poral derivatives that appear in Maxwells equations (specically Amperes and Faradays laws).Consider the Taylor series expansions of the function f(x) expanded about the point x0 with anoffset of /2:f_x0 + 2_ = f(x0) + 2f(x0) + 12!_2_2f(x0) + 13!_2_3f(x0) + . . . , (3.1)f_x0 2_ = f(x0) 2f(x0) + 12!_2_2f(x0) 13!_2_3f(x0) + . . . (3.2)where the primes indicate differentiation. Subtracting the second equation from the rst yieldsf_x0 + 2_f_x0 2_= f(x0) + 23!_2_3f(x0) + . . . (3.3)Lecture notes by John Schneider. fdtd-intro.tex3334 CHAPTER 3. INTRODUCTION TO THE FDTD METHODDividing by producesf_x0 + 2_f_x0 2_ = f(x0) + 13!222f(x0) + . . . (3.4)Thus the term on the left is equal to the derivative of the function at the point x0 plus a term whichdepends on 2plus an innite number of other terms which are not shown. For the terms which arenot shown, the next would depend on 4and all subsequent terms would depend on even higherpowers of . Rearranging slightly, this relationship is often stated asdf(x)dxx=x0=f_x0 + 2_f_x0 2_ + O(2). (3.5)The big-Oh term represents all the terms that are not explicitly shown and the value in paren-theses, i.e., 2, indicates the lowest order of in these hidden terms. If is sufciently small,a reasonable approximation to the derivative may be obtained by simply neglecting all the termsrepresented by the big-Oh term. Thus, the central-difference approximation is given bydf(x)dxx=x0f_x0 + 2_f_x0 2_ . (3.6)Note that the central difference provides an approximation of the derivative of the function at x0,but the function is not actually sampled there. Instead, the function is sampled at the neighboringpoints x0 + /2 and x0 /2. Since the highest power of being ignored is second order, thecentral difference is said to have second-order accuracy or second-order behavior. This impliesthat if is reduced by a factor of 10, the error in the approximation should be reduced by a factorof 100 (at least approximately). In the limit as goes to zero, the approximation becomes exact.One can construct higher-order central differences. In order to get higher-order behavior, moreterms, i.e., more sample points, must be used. Appendix A presents the construction of a fourth-order central difference. The use of higher-order central differences in FDTD schemes is certainlypossible, but there are some complications which arise because of the increased stencil of thedifference operator. For example, when a PEC is present, it is possible that the difference operatorwill extend into the PEC prematurely or it may extend to the other side of a PEC sheet. Becauseof these types of issues, we will only consider the use of second-order central difference.3.2 The Yee AlgorithmThe FDTD algorithm as rst proposed by Kane Yee in 1966 employs second-order central differ-ences. The algorithm can be summarized as follows:1. Replace all the derivatives in Amperes and Faradays laws with nite differences. Discretizespace and time so that the electric and magnetic elds are staggered in both space and time.2. Solve the resulting difference equations to obtain update equations that express the (un-known) future elds in terms of (known) past elds.3.3. UPDATE EQUATIONS IN 1D 353. Evaluate the magnetic elds one time-step into the future so they are now known (effectivelythey become past elds).4. Evaluate the electric elds one time-step into the future so they are now known (effectivelythey become past elds).5. Repeat the previous two steps until the elds have been obtained over the desired duration.At this stage, the summary is probably a bit too abstract. One really needs an example to demon-strate the simplicity of the method. However, developing the full set of three-dimensional equationswould be overkill and thus the algorithm will rst be presented in one-dimension. As you will see,the extension to higher dimensions is quite simple.3.3 Update Equations in 1DConsider a one-dimensional space where there are only variations in the x direction. Assume thatthe electric eld only has a z component. In this case Faradays law can be writtenHt = E = ax ay azx 0 00 0 Ez= ayEzx . (3.7)Thus Hy must be the only non-zero component of the magnetic eld which is time varying. (Sincethe right-hand side of this equation has only a y component, the magnetic eld may have non-zerocomponents in the x and z directions, but they must be static. We will not be concerned with staticelds here.) Knowing this, Amperes law can be writtenEt = H = ax ay azx 0 00 Hy 0= azHyx . (3.8)The two scalar equations obtained from (3.7) and (3.8) areHyt = Ezx , (3.9)Ezt = Hyx . (3.10)The rst equation gives the temporal derivative of the magnetic eld in terms of the spatial deriva-tive of the electric eld. Conversely, the second equation gives the temporal derivative of theelectric eld in terms of the spatial derivative of the magnetic eld. As will be shown, the rstequation will be used to advance the magnetic eld in time while the second will be used to ad-vance the electric eld. A method in which one eld is advanced and then the other, and then theprocess is repeated, is known as a leap-frog method.The next step is to replace the derivatives in (3.9) and (3.10) with nite differences. To do this,space and time need to be discretized. The following notation will be used to indicate the locationwhere the elds are sampled in space and timeEz(x, t) = Ez(mx, qt) = Eqz[m] , (3.11)Hy(x, t) = Hy(mx, qt) = Hqy[m] , (3.12)36 CHAPTER 3. INTRODUCTION TO THE FDTD METHODposition, xtime, tFuturePastwrite difference equationabout this pointEz [m1]q+1Ez [m+1]q+1Ez [m]q+1Hy [m1/2]q1/2Hy [m+1/2]q1/2Hy [m3/2]q1/2Hy [m1/2]q+1/2Hy [m+1/2]q+1/2Hy [m3/2]q+1/2Ez [m1]qEz [m]qEz [m+1]qHy [m1/2]q+3/2Hy [m+1/2]q+3/2Hy [m3/2]q+3/2xtFigure 3.1: The arrangement of electric- and magnetic-eld nodes in space and time. The electric-eld nodes are shown as circles and the magnetic-eld nodes as triangles. The indicated point iswhere the difference equation is expanded to obtain an update equation for Hy.where x is the spatial offset between sample points and t is the temporal offset. The index mcorresponds to the spatial step, effectively the spatial location, while the index q corresponds tothe temporal step. When written as a superscript q still represents the temporal stepit is not anexponent. When implementing FDTD algorithms we will see that the spatial indices are used asarray indices while the temporal index, which is essentially a global parameter, is not explicitlyspecied for each eld location. Hence, it is reasonable to keep the spatial indices as an explicitargument while indicating the temporal index separately.Although we only have one spatial dimension, time can be thought of as another dimension.Thus this is effectively a form of two-dimensional problem. The question now is: How should theelectric and magnetic eld sample points, also known as nodes, be arranged in space and time?The answer is shown in Fig. 3.1. The electric-eld nodes are shown as circles and the magnetic-eld nodes as triangles. Assume that all the elds below the dashed line are knownthey areconsidered to be in the pastwhile the elds above the dashed line are future elds and henceunknown. The FDTD algorithm provides a way to obtain the future elds from the past elds.As indicated in Fig. 3.1, consider Faradays law at the space-time point ((m + 1/2)x, qt)Hyt(m+1/2)x,qt= Ezx(m+1/2)x,qt. (3.13)The temporal derivative is replaced by a nite difference involving Hq+12y_m + 12and Hq12y_m + 12(i.e., the magnetic eld at a xed location but two different times) while the spatial derivative is re-placed by a nite difference involving Eqz[m + 1] and Eqz[m] (i.e., the electric eld at two different3.3. UPDATE EQUATIONS IN 1D 37position, xFuturePastwrite difference equationabout this pointEz [m1]q+1Ez [m+1]q+1Ez [m]q+1Hy [m1/2]q1/2Hy [m+1/2]q1/2Hy [m3/2]q1/2Hy [m1/2]q+1/2Hy [m+1/2]q+1/2Hy [m3/2]q+1/2Ez [m1]qEz [m]qEz [m+1]qtime, tHy [m1/2]q+3/2Hy [m+1/2]q+3/2Hy [m3/2]q+3/2xtFigure 3.2: Space-time after updating the magnetic eld. The dividing line between future andpast values has moved forward a half temporal step. The indicated point is where the differenceequation is written to obtain an update equation for Ez.locations but one time). This yieldsHq+12y_m + 12Hq12y_m + 12t= Eqz[m + 1] Eqz[m]x. (3.14)Solving this for Hq+12y_m + 12yieldsHq+12y_m + 12_= Hq12y_m + 12_+ tx(Eqz[m + 1] Eqz[m]) . (3.15)This is known as an update equation, specically the update equation for the Hy eld. It is ageneric equation which can be applied to any magnetic-eld node. It shows that the future valueof Hy depends on only its pervious value and the neighboring electric elds. After applying (3.15)to all the magnetic-eld nodes, the dividing line between future and past values has advanced ahalf time-step. The space-time grid thus appears as shown in Fig. 3.2 which is identical to Fig. 3.1except for the advancement of the past/future dividing line.Now consider Amperes law (3.10) applied at the space-time point (mx, (q +1/2)t) whichis indicated in Fig. 3.2:Eztmx,(q+1/2)t= Hyxmx,(q+1/2)t. (3.16)Replacing the temporal derivative on the left with a nite difference involving Eq+1z [m] and Eqz[m]and replacing the spatial derivative on the right with a nite difference involving Hq+12y_m + 12and38 CHAPTER 3. INTRODUCTION TO THE FDTD METHODHq+12y_m 12yieldsEq+1z [m] Eqz[m]t=Hq+12y_m + 12Hq+12y_m 12x. (3.17)Solving for Eq+1z [m] yieldsEq+1z [m] = Eqz[m] + tx_Hq+12y_m + 12_Hq+12y_m 12__. (3.18)Equation (3.18) is the update equation for the Ez eld. The indices in this equation are generic sothat the same equation holds for every Ez node. Similar to the update equation for the magneticeld, here we see that the future value of Ez depends on only its past value and the value of theneighboring magnetic elds.After applying (3.18) to every electric-eld node in the grid, the dividing line between whatis known and what is unknown moves forward another one-half temporal step. One is essentiallyback to the situation depicted in Fig. 3.2the future elds closest to the dividing line between thefuture and past are magnetics elds. They would be updated again, then the electric elds wouldbe updated, and so on.It is often convenient to represent the update coefcients t/x and t/x in terms of theratio of how far energy can propagate in a single temporal step to the spatial step. The maximumspeed electromagnetic energy can travel is the speed of light in free space c = 1/00 and hencethe maximum distance energy can travel in one time step is ct (in all the remaining discussionsthe symbol c will be reserved for the speed of light in free space). The ratio ct/x is often calledthe Courant number which we label Sc. It plays an important role in determining the stability of asimulation (hence the use of S) and will be considered further later. Letting = r0 and = r0,the coefcients in (3.18) and (3.15) can be written1tx= 1r00000tx=00r0ctx= 1r_00ctx= 0rctx= 0rSc (3.19)1tx= 1r00000tx=00r0ctx= 1r_00ctx= 1r0ctx= 1r0Sc (3.20)where 0 =_0/0 is the characteristic impedance of free space.In FDTDsimulations there are restrictions on howlarge a temporal step can be. If it is too large,the algorithm produces unstable results (i.e., the numbers obtained are completely meaninglessand generally tend quickly to innity). At this stage we will not consider a rigorous analysis ofstability. However, thinking about the way elds propagate in an FDTD grid, it seems logical thatenergy should not be able to propagate any further than one spatial step for each temporal step, i.e.,ct x. This is because in the FDTD algorithm each node only affects its nearest neighbors. Inone complete cycle of updating the elds, the furthest a disturbance could propagate is one spatialstep. It turns out that the optimum ratio for the Courant number (in terms of minimizing numericerrors) is also the maximum ratio. Hence, for the one-dimensional simulations considered initially,we will useSc = ctx= 1. (3.21)3.4. COMPUTER IMPLEMENTATION OF A ONE-DIMENSIONAL FDTD SIMULATION 39position, xHy [m1/2]q+1/2Hy [m+1/2]q+1/2Hy [m3/2]q+1/2Ez [m1]qEz [m]qEz [m+1]qxxFigure 3.3: A one-dimensional FDTD space showing the spatial offset between the magnetic andelectric elds.When rst obtaining the update equations for the FDTD algorithm, it is helpful to think interms of space-time. However, treating time as an additional dimension can be awkward. Thus,in most situations it is more convenient to think in terms of a single spatial dimension where theelectric and magnetic elds are offset a half spatial step from each other. This is depicted in Fig.3.3. The temporal offset between the electric and magnetic eld is always understood whetherexplicitly shown or not.3.4 Computer Implementation of a One-DimensionalFDTD SimulationOur goal now is to translate the update equations (3.15) and (3.18) into a usable computer program.The rst step is to discard, at least to a certain extent, the superscriptstime is a global parameterand will be recorded in a single integer variable. Time is not something about which each nodeneeds to be concerned.Next, keep in mind that in most computer languages the equal sign is used as the assignmentoperator. In C, the following is a perfectly valid statementa = a+b;In the usual mathematical sense, this statement is only true...</p>

Recommended

View more >