☀️ Magnetic Reconnection — Solar Flares & Substorms
Oppositely directed magnetic field lines break and reconnect at an X-point, explosively converting magnetic energy into plasma kinetic energy — the engine of solar flares.
About this simulation
This simulation animates a simplified 2D resistive magnetohydrodynamic (MHD) model of magnetic reconnection: an analytic Harris-like current sheet with Bx = B0·tanh(y/δ), where the sheet half-width δ is derived every frame from the Sweet-Parker balance δ/L = 1/√S. The Lundquist number S = L·v_A/η compares the Alfvén crossing time to resistive diffusion, so raising resistivity η instantly narrows S, widens the diffusion region, and speeds up the reconnection rate that opens a small reconnecting field component at the X-point. Plasma particles are spawned in the inflow, cross the diffusion region, then get kicked outward near the local Alfvén speed v_A = B0/√ρ, visualising energy converting from magnetic to kinetic in real time.
🔬 What it shows
An X-point current sheet where oppositely directed field lines (traced live with RK2 streamline integration) reconnect and snap outward into two plasma jets, while the energy bars track the live conversion from stored magnetic energy to plasma kinetic energy as the reconnection rate rises and falls with the Sweet-Parker target.
🎮 How to use it
Drag the four sliders — Resistivity η, Field strength B₀, Inflow drive, and Plasma density ρ — to reshape the sheet and jets live. Toggle Field lines vs. Current |J| to switch views, click or tap near the X-point to give the sheet a manual "poke" that briefly boosts the reconnection rate, and use Pause/Reset or the Info button for the full equation reference.
💡 Did you know?
In the solar corona the Lundquist number can reach 10¹² or higher, so the classic Sweet-Parker rate of 1/√S predicts reconnection so slow it would take months — yet real flares release up to 10²⁵ joules and finish in minutes, which is why solar physicists had to find faster mechanisms like plasmoid-mediated reconnection.
Frequently asked questions
Why does the magnetic field use a tanh profile in this simulation?
Bx = B0·tanh(y/δ) is the classic Harris sheet: it smoothly reverses sign across the mid-plane (positive above, negative below) while staying nearly uniform far from y = 0, which is exactly the reversed-field geometry that sets up a current sheet and X-point. It is a standard analytic stand-in for the field configuration that MHD simulations of reconnection produce numerically.
How does the resistivity slider actually change the reconnection rate?
Resistivity η enters the Lundquist number S = L·v_A/η on the bottom, so turning η up lowers S. The code's Sweet-Parker rate function returns drive/√S, so a lower S directly raises the target reconnection rate, which also widens the diffusion-region half-width δ ∝ 1/√S used to draw the current sheet and set the field profile.
What do the two energy bars represent?
The magnetic energy bar decreases at a rate proportional to the current reconnection rate (energy converted ≈ recRate × 0.9 × dt each frame), while the kinetic energy bar is computed directly from the live velocity of every plasma particle on screen. Together they show magnetic energy being converted into the kinetic energy of the outflow jets as the simulation runs.
Why can I click or tap on the canvas?
Clicking or tapping near the mid-plane (within 0.35 simulation units of y = 0) manually nudges the reconnection rate upward by a small amount that fades with distance from the click's x-position. It is a quick way to simulate a local disturbance triggering faster reconnection, similar to how a perturbation can seed the onset of a real reconnection event.
What is the difference between the Field lines and Current |J| views?
Field lines mode traces magnetic streamlines with RK2 integration from the left and right edges, colouring the upper (blue) and lower (orange) reversed regions separately so you can see them bend into the X-point. Current |J| mode instead renders a heat map of |∇×B|, computed from the sech²(y/δ) derivative of the tanh profile, which peaks exactly on the thin current sheet at y = 0.
Oppositely directed magnetic field lines break and reconnect at an X-point, explosively converting magnetic energy into plasma kinetic energy — the engine of solar flares.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install