Release Stats
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:
-
Beff(z) = (μ0 m) / (2π R3) / (1 + (z/R)²)²
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:
-
B[i][i] = Σj≠i 1/xij -
B[i][j] = −1/xijfor connected buses
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:
- Ring (8 nodes): every load has two supply paths. Single line trips degrade performance but rarely cause blackout. Two consecutive trips on adjacent lines can isolate a sector.
- Mesh (12 nodes): fully interconnected; highly resilient. Multiple simultaneous faults are needed to separate load from generation. Power flows re-route through surviving lines, often causing their overload in a cascade.
- Radial (10 nodes): tree topology typical of distribution networks. Any single line trip disconnects an entire downstream subtree — the most fragile topology.
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:
-
M = [[cos δ, (−i/η) sin δ], [−i η sin δ, cos δ]] - Phase:
δ = 2πnd/λ -
Admittance:
η = n cosθ(TE) orn/cosθ(TM)
The total matrix M is the product of all layer matrices. The transmission coefficient is then:
-
T = (ηs/η0) · |2η0|² / |η0M00 + η0ηsM01 + M10 + ηsM11|²
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:
- GaAs/AlAs — n = 3.5 / 2.9 at λc = 870 nm. Standard III-V semiconductor DBR mirror used in VCSELs.
- TiO2/SiO2 — n = 2.4 / 1.45 at 550 nm. Widely used in optical thin-film coatings and dichroic mirrors.
- Si/Air — n = 3.5 / 1.0 at 1000 nm. Maximum index contrast; even 4 periods achieve >99 % reflectance.
- UV Stack — n = 2.2 / 1.45 at 380 nm. UV mirror for fluorescence excitation optics.
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