Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of...

38
Bachelor Thesis zur Erlangung des akademischen Grades eines Bachelor of Science der Studienrichtung Physik an der Karl-Franzens-Universit¨ at Graz und der Technischen Universit¨ at Graz ¨ uber das Thema Finite Difference Time Domain Simulation of Electromagnetic Fields eingereicht am Institut f ¨ ur Physik Begutachter: Ao.Univ.-Prof. Mag. Dr.rer.nat. Ulrich Hohenester von Lucijan Ilic Dreiersch ¨ utzengasse 39b 8020 Graz Graz, Juni 2018

Transcript of Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of...

Page 1: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

Bachelor Thesis

zur Erlangung des akademischen Grades eines

Bachelor of Science

der Studienrichtung Physikan der Karl-Franzens-Universitat Graz und der Technischen Universitat Graz

uber das Thema

Finite Difference Time Domain Simulation ofElectromagnetic Fields

eingereicht amInstitut fur Physik

Begutachter: Ao.Univ.-Prof. Mag. Dr.rer.nat. Ulrich Hohenestervon

Lucijan Ilic

Dreierschutzengasse 39b8020 Graz

Graz, Juni 2018

Page 2: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

A�davit

I declare that I have authored this thesis independently, that I have not used other thanthe declared sources/resources, and that I have explicitly indicated all material which hasbeen quoted either literally or by content from the sources used.

Date Signature

ii

Lucijan Ilic
20.06.2018
Page 3: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

Abstract

This thesis gives a brief introduction to the broad topic of ”finite difference time domain”

simulations of electromagnetic fields. Before we start with the algorithm itself we’ll reviewthe basic principles of classical electrodynamics and consider some finite difference approx-imations, and depending on their stability choose the one which suits our problems best.We will continue with presenting the Yee-grid which will lead us to the awaited updateequations. Additionally we’ll discuss stability of the algorithm and the possible numericaldispersion caused by it. We’ll end the discussion about the ”finite difference time domain”

method with a few selected one and two dimensional simulations for different boundaryconditions and sources.

iii

Page 4: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

Contents

Abstract iii

1 Introduction 1

2 Finite di↵erence approximation and stability 3

2.1 Time and space derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2.1 Leapfrog method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Review of classical electrodynamics 6

3.1 Maxwell’s equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.2 Constitutive relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.3 Maxwell’s curl equations for isotropic materials . . . . . . . . . . . . . . . . 83.4 Time-harmonic Maxwell’s equations . . . . . . . . . . . . . . . . . . . . . . . 93.5 Approximating the time derivatives with finite differences . . . . . . . . . . 9

4 Yee grid and algorithm 11

4.1 1D FDTD algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.2 2D FDTD algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 Numerical stability and dispersion 17

5.1 Numerical stability of the FDTD algorithm . . . . . . . . . . . . . . . . . . . 175.2 Numerical disperison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

6 Sources 19

6.1 Hard source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206.2 Soft source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206.3 Total-field/scattered-field source . . . . . . . . . . . . . . . . . . . . . . . . . 21

7 Numerical boundary conditions 23

7.1 Dirichlet boundary condition . . . . . . . . . . . . . . . . . . . . . . . . . . . 237.2 Periodic boundary condition . . . . . . . . . . . . . . . . . . . . . . . . . . . 257.3 Perfectly absorbing boundary condition . . . . . . . . . . . . . . . . . . . . . 26

8 Uniaxial perfectly matched layer (UPML) 28

Bibliography 34

iv

Page 5: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

1 Introduction

What is the finite difference time domain method and what is it used for? Decades agoit was nearly impossible to simulate broadband electromagnetic wave interactions withmore than few hundreds field components. Integral solving techniques, Fourier-domainmethods and many other numerical solvers have been pushed to their limits [4]. Thanks tothe pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] andAllen Taflove[5] and the continued growth of computing power we have surpassed thoseproblems a long time ago. Beside the finite difference time domain method (FDTD) otheruseful numerical methods exit, but for a bunch of reasons FDTD became the most popularand for many applications also the best method. Later absorbing boundary conditions(ABCs: sec.7.3) and the perfectly matched layer (PML: cha.8) were introduced, and moreand more complex simulations have been developed since then.

The finite difference time domain scheme wasn’t always that popular as it is today. In the1970s the US Air Force Rome Air Development Center faced a problem with their air-to-airmissiles [4]. Radar beams caused them to go ”crazy”. They tried dozens of modellingtechniques, but every one of them failed. Only when Taflove tackled the problem with hisdeveloped FDTD algorithm they were successful. Even after this success, Taflove was stilllaughed at for his enthusiasm for the FDTD modelling scheme. Only a few decades later,the method was able to fully integrate into numerical electrodynamics. Meanwhile wecan simulate microwave radar technologies, investigate geophysical phenomena and alsoinvestigate problems in the field of nanoplasmonics or photonics [4], thanks to the FDTDmethod and its descendants. Possibilities for the future would be linking the method toquantum electrodynamics.

In this thesis we will focus on simulations with one and two spatial dimensions andfurthermore also implement different boundary conditions and a PML. Before we tackleFDTD algorithm, we will talk about the advantages of using FDTD [4][2].

+ Due to the nature of the algorithm it is pretty easy and straightforward to implementa working simulation in any desired programming language.

+ The method is easily understandable and follows from discretization of Maxwell’sequations.

+ No linear algebra or matrix inversions are necessary and hence the computation timereduces by quite a margin.

+ The fields are staggered in time and space and therefore fields at each point dependonly on the neighbouring field points.

1

Page 6: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

1 Introduction

However, no algorithm or method is perfect and consequently there are also disadvantages:

� As we will see in following chapters it is, due to the grid structure, complicated toimplement curved surfaces.

� To obtain stability pared with reasonable results, it is necessary that the time stepdoesn’t overpass a certain value. In cha.5 we will ”derive” a stability condition whichis limited by the spatial size.

� Numerical dispersion caused by the discretization process (cha.5).

2

Page 7: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

2 Finite di↵erence approximation and

stability

In order to obtain Maxwell’s equation in a discretized form, we must choose the rightfinite difference approximation. Right in this context means that the result is a stablealgorithm with rather good accuracy. The following approximations follow from certainTaylor expansions, but they won’t be derived in this thesis. Time derivatives and spacederivatives will be mentioned together in the coming discussion. For a briefer look intothis topic Inan’s book [2, cha.3] is recommended.

2.1 Time and space derivatives

The following approximation is widely used, but as we will see doesn’t suit our needs [2,sec.3.3].

∂ f∂t

����n

i⇡

f ni+1 � f n

iDt

∂ f∂x

����n

i⇡

f n+1i � f n

iDx

(2.1)

Approximation eq.2.1 is referred as a ”first-order forward difference” because the deriva-tive is approximated by using the value of the function f at time step i and i + 1 and dueto its first order accuracy.To obtain sufficient results a second-order approximation (at least for the time derivatives)is required. A well known second-order approximation is the ”second-order centered

difference approximation” shown in eq.2.2.

∂ f∂t

����n

i⇡

f ni+1 � f n

i�12Dt

∂ f∂x

����n

i⇡

f n+1i � f n�1

i2Dx

(2.2)

Due to the Yee-algorithm, which will be discussed in cha.4, the fields are staggered in aspecific way. As we will mention it useful to use an approximation which defines fieldvalues at intermediate steps instead of eq.2.2, where the approximation is centered in time.The ”second-order forward difference” approximation calculates the derivative for anintermediate step (eq.2.3).

∂ f∂t

����n

i+ 12

⇡f ni+1 � f n

iDt

∂ f∂x

����n+ 1

2

i⇡

f n+1i � f n

iDx

(2.3)

3

Page 8: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

2 Finite di↵erence approximation and stability

2.2 Stability

To check for stability we will inspect two different approximations for the convection equa-tion (eq.2.4)[see 2, p.53]. The structure of eq.2.4 doesn’t differ that much from Maxwell’scurl equations.

∂V∂t

+ c∂V∂x

= 0 (2.4)

Using eq.2.1 to approximate the time derivative and eq.2.2 for the space derivative weobtain the ”forward-time centered space” approximation (eq.) for the convection equation.

Vni+1 � Vn

iDt

+ cVn+1

i � Vn�1i

2Dx= 0 (2.5)

2.2.1 Leapfrog method

As shown in fig.2.1 the ”forward-time centered space” approximation results in an unsta-ble method, because the amplitude increase as time passes. Therefore we need anothermethod for approximating eq.2.4. The right column in fig.2.1 shows a stable method toapproximate the convection equation. This so called ”leapfrog” method uses eq.2.2 toapproximate the time and space derivative resulting in eq.2.6.

Vni+1 � Vn

i�12Dt

+ cVn+1

i � Vn�1i

2Dx= 0 (2.6)

In cha.4 we will talk more about the finite difference approximations, which fulfil ourneeds the best.

4

Page 9: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

2 Finite di↵erence approximation and stability

Figure 2.1: Convection equation solved at certain time steps for a forward-time centered space and a leapfrogscheme. Taken [from 2, p.56]

5

Page 10: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

3 Review of classical electrodynamics

With the goal to simulate electromagnetic fields, we first need to review some of the funda-mentals of the classical electromagnetic theory[1]. The complete classical electromagnetictheory is packed into a set of coupled partial differential equations known as Maxwell’sequations. Those equations are the basis for every electromagnetic phenomena.

3.1 Maxwell’s equations

Gauss’ law

Gauss’ law is a theoretical description for repulsion or attraction of electric charges. Wewill mostly consider a ”source free medium”(r f = 0 ! no free charges) and hence Gauss’law gets even simpler.

~r · ~D = r f ! r f = 0 ! ~r · ~D = 0 (3.1)

What does Gauss’ law for a ”source free” medium really tell us? If we have a lack of freecharge, the field lines can’t form straight lines from positive charges to negative charges,therefore they need to orient in a different manner. By rethinking the basic principals ofvector-analysis, one can easily show that ~r · ~D = 0 predicts a circulating electric field.

There are no magnetic sources

This equation doesn’t have a specific name, hence it is usually named after the mostimportant information one can gain from it.

~r · ~B = 0 (3.2)

Like for the ”source free” Gauss’ law the field lines have no sources or sinks.

Faraday’s law

~r⇥ ~E = �∂~B∂t

(3.3)

Before Faraday’s pioneering experiments this law was given by ~r⇥ ~E = 0. In his work heencountered that a time-changing magnetic flield induces a circulating electric field andalso the other way around.

6

Page 11: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

3 Review of classical electrodynamics

Ampere’s law with Maxwell’s correction

Maxwell added a correction term to Ampere’s law to satisfy the continuity equation~r · ~J f = � ∂r f

∂t . Since we will consider only ”source free” mediums, the ”free” electricalcurrent density can be neglected (~J f = 0).

~r⇥ ~H = ~J f +∂~D∂t

! ~J f = 0 ! ~r⇥ ~H =∂~D∂t

(3.4)

3.2 Constitutive relations

The relation between the electric field ~E and the electric flux density ~D or the magneticfield ~H and the magnetic flux density ~B is given by the two constitutive relations. In thediscussion above the Maxwell equations are defined without any hint of the mediuminvolved. This information is stored in the constitutive relations. Due to the fact thatmaterials can be very different in their behaviour, we will distinguish between isotropic,anisotropic and diagonal anisotropic materials.

Anisotropic

For anisotropic materials the relation between ~E and ~D is ”direction dependent” andtherefore the ~E field can show in a totally different direction than the ~D field.

~D(t) =

2

4exx exy exzeyx eyy eyzezx ezy ezz

3

5 ~E(t) (3.5)

~B(t) =

2

4µxx µxy µxzµyx µyy µyzµzx µzy µzz

3

5 ~H(t) (3.6)

Due to the three degrees of freedom of the given tensors above, it is possible to diagonalizethe tensors and hence receive tensors where the off diagonal terms are zero.

Diagonal anisotropic

For many materials the constitutive relations can be described by diagonal anisotropictensors even without a diagonalization process:

~D(t) =

2

4exx 0 00 eyy 00 0 ezz

3

5 ~E(t) (3.7)

~B(t) =

2

4µxx 0 00 µyy 00 0 µzz

3

5 ~H(t) (3.8)

7

Page 12: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

3 Review of classical electrodynamics

In the discussion of PML’s (cha.8) we will use a specific method to incorporate loss inthe boundary regions and thus avoid reflection at the boundaries. This method takesadvantage of diagonal anisotropic materials with diagonal tensors.

Isotropic

We can simplify the relations even more, by assuming that the orientation of the materialis irrelevant for the experimental results:

~D(t) = e~E(t) (3.9)~B(t) = µ~H(t) (3.10)

Note that all mentioned constitutive relations are given for homogeneous, linear andnon-dispersive materials. If not mentioned differently, this can always be presupposed. Wewill mostly talk about isotropic, homogeneous, linear and non-dispersive materials withthe exception that the PML, we will incorporate, needs diagonal anisotropic permittivityand permeability tensors.

3.3 Maxwell’s curl equations for isotropic materials

It can be shown that the discretization process (cha.4) leads to a ”divergence-free nature”

of the FDTD algorithm [see 2, sec.4.5] and thus the relevant equations for an isotropicmaterial are:

~r⇥ ~E = �µ∂~H∂t

(3.11)

~r⇥ ~H = e∂~E∂t

(3.12)

One can easily see the similarity between those two equations. This couple of equationsdescribes the encircling of the electric and magnetic field. A time-changing magneticfield induces a circulating electric field and a time-changing electric field induces acirculating magnetic field. This mechanism describes the propagation of electromagneticwaves (fig.3.1).

Figure 3.1: Demonstration of a propagating electromagnetic wave driven by Maxwell’s curl equations. Taken[from 2, p.24].

8

Page 13: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

3 Review of classical electrodynamics

3.4 Time-harmonic Maxwell’s equations

Until now we considered Maxwell’s equations in their time domain form, but often itis useful to treat them in their frequency domain form. We will need the frequencydomain form for the discussion and realisation of a uniaxial PML (cha.8). Additionally wepresuppose sinusoidally varying electric and magnetic fields, which can be written as:

~E(~r, t) = ~E0(~r) · ejwt ! ~D(~r, t) = ~D0(~r) · ejwt (3.13)~H(~r, t) = ~H0(~r) · ejwt ! ~B(~r, t) = ~B0(~r) · ejwt (3.14)

Further we consider a ”source and current free” medium and diagonal anisotropic permit-tivity and permeability tensors.

~r · ~D = 0 (3.15)~r · ~B = 0 (3.16)

~r⇥ ~E = �jwµ0

2

4µr,xx 0 0

0 µr,yy 00 0 µr,zz

3

5 ~H (3.17)

~r⇥ ~H = jwe0

2

4er,xx 0 0

0 er,yy 00 0 er,zz

3

5 ~E (3.18)

Once again for our discussion only the curl equations are relevant, due to the ”divergence-

free nature” of the algorithm. We will continue the discussion about Maxwell’s equationsin the frequency domain form in cha.8.

3.5 Approximating the time derivatives with finite di↵erences

Let us take a look at the relevant curl equations we mentioned in sec.3.3 and additionallyconsider a diagonal anisotropic material:

[er] =

2

4er,xx 0 0

0 er,yy 00 0 er,zz

3

5 and [µr] =

2

4µr,xx 0 0

0 µr,yy 00 0 µr,zz

3

5 (3.19)

~r⇥ ~H(t) = e0[er]∂~E∂t

and ~r⇥ ~E(t) = �µ0[µr]∂~H∂t

(3.20)

The electric field and the magnetic field have a different order of magnitude. For latersimulations we need to normalize one of them with respect to the other. This can beachieved by dividing ~E with the free space impedance h0 =

qµ0e0

⇣~E ! ~E

h0

⌘.

9

Page 14: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

3 Review of classical electrodynamics

Using the approximation for the time derivative from eq.2.3 and normalizing the electricfield we obtain the following equations [3]:

~r⇥ ~E(t) ' � [µr]c0

~H(t + Dt)� ~H(t)Dt

(3.21)

~r⇥ ~H(t) ' [er]c0

~E(t + Dt)� ~E(t)Dt

(3.22)

If ~E and ~H exist at the same time point we encounter some problems because of the”second-order forward difference” approximation. If we define the electric and magneticfield to exist at integer time steps (0, Dt, 2Dt, 3Dt,...) the left side of the two coupledequations exists also at integer time steps, but due to finite difference approximation theright side exists at half integer steps (Dt/2, t + Dt/2, 2tDt/2,...). Every term in a discretizedequation must exist at the same point in time and space [2][3]. The solution to is problemis an interleaved time grid. We will define the electric field component to exist at integertime steps and the magnetic field component to exist at half integer time steps. From thisassumption we gain the equations beneath. Fig.3.2 illustrates how ~E and ~H are staggeredin time.

~r⇥ ~E(t) ' � [µr]c0

~H(t + Dt/2)� ~H(t � Dt/2)Dt

! ~r⇥ ~E��t ' � [µr]

c0

~H��t+Dt/2 � ~H

��t�Dt/2

Dt(3.23)

~r⇥ ~H(t + Dt/2) ' [er]c0

~E(t + Dt)� ~E(t)Dt

! ~r⇥ ~H��t+Dt/2 ' [er]

c0

~E��t+Dt � ~E

��t

Dt(3.24)

We have now successfully approximated our time derivatives. In chap.4 we will discussthe finite difference approximation for the spatial derivatives of the rotor.

Figure 3.2: Electric and magnetic field exits at different time steps. Taken [from 2, p.74]

Note that in our description above the time index is the lower one and in the figure aboveit’s the upper one.

10

Page 15: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

Before we jump straight into the discussion about the structure of the Yee grid, we willonce more investigate Maxwell’s equations [3]. Writing done each vector component ofeq.3.23 and eq.3.24 yields:

∂⇣

Ez��i,j,kt

∂y�

∂⇣

Ey��i,j,kt

∂z' �µr,xx

c0

Hx��i,j,kt+Dt/2 � Hx

��i,j,kt�Dt/2

Dt(4.1)

∂⇣

Ex��i,j,kt

∂z�

∂⇣

Ez��i,j,kt

∂x' �

µr,yy

c0

Hy��i,j,kt+Dt/2 � Hy

��i,j,kt�Dt/2

Dt(4.2)

∂⇣

Ey��i,j,kt

∂x�

∂⇣

Ex��i,j,kt

∂y' �µr,zz

c0

Hz��i,j,kt+Dt/2 � Hz

��i,j,kt�Dt/2

Dt(4.3)

∂⇣

Hz��i,j,kt+Dt/2

∂y�

∂⇣

Hy��i,j,kt+Dt/2

∂z' er,xx

c0

Ex��i,j,kt+Dt � Ex

��i,j,kt

Dt(4.4)

∂⇣

Hx��i,j,kt+Dt/2

∂z�

∂⇣

Hz��i,j,kt+Dt/2

∂x'

er,yy

c0

Ey��i,j,kt+Dt � Ey

��i,j,kt

Dt(4.5)

∂⇣

Hy��i,j,kt+Dt/2

∂x�

∂⇣

Hx��i,j,kt+Dt/2

∂y' er,zz

c0

Ez��i,j,kt+Dt � Ez

��i,j,kt

Dt(4.6)

As discussed in the previous chapter (sec.3.5) every term in those equations above mustexist at the same point in space and time. We have already staggered the electric andmagnetic field in time (they exit half time steps apart). In the equations above we haveassigned the electric and the magnetic field with integer spatial steps (i,j,k). If we define~H to exist at the same integer spatial steps we run into some problems. As a result offinite difference approximation of the spatial derivatives not every term in those equationswould exist at the same point in space. Like we did it for the time variable, we need tostagger the electric and magnetic field in space. This leads us to the Yee grid and later tothe update equations for ~E and ~H. From this point on my discussion about the Yee gridand the governing update equations will differ a bit from the notation in Inan’s book [2].

11

Page 16: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

Figure 4.1: Conventional Yee cell. Taken [from 3, lecture 5].

Fig.4.1 demonstrates how ~E and ~H are staggered in space. To really understand thestructure of the Yee grid, we will approximate one of the curl equations from the equationsabove with a ”second-order forward difference” approximation (fig.4.2). Approximatingthe spatial derivatives of ~E in the Hx curl equation with eq.2.3 leads to:

∂Ez

∂y

����i,j+ 1

2 ,k

t'

Ez��i,j+1,kt � Ez

��i,j,kt

Dyand

∂Ey

∂z

����i,j,k+ 1

2

t'

Ey��i,j,k+1t � Ey

��i,j,kt

Dz(4.7)

Ez��i,j+1,kt � Ez

��i,j,kt

Dy�

Ey��i,j,k+1t � Ey

��i,j,kt

Dz= �µr,xx

c0

Hx��i,j,kt+Dt/2 � Hx

��i,j,kt�Dt/2

Dt(4.8)

Like mentioned previously the discretized equation contains staggered electric and mag-netic field components, whereas magnetic and electric components ”exit” a half grid cellapart. Due to the staggering we have successfully assured that every term in eq.4.8 existsat the same point in time and space. It may be confusing that ~E

��i,j,kt and ~H

��i,j,kt+Dt/2 don’t

represent the same point in space, but as soon as we have fully understood the Yee gridstructure this (maybe) ”misleading” notation will also appear logical.

12

Page 17: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

Figure 4.2: Demonstrating the finite difference approximation for the Hx curl equation using the Yee gridscheme. Taken [from 3, lecture 5].

Repeating the same approximation for the remaining curl equations, we gain the followingset of equations.

Ez��i,j+1,kt � Ez

��i,j,kt

Dy�

Ey��i,j,k+1t � Ey

��i,j,kt

Dz= �µr,xx

c0

Hx��i,j,kt+Dt/2 � Hx

��i,j,kt�Dt/2

Dt(4.9)

Ex��i,j,k+1t � Ex

��i,j,kt

Dz�

Ez��i+1,j,kt � Ez

��i,j,kt

Dx= �

µr,yy

c0

Hy��i,j,kt+Dt/2 � Hy

��i,j,kt�Dt/2

Dt(4.10)

Ey��i+1,j,kt � Ey

��i,j,kt

Dx�

Ex��i,j+1,kt � Ex

��i,j,kt

Dy= �µr,zz

c0

Hz��i,j,kt+Dt/2 � Hz

��i,j,kt�Dt/2

Dt(4.11)

Hz��i,j,kt+Dt/2 � Hz

��i,j�1,kt+Dt/2

Dy�

Hy��i,j,kt+Dt/2 � Hy

��i,j,k�1t+Dt/2

Dz=

er,xx

c0

Ex��i,j,kt+Dt � Ex

��i,j,kt

Dt(4.12)

Hx��i,j,kt+Dt/2 � Hx

��i,j,k�1t+Dt/2

Dz�

Hz��i,j,kt+Dt/2 � Hz

��i�1,j,kt+Dt/2

Dx=

er,yy

c0

Ey��i,j,kt+Dt � Ey

��i,j,kt

Dt(4.13)

Hy��i,j,kt+Dt/2 � Hy

��i�1,j,kt+Dt/2

Dx�

Hx��i,j,kt+Dt/2 � Hx

��i,j�1,kt+Dt/2

Dy=

er,zz

c0

Ez��i,j,kt+Dt � Ez

��i,j,kt

Dt(4.14)

These equations will be used to determine the update equations for a 1D and 2D FDTDalgorithm.

13

Page 18: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

4.1 1D FDTD algorithm

If we limit our investigation on electromagnetic fields with no variations in the x and yaxis, we receive an one dimensional finite difference time domain algorithm. We thus haveto drop every x and y derivative in eq.4.1-eq.4.6 and afterwards approximate the remainingspatial derivatives with finite differences in the same manner as in eq.4.9-eq.4.14. The resultis the following set of equations:Hy/Ex mode:

�Hy��kt+Dt/2 � Hy

��k�1t+Dt/2

Dz=

ekr,xxc0

Ex��kt+Dt � Ex

��kt

Dt(4.15)

Ex��k+1t � Ex

��kt

Dz= �

µkr,yy

c0

Hy��kt+Dt/2 � Hy

��kt�Dt/2

Dt(4.16)

Hx/Ey mode:

�Ey��k+1t � Ey

��kt

Dz= �

µkr,xxc0

Hx��kt+Dt/2 � Hx

��kt�Dt/2

Dt(4.17)

Hx��kt+Dt/2 � Hx

��k�1t+Dt/2

Dz=

ekr,yy

c0

Ey��kt+Dt � Ey

��kt

Dt(4.18)

Notice that the equations decouple into two sets of two equations. We will talk a bit moreabout this decoupling when we discuss the 2D FDTD algorithm. Fig.4.3 represents a onedimensional Yee cell for both modes.

Figure 4.3: One dimensional Yee cell for the Hx/Ey and Ex/Hy mode. The left picture represents the Ex/Hymode. Notice how E and H are staggered in space. Taken [from 3, lecture 5].

We’ll stick to the Hx/Ey mode for the further discussion on 1D simulations. By rearrangingthe terms in eq.4.17 and eq.4.18 we obtain the update equations for an 1D FDTD simulation.Update equations for the Hx/Ey mode:[3]

Hx��kt+Dt/2 = Hx

��kt�Dt/2 +

c0Dtµk

r,xx

Ey��k+1t � Ey

��kt

Dz(4.19)

Ey��kt+Dt = Ey

��kt +

c0Dtek

r,yy

Hx��kt+Dt/2 � Hx

��k�1t+Dt/2

Dz(4.20)

14

Page 19: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

4.2 2D FDTD algorithm

Often we can describe a material in just two dimensions instead of three (For Example:A device of infinite extent in the z direction). In such materials we have no variation inthe z-axis and can therefore drop all terms in eq.4.1-eq.4.6 which contain a z derivative.Afterwards we approximate the remaining spatial derivatives like we did it in eq.4.9-eq.4.14.Ez(TM) mode:

Ez��i,j+1t � Ez

��i,jt

Dy= �µ

i,jr,xxc0

Hx��i,jt+Dt/2 � Hx

��i,jt�Dt/2

Dt(4.21)

�Ez��i+1,jt � Ez

��i,jt

Dx= �

µi,jr,yy

c0

Hy��i,jt+Dt/2 � Hy

��i,jt�Dt/2

Dt(4.22)

Hy��i,jt+Dt/2 � Hy

��i�1,jt+Dt/2

Dx�

Hx��i,jt+Dt/2 � Hx

��i,j�1t+Dt/2

Dy=

ei,jr,zzc0

Ez��i,jt+Dt � Ez

��i,jt

Dt(4.23)

Hz(TE) mode:

Hz��i,jt+Dt/2 � Hz

��i,j�1t+Dt/2

Dy=

ei,jr,xxc0

Ex��i,jt+Dt � Ex

��i,jt

Dt(4.24)

�Hz��i,jt+Dt/2 � Hz

��i�1,jt+Dt/2

Dx=

ei,jr,yy

c0

Ey��i,jt+Dt � Ey

��i,j,kt

Dt(4.25)

Ey��i+1,jt � Ey

��i,jt

Dx�

Ex��i,j+1t � Ex

��i,j,kt

Dy= �µ

i,jr,zzc0

Hz��i,jt+Dt/2 � Hz

��i,jt�Dt/2

Dt(4.26)

Once again the equations decouple into two different modes. Due to the fact that thereis no variation in z direction, propagation in the z direction is excluded. In Hz(TE) mode,Ex and Ey are nonzero and lie in the plane of propagation and for the Ez(TM) mode, Hxand Hy are nonzero and also lie in the plane of propagation. To understand the differencebetween those two modes i’ll cite a passage from Inan’s book [see 2, p.79]:

”......., the TE and TM modes are physically quite different, due to orientation of electric andmagnetic field lines with respect to the infinitely long axis (i.e., the z axis) of the system. Note,for example, that the electric fields for the TE mode lie in a plane perpendicular to the longaxis, so that when modelling infinitely long metallic structures (aligned along the long axis),large electric fields can be supported near the metallic surface. For the TM mode, however, theelectric field is along the z direction and thus must be nearly zero at infinitely long metallicsurfaces (which must necessarily be aligned with the infinite dimension in the system) beingmodeled. As such, when running 2D simulations, the choice of TE or TM modes can depend onthe types of structures in the simulation.”[2, p.79]

15

Page 20: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

4 Yee grid and algorithm

Figure 4.4: Two dimensional Yee cell for Ez(TM) mode. The arrows represent the field values at the corre-sponding points in space. Like in one dimension the staggering of H and E is clearly visible. Taken[from 2, p.81].

We’ll stick to the implementation of the Ez(TM) mode. Fig.4.4 represents a two dimensionalYee cell for the TM mode. Rearranging the terms in eq.4.21-eq.4.23 and solving for the fieldvalues at the future time step leads us to the update equations for the TM mode in twodimensions.Update equations for the Ez(TM) mode:[3]

Hx��i,jt+Dt/2 = Hx

��i,jt�Dt/2 �

c0Dtµ

i,jr,xx

Ez��i,j+1t � Ez

��i,jt

Dy(4.27)

Hy��i,jt+Dt/2 = Hy

��i,jt�Dt/2 +

c0Dtµ

i,jr,yy

Ez��i+1,jt � Ez

��i,jt

Dx(4.28)

Ez��i,jt+Dt = Ez

��i,jt +

c0Dte

i,jr,zz

2

4Hy��i,jt+Dt/2 � Hy

��i�1,jt+Dt/2

Dx�

Hx��i,jt+Dt/2 � Hx

��i,j�1t+Dt/2

Dy

3

5 (4.29)

16

Page 21: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

5 Numerical stability and dispersion

5.1 Numerical stability of the FDTD algorithm

As we have mentioned often enough, the electromagnetic fields are staggered in spaceand time. Due to the fact that electric field components are always one spatial grid cellapart it takes a specific time for a electric disturbance to reach the adjacent cell [2] [3]. Thesame applies for the magnetic field. As stated previously this time step is named Dt. It’simportant to mention that a physical wave can’t travel farther than one grid cell in onetime step. To assure that this applies throughout the entire grid we’ll define the followingcriterion:

1D :c0Dt

n= vpDt Dz ! Dt Dz

vp(5.1)

With the criterion in eq.5.1 we have assured that the physical distance covered by the wave⇣c0Dt

n = vpDt⌘

doesn’t outdo the spatial step size (Dz) [2] [3].CFL (”Courant-Friedrichs-Lewy”) criterion:

1D : Dt Dzvp

(5.2)

2D : Dt 1

vp

q1

(Dx)2 +1

(Dy)2

(5.3)

3D : Dt 1

vp

q1

(Dx)2 +1

(Dy)2 +1

(Dz)2

(5.4)

We have ”derived” the CFL criterion in one dimension by logical assumption and onlymentioned it for two and three dimensions. For a further look into one of the many possiblederivations of the CFL criterion Inan’s book is referred [2, cha.5-6].

5.2 Numerical disperison

Dispersion normally refers to the dependence of the phase velocity (vp) on the frequencycaused by the interaction of light with matter. In many materials this ”classical” dispersioncan be neglected [2]. Numerical dispersion occurs due to the discretization of Maxwell’scurl equations. It causes a slower propagation through the FDTD grid. The numerical

17

Page 22: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

5 Numerical stability and dispersion

dispersion relation can be derived by substituting plane wave solutions for the fieldcomponents into the discretized curl equations (3D: eq.4.9-eq.4.14 — 2D: eq.4.21-eq.4.23— 1D: eq.4.17-eq.4.18). The complete derivation process can be read in Inan’s book [see 2,sec.6.3], whereas Inan and Marshall also mention a different approach which derives thenumerical dispersion relation directly from the discretized wave equation [see 2, sec.6.3.2-6.3.3].Numerical dispersion relation in 1D, 2D and 3D:

1D :�vp =

w

k=

2kDt

sin�1

vpDtDz

sin✓

kDz2

◆�(5.5)

2D :�vp =

2kDt

sin�1

"vpDt

s

(Dx)�2sin2✓

kxDx2

◆+ (Dy)�2sin2

✓kyDy

2

◆#(5.6)

3D :�vp =

2kDt

sin�1

"vpDt

s

(Dx)�2sin2✓

kxDx2

◆+ (Dy)�2sin2

✓kyDy

2

◆+ (Dz)�2sin2

✓kzDz

2

◆#

(5.7)

Whereas�vp is the numerical phase velocity, vp is the physical phase velocity

�vp = c0/n

and k is the wavenumber⇣

3D : k =q

k2x + k2

y + k2z 2D : k =

qk2

x + k2y

⌘. Take a look at

the dispersion relation for one dimension (eq.5.5). If we operate at the CFL limit then theFDTD algorithm doesn’t disperse and hence the numerical phase velocity is equal to thephysical phase velocity (eq.5.8). Using the CFL limit, we find:

vp =DzDt

! �vp =

2kDt

sin�1

sin✓

kDz2

◆�=

DzDt

= vp (5.8)

Before we end the discussion about dispersion we’ll talk a bit more about the CFL criterionand prove that it still holds for a dispersive FDTD algorithm. We consider plane wavesolutions f (z, t) = Cej(kz�wt) for the electromagnetic fields. If w is a comlex quantity(w = w1 + jw2), then every field value takes the form f (z, t) = Cew2tej(kz�w1t) and thereforegrowths or falls exponentially dependent on the sign of w2. To avoid this instability weneed to assure that w in eq.5.7 is a real quantity. Extracting w out of eq.5.7, we find:

w =2

Dtsin�1 (h) with h = vpDt

qA2

x + A2y + A2

z and Am =1

Dmsin✓

kmDm2

◆(5.9)

If h is greater than one, then w is a complex quantity. Because h is always positive andw must be a real number, we can set an upper and lower limit for h ! 0 h 1.Considering only the maximum value of h (h 1), we can set the sin terms in Ax,Ay andAz to 1 and receive following requirement:

vpDt

s1

(Dx)2 +1

(Dy)2 +1

(Dz)2 1 (5.10)

which is equivalent to the CFL criterion in three dimension. So we have successfullyre-derived the CFL stability condition [2, cha.6].

18

Page 23: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

6 Sources

For this chapter we’ll look at three different types of sources [2] [3]. We’ll introduce thistopic with a simple ”Hard source” and then we will talk about the problems related to sucha source and consider a possible solution to those problems which will be the simple ”Soft

source” . Finally we’ll discuss the most common source for FDTD simulations: The ”total-

field/scattered-field source”. Before we talk about these different types of sources we’lldiscuss some background information that is useful and necessary for the implementationof any source. Most FDTD simulations use either a continuous sinusoid or a Gaussianpulse for the source. In this thesis we’ll discuss both. A major advantage of the Gaussianpulse is that we can run a single simulation with a broad range of frequencies and thereforesave simulation-time [3, lecture 6]. Eq.6.1 represents a function for such a pulse.

g (t) = e�

t2

t2 (6.1)

For later simulations we need to determine the value of the half-width t. At the pointg (t) = 1

e the pulse has a width of 2t. By Fourier transforming the Gaussian pulse (eq.6.1)we can gain some further information about the half-width. As noted in eq.6.2 the Fouriertransform of a Gaussian pulse is again a Gaussian pulse, but in the frequency domain.

G ( f ) = Ft [g (t)] ( f ) ! G ( f ) =p

pt · e�p2 f 2t2(6.2)

We typically want to run our simulations over a broad range of frequencies up to amaximum frequencies fmax. In order to reach good results we will define the value fmax toexist where the exponential part of G ( f ) drops to e�1. So, fmax is defined in the exactlysame manner like the half-width t. With eq.6.2 it is now easy to determine a value for t:

G ( fmax) =p

pt · 1e

! e�p2 f 2maxt2 !

= e�1 ! t =1

p fmax(6.3)

But we are not done yet. In order to reach sufficient results we need to modify our Gaussianpulse. A source with an pulse like in eq.6.1 would step right into high field values. To avoidthat problem we simply need to delay the pulse by a time t0. To smoothly ease into andout of the Gaussian source (start with zero and end with zero), t0 should be approximately6t to 7t [3, lecture 6].

g (t) = e�(t � t0)

2

t2 , t0 ⇡ 7t (6.4)

19

Page 24: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

6 Sources

Sometimes it’s advantageous to implement a sinusoid source, but a pure sinusoid sourcewould not smoothly ease into and out of the FDTD grid [3]. To avoid stepping into highfield values we can combine the Gaussian source with a sinusoid source to a so-called”modulated Gaussian pulse” [2, sec.7.1]:

g (t) = e�(t � t0)

2

t2 sin (2p f0t) (6.5)

The simulations in fig.7.2 and fig.8.2 use f0 = 150MHz, t = 23 f0

and t0 = 4t.

6.1 Hard source

The simplest way to incorporate a source is to use a ”hard source”[2] [3]. A hard sourceis set up by overwriting an electric or magnetic field component at one point on thesimulation-grid (or even few grid points) with the value of the source for the presenttime-step. Eq.6.6 shows how a hard source can be implemented in one dimension (Note: ksis the point along the z-axis where we ”launch” the source). This type of source is rarelyused for simulations where something is investigated because incorporating such a sourcehas many disadvantages.

Ey��ks

t = g��t or Hx

��ks

t+Dt/2 = g��t+Dt/2 (6.6)

Due to the fact that we’re overwriting field values at a certain point (ks) the waves can’t passthrough the source and simply reflect at that point in the simulation-grid. That point in thegrid acts like a perfect electric/magnetic conductor. Sometime this behaviour is desired,but most of the time we just want to measure the response (scattered and transmitted field)without such a behaviour of the source. Therefore we’ll introduce the ”soft source”whichis a simple solution to the mentioned issue.

6.2 Soft source

To avoid that major issue related to the ”hard source” we need to add the source value at thepresent time-step to the update equations instead of overwriting them. Eq.6.7 demonstrateshow to implement a ”soft source” in one dimension, but the same mechanism applies totwo and three dimensions.

Ey��ks

t+Dt = Ey��ks

t+Dt + g��t+Dt or Hx

��ks

t+Dt/2 = Hx��ks

t+Dt/2 + g��t+Dt/2 (6.7)

Nevertheless, some problems can’t be solved by such a ”soft source”.

20

Page 25: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

6 Sources

6.3 Total-field/scattered-field source

The main problem associated with soft and hard sources is that the source launches energyin both directions. To launch a one-way source we need to modify our update equations.Due to linearity of Maxwell’s equation we can separate the electric and magnetic field intofields that are incident at some type of device and fields that are reflected from it. We cantreat those fields separately, because they separately satisfy Maxwell’s equations [2]. We’lldivide the grid into two regions, the total-field region and the scattered field region. Thetotal-field region contains incident, scattered and transmitted fields, whereas the scattered-field region consist only of the scattered (reflected) fields [3]. Fig.6.1 demonstrates the total-field/scattered-field scheme in two dimensions. In the further discussion on TF/SF we’llconcentrate on the one dimensional problem, but there is no big difference in implementinga 2D TF/SF source instead of a one dimensional. Take a look at the TF/SF section in Inan’sbook for further details on 2D TF/SF sources [see 2, sec.7.2].

Figure 6.1: Demonstration of the total-field and scattered-field regions in two dimensions.

In order to implement a sufficient ”total-field/scattered-field”source we have to modifythe update equations around the region where the source is launched. The grey shadedregion in fig.6.2 corresponds to the points in space where we need to modify our updateequations. If we evaluate the update equations for an one dimensional FDTD algorithm(eq.4.19-eq.4.20) at the problem points ks and ks � 1 we get the following set of equations:

Hx��ks�1t+Dt/2 = Hx

��ks�1t�Dt/2 +

c0Dtµks�1

r,xx

Ey��ks

t � Ey��ks�1t

Dz(6.8)

Ey��ks

t+Dt = Ey��ks

t +c0Dteks

r,yy

Hx��ks

t+Dt/2 � Hx��ks�1t+Dt/2

Dz(6.9)

Eq.6.8 is in the scattered-field region, but contains the total-field quantity⇣

Ey��ks

t

⌘. In order

to assure that the scattered-field region contains only scattered (reflected) fields we need

21

Page 26: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

6 Sources

Figure 6.2: Spatial points where we need to modify our update equations.

to modify Ey��ks

t so that it behaves like a scattered-field quantity. This can be achieved bysubtracting the source from the total-field quantity [3, lecture 7]. On the other hand eq.6.9is in the total-field region and contains the scattered-field quantity

⇣Hx��ks�1t+Dt/2

⌘. For this

equation we need to add the source to the scattered-field quantity in order to assure thatonly total-field quantities are present. The result is a modified set of update equations forthe spatial points ks and ks � 1:

Hx��ks�1t+Dt/2 = Hx

��ks�1t�Dt/2 +

c0Dtµks�1

r,xx

⇣Ey��ks

t � gE��t

⌘� Ey

��ks�1t

Dz(6.10)

Ey��ks

t+Dt = Ey��ks

t +c0Dteks

r,yy

Hx��ks

t+Dt/2 �⇣

Hx��ks�1t+Dt/2 + gH

��t+Dt/2

Dz(6.11)

Note that the we have defined a source for the electric field⇣

gE��t

⌘and for the magnetic

field⇣

gH��t+Dt/2

⌘. There are two reasons for this: Firstly the amplitude for electric and

magnetic field isn’t the same, and secondly we need to delay the source for the magneticfield with respect to the source of the electric field because electric and magnetic field arestaggered in time and space in our FDTD algorithm (Side note: The fields are half of a gridcell and half of a time step apart)[3, lecture 7].

22

Page 27: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

7 Numerical boundary conditions

The problem with the discretized Maxwell equations is that the update equations involvepoints outside the grid and hence we need to implement numerical boundary conditionswhich surpass that problem. To visualize the issue in form of equations we’ll evaluate the1D update equations for the Hx/Ey mode (eq.4.19-eq.4.20) at the edges of the FDTD grid(1 on the left and Nz on the right) [3]:

Hx��Nz

t+Dt/2 = Hx��Nz

t�Dt/2 +c0DtµNz

r,xx

Ey��Nz+1t � Ey

��Nz

tDz

(7.1)

Ey��1t+Dt = Ey

��1t +

c0Dte1

r,yy

Hx��1t+Dt/2 � Hx

��0t+Dt/2

Dz(7.2)

The values outside the FDTD grid (written in red) need modification. There are differentways to handle these boundary problems. We’ll talk about 2 methods, which both apply inone, two and three dimensions and a so called ”perfectly absorbing boundary conditions”,which only applies in one dimension.

7.1 Dirichlet boundary condition

One way to incorporate a boundary condition is to assume that the boundaries act like aperfect electric/magnetic conductor and hence the field values outside the grid immediatelydrop to zero. The update equations at the boundaries take the form:

Hx��Nz

t+Dt/2 = Hx��Nz

t�Dt/2 +c0DtµNz

r,xx

0 � Ey��Nz

tDz

(7.3)

Ey��1t+Dt = Ey

��1t +

c0Dte1

r,yy

Hx��1t+Dt/2 � 0

Dz(7.4)

Fig.7.1 pictures a simulation in two dimensions with Dirichlet boundary conditions.

23

Page 28: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

7 Numerical boundary conditions

Figure 7.1: Two dimensional Gaussian pulse travelling through air. The Dirichlet boundary condition causesreflection at the boundaries.

24

Page 29: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

7 Numerical boundary conditions

7.2 Periodic boundary condition

For periodic structures the electromagnetic fields take on the same periodicity in spaceand hence if a field value outside the grid is needed, we just reach to the other side of thegrid and take that field value [3]. The update equations at the boundaries take the form:

Hx��Nz

t+Dt/2 = Hx��Nz

t�Dt/2 +c0DtµNz

r,xx

Ey��1t � Ey

��Nz

tDz

(7.5)

Ey��1t+Dt = Ey

��1t +

c0Dte1

r,yy

Hx��1t+Dt/2 � Hx

��Nz

t+Dt/2Dz

(7.6)

Both sec.7.1 and sec.7.2 apply equally in two and three dimensions. Fig.7.2 represents atwo dimensional simulation with periodic boundary conditions.

Figure 7.2: Two dimensional sinusoidal wave travelling through air. The periodic boundary condition causesre-entering of the wave.

25

Page 30: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

7 Numerical boundary conditions

7.3 Perfectly absorbing boundary condition

The ”perfectly absorbing boundary condition” is a special case of the ”first-order Murboundary” for the CFL limit where vpDt = Dx. We need to assure that both boundarieshave the same material properties (permittivity and permeability) because the wave musttravel at the same speed on the left edge of the grid and on the right edge of the grid inorder to absorb the incoming ”field values” (waves). If we define the time step to be [3]

Dt =c0Dtnb

(7.7)

where nb is the refractive index at the boundaries (equal for the left and right boundary),we assure that the field values travel one grid cell in one time step at the boundaries. So ifa field value outside the grid is required we just take the field value at the boundary onetime step before. Hence the ”critical” terms in eq.7.9 and eq.7.10 are replaced by:

Ey��Nz+1t = Ey

��Nz

t�Dt and Hx��0t+Dt/2 = Hx

��1t�Dt/2 (7.8)

where this yields to the following update equations evaluated at the critical points:

Hx��Nz

t+Dt/2 = Hx��Nz

t�Dt/2 +c0DtµNz

r,xx

Ey��Nz

t�Dt � Ey��Nz

tDz

(7.9)

Ey��1t+Dt = Ey

��1t +

c0Dte1

r,yy

Hx��1t+Dt/2 � Hx

��1t�Dt/2

Dz(7.10)

and everywhere else the standard update equations for the Hx/Ey mode (eq.4.19-eq.4.20)are valid. The ”perfectly absorbing boundary condition” applies only in one dimension. Forfurther information about first order and higher order Mur boundaries (which also applyin two dimensions) Inan’s book is recommended [see 2, cha.8]. Fig.7.3 shows snapshotsof an one dimensional simulation with an incorporated ”perfectly absorbing boundarycondition”.

26

Page 31: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

7 Numerical boundary conditions

Figure 7.3: A TF/SF source (sec.6.3) is incident on a device and additionally transmission and reflection independence of frequency are recorded. The device is build up by three layers. The two thin layerson the left and right represent an anti-reflection coating for the plastic slab in the middle. Noticethat for the final snapshot at 2.4GHz the rate of transmission is approximately 100%.

27

Page 32: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

8 Uniaxial perfectly matched layer (UPML)

In sec.7.3 we talked about a ”perfectly absorbing boundary condition” and how to imple-ment it in one dimension. In the last few chapters we often derived a one dimensionalformulation of some method and stated that this method works equivalently in two andeven three dimensions. In case of the ”perfectly absorbing boundary condition” unfortu-nately it isn’t that easy. In two dimension we can’t assure that the wave travels to everypoint at the edge of the grid in exactly the same time because the grid-corner is fartheraway then every other point on the grid-edge. Actually, in two dimension the ”go-to”boundary condition which assures absorption at the edge of the grid isn’t even a ”real”boundary condition.The perfectly matched layer (PML)” [2, cha.9] [3] is mostly used in two and three dimen-sional simulations where ”absorbing boundaries” are required, but we’ll concentrate on thetwo dimensional problem. A PML is strictly seen not a real boundary condition becauseit introduces loss at the boundaries of the grid in order to absorb the incoming waves.The waves travel outward and get absorbed through the lossy media at the edge of thegrid. However it’s not that easy as it sounds. Many things must be considered to preventreflection and other artefacts form the PML region. Let’s consider a TM polarized waveincident on a material. The Fresnel reflection coefficient becomes:

RTM =h2 cos(q2)� h1 cos(q1)h2 cos(q2) + h1 cos(q1)

(8.1)

where hi is the impedance of material i and qi is angle of incident/transmission. Our goalis to completely prevent reflection ! RTM = 0. Many PML methods have been developedthroughout the last decades, but we’ll just concentrate on the uniaxial perfectly matched

layer (UPML)”. In order to prevent reflection, the UPML introduces loss by assigningcomplex permittivity and permeability values to the PML region. Because of these complexpermittivity and permeability values we’ll work with the time harmonic Maxwell equations(eq.3.17-eq.3.18) and normalize them like we did in sec.3.5:

~r⇥ ~E = � jwc0

⇥µ0

r⇤~H (8.2)

~r⇥ ~H =jwc0

⇥e0r⇤~E (8.3)

28

Page 33: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

8 Uniaxial perfectly matched layer (UPML)

where [µ0r] and [e0r] are the complex relative permeability and permittivity.

⇥µ0

r⇤=

2

4µ0

r,xx 0 00 µ0

r,yy 00 0 µ0

r,zz

3

5 =

2

4µr,xx 0 0

0 µr,yy 00 0 µr,zz

3

5 ·

2

6664

SHy SH

zSH

x0 0

0 SHx SH

zSH

y0

0 0 SHx SH

ySH

z

3

7775(8.4)

⇥e0r⇤=

2

4e0r,xx 0 0

0 e0r,yy 00 0 e0r,zz

3

5 =

2

4er,xx 0 0

0 er,yy 00 0 er,zz

3

5 ·

2

6664

SEy SE

zSE

x0 0

0 SEx SE

zSE

y0

0 0 SEx SE

ySE

z

3

7775(8.5)

The right term of the matrix multiplication in eq.8.4 and eq.8.5 ensures that the impedanceis matched (h1 = h2) and the angle of transmission is equal to the angle of incident andhence no reflection occurs

�RTM = 0

�[3][5]. Notice that different Si values are assigned to µ

and e (SEi and SH

i ). This becomes relevant when discretizing eq.8.2-eq.8.3. Electromagneticfields are staggered in space (therefore also permittivity and permeability are staggered inspace) and hence the Si depend on the spatial components. Otherwise for the continuouscurl equations the SE

i and SHi are the same. We can choose the following values for the Si

[3]:

Sjx(x) = 1 +

sjx(x)

jwe0and s

jx(x) =

e0

2Dt

✓xLx

◆3(8.6)

Sjy(y) = 1 +

sjy(y)

jwe0and s

jy(y) =

e0

2Dt

✓yLy

◆3(8.7)

Sjz(z) = 1 +

sjz(z)

jwe0and s

jz(z) =

e0

2Dt

✓zLz

◆3(8.8)

where j specifies either electric or magnetic field, x is the position within the PML regionand Lx is width of the PML region. Since we’ll only discuss the two dimensional algorithmwith no variations in z-axis, we can neglect the z derivatives in the curl equations (eq.8.2and eq.8.3). Furthermore s

jz = 0 and hence Sj

z = 1. This results in the following set ofequations:

∂Ez

∂y= �jw

µr,xx

c0

SHy

SHx

Hx∂Hz

∂y= jw

er,xx

c0

SEy

SEx

Ex (8.9)

� ∂Ez

∂x= �jw

µr,yy

c0

SHx

SHy

Hy � ∂Hz

∂x= jw

er,yy

c0

SEx

SEy

Ey (8.10)

∂Ey

∂x� ∂Ex

∂y= �jw

µr,zz

c0SH

x SHy Hz

∂Hy

∂x� ∂Hx

∂y= �jw

er,zz

c0SE

x SEy Ez (8.11)

Fig.8.1 demonstrates where the PML is located for a two dimensional grid and where sxand sy are assigned.

29

Page 34: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

8 Uniaxial perfectly matched layer (UPML)

Figure 8.1: Two dimensional ”perfectly matched layer” scheme. Waves are absorbed by the lossy materialproperties in the PML region (grey shaded area) [see 6, p.41].

Due to the decoupling we only need to consider the TM mode like we have done before.Using eq.8.6-eq.8.8 and considering only the TM mode we obtain:

✓1 +

sHx (x)jwe0

◆∂Ez

∂y= �jw

µr,xx

c0

1 +

sHy (y)jwe0

!Hx (8.12)

1 +

sHy (y)jwe0

!∂Ez

∂x= jw

µr,yy

c0

✓1 +

sHx (x)jwe0

◆Hy (8.13)

∂Hy

∂x� ∂Hx

∂y= �jw

er,zz

c0

✓1 +

sEx (x)jwe0

◆ 1 +

sEy (y)jwe0

!Ez (8.14)

Note that we have terms that contain jw or 1jw . In order to to get rid of these complex

values a transformation back to the time domain is necessary. Following relations areuseful [3, lecture 14]:

F [g(t)] = G(w) (8.15)F [ag(t)] = aG(w) (8.16)

F

di

dti g(t)�= (jw)iG(w) (8.17)

FZ t

�•g(t)dt

�=

1jw

G(w) (8.18)

30

Page 35: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

8 Uniaxial perfectly matched layer (UPML)

Transforming eq.8.12-eq.8.14 to the time domain followed by approximating with finitedifferences (see cha.4) and rearranging the terms leads us to the awaited update equationsfor 2D uniaxial PML simulations:Update equations for the 2D TM mode with a PML:[3, lecture 14]

Hx��i,jt+Dt/2 =

1Dt �

sHy |i,j2e0

1Dt +

sHy |i,j2e0

Hx��i,jt�Dt/2 �

11

Dt +sH

y |i,j2e0

c0

µi,jr,xx

2

4Ez��i,j+1t � Ez

��i,jt

Dy

3

5

�1

1Dt +

sHy |i,j2e0

c0Dte0

sHx��i,j

µi,jr,xx

t

ÂT=0

2

4Ez��i,j+1T � Ez

��i,jT

Dy

3

5

(8.19)

Hy��i,jt+Dt/2 =

1Dt �

sHx |i,j2e0

1Dt +

sHx |i,j2e0

Hy��i,jt�Dt/2 �

11

Dt +sH

x |i,j2e0

c0

µi,jr,yy

2

4Ez��i+1,jt � Ez

��i,jt

Dx

3

5

�1

1Dt +

sHx |i,j2e0

c0Dte0

sHy��i,j

µi,jr,yy

t

ÂT=0

2

4Ez��i+1,jT � Ez

��i,jT

Dx

3

5

(8.20)

Ez��i,jt+Dt =

1Dt �

sEx |i,j+sE

y |i,j2e0

� sEx |i,jsE

y |i,jDt4e2

0

1Dt +

sEx |i,j+sE

y |i,j2e0

+sE

x |i,jsEy |i,jDt

4e20

Ez��i,jt

+c0er,zz

��i,j

1Dt +

sEx |i,j+sE

y |i,j2e0

+sE

x |i,jsEy |i,jDt

4e20

2

4Hy��i,jt+Dt/2 � Hy

��i�1,jt+Dt/2

Dx�

Hx��i,jt+Dt/2 � Hx

��i,j�1t+Dt/2

Dy

3

5

�1

1Dt +

sEx |i,j+sE

y |i,j2e0

+sE

x |i,jsEy |i,jDt

4e20

DtsEx |i,jsE

y |i,j

e20

t�Dt

ÂT=0

Ez��i,jT

(8.21)

Fig.8.2 demonstrates a two dimensional simulation with an incorporated PML regionat different time steps. Notice that at a specific point on the spatial grid the waves start to”vanish”. This effect of ”absorption” is caused by the incorporated loss in the outer edgeof the grid.

31

Page 36: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

8 Uniaxial perfectly matched layer (UPML)

Figure 8.2: Snapshots at different time steps of a two dimensional FDTD simulation with a PML. The sinusoidalsource travels through air and gets absorbed in the PML region.

32

Page 37: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

List of Figures

2.1 Stability of the leapfrog method . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1 Propagation of an electromagnetic wave . . . . . . . . . . . . . . . . . . . . . 83.2 Electric and magnetic field are staggered in time . . . . . . . . . . . . . . . . 10

4.1 Yee cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.2 Yee cell for Hx curl equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3 1D Yee cell for the Hx/Ey and Ex/Hy . . . . . . . . . . . . . . . . . . . . . . 144.4 2D Yee cell for the TM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

6.1 TF/SF demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2 1D TF/SF source problem points . . . . . . . . . . . . . . . . . . . . . . . . . 22

7.1 2D simulation with a Dirichlet boundary condition. . . . . . . . . . . . . . . 247.2 2D simulation with a periodic boundary condition. . . . . . . . . . . . . . . 257.3 1D simulation with 3 layers of different permittivity . . . . . . . . . . . . . . 27

8.1 2D PML region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308.2 2D simulation with a PML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

33

Page 38: Bachelor of Scienceuxh/diploma/ilic18.pdf · the pioneering work on numerical solutions of Maxwell’s equations by Kane Yee [7] and Allen Taflove[5] and the continued growth of

Bibliography

[1] David J. Griffiths. Introduction to Electrodynamics. Fourth. Cambridge University Press,2005. isbn: 987-1-108-42041-9.

[2] Umran S. Inan and Robert A. Marshall. Numerical Electromagnetics: The FDTD Method.Cambridge University Press, 2011. isbn: 978-0-521-19069-5.

[3] Dr. Raymond C. Rumpf. Electromagnetic analysis using Finite-Difference Time-Domain.2018. url: http://emlab.utep.edu/ee5390fdtd.htm.

[4] Allen Taflove. “Nature Photonics Taflove Interview.” In: Nature Photonics (Jan. 2015).

[5] Allen Taflove and Susan C. Hagness. Computational Electrodynamics: The Finite-DifferenceTime-Domain Method. Third. Artech House, 2005. isbn: 978-1580538329.

[6] Thorsten Feichtner Ulrich Hohenester Andreas Trugler and David Masiello. “Sim-ulations and modeling for nanooptical spectroscopy.” In: Optical Nanospectroscopy.2018.

[7] Kane S. Yee. “Numerical solution of initial boundary value problems involvingMaxwell’s equations in isotropic media.” In: IEEE Trans. Antennas and Propagation(1966), pp. 302–307.

34