Finite-Difference Time-Domain (FDTD) - IEEE Xplore

50 downloads 0 Views 4MB Size Report
A MATLAB-based 1D FDTD simulation of plane wave propagation in time domain through single, double or three-layer media. EM parameters are supplied by ...
Finite-Difference Time-Domain (FDTD) MATLAB Codes for First- and Second-Order EM Differential Equations Gizem Toroğlu, Levent Sevgi Electronics and Communications Engineering Department Doğuş University Zeamet Sokak 21, Acıbadem – Kadıköy, 34722 Istanbul – Turkey E-mail: [email protected]

Abstract A set of two-dimensional (2D) electromagnetic (EM) MATLAB codes, using both first-order coupled differential (Maxwell) equations and second-order decoupled (wave) equations, are developed for both transverse-magnetic (TM) and transverse-electric (TE) polarizations. Second-order MUR type absorbing boundary conditions are used to simulate free space. Metamaterial (MTM) modeling is also included. Performance tests in terms of computational times, memory requirements, and accuracies were done for simple EM scenarios with magnetic field, current, and voltage comparisons. The codes may be used for teaching and research purposes. Keywords: Maxwell equations; finite-difference time-domain; FDTD; wave equation; absorbing boundary conditions; MUR conditions; transverse electric; TE; transverse magnetic; TM; metamaterials; MTM; MATLAB

T

1. Introduction

he Finite-Difference Time-Domain (FDTD) method is one of the most powerful numerical approaches widely used in solving a broad range of electromagnetic (EM) problems since its first introduction [1] (a quick Internet search will list tens of thousands of FDTD studies). A few of the many useful books written on the FDTD are [2-8]. Information related to the FDTD may also be found in Wikipedia [9]. The books on the parallel FDTD [10] and FDTD-based metamaterial (MTM) modeling [11] are also worth mentioning. We have also presented many useful tutorials, and have shared our codes and virtual tools for a long time [12-19]. Table 1 lists these free FDTD-based virtual tools, with short explanations. These and many more can be found in the IEEE Press/John Wiley book recently published within the Press series on EM Wave Theory [20]. The MATLAB-based codes and virtual tools in [12] use the one-dimensional FDTD for the plane-wave propagation modeling and simulation through inhomogeneous media, and in [13] for voltage/current wave transmission and reflection along a transmission line (TL) under different termination and impedance-mismatch conditions. The TDRMeter virtual tool

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 221

in [13] can be used for the visualization of both transmission/ reflections and fault identification. A general-purpose two-dimensional FDTD virtual tool, MGL-2D [14], and its modified version, MTM-FDTD [15], can be used in the modeling and simulation of EM waves in two dimensions. A variety of electromagnetic problems, from indoor/outdoor radiowave urban/rural propagation to electromagnetic compatibility (EMC), from resonators to closed/open periodic structures, linear and planar arrays of radiators can be simulated easily with MGL-2D. The beauty of MGL-2D comes from its visualization power, as well as its easy-to-use design steps. Similarly, MTM-FDTD may be used for the visualization of EM waves interacting with different metamaterials. Snapshots during these interactions may be taken. Scenarios with normal and oblique incidences, demonstrating focusing beams in planar metamaterials and the existence of a negative refractive angle, respectively, may be observed in the time domain. In addition, video clips of wave- metamaterial interactions may easily be recorded. The MATLAB-based virtual tool WedgeFDTD was developed to investigate EM scattering on the canonical non-pene221

5/31/2014 3:51:23 PM

Table 1. Free FDTD-based EM Virtual Tools presented in the IEEE Antennas and Propagation Magazine. Virtual Tool

Explanation

1DFDTD

A MATLAB-based 1D FDTD simulation of plane wave propagation in time domain through single, double or three-layer media. EM parameters are supplied by the user [12].

TDRMeter

A virtual time-domain reflectometer virtual tool. It is used to locate and identify faults in all types of metallic paired cable. Fourier and Laplace analyzes are also possible [13].

MGL2D

A general purpose 2D FDTD package for both TE and TM type problems. Any 2D scenario may be created by the user by just using the mouse [14].

MTM-FDTD

Modified version of MGL-2D to simulate cylindrical wave propagation through MeTaMaterials (MTM) [15].

WedgeFDTD*

A 2D MATLAB-based simulator for the modeling of EM diffraction from a semi-infinite non-penetrable wedge using high frequency asymptotics and FDTD [16] (*published in ACES).

MSTRIP

A 3D FDTD-based EM simulator for the broadband investigation of microstrip circuits. The user only needs to picture the microstrip circuit via computer mouse on a rectangular grid, to specify basic dimensions and operational needs such as the frequency band, simulation length [18].

MGL-RCS

A 3D FDTD-based EM simulator for RCS prediction. The user only needs to locate a 3D image file of the target in 3DS graphics format, specify dimensions and supply other user parameters. The simulator predicts RCS vs. angle and/or RCS vs. frequency [19].

trable wedge problem with the FDTD method [16]. Diffracted fields may easily be extracted and compared with the results of high-frequency asymptotic (HFA) models. Some interesting applications of the two-dimensional FDTD method were also discussed in one of our tutorials [17]. There, FDTD-based path planning and segmentation were modeled and implemented. Finally, full-wave, 3D-FDTD EM virtual tools have been prepared and reviewed in tutorials [18] and [19] for realistic problem modeling and simulations. In [18], MSTRIP was introduced for the investigation of a variety of microstrip circuits. MSTRIP is a 3D-FDTD EM simulator that uses the powerful perfectly matched layer terminations (PML) [21]. The user needs only to render the microstrip circuit via a computer mouse on a rectangular grid, and to specify basic dimensions and supply operational requirements, such as the frequency band and simulation length. The rest is handled by MSTRIP. It is easy-to-use, strengthened with visualization and video-clip capabilities, and can handle very complex single- and doublelayer microstrip structures. Time-domain visualization is possible during the simulations and video clips may be recorded. The S parameters are automatically calculated, and may be displayed online. In [19], a three-dimensional FDTD-based RCS prediction virtual analysis tool (MGL-RCS) was introduced. It can be used to design any kind of a PEC target using basic blocks, such as a rectangular prism, cone, cylinder, sphere, etc. A collection of pre-designed surface and air targets stored in 3DS format files, are also supplied. Time-domain near scattered fields can be simulated around the object under investigation, and transients can be recorded as video clips. Far fields are then extrapolated, and RCS as a function of frequency and RCS as a function of angle plots can be produced (FORTRAN source codes of this package may also be found in [4]). 222

AP_Mag_Apr_2014_Final.indd 222

2. The Two-Dimensional FDTD Models The FDTD method [1] discretizes Maxwell equations by replacing derivatives with their finite-difference approximations, directly in the time domain. It is simple, easy to code, but has the open-form (iterative) solution. It is therefore conditionally stable: one needs to satisfy a stability condition. The FDTD volume is finite, and therefore may model only closed regions. Free-space simulation is an important task in FDTD, and various effective boundary terminations have been developed for the last two decades (see [22] for the second-order MUR-type terminations used here). Broadband (pulse) excitation is possible in the FDTD, but inherits the numerical-dispersion problem. Finally, only near fields can be simulated around the object under investigation; far fields can be extrapolated using the Equivalence Principle (e.g., the Stratton-Chu equations) [4].

2.1 First-Order Coupled Equations The assumption of a continuous translational symmetry along z lets us reduce the three-dimensional problem into two dimensions on the xy plane. Maxwell equations in such an environment are characterized with three parameters (the permittivity, ε , permeability, µ , and conductivity, σ ):   ∂H ∇ × E = −µ , ∂t

(1)

   ∂E ∇ ×= +σ E . H ε ∂t

(2)

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:24 PM

These reduce to two sets of scalar equations (i.e., TM z and TE z ) in two dimensions under the assumption ∂ ∂z ≡ 0 , and can be given as [23]

2ε − σ∆t n −1 E x ( i, j ) 2ε + σ∆t 2∆t  H zn ( i, j ) − H zn ( i, j − 1)  , −  2 t y ε + σ ∆ ∆ ( ) 

E xn ( i, j ) =

SET #1: TM z ( H z ≡ 0 ) −µ

µ

∂H x ∂Ez = , ∂t ∂y

∂H y ∂t

=

∂Ez , ∂x

(6a) (3a)

(3b)

∂H y ∂H x ∂E ε z = − − σ Ez , ∂t ∂x ∂y

∂E ∂t

ε

∂H z − σ Ex , ∂y

∂E y

(3c)

(4a)

(4b)

∂H z ∂E y ∂Ex = − . ∂t ∂x ∂y

(4c)

As observed, knowing the Ez ( H z ) component is enough to derive all the other field components for the TM z ( TE z ) problem. The discretized FDTD iteration equations then reduce to SET #1: TM z ( H z ≡ 0 ) H xn

( i, j=)

H xn −1

H zn ( i, j ) = H zn −1 ( i, j ) n n ∆t  E y ( i, j ) − E y ( i − 1, j )    ∆x µ0     n n ∆t  Ex ( i, j ) − Ex ( i, j − 1)  −  . µ0  ∆y 

+

∂H z = − − σ Ey , ∂t ∂x

−µ

2ε − σ∆t n −1 E z ( i, j ) 2ε + σ∆t 2∆t  H n ( i, j ) − H zn ( i − 1, j )  +  ( 2ε + σ∆t ) ∆x  z (6b)

SET #2: TE z ( Ez ≡ 0 ) x ε =

E zn ( i, j ) =

∆t  n E ( i, j ) − E zn ( i, j − 1)  , ( i, j ) −  µ∆y  z (5a)

∆t  n H yn ( i= E ( i, j ) − E zn ( i − 1, j )  , , j ) H yn −1 ( i, j ) +  µ∆x  z (5b)  2ε − σ∆t  n Ezn +1 ( i, j ) =   E z ( i, j )  2ε + σ∆t  n n 2∆t  H y ( i, j ) − H y ( i − 1, j )    + ∆x 2ε + σ∆t     n n   H ( i, j ) − H x ( i, j − 1) 2∆t −  x  , 2ε + σ∆t  ∆y  (5c)

(6c)

2.2 Second-Order Decoupled Equations Two of the three field components in Equations (3) and (4) can be eliminated, and a second-order differential (wave) equation with a single field component can be obtained. For example, the following wave equation for the TM z problem can be directly obtained from Equation (3c) using Equations (3a) and (3b):  ∂2 ∂2 1 ∂2 ∂ − µσ  Ez = 0.  2+ 2− 2 εµ ∂t ∂t  ∂y  ∂x

(7)

This equation, defined for t ≥ 0; 0 ≤ x ≤ X max , 0 ≤ y ≤ Ymax ,

(8)

together with the boundary conditions Ez ( 0, y, t ) = g1 ( y, t ) for x= 0, 0 ≤ y ≤ Ymax ,

(9a)

Ez ( x, 0, t ) = g 2 ( x, t ) for y= 0, 0 ≤ x ≤ X max ,

(9c)

Ez ( X max , y, t ) = g3 ( y, t ) for = x X max , 0 ≤ y ≤ Ymax (9b) Ez ( x, Ymax , t ) = g 4 ( x, t ) for = y Ymax , 0 ≤ x ≤ X max , (9d)

SET #2: TE z ( Ez ≡ 0 ) and, the initial conditions

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 223

223

5/31/2014 3:51:24 PM

Ez ( x, y, 0 ) = f1 ( x, y ) , ∂Ez ( x, y, 0 ) ∂t

(10a)

= f 2 ( x, y ) ,

4 (1 − p − q ) g

Ezn ( i, j ) −

t n −1 E z ( i, j ) g

2p  n E z ( i − 1, j ) + E zn ( i + 1, j )   g  2q +  E zn ( i, j − 1) + E zn ( i, j + 1)   g  (11)

+

where

Since the FDTD equations are iterative (i.e., openform solutions), they are conditionally stable. The Courant stability condition, which states that the time step cannot be arbitrarily specified once the spatial discretization is done, must be satisfied.



Although the same notations,

(10b)

are enough to solve for Ez and the other field components. Equation (7) can therefore also be used in the FDTD modeling and simulations. The FDTD discretized form of Equation (7) is = Ezn +1 ( i, j )



H zn

Exn ( i, j )

and

( i, j ) , are used, their locations are different in

the classical Yee cell [1] (see Figure 1), and there is a half-time-step difference between the E and H field computation times. That is, the magnetic-field components are calculated at time steps t = ∆t 2 , 3∆t 2 , 5∆t 2 , ..., but the electric fields are calculated at time steps t = ∆t , 2∆t ,3∆t ,... .

2

 v∆t  p  ,  ∆x 

 v∆t  q   ∆y 

2

(12a)

g  2 + µσ v 2 ∆t , t  −2 + µσ v 2 ∆t v=

1

εµ

.

(12b)

(12c)

Note that the dispersion and stability conditions, as well as the source injection in time, are handled just like the first-order coupled FDTD equations. On the other hand, the values at the first two time instants of Ez (i.e., Ez0 ( i, j ) and E1z ( i, j ) ) must be supplied for the spatial source injection.

2.3 Basic Features of the FDTD Equations The observations listed below are important for the numerical implementation of the first-order coupled (FOC) FDTD model: •

There are three field components ( H x , H y , Ez for TM z and Ex , E y , and H z for TE z ) in each cell,

and they are distinguished by the ( i, j ) label for the first-order coupled FDTD model. •

The discretization steps are ∆x, ∆y , and ∆t , and the physical quantities are calculated from x = i∆x , y = j ∆y , and t = n∆t .

224

AP_Mag_Apr_2014_Final.indd 224

Figure 1. The Yee cells for the (a) TM z and (b) TE z problems. IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:25 PM





Only neighboring magnetic-field values and Ezn −1 ( i, j ) are required to update Ezn ( i, j ) . Similarly, neighboring electric-field values and H xn −1 ( i, j ) are required to update H xn ( i, j ) . Both magnetic- and electric-field components in any cell may be moved to the origin by just cell averaging. This is accomplished via H x= ( i, j ) 0.5  H x ( i, j ) + H x ( i + 1, j ) for magnetic fields, but four electric-field components are required for this purpose: E= z ( i, j ) 0.25  E z ( i, j ) + E z ( i + 1, j ) + Ez ( i, j + 1) + E z ( i + 1, j + 1)  .





Any object may be modeled by giving ε , µ , and σ . Two of these, ε and σ , appear in the electricfield components, and the third, µ , appears in the magnetic-field components. Three different ε and σ values may be assigned for three electric-field components, so that different objects may be located within the Yee cell. Similarly, different µ values may be given for H-field components for the same purpose.

The important aspects of the second-order decoupled (SOD) FDTD model are as follows: •

There is only one field component, and its location may be anywhere in the unit cell.



The models and discrete equations are identical for the TM z and TE z problems.



The past two values are needed in every cell.



FDTD iterations yield only Ez ( TM z ) or H z ( TE z  ). One therefore needs to write down another discrete (Maxwell) equation for the other two components, i.e., H x , H y ( TM z ) or Ex , E y ( TE z ).

2.4 Absorbing Boundary Conditions To make it simple in this tutorial, the second-order MUR terminations [22] are used. Table 2 lists equations that must be satisfied along the boundaries (see Figure 2). The discrete iteration equations will then be

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 225

At x = 0 ( N = N x ) Ezn +1 (1, j ) = − E zn −1 ( 2, j )  c∆t − ∆x   n +1 n −1  +  Ez ( 2, j ) + Ez (1, j )   c∆t + ∆x    2∆x   n n  +  Ez ( 2, j ) + Ez (1, j )   c∆t + ∆x    ( c∆t )2 ∆x    Ezn ( 2, j + 1) − 2 Ezn ( 2, j ) + Ezn ( 2, j − 1)  +   2∆y 2 ( c∆t + ∆x )      ( c∆t )2 ∆x    Ezn (1, j + 1) − 2 E zn (1, j ) + E zn (1, j − 1)  + 2   2∆y ( c∆t + ∆x )     (13) At x = X max ( N = N x ) Ezn +1 ( N , j ) = − Ezn −1 ( N − 1, j )  c∆t − ∆x   n +1 n −1  +  Ez ( N − 1, j ) + Ez ( N , j )   c∆t + ∆x    2∆x   n n  +  Ez ( N − 1, j ) + Ez ( N , j )   c∆t + ∆x    ( c∆t )2 ∆x    Ezn ( N − 1, j + 1) +  2∆y 2 ( c∆t + ∆x )     n n −2 Ez ( N − 1, j ) + Ez ( N − 1, j − 1)    ( c∆t )2 ∆x    Ezn ( N , j + 1) − 2 Ezn ( N , j ) + Ezn ( N , j − 1)  +   2∆y 2 ( c∆t + ∆x )     (14)

Table 2. Differential equations for the second-order MUR terminations.  ∂2 1 ∂2 c ∂2  x=0 → − + 0  E z ( 0, y, t ) = 2 0 ≤ y ≤ Ymax 2 ∂y 2   ∂x∂t c ∂t  ∂2 1 ∂2 c ∂2  x = X max 0 → + −  Ez ( X max , y, t ) = 2 2 0 ≤ y ≤ Ymax ∂y 2   ∂x∂t c ∂t  ∂2 1 ∂2 c ∂2  y=0 → − + 0  E z ( x, 0, t ) = 2 0 ≤ x ≤ X max 2 ∂x 2   ∂y∂t c ∂t  ∂2 1 ∂2 c ∂2  y = Ymax 0 → + −  Ez ( x, Ymax , t ) = 2 2 0 ≤ x ≤ X max ∂x 2   ∂y∂t c ∂t

225

5/31/2014 3:51:25 PM

2.5 Parameter Selection in FDTD Simulations FDTD modeling and simulations are usually preferred because of the ability for handling complex EM environments and broadband behavior. Running simulations requires parameter optimization. The spatial mesh sizes, ∆x and ∆y , the time step, ∆t , the total simulation period ( Tmax = n∆t ), the source bandwidth, B, and the pulse duration are characteristic parameters that should be optimally selected prior to the simulation [4].

Figure 2. The boundary cells used in MUR terminations.

At y = 0 ( N = N y ) Ezn +1 ( i,1) = − E zn −1 ( i, 2 )  c∆t − ∆y   n +1 Ez ( i, 2 ) + E zn −1 ( i,1)  +     c∆t + ∆y   2∆y   n n +   Ez ( i, 2 ) + Ez ( i,1)  c t y ∆ + ∆    ( c∆t )2 ∆y     E zn ( i + 1, 2 ) − 2 Ezn ( i, 2 ) + Ezn ( i − 1, 2 )  + 2   2∆x ( c∆t + ∆y )      ( c∆t )2 ∆y    E zn ( i + 1,1) − 2 Ezn ( i,1) + Ezn ( i − 1,1)  +   2∆x 2 ( c∆t + ∆y )     (15)

FDTD simulations are generally performed in obtaining the frequency characteristics of a given EM structure, for example, the radiation characteristics or input impedance of an antenna structure, the RCS behavior of a chosen target, the transmission and/or reflection characteristics of a microstrip network, the propagation characteristics of a waveguide, the resonance frequencies of a closed enclosure, the shielding effectiveness of an aperture, etc. One therefore needs to start with the frequency requirements (the minimum/maximum frequency of interest, f min / f max , and the frequency resolution, ∆f ). The time-domain discrete simulation parameters ( ∆x , ∆y , ∆t , Tmax = n∆t , source bandwidth B, etc.) are then accordingly specified. Suppose the problem was to find the frequency characteristics of reflections from a free-space/dielectric interface, from dc to 1 GHz with 50 MHz frequency steps. Starting from the frequency-analysis requirements and sampling criteria, the parameter-optimization steps can be listed as follows: •

Choose the source waveform with a duration that contains the maximum frequency of interest.



According to the properties of the fast Fourier transform (FFT), the maximum frequency determines the minimum time step, i.e., ∆t FFT = 1 ( 2 f max ) . This is the hard limit for the frequency analysis. A 1 GHz maximum frequency corresponds to a 0.5 ns ∆t FFT .



There are two important points in choosing the maximum simulation (observation) time. First, the frequency sensitivity, ∆f , which determines the observation time should be ∆f = 1 Tmax . Second, the simulation should continue until all the transients are over. Therefore, Tmax is chosen to satisfy both requirements. Since ∆f was given as 10 MHz, Tmax was determined to be 100 ns. The number of time steps, n, will then be 200. If all transients decay after 200 time steps, then this will be enough for the simulation time. If the structure under investigation is some kind of resonant structure, which

At y = Ymax ( N = N y ) Ezn +1 ( i, N ) = − E zn −1 ( i, N − 1)  c∆t − ∆y   n +1 n −1 +   Ez ( i, N − 1) + Ez ( i, N )  c t y ∆ + ∆    2∆y   n Ez ( i, N − 1) + Ezn ( i, N )  +     c∆t + ∆y   ( c∆t )2 ∆y    E zn ( i + 1, N − 1) +  2∆x 2 ( c∆t + ∆y )     n n −2 Ez ( i, N − 1) + Ez ( i − 1, N − 1)    ( c∆t )2 ∆y    E zn ( i + 1, N ) − 2 E zn ( i, N ) + Ezn ( i − 1, N )  +   2∆x 2 ( c∆t + ∆y )     (16)

226

AP_Mag_Apr_2014_Final.indd 226

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:26 PM

corresponds to ringing effects in the time domain, then a much longer observation period will be required. •

Two important issues in the time-domain simulations are the Courant stability criteria and numerical dispersion.



The spatial mesh sizes, ∆x and ∆y , are chosen according to numerical dispersion requirements. This is nothing but satisfying the Nyquist sampling criteria in the spatial domain. The minimum wavelength, λmin , must be sampled with at least two samples, i.e., max {∆x, ∆y} ≤ λmin 2 . In practice, at least λmin 10 is required for acceptable results. Depending on the problem at hand, as much as λmin 100 to λmin 120 may be required in order to get rid of numerical-dispersion effects. Since λmin was 30 cm, ∆x =∆y =1 cm may be chosen if λmin 30 is good enough for eliminating numericaldispersion effects.



The time step, ∆t FDTD , may be directly chosen from the Courant stability criteria. Since ∆x =∆y and this is equal to 1 cm, ∆t may be chosen to be ∆x 2c , where c is the speed of light. This gives

( )

∆t ≈ 24 ps. In general, ∆t FDTD is much less than ∆t FFT , and therefore ∆t FDTD is taken into account. With this time step, the simulation time was n = 5000 .

3. Tests and Comparisons Simple MATLAB codes were developed for the first-order coupled FDTD (FOC-FDTD) and the second-order decoupled FDTD (SOD-FDTD) models, for both the TE and TM problems. Table 3 lists these codes and their explanations (visit http://leventsevgi.net for these codes). Tests with first-order coupled FDTD and second-order decoupled FDTD were done in terms of memory requirements and computational times. Table 4 shows some numerical results for these comparisons. As observed, the computational times were of the same order, but the second-order decoupled FDTD was slightly faster. Note that the classical loop philosophy used in MATLAB coding drastically slowed down the computation. This means that the use of “For/End” loops had a significant impact on the computation time (two loops almost doubled the computation time of one loop). The first-order coupled FDTD had three loops, one inside the other, whereas one loop was used for the second-order decoupled FDTD. The first-order coupled FDTD lasted roughly three times longer than the second-order decoupled FDTD with the classical coding approach. Their computational times were almost the same when the “For/ End” loops were removed. (For example, observe in the table that simulations in a 400 × 400 FDTD area lasted 8.85 s and 8.56 s with the first-order coupled FDTD and second-order decoupled FDTD models, respectively. On the other hand, these values were 523 s and 202 s, respectively, if the classical “For/End” loops were used in the MATLAB codes). However, the memory allocation of the second-order decoupled FDTD was considerably higher than for the first-order coupled FDTD, because of the requirements of the two past time values of the fields at every cell.

Table 3. The first-order coupled FDTD and SOD_FDTD MATLAB codes. FrstOrder_TM_FDTD_MUR.m

2D-FDTD MATLAB codes for TM problem under MUR terminations ( H x , H y , Ez )

FrstOrder_TM_FDTD_MUR_INH.m

2D-FDTD MATLAB codes for TM problem under MUR terminations ( H x , H y , Ez ) having a rectangular lossy layer

FrstOrder_TM_FDTD_MUR_MTM.m

2D-FDTD MATLAB codes for TM problem under MUR terminations ( H x , H y , Ez ) having a rectangular MTM layer

FrstOrder_TE_FDTD_PEC.m FrstOrder_TE_FDTD_MUR_MTM.m ScndOrder_TM_FDTD_MUR.m ScndOrder_TM_FDTD_MUR_INH.m ScndOrder_TE_FDTD_MUR.m

2D-FDTD MATLAB codes for TE problem under PEC terminations ( Ex , E y , H z ) 2D-FDTD MATLAB codes for TE problem under MUR terminations ( Ex , E y , H z ) having a rectangular MTM layer 2D Second order FDTD MATLAB codes for TM problem under MUR terminations ( Ez ) 2D Second order FDTD MATLAB codes for TM problem under MUR terminations   ( Ez  ) having a rectangular lossy layer 2D Second order FDTD MATLAB codes for TE problem under MUR terminations ( Hz )

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 227

227

5/31/2014 3:51:26 PM

Table 4. The Time and memory requirements for the firstorder coupled FDTD and second-order decoupled FDTD

3.2 Voltage Computations

models ( n = 500 , FOC: H x , H y , Ez ; SOD: Ez ).

Potential differences cause electric fields. This means that the voltage induced by EM fields between any terminals may also be computed during the FDTD simulations. Faraday’s Law may be used for this purpose. The necessary equation for the voltage computations in the scenario shown in Figure 6 is

Time (s)

Memory (MB)

Simulation Area

FOC

SOD

FOC

SOD

300×300

7.19

5.27

2.11

345

400×400

8.85

8.56

3.71

920

600×600

17.3

13.4

8.3

1384

1000×1000

47.48

37.48

22.9

3845

y2

V= − ∫ Edl = − ∑ E z ( xa , j ) dy .

(18)

j = y1

3.1 Current Computations Alternating currents produce surrounding magnetic fields and can be calculated using Ampere’s Law. This means currents can be extracted from known magnetic fields. Assume an infinite thin wire is located in the simulation area (see Figure 3). The current passing through this wire can be calculated using Ampere’s Law: = I =

 

 

Hdl ∑ Hdl ∫= x2



H x ( i, y1 ) dx +

y2

∑ H y ( x2 , j ) dx

=i x1=j y1 x2

− ∑ H x ( i, y2 ) dx −

y2

∑ H y ( x1 , j ) dx

=i x1=j y1

(17)

Figure 3. An application of Ampere’s Law.

Short scripts were added to the first-order coupled and second-order decoupled FDTD codes for the computation of a current flowing on a thin wire. The sample scenario prepared for this purpose is pictured in Figure 4. At 300 MHz, a 25 m × 25 m simulation area was assumed. A PEC rectangular object (5 m × 2.5 m) was placed at Node (200,225). A hard pulse line source was injected from Node (350,200). An infinitely long, thin wire was located in the simulation area. The number of time steps was 500. Figure 5 shows a current as a function of time comparison of the first-order coupled FDTD and second-order decoupled FDTD models. The computational times are also given on the graph. The wire was enclosed by a rectangle sized four cells along the x direction and five cells along the y direction. The magnetic fields were calculated along this arbitrary loop. The H y components were considered for the right and left edges of the rectangle, whereas the H x components were used for the top and bottom edges. The sum of the magnetic fields was multiplied by the cell size. Finally, the flowing current was obtained.

228

AP_Mag_Apr_2014_Final.indd 228

Figure 4. A sample scenario for current simulations.

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:27 PM

along the y direction were added, and the sum was multiplied by the cell size. A comparison of the voltage as a function of time is given in Figure 8. Note that the codes listed in the Appendix were used for the scenario given in Figure 7, and produced the results in Figure 8. The codes in Appendices 6.1 and 6.2 generated the same Figure 8 using the first-order coupled FDTD and second-order decoupled FDTD models, respectively. The code in Appendix 6.3 could be used after the other two. It loaded the recorded FDTD data, applied the FFT, and compared the two models in both the time and frequency domains. (All these codes and the others may also be downloaded from leventsevgi.net.)

4. Metamaterial (MTM) Modeling

Figure 5. The current as a function of time obtained with both models.

The EM response of a material is determined to a large extent by its electrical properties. A material/medium with both permittivity and permeability greater than zero ( ε > 0 , µ > 0 ) is called double positive (DPS). A medium with permittivity less than zero and permeability greater than zero ( ε < 0 , µ > 0  ) is designated as ε -negative (ENG). Materials with permittivity and permeability both less than zero ( ε < 0 , µ < 0  ) are called double-negative (DNG) media. Recent research on FDTD modeling has covered a hot topic of artificial materials. Russian scientists [24] came up with the idea of negative-index materials in 1967 [25]. They put negative-index materials into Maxwell’s equations and   investigated them. The electric field ( E ), magnetic field ( H )  and the wave vector ( k ) originally obeyed the right-handed    rule ( E × H → k ). However, when metamaterials are considered, they realized that these materials satisfy the left-handed rule. The opposite directions of the wave vector and the pointing vector results in backwards wave propagation and also focusing. When both the real parts of the permittivity and the permeability are negative, the material is then called a double-negative (DNG) media [11].

Figure 6. An application of Faraday’s Law.

Here, two parallel PEC plates were inserted horizontally, and the voltage between them was simulated (see the scenario in Figure 7a). Two thin parallel plates, of a size of 1 × 100 segments, were inserted into the simulation area. They were separated from each other by 50 cells. At a selected node (the 150th cell), the voltage value was computed. A hard pulse source was then applied at node (250,250). Figure 7b shows an instant (a screen capture) during the FDTD simulations. The wave components marked 1, 2, 3, and 4 corresponded to the cylindrical incident field, reflections from the top plate, the topedge diffracted fields, and the bottom-edge diffracted fields, respectively. All the E fields from the 150th to the 200th cells IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 229

One of the many applications of metamaterials is in medical/optical imaging with high focusing capabilities. Another application is antenna design. Antenna sizes may be reduced, and higher-directivity gains can be achieved by using metamaterials [11, 25]. Metamaterials can be characterized in terms of their dispersive properties [11, 15]. The virtual tools listed in Table 1 and presented in [15] use the auxiliary differential-equation (ADE) based FDTD approach [26]. In this approach, two of Maxwell’s equations for the dispersive materials in the frequency domain are given as D = E (ω ) ε 0 ε ∞ + χ e (ω )  E (ω ) , (19a) (ω ) ε (ω ) = = B (ω ) µ (ω )= H (ω ) µ0  µ∞ + χ m (ω )  H (ω ) , (19b) 229

5/31/2014 3:51:27 PM

The combination of Equations (16a) and (17a) yields       εk D = E (ω ) , (ω ) ε 0 ε ∞ + ∑ 2 ω  ω   k  α k + i 2δ k   −      ωk   ωk    (21) which may also be written as = D (ω ) ε ∞ E (ω ) + ∑ S k (ω ) ,

(22)

k

where Sk (ω ) = Figure 7a. A voltage simulation scenario.

εk ω α k + i 2δ k   ωk

 ω  −    ωk 

2

E (ω ) ,

(23)

or −ω 2 Sk (ω ) + iω 2δ k ωk Sk (ω ) + ωk 2α k Sk (ω ) = ε k ωk 2 E ( ω ) . (24) The inverse Fourier transform of Equation (21) is ∂ 2 Sk ( t ) ∂t

2

+ 2ωk δ k

∂Sk ( t ) ∂t

+ ωk 2α k Sk ( t ) = ε k ωk 2 E ( t ) ,

(25)

which is suitable for the FDTD discretization:

Figure 7b. A screen capture during the FDTD simulations.

where χ e (ω ) , χ m (ω ) are the electric and magnetic susceptibilities, and ε ∞ , µ∞ are the complex relative permittivities. According to the Lorentz model, these susceptibility are given as

χ e (ω ) = ∑ k

εk ω α k + i 2δ k   ωk

χ m (ω ) = ∑ k

230

AP_Mag_Apr_2014_Final.indd 230

 ω  −    ωk 

2

µk ω α k + i 2δ k   ωk

 ω  −    ωk 

2

,

(20a)

.

(20b)

Figure 8. The voltage as a function of time between the PEC plates. IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:27 PM

Skn +1 =

( 2 − ωk 2α k ∆t 2 ) S n (1 + ωk δ k ∆t )

k

( −1 + ωk δ k ∆t ) n−1 (ε k ωk ∆t ) n + S + E , (1 + ωk δ k ∆t ) k (1 + ωk δ k ∆t ) k 2

= Exn, y

2

1  n n  Dx, y − ∑ Sk  , ε ∞   k

(26)

(27)

Dxn +1 ( i, j ) = Dxn ( i, j ) +

∆t  n H z ( i, j ) − H zn ( i, j − 1)  ,  ∆y 

(28a)

D yn +1 ( i, j ) = D yn ( i, j ) −

∆t  n H z ( i, j ) − H zn ( i − 1, j )  .  ∆x 

(28b)

Similarly; starting with Equations (16b) and (17b), one ends up with the other set of equations: Skn +1

2 − ωk 2α k ∆t 2 ) ( = Sn

(1 + ωk δ k ∆t )

Figure 9. The classical FDTD time loop.

k

( −1 + ωk δ k ∆t ) n−1 ( µk ωk ∆t ) n + S + H , (29) (1 + ωk δ k ∆t ) k (1 + ωk δ k ∆t ) k 2

= H zn

1  n n  Bz − ∑ Sk  , µ∞  k 

2

(30)

Bzn +1 ( i, j ) = Bzn ( i, j ) ∆t  n Ex ( i, j + 1) − Exn ( i, j )   ∆y  ∆t  n E y ( i + 1, j ) − E yn ( i, j )  . −  ∆x  (31) +

The classical FDTD procedure is based on three-step iterations: update E fields, update source and boundary conditions, update H fields. Figure 9 pictures the classical time loop of the FDTD procedure. Here, the source was injected to the magnetic-field component, but any other field component may also be used, depending on the type of the source (such as a line source, a horizontal dipole, a vertical dipole, an array, etc.). The Lorentzian metamaterial-FDTD time loop, which is a little bit complicated, is pictured in Figure 10 and can be described step by step as follows: •

Use Equation (26) and update Skx and Sky using the Ex and E y components, respectively, inside the metamaterial region. Remember, the two past time

Figure 10. The Lorentzian metamaterial (MTM) FDTD time loop.

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

231

AP_Mag_Apr_2014_Final.indd 231

5/31/2014 3:51:28 PM

values and current Ex ( E y ) value are necessary. The Ex and E y fields are then updated everywhere as in the classical FDTD procedure. •

Derive the electric flux densities, Dx and D y , inside the metamaterial region using Equations (28a) and (28b).



Use Equation (27) and update the Ex and E y components inside the metamaterial region.



Repeat the same procedure for the magnetic-field and flux components using Equations (29) to (31).



Inject the source to the related field component. The source may be a pulsed line source, a short dipole, an array, or a beam.



A directive beam was simulated here. A narrowband (sinusoidal) beam was generated as explained in Figure 11. First, determine the number of nodes that produce line sources individually (it is better if this is an odd number). The distance, ∆ , between these nodes is stated. The selected cells are then excited by the sinusoidal source sin ( 2π f 0t ) . The amplitudes are changed using a suitable weighting

(

)

function exp − x 2 nT 2 , where nT controls the beamwidth of the source. The beam angle is also controlled by shifting the nodes along the x and y directions. The selected seven red nodes are shown in Figure 11a, whereas the blue nodes show the shifted beam. To achieve this, the x component (y component) was multiplied with cos 2 a ( sin a cos a  ) (see Figure 11b). •

Finally, satisfy the MUR absorbing boundary conditions for the H z component.

The two MATLAB codes (FrstOrder_TM_MUR_MTM.m and FrstOrder_TE_MUR_MTM.m), available at http:// leventsevgi.net, were prepared for the investigation of wave propagation inside a metamaterial layer. The example given in Figure 12 was for the TE z problem. The metamaterial values were taken from [15], and are given in Table 5. Here, a Gaussian beam-type sinusoidal source was used. The angle of incidence was 60°. Figure 9a visualizes a sinusoidal array source propagation in free space. A dielectric object was placed in Figure 12b. A wave was propagated conforming to Snell’s law of refraction. Figures 12c and 12d belonged to metamaterials the refractive indices of which were negative. Backward wave propagation and wave focusing were observed. The next example given in Figure 13 belonged to wave propagation through a metamaterial layer with n = −2 for the TE z problem. Here, a Gaussian-beam-type sinusoidal source was used. The angle of incidence was 90°. Note that the beams 232

AP_Mag_Apr_2014_Final.indd 232

Figure 11. Beamforming using multiple line sources: (a) the source nodes and beam directions; (b) beam angle control with shifts along the x and y components.

in Figures 12 and 13 were formed with 25 line sources with inter-element distances of 5∆ . The last example belonged to wave propagation through a metamaterial layer with n = −2 for the TM z problem (see Figure 14). A single-node line source was used as an incident field. The E fields at the selected three nodes were recorded during the FDTD simulations. Point 1 at node (200,150) and Point 3 at node (200,350) were in the free-space regions before and after the metamaterial layer, respectively. Point 2 at node (200,250) was inside the metamaterial region. Figure 15 shows the E field as a function of time at these three nodes. As observed, the once-differentiated Gaussian pulse reached Point 1 first, and then reflections from the free-space/ metamaterial interface were observed. After these two, there appeared a strong sinusoidal ringing. On the other hand, sinemodulated signals were recorded at Points 2 and 3. Frequency spectra of the recorded signals at these three points are plotted in Figure 16. The frequency spectra of the source is also given in this figure. Note that the FDTD parameters of the examples presented here are listed in Table 6.

5. Conclusions Two-dimensional FDTD modeling and simulation was reviewed. MATLAB codes for the first-order coupled and second-order decoupled EM equations for both TM- and TE-type problems were prepared. The current flowing on a thin wire and the voltage between parallel plates were also calculated during FDTD simulations. MATLAB codes for Lorentz-type metamaterial models were developed. Lecturers who teach courses such as “Computational Electromagnetics,” “FiniteIEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:28 PM

Figure 12a. Wave propagation in free space ( TE z problem, material parameters are given in Table 5).

Figure 12b. Wave propagation in a dielectric ( TE z problem, material parameters are given in Table 5).

Figure 12c Wave propagation in a metamaterial ( TE z problem, material parameters are given in Table 5).

Figure 12d Wave propagation in a metamaterial ( TE z problem, material parameters are given in Table 5).

Table 5. The metamaterial Lorentz parameters used in Figure 12. Figure

αk

δk

ωk

ε ∞ ( µ∞ )

ε k ( µk )

12a ( n = 1 )

1

0

0

1

0

12b ( n = 2 )

1

0

0

4

0

12c ( n = −1 )

1

0

7.535 MHz

1

48

12d ( n = −2 )

1

0

9.418 MHz

1

45

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 233

233

5/31/2014 3:51:28 PM

Figure 13. Wave propagation through a metamaterial layer ( TE z problem, metamaterial parameters were α k = 1 , δ k = 0 , ωk = 9.42 MHz, ε ∞ = 1 , ε k = 45 ).

Figure 15. The E field as a function of time in three regions.

Figure 14. Wave propagation through a metamaterial layer ( TM z problem, metamaterial parameters were α k = 1 , δ k = 0 , ωk = 9.42 MHz, ε ∞ = 1 , ε k = 45 ).

Figure 16. The frequency spectra of the E-field data that are highlighted in Figure 14.

234

AP_Mag_Apr_2014_Final.indd 234

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:29 PM

Table 6. The FDTD discretization parameters used in the examples. Figure 4 Current Comparison

Figure 7 Voltage Comparison

Figures 12 and 13 MTM-TE

Figure 14 MTM-TM

dx

0.049 m

0.049 m

2.49 m

2.49 m

dy

0.049 m

0.049 m

2.49m

2.49 m

dt

11.2 ns

11.2 ns

5.6 ns

5.6 ns

Nx

500

500

400

400

Ny

500

500

400

400

n

700

1000

1000

1000

FDTD Parameters

Cell Size Time step # of cells # of time steps

Difference Time-Domain Method,” “Numerical Modeling and Simulation,” etc., may download and use all the MATLAB codes listed at http://leventsevgi.net. Those of you who use the FDTD method in your research are strongly advised to develop your own codes. This is certainly required at some stage of graduate-level numerical modeling and simulation studies. Commercial packages are wonderful; use them as much as possible, but preferably for validation. You can start with the simple codes discussed in this tutorial and extend them into three dimensions. You may also need to add important modules such as a perfectly matched layer (PML) [21] and/or near-to-far-field (NTFF) transformation [4], etc., in order to deal with real-life, complex engineering problems.

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 235

6. Appendix 6.1 Code for Figures 7 and 8 Using First-Order Coupled FDTD The MATLAB code for Figures 7 and 8 using first-order coupled FDTD is given in Figure 17.

235

5/31/2014 3:51:29 PM

236

AP_Mag_Apr_2014_Final.indd 236

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:31 PM

6.2 Code for Figures 7 and 8 Using Second-Order Decoupled FDTD The MATLAB code for Figures 7 and 8 using second-order decoupled FDTD is given in Figure 18.

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 237

237

5/31/2014 3:51:32 PM

6.3 Code for Voltage as a Function of Time and Frequency Calculations The MATLAB code for calculations of voltage as a function of time and frequency is given in Figure 19.

7. References 1. K. S. Yee, “Numerical Solution of Initial Boundary Value Problems Involving Maxwell’s Equations in Isotropic Media,” IEEE Transactions on Antennas and Propagation, AP-14, 3, 1966, pp. 302-307. 2. K. A. Kunz and Raymond J. Luebbers, The Finite Difference Time Domain Method for Electromagnetics, Boca Raton, FL, CRC Press, 1993. 3. A. Taflove, Computational Electrodynamics: The finiteDifference Time-Domain Method, Norwood, MA, Artech House, 1995. 4. L. Sevgi, Complex Electromagnetic Problems and Numerical Simulation Approaches, New York, IEEE Press/John Wiley, 2003. 5. A. Taflove and S. C. Hagness, Computational Electrodynamics: The Finite-Difference Time-Domain Method, Norwood, MA, Artech House, 2005. 6. D. Sullivan, Electromagnetic Simulation Using the FDTD Method, Second Edition, New York, IEEE Press/John Wiley, 2013. 7. J. B. Schneider, Understanding the FDTD Method, 2010, (http://www.eecs.wsu.edu/~schneidj/ufdtd/). 8. A. Z. Elsherbeni and V. Demir, The Finite Difference Time Domain Method for Electromagnetics: With MATLAB Simulations, Rayleigh, NC, SciTech, 2009. 9. “Finite-Difference Time-Domain Method,” http:// en.wikipedia.org/wiki/Finite-difference_time-domain_method. 10. W. Yu, R. Mittra, T. Su, Y. Liu, and X. Yang, Parallel FiniteDifference Time-Domain Method, Norwood, MA, Artech House, 2006. 11. Y. Hao and R. Mittra, FDTD Modeling of Metamaterials: Theory and Applications, Norwood, MA, Artech House, 2008. 12. L. Sevgi, “Review of Discrete Solutions of Poisson, Laplace, and Wave Equations,” IEEE Antennas and Propagation Magazine, 50, 1, February 2008, pp. 246-254. 13. L. Sevgi and Ç. Uluışık, “A MATLAB-Based Transmission-Line Virtual Tool: Finite-Difference Time-Domain Reflectometer,” IEEE Antennas and Propagation Magazine, 48, 1, February 2006, pp. 141-145. 14. G. Çakır, M. Çakır, and L. Sevgi, “A Multipurpose FDTDBased Two-Dimensional Electromagnetic Virtual Tool,” IEEE Antennas and Propagation Magazine, 48, 4, August 2006, pp. 142-151.

238

AP_Mag_Apr_2014_Final.indd 238

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

5/31/2014 3:51:33 PM

15. M. Çakır, G. Çakır, and L. Sevgi, “A Two-dimensional FDTD-Based Virtual Metamaterial – Wave Interaction Visualization Tool,” IEEE Antennas and Propagation Magazine, 50, 3, June 2008, pp. 166-175. 16. M. A. Uslu and L. Sevgi, “MATLAB-Based Virtual Wedge Scattering Tool for the Comparison of High Frequency Asymptotics and FDTD Method,” ACES Journal on Applied Computational Electromagnetics, 27, 9, September 2012, pp. 697-705. 17. M. Çakır and L. Sevgi, “Path Planning and Image Segmentation Using the FDTD Method,” IEEE Antennas and Propagation Magazine, 53, 2, April 2011, pp. 230-245. 18. G. Çakır, M. Çakır, and L. Sevgi, “A Novel Virtual FDTDBased Microstrip Circuit Design and Analysis Tool,” IEEE Antennas and Propagation Magazine, 48, 6, December 2006, pp. 161-173. 19. G. Çakır, M. Çakır, and L. Sevgi, “Radar Cross Section (RCS) Modeling and Simulation: Part II – A Novel FDTDBased RCS Prediction Virtual Tool,” IEEE Antennas and Propagation Magazine, 50, 2, April 2008, pp. 81-94. 20. L. Sevgi, Electromagnetic Modeling and Simulation, New York, IEEE Press/John Wiley, 2014. 21. J. P. Berenger, “A Perfectly Matched Layer for the Absorption of Electromagnetic Waves,” J. Comput. Phys., 114, 1994, pp. 185-200. 22. G. Mur, “Absorbing Boundary Conditions for the Finite Difference Approximation of the Time-Domain Electromagnetic-Field Equations,” IEEE Transactions on Electromagnetic Compatibility, EMC-23, 4, 1981, pp. 377-382. 23. L. Sevgi, “Guided Waves and Transverse Fields: Transverse to What?” IEEE Antennas and Propagation Magazine, 50, 6, December 2008, pp. 221-225. 24. V. G. Veselago and P. N. Lebedev “The Electrodynamics of Substances with Simultaneously Negative Values of Permittivity and Permeability,” Soviet Physics, 10, 4, January 1968, pp. 509-514. 25. T. J. Cui, D. R. Smith, and R. Liu (eds.), Metarmaterials: Theory, Design and Applications, New York, Springer, USA, 2009. 26. T. Kashiwa and I. Fukai, “A Treatment by FDTD Method of Dispersive Characteristics Associated with Electronic Polarization,” Microwave and Optical Technology Letters, 3, 1990, pp. 203-205.

IEEE Antennas and Propagation Magazine, Vol. 56, No. 2, April 2014

AP_Mag_Apr_2014_Final.indd 239

239

5/31/2014 3:51:33 PM