The Sun constantly blasts charged particles outward at 400–800 km/s.
Earth's magnetic dipole deflects this stream, carving out a cavity
called the magnetosphere — complete with a bow shock, magnetopause,
magnetosheath, and magnetotail. When the interplanetary magnetic
field (IMF) turns southward, magnetic reconnection allows particles
to funnel down field lines, lighting up auroras at the poles.
Bow shock: where the supersonic solar wind
abruptly decelerates to sub-Alfvénic speeds. Standoff distance ≈
14 RE upstream. Visualised in orange.
Magnetopause: the pressure-balance boundary
between the magnetosheath (compressed solar wind plasma) and the
inner magnetosphere. Described by the Shue (1997) model: r = r0
(2/(1+cos φ))α, r0 ≈ 10–12 RE, α
≈ 0.58. Visualised in blue.
IMF Bz: when the interplanetary magnetic field points southward (Bz
< 0), it anti-parallels Earth's dayside field — enabling
magnetic reconnection. Particles enter the polar cusps
and precipitate toward the poles, producing auroras. Raise the
storm / CME activity to see this.
🌞 Solar Wind & Magnetosphere
About this simulation
This simulation models how the supersonic solar wind — a stream of charged particles
flung from the Sun at 400–800 km/s — slams into Earth's magnetic dipole and is sculpted
into the magnetosphere. Understanding this coupling is the heart of space weather
forecasting, which protects satellites, power grids, and astronauts from geomagnetic
storms. It is also what paints the auroras across polar skies.
How it works
The Sun glows on the left and emits a flowing stream of charged-particle solar wind.
The wind is advected fractional-Brownian-motion (fBm) plasma rendered entirely in a GLSL fragment shader.
Earth's dipole carves a bow shock, a compressed dayside magnetopause, and a stretched magnetotail.
When storm / CME activity is high, the magnetosphere compresses and aurora ovals brighten at the poles.
Key equations
r = r0 * (2/(1+cos phi))^alpha — the Shue (1997) magnetopause model, where
r0 ≈ 10–12 RE is the subsolar standoff distance, phi is the angle from the
Sun–Earth line, and alpha ≈ 0.58 sets the flaring of the boundary. The standoff shrinks
as solar-wind dynamic pressure (density × speed²) rises.
Controls
Solar wind speed (vsw) (300–800 km/s): faster wind compresses the magnetopause closer to Earth.
Earth field strength: a stronger dipole pushes the magnetopause and bow shock further out.
Wind density: scales how dense and bright the plasma stream is.
Storm / CME activity & Solar storm!: brighten the aurora and compress the magnetosphere.
Pause / Reset: freeze the animation or restore default parameters.
Did you know?
The magnetopause can be pushed inside geostationary orbit during severe storms, leaving
communications satellites briefly exposed to raw solar wind plasma.
About the Solar Wind & Magnetosphere Shader
This simulation renders Earth's magnetosphere as a single real-time GLSL fragment shader — there is no particle system, only closed-form geometry evaluated per pixel. Each frame, a magnetopause standoff distance r0 is derived from the solar wind's dynamic pressure (density × (speed/400)²) and Earth's dipole strength, then swept into a Shue (1997)-style boundary r = r0·(2/(1+cosφ))0.58, with the bow shock traced at 1.32×r0. Fractal Brownian motion (fBm) noise advects the plasma stream and bends it around the dayside boundary, while a wedge-shaped magnetotail stretches away from the Sun. A synthetic Kp index, driven by wind speed and storm/CME activity, brightens two auroral ovals near the poles.
What You're Looking At
What it shows
Bow shock, magnetopause, magnetosheath, and a stretched magnetotail — all traced from closed-form boundary equations rather than simulated particles. Two auroral ovals brighten near the poles when the synthetic Kp index climbs.
How to use it
Drag wind speed, Earth field strength, wind density, and storm/CME activity to reshape the magnetosphere in real time. Hit Solar storm! to spike activity to maximum and watch it decay back to baseline over the following seconds.
Did you know?
During severe geomagnetic storms the real magnetopause can compress inside geostationary orbit (~6.6 Earth radii), briefly exposing communications satellites to unshielded solar wind plasma — exactly the compression this shader's standoff formula models.
Frequently Asked Questions
What is the Shue magnetopause model used here?
The shader's magnetopause(phi, r0) function implements a Shue (1997)-style boundary, r = r0·(2/(1+cosφ))α with α = 0.58, where φ is the angle from the Sun–Earth line and r0 is the subsolar standoff distance. A guard clamps the denominator max(1+cosφ, 0.18) near the tail to avoid a singularity as φ approaches π. The bow shock reuses the same formula with r0 scaled by 1.32, since the shock stands further upstream than the magnetopause itself.
Why does the magnetopause shrink when I increase wind speed or density?
The standoff() function computes a dynamic pressure term press = density × (speed/400)², then sets r0 = 0.42 × (fieldStrength / (press × storm))1/6, clamped between 0.16 and 0.62 screen units. Because press sits in the denominator under a sixth root, faster or denser wind raises the pressure and shrinks r0 — a soft echo of the real pressure-balance relation that sets Earth's actual magnetopause distance.
How is the synthetic aurora Kp value calculated?
Two related formulas run in parallel: the on-screen readout uses kpLevel() = storm×7 + ((speed−300)/500)×2, clamped to 0–9 to mimic the real geomagnetic Kp scale, while the shader itself computes kp = 0.3 + storm×0.9 + ((speed−300)/500)×0.4 to set how strongly the two polar auroral ovals brighten. Both rise with storm/CME activity and solar wind speed, so pushing either slider — or hitting Solar storm! — lights the poles up faster.
Is this a real particle simulation of the solar wind?
No — the entire scene, including the Sun's glow, the plasma stream, the bow shock and magnetopause arcs, the magnetotail, Earth, and the aurora, is painted analytically inside one GLSL fragment shader running on a full-screen quad. Fractal Brownian motion (fbm) noise gives the plasma its turbulent, flowing look, but there are no individual charged particles being integrated through a magnetic field — the boundaries and glow are closed-form functions of position and time.
What shapes the magnetotail on the night side?
The tail half-width is tailHalf = r0 × (0.95 + 0.25×fieldStrength), and a night-side mask restricts the tail to the side of Earth away from the Sun (where d.x is negative). Within that wedge, a brighter "plasma sheet" glow is drawn at the tail's centreline, its intensity modulated by the same fbm noise function used for the upstream solar wind, so the tail shimmers rather than appearing as a flat triangle.