Maxwell's curl equations solved on a 2D Yee grid via the
Finite Difference Time Domain (FDTD) method (TMz
mode: Ez, Hx, Hy). Unlike a pure
perfect-conductor sandbox, this version tracks a real per-cell
permittivity and conductivity, so painted glass genuinely refracts and
slows the wave, and painted lossy metal genuinely absorbs it.
Source
Material tool
PEC (total reflect)Dielectric (refracts)Lossy metal (absorbs)
Presets
Display
Simulation
Step0
Courant—
What this demonstrates
The FDTD method (Yee, 1966) solves Maxwell's curl
equations on a staggered spatial grid with leapfrog time-stepping.
Here each grid cell also carries a real relative permittivity
εr and conductivity σ, updated with the standard lossy-medium
FDTD equation CaE + CbcurlH. A perfect electric
conductor (PEC) forces Ez=0 and reflects the wave totally; a
dielectric slows the local wave speed by 1/√εr, bending
wavefronts at its boundary exactly as Snell's law predicts; a lossy
metal has finite conductivity and dissipates the field's energy as it
passes through, producing genuine absorption rather than a hard wall.
How to use
Point source: single oscillating dipole radiating circular wavefronts
Plane wave: coherent wave injected from the left edge
Pick a Material tool and drag on the canvas to paint that region; erase to clear it
Raise the dielectric's εr slider to bend light more sharply, just like a higher-index glass
Use Presets for an instant prism, plano-convex glass lens, double slit or absorbing wall
Did you know?
Real FDTD solvers assign every cell its own εr, μr
and σ this same way to model glass fibres, human tissue, or radar
absorbing paint — the update equation here is the textbook lossy-medium
form, just run on a small 2D grid you can paint on directly instead of
importing a CAD model.
About the 2D FDTD Simulator with Real Dielectrics and Conductors
This simulator solves Maxwell's curl equations on a 160×120 Yee grid with the Finite Difference Time Domain (FDTD) method, running the transverse-magnetic (TMz) mode: Ez, Hx and Hy evolve by leapfrog time-stepping. Unlike a pure perfect-conductor sandbox, every cell here carries its own relative permittivity εr and conductivity σ, updated with the standard lossy-medium FDTD equation Ez = CaEz + Cb·curlH. That single change is what lets painted glass genuinely refract the wave and painted metal genuinely absorb it, instead of just blocking it.
Pick a material with the Material tool — PEC forces Ez=0 and reflects totally, Dielectric slows the local wave speed by 1/√εr and bends wavefronts at its boundary the way real glass bends light, and Lossy metal carries a finite conductivity that dissipates the field's energy as it crosses. The Prism and Glass lens presets fill real triangular and lens-shaped dielectric regions so you can watch genuine Snell's-law refraction and focusing, not a drawn outline.
Frequently Asked Questions
How is this different from a simple reflect-only FDTD demo?
Most simple demos only support perfect electric conductors (PEC), which just block or bounce the wave. This simulator additionally tracks a real permittivity and conductivity per cell and runs the standard lossy-dielectric FDTD update, so it reproduces refraction (bending at a material boundary) and absorption (energy loss inside a lossy conductor), not just reflection.
What is happening physically when a wave enters the dielectric?
Inside a dielectric with relative permittivity εr, the wave travels at c/√εr instead of c. Because the wavefront crosses the boundary at an angle and slows down on one side, it bends — exactly the mechanism behind Snell's law and why the prism and lens presets focus and split the wave the way real glass would.
What is the lossy-medium update equation?
Each cell updates as Ez = CaEz + Cb·curl(H), where Ca and Cb depend on that cell's εr and σ. Ca < 1 when σ > 0, so energy decays as the wave crosses a lossy conductor; Cb shrinks with higher εr, which is what slows the wave inside a dielectric.
What do PEC, Dielectric and Lossy metal actually paint?
PEC paints a perfect electric conductor: Ez is forced to zero every step, so the wave reflects totally with no loss. Dielectric paints a region with the εr you set on the slider (glass-like, no conductivity), which refracts and slows the wave but does not absorb it. Lossy metal paints a region with finite conductivity, which absorbs energy from the wave as it passes, similar to radar-absorbing material.
What does the εr slider control?
εr is the relative permittivity of the next dielectric region you paint (or of the Prism/Glass lens presets). Higher εr slows the wave more inside that material and bends it more sharply at the boundary, the same way a higher refractive-index glass bends light more than window glass.
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, mimicking an open, infinite domain so outgoing waves leave cleanly instead of reflecting back and contaminating the interior.
What does the Courant value mean?
Courant refers to the Courant–Friedrichs–Lewy stability condition. The time step must satisfy c·Δt/Δx ≤ 1/√2 for the vacuum wave speed; since a dielectric only slows the wave further, this fixed ratio stays stable everywhere on the grid, painted or not.
Is this physically accurate?
The update equations are the textbook lossy-medium Yee-grid FDTD scheme, so the refraction, reflection and absorption you see are governed by the same physics as a professional solver. It uses normalised units and a simple absorbing layer rather than a full perfectly matched layer, so it is qualitatively accurate and ideal for learning rather than for precision antenna design.
Where is this kind of simulation used in the real world?
Engineers use FDTD with spatially-varying permittivity and conductivity to design optical fibres and photonic waveguides, model radar-absorbing coatings on aircraft, and simulate how radio waves are absorbed by human tissue for safety standards — all the same physics you are painting here, just on a much larger 3D grid.