Вы находитесь на странице: 1из 20

Testing Ourselves

Testing Ourselves Levent Sevgi Doğuş University Electronics and Communications Eng. Dept. Zeamet Sokak, No 21,

Levent Sevgi Doğuş University Electronics and Communications Eng. Dept. Zeamet Sokak, No 21, Acibadem — Kadiköy Istanbul - Turkey E-mail: lsevgi@dogus.edu.tr, levent.sevgi@ieee.org

http://www3.dogus.edu.tr/lsevgi

W e have introduced many computer codes and virtual tools for electromagnetic modeling and simulation in

the Magazine for nearly a decade. I’m very glad to see that those tools are used in several universities and institutions, even in national research centers, from USA to Japan, Europe to Australia and Africa. Most of those tools can be downloaded from http://modsim.dogus.edu.tr (and may also be requested from the authors), and be used in teaching/training in virtual undergraduate labs as well in graduate-level research. Now, we’re happy to announce they can also be downloaded from my new Web site (http://leventsevgi.net). The list of the tutorials we have introduced since February 2007 may also be found there.

We have received several requests and questions on some of our Finite-Difference Time-Domain (FDTD)-based virtual tools from our readers, who have experienced MATLAB-based coding/compiling/version problems. I have assigned Miss Gizem Toroglu, the youngest research and teaching assistant in our department at Doğuş University, to re-shape (as well as redevelop) a collection of MATLAB-based core FDTD codes in two dimensions (2D), without the need for any toolbox and/or special command/macro, and to present them in her interdepartmental seminar this semester. I liked the way she tailored and presented these codes. Although there were a number of FDTD codes and packages, I therefore decided to share them with our readers, through the tutorial we prepared for this purpose in this issue (by the way, the tutorial on novel RCS measurement approaches by B. Fisher is on the way). Those codes mentioned in this issue’s tutorial are already there, under EM Virtual Tools, at leventsevgi.net. I hope the readers

will enjoy having them and find them useful.

We have already discussed “Statistical Decision Making” [1] and “Biostatistics” with hypothetical tests on cell-phone users using statistical decision making [2]. What about “Strategic Decision Making?” The study of strategic decision making is called “Game Theory.” We, engineers, have mostly been familiar with game theory after a wonderful movie, A Beautiful Mind, a 2001 American biographical drama film based on the life of John Nash, a Nobel Laureate in Econom- ics. John Nash, who introduced the Nash equilibrium concept, was played by Russell Crowe. I’m glad to announce that I have finally convinced Prof. Benan Zeki Orbay, former Dean of the Faculty of Economics and Administrative Sciences, and current Chair of the Department of Economics and Finance at Doğuş University, to prepare a tutorial on game theory. She is going to give a presentation entitled “Game Theory and Engineering Applications” in one of our inter-departmental seminars in April 2014. Hopefully, we’ll extend it to an interesting tutorial.

References

1. L. Sevgi, “Hypothesis Testing and Decision Making: Con-

stant-False-Alarm Rate,” IEEE Antennas and Propagation Magazine, 51, 3, June 2009, pp. 218-224.

2. L. Sevgi, “Biostatistics and Epidemiology: Hypothetical

Tests on Cell Phone Users,” IEEE Antennas and Propagation Magazine, 52, 1, February 2010, pp. 267-273.

220

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

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: lsevgi@dogus.edu.tr

34722 Istanbul – Turkey E-mail: lsevgi@dogus.edu.tr Abstract A set of two-dimensional (2D) electromagnetic (EM)

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

1. Introduction

T 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

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 electro- magnetic 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 visualiza- tion 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 inter- actions may easily be recorded.

The MATLAB-based virtual tool WedgeFDTD was devel- oped to investigate EM scattering on the canonical non-pene-

221

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).

 

A

3D FDTD-based EM simulator for the broadband investigation of microstrip circuits. The user only needs

MSTRIP

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 cir- cuits. MSTRIP is a 3D-FDTD EM simulator that uses the pow- erful 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 double- layer microstrip structures. Time-domain visualization is pos- sible 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

2. The Two-Dimensional FDTD Models

The FDTD method [1] discretizes Maxwell equations by replacing derivatives with their finite-difference approxima- tions, directly in the time domain. It is simple, easy to code, but has the open-form (iterative) solution. It is therefore con- ditionally 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 devel- oped for the last two decades (see [22] for the second-order MUR-type terminations used here). Broadband (pulse) excita- tion is possible in the FDTD, but inherits the numerical-disper- sion 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 equa- tions) [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 per- mittivity, ε , permeability, µ , and conductivity, σ ):

∇×

∇×

E

H

= −

H

µ

t

=

ε

E

t

+

,

σ

E .

(1)

(2)

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

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]

the assumption ∂∂ z ≡ 0 , and can be given as [23] SET #1: TM

SET #1: TM z (

H

z

0

)

µ

H

x

t

=

E

z

y

,

(3a)

µ

H

y

t

=

E

z

x

,

(3b)

ε

E

z

H

y

H

x

=−−

∂∂∂ t xy

σ

E

z

,

(3c)

SET #2: TE z (

E

z

ε

E

x

t

=

H

z

y

0

)

σ

E

x

,

ε

E

y

t

=−

H

z

x

σ

E

y

,

H

z

E

y

E

x

µ .

t

=−

∂∂ xy

(4a)

(4b)

(4c)

As observed, knowing the

derive all the other field components for the TM z ( TE z ) prob- lem. The discretized FDTD iteration equations then reduce to

( H ) component is enough to

E

z

z

SET #1: TM z (

H

z

0

)

H

n n

x

x

(

ij

H

, ,

)

1

(

= −

ij

)

t

µ

y

E

nn

ij ,

E

(

)

(

−−

ij ,1

zz

(5a)

H

n n

y

y

(

ij

H

, ,

)

= +

1

(

ij

)

t

µ

x

E

nn

ij ,

−−

E

i

(

)

(

zz

(5b)

n

z

E

+ 1

(

ij ,

)

2 =  

2

ε

σ

t  

t

ε

+

σ

2

t

+

2

ε

+∆

σ

t

2 t

2

ε

+∆

σ

t

n

z

E

n

y

H

(

ij ,

)

(

ij

,

)

n

y

H

(

i

1,

j

)

n

x

H

(

ij

,

)

x

n

x

H

(

ij

,1)

y

(5c)

SET #2: TE z (

E

z

0

)

1,

 

j

,

)

)

,

,

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

n

x

E

( ij ,

)

E ij

z

,

n

(

)

n

z

H

(

ij

,

)

=

2

ε

t

σ

2

ε

+

t

σ

E

n 1

x

2 t

(

2

ε

+∆

σ

t )

y

(

ij ,

)

  )

n

H

z

(

ij

,

n

z

H

(

,1

ij

(6a)

=

2

ε

t

σ

2

ε

+

t

σ

E

n 1

z

(

+

2

t

(

2

ε

+∆

σ

t

)

x

ij ,

)

n

z

H

(

ij

,

(6b)

)

n

z

H

(

i

=

n 1 z

H

+

t

µ

0

(

ij

,

n

y

E

)

(

ij

,

)

n

y

E

(

i

1,

j

)

x

t

µ

0

n

x

E

(

ij

,

)

n

x

E

(

,1

ij

)

y

 

.

(6c)

1,

j

)

)

,

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 Equa- tions (3a) and (3b):

∂∂  xy

∂∂ +−

22

22

1

εµ

2

t

2

µσ

t

E

z

= 0 .

This equation, defined for

t

0;

0

≤≤x

X

max

, 0

≤≤yY

max

,

(7)

(8)

together with the boundary conditions

E

z

E

z

E

z

E

z

(

(

(

(

0,

yt

,

x

,0,

t

X

max

)

= g

1

)

= g

2

yt

,,

)

(

(

yt

,

xt

,

= g

3

)

)

(

for

for

yt

,

)

xY

,,

max

t

)

= g

4

(

xt

,

)

and, the initial conditions

x =

y =

0, 0

0, 0

≤≤yY

max

≤≤xX

max

,

,

(9a)

(9c)

for

x = X

max

, 0

≤≤yY

max

(9b)

for

yY=

max

, 0

≤≤xX

max

(9d)

,

223

E

z

(

xy

,

,0

)

= f

1

(

xy

,

)

,

E

z

(

xy

,

,0

)

t

= f

2

(

xy

,

)

,

(10a)

(10b)

are enough to solve for

Equation (7) can therefore also be used in the FDTD modeling and simulations. The FDTD discretized form of Equation (7) is

and the other field components.

E

z

n +

z

E

1

(

ij

,

)

=

+

+

4

(

1

p

q

)

g

n

z

E

(

ij

,

)

t

g

n

z

E

1

2 p

g

2 q

g


(

n

Ei

z

−+

1,

j

)


n (

E

z

,1

ij

−+

)

(

n

Ei

z

+

1,

j

)

n

z

E

(

,1

ij

+

)

(11)

(

ij

,

)

where

p

q

v

 

t

 

x

2

v

t

y

2

,

(12a)

g

2

2 + µσ vt,

t

−+2

2

µσ vt

(12b)

v =

1

. εµ
.
εµ

(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

) must

be supplied for the spatial source injection.

first two time instants of E (i.e.,

z

0

E

z

(

ij

,

)

1

and E

z

(

ij

,

)

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

TM z and

E

x

,

E

y

, and

H

z

,

for

for TE z ) in each cell,

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

H

y ,

E

z

• The discretization steps are x, y , and t , and the

,

physical quantities are calculated from

x = ix

y = jy

, and t = nt

.

224

• Since the FDTD equations are iterative (i.e., open- form 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

n

H

z

(

ij

,

and

) , 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 ,

the

same

notations,

n

E

x

(

ij

,

)

steps t = ∆ t 2 , the same notations, n E x ( ij ,
3∆t 2 , 5∆t 2 ,
3∆t 2 , 5∆t 2 ,

, but the electric fields are calcu-

lated at time steps t =∆ttt, 2,3,

.

calcu- lated at time steps t =∆ ttt , 2 ∆ ,3 ∆ , . Figure
calcu- lated at time steps t =∆ ttt , 2 ∆ ,3 ∆ , . Figure

Figure 1. The Yee cells for the (a) TM z and (b) TE z prob- lems.

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

• Only

E

n 1

z

larly,

H

n 1

x

(

neighboring

magnetic-field

ij

,

)

are required to update

n

z

E

(

neighboring

electric-field

ij

,

)

are required to update

n

x

H

values

(

)

ij

values

.

,

(

ij

,

)

and

. Simi-

and

Both magnetic- and electric-field components in any cell may be moved to the origin by just cell averaging. This is accomplished via

for mag-

netic fields, but four electric-field components are required for this purpose:

H

x

(

ij

,

)

= 0.5 H

(

ij ++H

,

i

)

(

1,

j

)

xx

E

z

(

ij

,

)

= 0.25 E

(

ij ++E

,

i

)

(

zz

+E

z

(

1)

ij ++ E

,

z

(

i +

1,

1,

j +

)

j

1)   .

• Any object may be modeled by giving ε , µ , and σ . Two of these, ε and σ , appear in the electric- field 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. Simi- larly, 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

E

z

( TM z )

or

H

z

( TE z  ). One therefore needs to write down another discrete (Maxwell) equation for the other two com-

ponents, i.e.,

H

x

,

H

y

( TM z ) or

E

x

,

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

At

+ 

+

At

+

x = 0

( N = N

x

)

n

z

E

+

1

(

1,

jE

= −

)

n

z

1

(

2,

j

)

(

ct

)

2

x

+

+

2

y

(

2

(

∆ +∆

ct

x

ct

)

2

x

)

2

y

2

(

∆ +∆

ct

x

)

ct

 

ct

−∆ x  

 

+∆ x

ct

2

x

∆ +∆

x

n

z

E

n

z

E

+

1

(

(

2,

2,

+

jE

)

n

z

jE +

)

n

z

(

1,

1

(

1,

j

)

j

n

z

E

n

z

E

(

(

2,

1,

j

j

)

+− 1

)

+− 1

2

E

nn

2,

+

jE

(

)

zz

2

E

nn

1,

jE +

(

)

zz

(

(

2,

1,

j

)

j

1

(13)

x = X

max

( N = N

x

)

1

)

)

n

z

E

+

1

(

Nj

,

)

1

=−


+

+

+ 

ct

n

z

(

N

   

E

−∆ x

1,

j

n +

z

E

1

)

(

N

1,

j

)

ct

2

+∆ x

x

n

z

E

(

N

ct

(

∆ +∆

ct

x

)

2

x

2 y

2

(

∆ +∆

ct

x

)

1,

j

)

+

(

EN

z

n

+

n

z

E

1

(

Nj ,

n

z

E

(

Nj

,

)

1,

j

+

1

)

)

(

ct

)

2

x

2 y

2

(

∆ +∆

ct

x

)

2 EN

n

z

(

1,

n

z

E

(

Nj ,

j

)

+

(

EN

z

n

1,

j

−−

1)

)

+− 12

E

nn

Nj ,

+

E

(

)

zz

(

Nj ,

1

(14)

)

Table 2. Differential equations for the second-order MUR terminations.

 

x

= 0

0

y

Y

max

x

=

X

max

0

y

Y

max

 

y

= 0

0

x

X

max

y

=

Y

max

0

x

X

max

∂∂∂

1

c

2

22


=

0

 → 

 

222 ∂∂∂ −+ 1 c 2 2 ∂ xt ∂ c ∂ t 2 ∂
222
∂∂∂ −+
1
c
2
2
xt
c
t
2 ∂
y


 

E

z

(

0,

,

yt

)

=

0

→ 

xt

+−

c

t

2

→    ∂ ∂ xt +− ∂ c t 2 2 ∂ y 2
→    ∂ ∂ xt +− ∂ c t 2 2 ∂ y 2
→    ∂ ∂ xt +− ∂ c t 2 2 ∂ y 2
→    ∂ ∂ xt +− ∂ c t 2 2 ∂ y 2

2

y

2

 

E

z

(

X

max

,, yt

)

 → 

 

222 ∂∂∂ −+ 1 c 2 2 ∂ yt ∂ c ∂ t 2 ∂
222
∂∂∂ −+
1
c
2
2
yt
c
t
2 ∂
x

  

(

Ex

z

   222 ∂∂∂ −+ 1 c 2 2 ∂ yt ∂ c ∂ t

,0,

t

)

=

0


 

2 22 ∂∂∂ 1 c +− 2 2 ∂ yt ∂ c ∂ t 2
2
22
∂∂∂
1
c
+−
2
2
∂ yt ∂
c
t
2 ∂ x
2 22 ∂∂∂ 1 c +− 2 2 ∂ yt ∂ c ∂ t 2 ∂



E

z

(

xY ,

max

)

,0 t =

225

Figure 2. The boundary cells used in MUR terminations. At + +   

Figure 2. The boundary cells used in MUR terminations.

At

+

+

 

 

 

At

+ 

226

y = 0 ( N = N

y

)

1

+

Ei

z

n

(

,1

)

= −

1

Ei

z

n

(

,2

)

(

ct

)

2

y

+

+

2

x

(

2 (

∆ +∆

ct

y

ct

)

2

y

)

2

x

2 (

∆ +∆

ct

y

)


ct

ct

2

−∆ y

+∆ y

y

∆ +∆

ct

y

1

+

Ei

z

n

(

,2

)

(

n

Ei

z

,2

)

+

+

1

Ei

z

n

(

(

n

Ei

z

,1

)

,1

)



(

n

Ei

z

(

n

Ei

z

)

+− 1, 2

)

+− 1,1

2

nn

Ei

, 2

+

Ei

(

)

(

zz

1, 2

)

2

nn

Ei

,1

+

Ei

(

)

(

zz

1,1

)

(15)

y = Y

max

( N = N

y

)

n

z

E

+

1

(

iN

,

)

=−

n

z

E

1

(

,1

iN

)

+

+

ct

−∆ y



ct

+∆ y

2 y

ct

+∆ y

 

n +

z

E

1

(

iN ,1

)

n

z

E

(

,1

iN

)

+

+

n

z

E

1

(

n

z

E

(

iN

,

iN ,

)

+

(

ct

)

2

y

2 x

2

(

∆ +∆

ct

y

)

(

n

Ei

z

+

1,

N

1

)

)

(

ct

)

2

y

2 x

2

(

∆ +∆

ct

y

)

2 E

n

z

(

n

z

E