Devlog #58 – Wave 38: Faraday’s Law, Power Grid & Photonic Crystal

Wave 38 spans electromagnetism, power engineering, and photonics: an interactive Faraday induction demo where you physically drag a bar magnet through a coil and watch the EMF trace build on a phosphor oscilloscope, a DC power-flow grid simulator that lets you trigger cascade failures across three network topologies, and a 1D photonic crystal where you tune the layer stack and instantly see the photonic bandgap open or close on an exact Transfer Matrix Method transmission spectrum. All three ship with full Ukrainian translations on launch day.

Release Stats

487
Total simulations
58
Devlog entries
38
Release waves
1693
Sitemap URLs

New Simulations

🧲

Faraday’s Law

A bar magnet moves through an N-turn coil. A layered-ellipse coil drawing shows all turns (up to 12 rendered), with a Lenz arrow on the top turn flipping direction as the field changes. A green phosphor oscilloscope traces either the induced EMF or the magnetic flux Φ live. Drag mode lets you push the magnet by hand; auto mode oscillates it at a selectable frequency and amplitude.

Open Faraday’s Law →

Power Grid

DC power-flow simulation on three grid topologies: Ring (8 nodes), Mesh (12 nodes), and Radial (10 nodes). A Gauss-Seidel solver on the susceptance matrix finds voltage angles θ and line flows P = (θfrom−θto)/x in 80 iterations. Animated flow dots move along colour-coded lines (green/yellow/red by load %). The Cascade button simulates overload trips and re-solves up to 20 times.

Open Power Grid →
💡

Photonic Crystal

A 1D Bragg mirror with N periods of alternating high-n and low-n dielectric layers. The Transfer Matrix Method sweeps 300–1200 nm and plots the exact transmission spectrum T(λ). The photonic bandgap is highlighted in violet. A wave animation below the spectrum shows evanescent decay inside the gap vs. free propagation outside. Includes GaAs/AlAs, TiO2/SiO2, Si/Air, and UV stack presets.

Open Photonic Crystal →

Faraday’s Law — Design Notes

Dipole Field Model

The axial field of the bar magnet is modelled as a magnetic dipole along the coil axis. The effective on-axis field at displacement z from the coil centre is:

where R is the coil radius and m is the magnetic moment (a product of the adjustable strength slider). The flux through the coil is Φ = N · πR² · Beff(z) and the EMF follows Faraday’s law directly: ϵ = −dΦ/dt = −N πR² (dBeff/dz) v. The spatial derivative is computed analytically via the chain rule, giving smooth, exact values at any magnet velocity.

Lenz’s Law Indicator

The curved arrow drawn on the top coil ellipse reverses direction whenever the flux is increasing vs. decreasing. The arrow colour shifts from amber (positive EMF) to teal (negative EMF), and the stats panel reports “CW” or “CCW” for the induced current direction. At zero velocity (magnet stationary) the arrow disappears and the panel shows “—”.

Oscilloscope Trace

A 320-sample ring buffer accumulates values at a capped rate of one sample per 16 ms. The scope auto-scales its vertical range to the peak absolute value in the buffer, so the trace always fills the screen regardless of the signal amplitude. The green phosphor aesthetic uses shadowBlur = 6 with colour #4ade80 on a very dark background, matching classic analogue oscilloscope displays.

Power Grid — Design Notes

DC Power Flow & Gauss-Seidel Solver

The simulator implements the standard DC (linearised) power flow approximation. For a network with n buses, the susceptance matrix B is built as:

The voltage angle vector θ satisfies Bθ = P. The Gauss-Seidel update θi = (Pi + Σj B[i][j] θj) / B[i][i] is iterated 80 times with the slack bus (first generator) pinned at θ = 0. Line flows are then Pij = (θfrom − θto) / xij. The DC approximation ignores reactive power and voltage magnitude variation, making it suitable for didactic exploration of grid topology and loading.

Topologies

Three network types illustrate fundamentally different failure behaviours:

Cascade Failure

After each solve step, every line with |Pij| > 1.05 × capacity is tripped. The system is then re-solved with the remaining network. This repeats for up to 20 rounds with a 400 ms visual delay between rounds, letting you watch the cascade propagate. Isolated buses (no active line connections) are greyed out and their load demand registered as unserved. The “Served %” statistic tracks what fraction of total load demand is currently met.

Photonic Crystal — Design Notes

Transfer Matrix Method

For a stack of dielectric layers at normal incidence, each layer of refractive index n and thickness d contributes a 2×2 transfer matrix:

The total matrix M is the product of all layer matrices. The transmission coefficient is then:

The simulation sweeps 400 wavelength points between 300 and 1200 nm, allowing real-time response to slider changes. All arithmetic is performed with explicit complex-number pairs [re, im] to avoid any dependency on a complex number library.

Quarter-Wave Condition

The bandgap is widest when each layer satisfies the quarter-wave condition nd = λc/4, giving maximum constructive interference for reflected waves. The default slider positions set exactly this condition at the chosen centre wavelength λc. The fill ratio slider deviates from the quarter-wave condition, narrowing the gap asymmetrically and revealing the precise dependence of bandwidth on layer thickness ratio.

Wave Animation

Below the spectrum, a 1D wave animation illustrates the physics at the probe wavelength λ (orange slider). If λ is inside the bandgap, the wave amplitude decays exponentially through the crystal as exp(−z / ldecay) and the wave turns red — evanescent behaviour analogue to quantum tunnelling in a potential barrier. If λ is outside the gap, the wave propagates through at full amplitude in purple, with a transmitted wave at right whose amplitude reflects the computed T.

Presets

Four built-in presets match real photonic crystal systems:

Technical Notes

All three simulations are self-contained single-page HTML5/CSS/JS files with zero external dependencies. The Transfer Matrix sweep of 400 wavelength points over N=8 × 2 layers completes in under 5 ms per update, allowing direct slider feedback without debouncing. The Gauss-Seidel power flow converges in under 2 ms for the largest topology (12 buses, 14 lines). Faraday induction physics is analytical — exact EMF at every frame with no numerical integration required.

Tags

Electromagnetism Faraday’s Law Lenz’s Law EMF Power Systems DC Power Flow Cascade Failure Gauss-Seidel Photonics Photonic Crystal Bandgap Transfer Matrix Method Bragg Mirror Wave 38