Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The finite-difference time-domain method

ProblemSolve Maxwell’s equations directly in time on a grid, for pulses travelling through materials and scattering from objects, with open boundaries that absorb outgoing waves
Devised byKane Yee (1966), the staggered grid; Allen Taflove (1975–80), the method’s development and name; Gerrit Mur (1981), absorbing boundaries; Jean-Pierre Berenger (1994), the perfectly matched layer
AccuracySecond order in space and time; exact (dispersionless) in 1D at the magic time step; reflection coefficients within 0.4% of Fresnel’s (tables below)
Cost per time step for cells, with steps limited by the Courant condition
Read firstFinite difference methods
APIFdtd1D (new, set_material, step, ez, hy), FdtdTmz (new, set_permittivity, set_pec, step, ez, interior_energy), gaussian_pulse

Overview

The finite-difference time-domain (FDTD) method replaces the curl equations by centred differences on a staggered grid and steps the fields forward in time. Electric and magnetic field components sit half a cell apart in space and half a step apart in time (the Yee cell), so each update uses the curl of its neighbours. The method needs no matrix and no frequency-domain formulation, and handles any arrangement of materials. A single pulse gives the response at all frequencies at once. Its open problems are the grid’s edges, which must absorb outgoing waves (absorbing boundary conditions or a perfectly matched layer), and numerical dispersion: waves on a grid travel slightly slower than in reality, depending on frequency and direction.

Where it is used

FDTD is the standard way to watch an electromagnetic pulse travel and scatter on a computer.

  • Antenna and microwave design. Commercial simulators such as those used for phone antennas, PCB traces and waveguide components are FDTD-based.
  • Radar cross-section and stealth. The scattering of a pulse by an aircraft or ship shape is computed in the time domain.
  • Photonics and biomedical. Light in nanostructures, optical fibres and photonic crystals, and the absorption of radiation in tissue (SAR for phone safety), are FDTD problems.

History

Kane Yee (1966) published the staggered-grid scheme in a short paper on scattering by isotropic media. It attracted little notice until Allen Taflove and colleagues developed it through the 1970s and 80s, named it FDTD (1980), and applied it to scattering and microwave penetration. Gerrit Mur’s absorbing boundary conditions (1981) let open problems run in finite grids. Jean-Pierre Berenger’s perfectly matched layer (1994) absorbs waves of every angle and frequency with tiny reflection. FDTD is now a standard tool for antenna, microwave, photonic and bioelectromagnetic simulation.

The idea

The Yee scheme in one dimension

The equations. Maxwell’s two curl equations say that a changing magnetic field produces a circulating electric field, and a changing electric field a circulating magnetic one. For a wave travelling along with field components and , they reduce to

The time derivative of each field is the space derivative of the other.

Yee’s staggering. The finite-difference time-domain (FDTD) method replaces all four derivatives by central differences, which are second-order accurate. A central difference of between two neighbouring grid points gives the derivative at the point halfway between them, so that is where should be stored. Yee therefore placed the two fields on interleaved grids: at the points , at the half-points . The same argument applies in time: is stored at the whole time steps and at the half steps . Each field is then advanced using the other field at the time halfway through its step, a leapfrog scheme. No linear system is solved; every update is explicit and uses only the two nearest neighbours.

With the normalised field (which gives and the same units) and the time step , the two updates are

with a conductivity term for lossy cells.

Stability. The number is the Courant number: the fraction of a cell that light crosses in one time step. An update uses only neighbouring cells, so information in the computation travels at most one cell per step. If the physical wave travelled further than that in a step (), the scheme could not possibly follow it, and in fact it becomes unstable: errors grow without bound. The scheme is stable for . At , the “magic time step”, a wave moves exactly one cell per step in vacuum, and the scheme has no dispersion at all.

Boundaries. The grid must end somewhere, and a wave reaching the last cell would reflect back as from a mirror. An absorbing boundary condition sets the edge value so as to mimic a wave leaving the grid. First-order Mur boundaries, , absorb exactly at the magic step.

Table 21.4. FDTD reflection from a dielectric interface against the Fresnel coefficient.

ε_rFresnel Γ = (1 − √ε_r)/(1 + √ε_r)FDTD, Courant number 1FDTD, Courant number 0.5
2-0.1716-0.1719-0.1718
4-0.3333-0.3342-0.3341
9-0.5000-0.5019-0.5017

A Gaussian pulse meeting a dielectric half-space reflects with the Fresnel coefficient, to within 0.4% at , where the medium’s wavelength is shortest.

Numerical dispersion

On the grid, waves of different wavelengths travel at slightly different speeds, although in vacuum they should all travel at . This artefact is numerical dispersion, and it distorts pulses over long distances. For the Yee scheme’s dispersion relation is . Waves travel slower than , by an error proportional to , so ten cells per wavelength is a common minimum and twenty is safer. Measuring the phase velocity of a sinusoid in the library’s solver reproduces the formula:

Table 21.5. FDTD numerical dispersion against Courant number and resolution.

Courant number Scells per wavelengthphase velocity error ‖1 − v/c‖, Yee dispersion relationmeasured
1100.00e00.00e0
1200.00e00.00e0
1400.00e00.00e0
0.5101.27e-21.27e-2
0.5203.11e-33.11e-3
0.5407.73e-47.72e-4

Two dimensions and the perfectly matched layer

The transverse-magnetic mode (, , ) needs . Around the domain, Berenger’s split-field PML splits into two parts, each with a conductivity along one axis, and the matching magnetic conductivity makes the layer’s impedance equal free space’s at every angle. Waves enter without reflection and decay inside it. The conductivity is graded smoothly from zero to limit the discretisation’s reflection. Here, a pulse scatters from a perfectly conducting cylinder:

Figure 21.12. FDTD cylinder.

Figure 21.13. FDTD energy.

Once the pulse and its scattered waves have left the interior, the energy remaining there falls by six orders of magnitude.

Algorithm

One time step of the simulation, in this order.

  1. Update . At every half-cell, add to the Courant number (divided by the cell’s relative permeability) times the difference of the two neighbouring values of . In two dimensions this is the discrete curl of , and inside the PML the update includes the magnetic loss.
  2. Update . At every cell, add to the Courant number (divided by the relative permittivity) times the difference of the two neighbouring values of , which have just been updated. A lossy cell multiplies the old value by a factor below 1 that depends on its conductivity. In the PML, each of the two split parts of is updated with its own conductivity.
  3. Add the source. Add the source’s value at this time to at the source cell. Adding, and not overwriting, makes it a soft source: waves reflected back towards it pass through instead of being reflected again.
  4. Apply the boundary conditions. In one dimension, set the two end values by the Mur formula, from the stored previous values. In two dimensions the PML absorbs the outgoing waves, and the field at its outer edge is simply held at zero.

Because and are staggered in time, each update uses values of the other field that are half a step newer, which is what makes the scheme second-order accurate. The cost per step is proportional to the number of cells.

Implementation

        let s = self.courant;
        let n = self.ez.len();
        for i in 0..n - 1 {
            self.hy[i] += s / self.mu_r[i] * (self.ez[i + 1] - self.ez[i]);
        }
        let (old_left, old_right) = (self.ez[1], self.ez[n - 2]);
        let dt = self.time_step();
        for i in 1..n - 1 {
            let loss = self.sigma[i] * dt / (2.0 * EPS_0 * self.eps_r[i]);
            self.ez[i] = (1.0 - loss) / (1.0 + loss) * self.ez[i] + s / (self.eps_r[i] * (1.0 + loss)) * (self.hy[i] - self.hy[i - 1]);
        }
        if let Some((i, value)) = source {
            self.ez[i] += value;
        }
        // First-order Mur boundaries with the local Courant number.
        let mur = |s_local: f64| (s_local - 1.0) / (s_local + 1.0);
        let (sl, sr) = (s / self.eps_r[0].sqrt(), s / self.eps_r[n - 1].sqrt());
        self.ez[0] = old_left + mur(sl) * (self.ez[1] - self.ez[0]);
        self.ez[n - 1] = old_right + mur(sr) * (self.ez[n - 2] - self.ez[n - 1]);
  • Fields are stored as public vectors (1D) or read through ez(i, j) (2D), so they can be recorded at probes or as snapshots.
  • set_pec makes cells perfect conductors; set_permittivity and set_material set dielectrics and losses.

In practice

//! Finite-difference time-domain simulation: reflection from a dielectric in 1D, and a pulse in a
//! 2D domain with a perfectly matched layer.
//!
//! Run with `cargo run --release -p lib_jsl_electromagnetics --example fdtd`.

use lib_jsl_electromagnetics::algorithms::{Fdtd1D, FdtdTmz, gaussian_pulse};

fn main() {
    // 1D: a Gaussian pulse meets glass (ε_r = 2.25) at cell 500.
    let mut line = Fdtd1D::new(1000, 1e-3, 1.0).unwrap();
    line.set_material(500, 1000, 2.25, 0.0, 1.0);
    let mut peak_incident: f64 = 0.0;
    let mut peak_reflected: f64 = 0.0;
    // The incident pulse passes the probe (cell 300) near step 260; the reflection returns near 660.
    for n in 0..1000 {
        line.step(Some((100, gaussian_pulse(n, 60.0, 15.0))));
        let v = line.ez[300];
        if n < 500 { peak_incident = peak_incident.max(v) } else if v.abs() > peak_reflected.abs() { peak_reflected = v }
    }
    println!("1D: reflection {:.4} (Fresnel (1 − 1.5)/(1 + 1.5) = -0.2000)", peak_reflected / peak_incident);
    // 2D: a pulse from the centre of a 120 × 120 grid with a 10-cell PML.
    let mut grid = FdtdTmz::new(120, 120, 1e-3, 0.7, 10).unwrap();
    let mut peak: f64 = 0.0;
    for n in 0..600 {
        grid.step(Some((60, 60, gaussian_pulse(n, 30.0, 10.0))));
        peak = peak.max(grid.interior_energy(10));
        if n % 150 == 149 {
            println!("2D: step {:3}, energy left inside the PML boundary {:.2e} of its peak", n + 1, grid.interior_energy(10) / peak);
        }
    }
}
1D: reflection -0.2007 (Fresnel (1 − 1.5)/(1 + 1.5) = -0.2000)
2D: step 150, energy left inside the PML boundary 4.84e-3 of its peak
2D: step 300, energy left inside the PML boundary 5.44e-5 of its peak
2D: step 450, energy left inside the PML boundary 7.58e-6 of its peak
2D: step 600, energy left inside the PML boundary 2.14e-6 of its peak

Strengths

  • Simple, explicit, matrix-free; arbitrary materials and geometries; broadband results from one run.
  • Exact in 1D at the magic step; effective absorbing boundaries.

Weaknesses

  • Staircased geometry on a Cartesian grid; numerical dispersion needs many cells per wavelength.
  • 1D and 2D TMz only here; no 3D solver, dispersive materials or near-to-far transformation built in.

Exercises

  1. Derive the 1D update equations from Faraday’s and Ampère’s laws with centred differences.
  2. Derive the dispersion relation , and show that removes dispersion.
  3. Show that the scheme is unstable for by finding a growing mode.
  4. Measure the transmission through a dielectric slab with an FDTD pulse and compare it with the Fabry-Pérot formula.
  5. Reduce the PML to four cells and measure how the reflected energy grows.
Hints and answers
  1. Faraday: ; Ampère: . Centred differences on the staggered grid give and the analogous update.
  2. Insert into the update equations: , i.e. with . For this gives exactly.
  3. For and , has no real solution: is complex and the corresponding mode grows exponentially.
  4. Compare the simulated transmission spectrum (ratio of transmitted to incident Fourier amplitudes) with the Fabry-Pérot formula for a slab of thickness and index : .
  5. Reflection from a PML grows as its thickness decreases, because the absorption profile must increase gradually to avoid a reflection at the interface; measure the reflected energy for 4, 8, 16 cells.

Further reading

  • A. Taflove and S. C. Hagness, Computational Electrodynamics: The Finite-Difference Time-Domain Method, 3rd ed., Artech House, 2005.
  • K. S. Yee, “Numerical solution of initial boundary value problems involving Maxwell’s equations in isotropic media”, IEEE Transactions on Antennas and Propagation 14 (1966) 302–307.
  • J.-P. Berenger, “A perfectly matched layer for the absorption of electromagnetic waves”, Journal of Computational Physics 114 (1994) 185–200.
  • J. B. Schneider, Understanding the Finite-Difference Time-Domain Method, 2010, www.eecs.wsu.edu/~schneidj/ufdtd.