loading...
running...
How to use
Three views. Plane wave: pick a preset or set the wavelength (log scale from kilometres to femtometres), polarization and amplitude and read frequency, photon energy, intensity and the Stokes state. Thin film: slide the film thickness and index; the pulse passes through and the plots show R(λ) from the simulation against the exact Airy curve. 2D field lab: choose a scene, change the wavelength, indices, slits or angles and watch the field. Space pauses, R resets. Try: the double slit with the display set to time-averaged intensity, the right-angle prism (total internal reflection), the waveguide just below and just above cutoff, the phased array at 0 and 25 degrees, and an anti-reflection film at 100 nm.
The science
Maxwell's equations in a source-free, lossless medium reduce to a wave equation for each field component. For a plane wave travelling along z with fields E(z,t) and B(z,t) perpendicular to z and to each other,
∂2E/∂z2 = με ∂2E/∂t2 ⇒ v = 1/√(με) = c/n, c = 1/√(μ0ε0) = 299 792 458 m/s, E0/B0 = c/n
The frequency f is set by the source and stays fixed, so entering a medium of index n shortens the wavelength to λ0/n and slows the phase to c/n. The energy flow is the Poynting vector S = E × H. Its magnitude oscillates at twice the optical frequency; the average is the intensity I = ½ n ε0 c E02, and an absorbing surface feels a radiation pressure I/c. A photon carries E = hf, which is how the X-ray presets reach tens of keV.
Polarization. Writing the transverse field as a Jones vector (Ex, Ey) with complex amplitudes, a relative phase of 0 or 180 degrees gives linear polarization, 90 degrees with equal amplitudes gives circular polarization, and anything else is an ellipse. The Stokes parameters S0 = |Ex|2 + |Ey|2, S1, S2 and S3 = 2 Im(Ex* Ey) give the ellipse orientation and handedness; the analyzer graph is I(θ) = ½(S0 + S1 cos 2θ + S2 sin 2θ), Malus's law for a general state. The wave picture is not to scale: 3.2 wavelengths are always drawn, whatever the real wavelength.
Thin films. The film view is a one-dimensional Yee finite-difference time-domain (FDTD) solution of ∂tE = (1/ε) ∂zH and ∂tH = ∂zE in cells of 5 nm with Courant number S = 0.5 and first-order Mur boundaries. A broadband pulse is sent at the structure, the field at a reflection probe is recorded with and without the film, the difference is the reflected pulse, and a discrete Fourier transform at every wavelength gives R(λ) and T(λ). For one film of index n2 and thickness d between media n1 and n3 the exact result is the Airy formula r = (r12 + r23 e2iβ)/(1 + r12 r23 e2iβ), β = 2π n2 d/λ, R = |r|2, drawn as the grey line. A quarter-wave coating (n2 d = λ/4 with n2 = √n3) cancels the two reflections; real MgF2 (n = 1.38) on glass leaves about 1.3 % for this reason. The colour swatch weights the reflected spectrum with approximate display colours and is only indicative.
The 2D field lab. The third view solves the transverse-magnetic Maxwell equations ∂tEz = (1/ε)(∂xHy − ∂yHx), ∂tHx = −∂yEz, ∂tHy = ∂xEz on a 300 x 190 Yee grid (S = 0.5, the stability limit is 1/√2). Glass is a map of ε = n2 averaged over 3 x 3 sub-cells at the edges; metal is a perfect conductor (Ez = 0). The border is a graded absorbing layer whose electric and magnetic losses are matched, so it absorbs without reflecting at normal incidence. Everything you see (Snell refraction, total internal reflection, double-slit fringes, lens focus, the parabolic dish, waveguide cutoff at λc = 2w and phased-array steering) emerges from those two update lines; the theory rows in the readout are the analytic predictions for comparison.
Numerical checks run in the page. (1) The FDTD reflectance of one glass surface against (n−1)2/(n+1)2; (2) the FDTD film spectrum against the Airy formula at eight wavelengths; (3) R + T = 1 for a lossless coating; (4) the TM110 resonance of a closed 40 x 30 cell metal cavity against ω = π c √(1/a2 + 1/b2); (5) conservation of that cavity's energy over 24 000 steps; (6) c from the vacuum constants; (7) the average of |E|2 over one period against S0/2.
Simplifications. Materials are lossless and dispersion-free in the FDTD views (real glass has n(λ), see the 3D bench); the film view is normal incidence; the 2D lab is scalar TM with a 20-cell wavelength, so numerical dispersion is below 1 %, and fringe profiles close to the slits are in the Fresnel (near-field) regime, so the Fraunhofer curve is a far-field guide, not an exact fit. The absorbing layer leaves about one percent of residual reflection at grazing angles. Wavelengths in the analytic view are real; the drawing is a schematic.