🇺🇦 Українська

🌊 EM Wave Simulator — 2D FDTD

Maxwell's curl equations solved on a 2D Yee grid using the Finite Difference Time Domain (FDTD) method. The TMz mode evolves Ez, Hx, Hy by leapfrog integration. Click the canvas to paint reflectors; use presets to see interference and diffraction.

Source

Draw Tool

Presets

Display

Simulation

Step0
Courant

What this demonstrates

The FDTD method (Yee, 1966) solves Maxwell's curl equations on a staggered spatial grid with a leapfrog time-stepping scheme. In the TMz mode the relevant fields are Ez, Hx and Hy. The stability condition (Courant–Friedrichs–Lewy) requires c·Δt / Δx ≤ 1/√2. Absorbing boundary conditions prevent artificial reflections at the edges. Painting cells as perfect electric conductors (PEC) allows you to create waveguides, cavities, slits and lenses.

How to use

Did you know?

FDTD is used in real-world engineering to design antennas, photonic crystals, and integrated circuits at optical frequencies. The same Yee algorithm running here at 120×90 cells scales up to billion-cell 3D grids on supercomputers to simulate how radar waves diffract around aircraft or how light propagates through nanophotonic chips.

About the 2D FDTD Electromagnetic Wave Simulator

This simulator solves Maxwell's curl equations on a 120×90 Yee grid using the Finite Difference Time Domain (FDTD) method introduced by Kane Yee in 1966. It runs the transverse-magnetic (TMz) mode, evolving the electric field Ez together with the magnetic components Hx and Hy by leapfrog time-stepping. The colour map shows the instantaneous Ez field, with red and blue marking opposite polarities of the oscillating wave.

The Source panel sets the sine wave's frequency and amplitude and switches between a point source and a left-edge plane wave. A draw tool lets you paint or erase perfect electric conductors (PEC), and the Display panel adjusts the field colour range and steps-per-frame speed. The same algorithm scales to billion-cell grids in industry, where it designs antennas, photonic chips, and radar-stealth geometry.

Frequently Asked Questions

What does this simulation actually show?

It shows electromagnetic waves propagating through a 2D space in real time. The red and blue colours represent the instantaneous strength and sign of the out-of-plane electric field Ez, so you watch crests and troughs spread, interfere, diffract and reflect exactly as Maxwell's equations predict.

What is the FDTD method?

Finite Difference Time Domain is a numerical scheme that replaces the spatial and time derivatives in Maxwell's curl equations with finite differences on a staggered grid. The electric and magnetic fields are updated in alternating half-steps (leapfrog), so the wave naturally evolves forward in time without solving any large matrix.

What is a Yee grid and TMz mode?

The Yee grid stores the electric and magnetic field components at offset positions so each curl can be computed with central differences. TMz means transverse-magnetic with respect to z: only Ez, Hx and Hy are non-zero, which reduces the full 3D problem to a tractable 2D one.

What do the frequency and amplitude sliders do?

Frequency sets how fast the source oscillates, from 0.01 to 0.12 cycles per time step. Higher frequency means a shorter wavelength and sharper diffraction. Amplitude (0.1 to 3.0) scales how strongly the source drives the field, affecting brightness but not the wave's speed.

What is the difference between a point and a plane source?

The point source is a single oscillating cell near the left third of the grid, radiating circular wavefronts ideal for showing diffraction through slits. The plane source injects the wave along a column at the left edge, producing flat, parallel wavefronts that travel rightwards like a collimated beam.

What are the reflectors and presets for?

Painting reflectors marks cells as perfect electric conductors, which force Ez to zero and bounce waves back. The presets instantly build single-slit, double-slit, mirror and lens geometries from these conductors, so you can reproduce classic interference and focusing experiments with one click.

What does the Courant value mean?

Courant refers to the Courant–Friedrichs–Lewy stability condition. For 2D FDTD the time step must satisfy c·Δt/Δx ≤ 1/√2 ≈ 0.707, otherwise the simulation blows up. This page fixes the ratio at 1/√2 so the scheme stays stable and accurate.

Why don't waves bounce off the edges of the canvas?

A 10-cell absorbing layer rings the grid and gently damps the field as it approaches the boundary. This mimics an open, infinite domain so outgoing waves leave cleanly instead of reflecting back and contaminating the interior, much like the absorbing boundary conditions used in real FDTD solvers.

Is this physically accurate?

The core update is a faithful, textbook FDTD solver of Maxwell's equations and reproduces the correct physics of propagation, interference and diffraction. It uses normalised units (Δx = 1) and a simple absorbing layer rather than a full perfectly matched layer, so it is qualitatively accurate and excellent for learning rather than for precision engineering.

Where is FDTD used in the real world?

FDTD is a workhorse of computational electromagnetics. Engineers use it to design mobile-phone and radar antennas, model how waves scatter off aircraft, simulate photonic crystals and nanophotonic chips at optical frequencies, and study the absorption of radio waves in human tissue for safety standards.