C10 · Lesson 49 · Simulating fields with FDTD
Maxwell's equations stepped forward on a grid
Closed-form answers run out quickly: a real antenna on a phone, a connector on a board, a radar reflection off an aircraft. Engineers solve those with field simulators, and one of the simplest and most widely used is the finite-difference time-domain method, FDTD. It divides space into a grid of tiny cells, stores E and H at staggered points, and steps Faraday's and Ampère's laws forward in time, a few lines of arithmetic per cell per step. Kane Yee published the scheme in 1966; the course's own wave pictures use it. Its two rules of thumb, a time step limited by the cell size and enough cells per wavelength, decide whether a simulation is right or wildly wrong.
- On a grid, waves don't travel at exactly c: the discrete equations make them a little slow, more so for short wavelengths. The curve is the simulated speed over c against the number of cells per wavelength, N.
- S is the Courant number, . At S = 1 the one-dimensional scheme is exact. Lower S and the error appears: about 1% at 10 cells per wavelength, falling as .
- Above S = 1 the scheme is unstable: errors grow without limit, which is why the time step is capped.
Predict
A 1D FDTD grid has 1 mm cells. What is the longest time step that stays stable?
ps. A wave must not cross more than one cell per step, or the update can't "see" it coming and the solution blows up. In 3D the limit is .
Name it
The Yee scheme in one dimension
Store at whole-numbered grid points and times, and halfway between in both space and time. Faraday's and Ampère's laws become
Each step updates every H from the E's beside it, then every E from the new H's. Materials enter through ε and μ cell by cell, so a dielectric slab is just a range of cells with a different ε.
Stability
The Courant number must satisfy S ≤ 1 in 1D (S ≤ for cubic cells in 3D). Above that the scheme is unstable.
Accuracy
Waves on the grid travel at
for N cells per wavelength: exact at S = 1 in 1D, otherwise slow by an error that falls as . The usual rule is 10 to 20 cells per wavelength at the highest frequency of interest, and finer cells around small features.
Boundaries, sources and cost
A metal wall is E = 0. An open boundary needs an absorbing layer (the perfectly matched layer, PML) so waves leave without reflecting. Sources are usually a Gaussian pulse added to E at a cell, which covers a whole band of frequencies in one run. A 3D simulation has cells and needs about steps per crossing, so halving the cell size costs 16 times the work.
Worked example
A 2.4 GHz antenna is simulated with 20 cells per wavelength in 3D. What cell size and time step are needed?
Show the solution
- Cell size. λ = 125 mm, so
- Time step. The 3D Courant limit is
Answer cells of 6.25 mm and a time step of 12 ps.
Worked example
A 1D run uses S = 0.5 and 10 cells per wavelength. How fast do its waves travel?
Show the solution
- Numerical speed. so the waves run 1.2% slow.
- Over a long run. After crossing 50 wavelengths the wave would lag by more than half a wavelength.
- Finer cells. Doubling to 20 cells cuts the error to 0.3%.
Answer the waves travel at 0.988 of their true speed, 1.2% slow.
Worked example
A 1D FDTD grid of 1000 cells uses 20 cells per wavelength at 1 GHz with a Courant number of 1. What are the cell size and time step, and how many steps does a pulse take to cross?
Show the solution
- Cell size. λ = 30 cm, so
- Time step. At S = 1,
- Crossing time. A pulse moves exactly one cell per step, so crossing 1000 cells takes 1000 steps, 50 ns.
- Why S = 1 is special. In 1D, S = 1 is the magic step where the scheme has no dispersion at all.
Answer Δx = 15 mm and Δt = 50 ps, and a pulse takes 1000 steps (50 ns) to cross.
Check
A 1D grid has 1 mm cells and runs at Courant number 0.9. What time step is that?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
Check
What is the largest stable time step for a 3D grid of 2 mm cubic cells?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
Check
A simulation must resolve 5.8 GHz with 10 cells per wavelength, inside a material with = 4. What cell size does that need?
Write units the way you normally would: 1.5 mm, 1500 µm and 0.0015 m are the same answer.
Check
By what percentage are waves slow on a 1D grid with 15 cells per wavelength and Courant number 0.3?
Check
A 3D simulation covers a cube 50 mm on a side with 1 mm cells, storing six field components per cell as 8-byte numbers.
(a)
How many cells?
(b)
How much memory do the fields need?
Check
How many steps does a wave take to cross 100 mm on a 1D grid with 0.5 mm cells at Courant number 0.8?
Check
A 1D FDTD run uses S = 1.2. What happens?
Check
A 3D FDTD grid uses 10 cells per wavelength at 2.4 GHz.
(a)
What cell size is that?
Write units the way you normally would: 1.5 mm, 1500 µm and 0.0015 m are the same answer.
(b)
What is the largest stable time step?
Check
A 3D FDTD grid is 200 cells on a side, with six field components in double precision.
(a)
How much memory do the fields take?
(b)
By what factor does halving the cell size multiply the memory, for the same space?
Explain why
Why must the FDTD time step be short enough that a wave crosses at most one cell per step?
Each update computes a cell's new field from its immediate neighbors only, so information moves across the grid by at most one cell per step. If the real wave would cross more than one cell in a step, the numerical scheme can't keep up: the physics needs influence from cells it doesn't consult. Mathematically, the update then amplifies some wavelengths each step instead of preserving them, and rounding errors at those wavelengths grow exponentially until they swamp the solution. Keeping cΔt below the cell size (the Courant condition) guarantees the grid's speed limit is at least the physical one.
Practice
Keep practicing
11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.