# FDTD

This is a collection of open source FDTD, Finite-Difference Time-Domain, demo programs.

These C software programs model the standard FDTD curl algorithm, including UPML and Berenger’s PML ABC. In addition, a “novelty” variation of the FDTD algorithm that uses the un-coupled “wave equations” instead of the usual curl equations was also developed.

While a demo may be worth a thousand words, if you’re looking for the “real thing” try these links…

And of course you’ll need a copy of the “bible”… Computational Electrodynamics: The Finite-Difference Time-Domain Method by Allen Taflove and Susan C. Hagness.

You might also want to check out the link for the popular toyFDTD, created by Laurie E. Miller, around 1999/2000. ToyFDTD is no longer actively maintained, but thanks to WayBack.org I have mirrored an archived copy: toyFDTD

In the spirit of the ToyFdtd programs, I tried to try to heavily comment the FDTD source code.

This is free FDTD code and is all open source. Share and enjoy — Doug Neubauer 7/3/2009

## Introduction

FDTD is a computational electrodynamics modeling technique used to simulate Maxwell’s Equations. Maxwell’s Equations decribe the physical laws of Electromagnetics (at the classical level).

These demo programs illustrate the basics of the 2D FDTD algorithm using the Yee Grid and the standard Curl Equations.

In addition to the usual FDTD algorithm, demo programs that use the second-order wave equation version of Maxwell equations, instead of the usual first order curl equations were also created. These programs build on the earlier article by Aoyagi etal (Aoyagi1993).

I tried, without success (so far anyway), to develop a fdtd program using the vector potentials (A,V), but ran into problems modeling the PML and in general areas where magnetic resistivity (σm) was not a constant. For more information on attempts to use the vector potentials in FDTD see: Time-domain vector-potential analysis of complex RF multilayerstructures via segmentation technique and other papers by Dr. Natalia K. Nikolova (formerly Georgieva).

Added (1/9/11): Dr. John B. Schneider (WSU) has recently made available his FDTD lecture notes in book form…

Dr. Schneider is an Associate Professor in the School of Electrical Engineering and Computer Science at Washington State University. Dr. Schneider’s Homepage. Dr. Schneider requests that, “If you find this material useful and see an opportunity to cite it in one of your publications, I would ever so appreciative of the citation. Please cite this work as: Understanding the Finite-Difference Time-Domain Method, John B. Schneider, www.eecs.wsu.edu/~schneidj/ufdtd, 2010. The book is continually evolving, so check out the link for the latest version.

Added (10/17/09): Here is a nice collection of YouTube FDTD lectures by Dr. Cynthia Furse…

Dr. Furse is an Associate Vice President for Research, University of Utah, Professor of Electromagnetics, Director, Center of Excellence for Smart Sensors. Dr. Furse’s Homepage.

The entire series of over 200 lectures on electromagnetics, including introductory material on Maxwell’s equations, finite difference frequency domain techniques, Method of Moments, and so on are located here: YouTube Lectures on Electromagnetics

Also here is a series of lecture notes by Dr. Natalia K. Nikolova, (reposted here with permission)…

## Electromagnetic

This page has a brief overview of the four partial differential equations that make up what is known as “Maxwell’s Equations”. These equations describe the properties of the electric and magnetic fields.

## FDTD Overview

An overview of the FDTD “Yee” grid and algorithm. The “Yee Grid” lies at the heart of the FDTD method for simulating Maxwell’s equations.

## Yee 2D FDTD Algorithms

### 2D FDTD, TE, (with Berenger PML ABC), 4/2/08

A port to C of a 2d FDTD (TE) matlab program originally written by Dr. Susan C. Hagness (See Taflove2000)

The fdtd C software implements the solution of Maxwell’s curl equations over a two-dimensional (TEz) Cartesian space lattice comprised of uniform square grid cells.

To illustrate the algorithm, a 6-cm-diameter metal cylindrical scatterer in free space is modeled. The source excitation is an Infinite Magnetic Line-source Gaussian pulse with a carrier frequency of 5 GHz.

• Yee2d.c .c file (Open source FDTD code)
• Results (Display Hz vs time) Note: only displaying Hz in the main grid

### 2D FDTD, TE, (with Berenger PML ABC), 4/4/08

A variation of a 2d TE FDTD adapted from the code of Dr. Susan C. Hagness (See Taflove2000)

Essentially the same as the previous demo fdtd code, this variation attempts to optimize the C code. As before, the program implements the fdtd solution of Maxwell’s curl equations over a two-dimensional (TEz) Cartesian space lattice comprised of uniform square grid cells.

This program simulates a 6-cm-diameter metal cylindrical scatterer in free space is modeled. The source is an Infinite Magnetic Line-source Gaussian pulse with a carrier frequency of 5 GHz.

• Yee2d.c .c file (Open source FDTD code)
• Results (Display Hz vs time) Note: Displays Hz in main grid and pml

### 2D FDTD, TE, (with UPML ABC), 4/29/08

A variation of the 2d FDTD (TE) code to test the fdtd PML using UPML. Adapted from Taflove2005.

This demo program implements a 2-D FDTD solution of Maxwell’s curl equations over a two-dimensional (TEz) lattice comprised of uniform square grid cells. The program uses a UPML instead of the Berenger’s PML ABC of the earlier two demo programs.

As before, a 6-cm-diameter metal cylindrical scatterer in free space is modeled. The source is an Infinite Magnetic Line-source Gaussian pulse with a carrier frequency of 5 GHz.

## Wave Equation 2D FDTD Algorithms

It is possible to use the FDTD method using the second-order wave equation version of Maxwell equations, instead of the usual first order curl equations (The standard Yee algorithm). FDTD using the wave equation was first described in an article by Aoyagi etal in 1993.

### Wave Equation 2D FDTD, TEz, (Ex,Ey) (with Berenger PML ABC), 5/22/08

This program builds upon the previous work of Aoyagi etal (Aoyagi1993) and is also adapted from the earlier standard 2D FDTD Curl Equation code of Dr. Susan C. Hagness (See Taflove2000)

This program probably has no practical value, as implementing the wave equation version of the PML is much more memory intensive and compute intensive than the standard Yee algorithm.

The point of the wave equation is to “decouple” the H and E fields, but the penalty is that it is then necessary to keep around an old value of Ex and Ey for every point on the grid.

This “novelty” FDTD software is provided as an existence proof. It is possible to implement the PML as a wave equation, but there is probably no practical reason to do so.

Note: no attempt was made to optimize the FDTD code, as it was only intended as a proof of concept. Therefore, for simplicity, the PML equations were also used in the main grid as well. This results in a slower running program, but an easier one to debug.

The program implements the FDTD solution of Maxwell’s wave equations over a two-dimensional (TEz) lattice comprised of uniform square grid cells.

To illustrate the algorithm, a 6-cm-diameter metal cylindrical scatterer in free space is modeled. The source excitation is an Infinite Magnetic Line-source Gaussian pulse with a carrier frequency of 5 GHz.

### Wave Equation 2D FDTD, TEz, (Hz) (with Berenger PML ABC), 6/05/08

This program builds upon the previous Wave Equation 2D TEz FDTD (Ex,Ey) program (above).

As with the previous demo, this program probably has no practical value, as implementing the wave equation version of the PML is much more memory intensive and compute intensive than the standard Yee algorithm.

Note: no attempt was made to Optimize the algorithm, as it was only intended as a proof of concept.

The program implements the finite-difference time-domain solution of Maxwell’s wave equations over a two-dimensional (TEz) Cartesian space lattice comprised of uniform square grid cells.

To illustrate the algorithm, a 6-cm-diameter metal cylindrical scatterer in free space is modeled. The source excitation is an Infinite Magnetic Line-source Gaussian pulse with a carrier frequency of 5 GHz.

## Analytic Solutions (2-D) 10/04/08

A comparison of the 2D “analytic” solution of an Infinite Magnetic Line-source sine wave (with a carrier frequency of 5 GHz) to the output of the 2D FDTD simulations above.

## Analytic Solutions (3-D)

A couple of 3-D “analytic” solutions to some simple electromagnetic problems, which can be compared to the output of a FDTD simulator…