# The FDTD Yee Algorithm

This page gives a brief overview of the FDTD algorithm and the Yee Grid. The basic FDTD grid and time stepping algorithm originate to the seminal paper by Kane Yee in IEEE Transactions on Antennas and Propagation (Yee 1966).

## Maxwell’s equations

The FDTD algorithm starts from Maxwell’s equations in a region that has no electric or magnetic current sources. From Taflove2005 pp.51-54. Also see Maxwell’s equations

### Faraday’s Law

Eqn:2.1 |

### Ampere’s Law

Eqn:2.2 |

### Gauss’s Law (electric)

Eqn:2.3 |

### Gauss’s Law (magnetic)

Eqn:2.4 |

## Terms Defined

electric field intensity (volts / meter) |

electric flux density (coulombs / square meter) |

magnetic field intensity (amperes / meter) |

magnetic flux density (webers / square meter) |

electric current density (amperes / square meter) |

equivalent magnetic current density (volts / square meter) |

## Maxwell’s Equations for FDTD

The FDTD algorithm makes certain assumptions concerning the constitutive relations and sources and losses.

### The Constitutive Relations

If the material is linear, isotropic, non-dispersive (i.e. materials having field-independent, direction-independent, and frequency-independent electric and magnetic properties) then:

Eqn:2.5 |

Eqn:2.6 |

where,

electric permittivity (farads/meter) |

relative electric permittivity (dimensionless) |

electric permittivity (free space) (8.854 * 10^-12 farads/meter) |

magnetic permeability (Henrys/meter) |

relative magnetic permeability (dimensionless) |

(Henrys/meter), magnetic permeability (free space) |

### Sources and Losses

Allowing for sources and materials with isotropic, non-dispersive electric and magnetic losses gives:

Eqn:2.7 |

Eqn:2.8 |

where,

electric conductivity (siemens / meter) |

equivalent magnetic loss (ohms / meter) |

### The Modified Maxwell’s Equations for FDTD

Substituting into the two Maxwell’s curl equations, gives for linear, isotropic, non-dispersive, lossy materials:

Writing out the individual components gives six coupled equations for E and H:

Eqn:2.11 |

Eqn:2.12 |

Eqn:2.13 |

Eqn:2.14 |

Eqn:2.15 |

Eqn:2.16 |

## The Yee FDTD Algorithm

The algorithm used in FDTD simulations is known as the Yee algorithm. The Yee algorithm solves for both electric and magnetic fields using the coupled Maxwell’s curl equations. (As opposed to solving for the electric or magnetic field alone using a wave equation.) From Taflove2005 pp.58-60. and Sadiku pp.160-164.

A key to the Yee algorithm is that the components of E and H (Ex,Ey,Ez, Hx,Hy,Hz) are spatially offset from one another. An easy way to visualize this is to see how the field components are arranged within a unit cell (voxel) as shown below:

- Ex = i+.5, j, k
- Ey = i, j+.5, k
- Ez = i, j, k+.5
- Hx = i, j+.5, k+.5
- Hy = i+.5, j, k+.5
- Hz = i+.5, j+.5, k

The Yee Grid

from Sadiku P.161,164

Spatial offset of the field components

Other features of the Yee algorithm are:

- In addition to being offset spatially, E and H are also offset in time by 1/2 time step using a “leapfrog” time-stepping technique.
- The leapfrog time-stepping algorithm is fully explicit. This avoids problems involved with simultaneous equations and matrix inversions.
- The finite-difference equations for both the space derivatives and time derivatives are central-difference and second-order accurate.

Close-up view of the Yee Grid for the 2-D TEz (transverse electric mode)

### Example Code

Some simple example code of a 2-D FDTD TE in a free-space region: (See Taflove2005 pp.60-73 for explanation and more examples) From: Yee2d.c .c file (FDTD code)

for (n = 0; n < maximumIteration; n++) { // iteration loop for (i = 0; i < xSize; i++) { // evaluate ex for (j = 1; j < ySize; j++) { ex[i][j] = caex[i][j] * ex[i][j] + cbex[i][j] * ( hz[i][j] - hz[i][j-1] ); } } for (i = 1; i < xSize; i++) { // evaluate ey for (j = 0; j < ySize; j++) { ey[i][j] = caey[i][j] * ey[i][j] + cbey[i][j] * ( hz[i-1][j] - hz[i][j] ); } } for (i = 0; i < xSize; i++) { // evaluate hx for (j = 0; j < ySize; j++) { hz[i][j] = dahz[i][j] * hz[i][j] + dbhz[i][j] * ( ex[i][j+1] - ex[i][j] + ey[i][j] - ey[i+1][j] ); } } hz[xSource][ySource] = sourceValue[n]; } Where (in vacuum), ca = da = 1.0 cb = dTime / (electricalPermittivity0 * dx); db = dTime / (magneticPermeability0 * dx);

## See Also

- Fdtd Main Index Page (with example code)
- Maxwell’s Equations
- The Yee Algorithm
- 2D UPML Algorithm and Theory
- The 2D FDTD Wave Algorithm and Theory
- The 2D FDTD Wave Hz Algorithm
- Analytical Solution: Infinite Magnetic Line-source
- Numerical Methods
- Spherical and Cartesian coordinates
- Vector Algebra
- Fundamental and Derived Units
- Glossary
- FDTD References
- FDTD Resources

## References

- Sadiku – Numerical Techniques in Electromagnetics, 2001
- Taflove1995 – Computational Electrodynamics, 1995
- Taflove1998 – Advances in Computational Electrodynamics, 1998
- Taflove2000 – Computational Electrodynamics, 2000
- Taflove2005 – Computational Electrodynamics, 2005

## External Links

- Dr. Natalia K. Nikolova (formerly Georgieva). FDTD using A,V wave equations
- Dr. Allen Taflove website