SPACE PLASMA SIMULATIONS

Understanding Magnetohydrodynamics, Numerical Methods, and Adaptive Mesh Refinement

— / 12 knowledge checks

What is Plasma?

Plasma is the fourth state of matter. Heat a gas enough and electrons break free from their atoms, leaving a soup of ions and free electrons. This electrically charged gas conducts electricity and responds to magnetic fields — which is what makes everything else on this page happen.

👆 Click a state to learn more.

⚡ 99% of the Visible Universe

Almost all visible matter is plasma — stars, nebulae, and the space between galaxies.

🌡️ Temperature

Hydrogen ionizes appreciably above ~10,000 K, but plasmas can also form at lower temperatures under the right conditions.

💡 Everyday Examples

Lightning, neon signs, welding arcs, and the Sun are all plasmas you have already met.

📐 Plasma, by the numbers

Visible matter that is plasma
~99%
Typical ionization temperature (hydrogen)
> 10,000 K
Solar core
~15 million K
Aurora altitude
100–300 km

What distinguishes a plasma from an ordinary gas?

Roughly how much of the visible matter in the universe is plasma?

Magnetohydrodynamics (MHD)

MHD combines three pieces of physics — magnetism, fluid dynamics, and electricity — to describe how electrically conducting fluids like plasma interact with magnetic fields.

Field lines (frozen into the flow)Ions (+)Electrons (−), 6× faster

The flow is fastest mid-channel, dragging the field lines with it (frozen-in). Raise the field strength: magnetic tension (∝ B²) straightens the lines and shrinks the gyroradius (rg ∝ 1/B).

The Key Idea: “Frozen-In” Flux

In a highly conductive plasma, magnetic field lines are “frozen” into the fluid. When the plasma moves, it carries the field with it; when the field is bent, its tension pushes back on the plasma. Field and fluid move as one.

∂B/∂t = ∇ × (v × B)

The ideal-MHD induction equation: the magnetic field B changes in time only through being carried and deformed by the plasma velocity v. No slipping, no diffusion — that is the frozen-in condition.

📐 Scales of gyration

Proton gyroradius (solar wind, ~5 nT)
~80 km
Electron gyroradius (same field)
~2 km
Proton : electron mass ratio
1836 : 1
Solar-wind magnetic field at 1 AU
~5 nT (0.005% of Earth surface field)

In ideal MHD, what does "frozen-in flux" mean?

If you double the magnetic field strength B, a particle’s gyroradius…

Space Plasma Environment

Space is filled with plasma. From the solar windto Earth's magnetosphere, plasma physics drives the space weather that can disrupt satellites, power grids, and astronauts. Explore the 3D scene below — or take the guided tour.

· · ·
View:

☀️ CME Storm — predict first, then watch

A coronal mass ejection is about to hit with ~8× the normal solar-wind pressure. Your prediction: what happens to the magnetopause (the boundary at the nose)?

Commit to a prediction to unlock the launch button.

🖱️ Drag to rotate · scroll to zoom · right-click to pan · click any label to fly to it

☀️ Solar Wind

Plasma streams from the Sun at 300–800 km/s, carrying the interplanetary magnetic field through the whole solar system.

🛡️ Magnetosphere

Earth’s magnetic field carves a protective cavity that deflects most of the wind around the planet.

🌌 Magnetotail

Downstream, the wind stretches the field into a tail hundreds of Earth radii long — the reservoir that powers substorms.

✨ Aurora

Particles funnelled in near the poles strike the upper atmosphere, making oxygen and nitrogen glow.

📐 The real magnetosphere

Bow shock nose
~13–15 Re (Earth radii)
Magnetopause nose
~10 Re ≈ 64,000 km
Magnetotail length
> 100–1000 Re
Solar wind speed
300–800 km/s
Solar wind density at 1 AU
~3–10 protons/cm³
Sun–Earth distance
~23,500 Re (1 AU)
Plasmasphere outer edge
~4 Re
Van Allen belts
inner ~1.5–2 Re · outer ~3–6 Re

The 3D scene compresses these distances ~2–3× (and the Sun ~2000×) so everything fits in one view.

What sets the location of the magnetopause?

Why does a bow shock form upstream of Earth?

Numerical Simulation Methods

The MHD equations are far too complex to solve by hand. Instead we use numerical methods: divide space into a grid of cells and march the solution forward in small steps of time.

How It Works

  1. 1. Discretization: Divide space into small cells (the grid)
  2. 2. Initial conditions: Set starting density, velocity, pressure, magnetic field
  3. 3. Time stepping: Compute how values change in each cell
  4. 4. Flux calculation: Determine how quantities flow between neighbouring cells
  5. 5. Update: Apply the changes and advance to the next time step

Uⁿ⁺¹ᵢ = Uⁿᵢ − Δt/Δx (Fᵢ₊½ − Fᵢ₋½)

The demo runs exactly this finite-volume scheme with an upwind flux F = vU. Watch the pulse smear as it travels — that is numerical diffusion, an artifact of discretization that shrinks as resolution grows. Then push the Courant number C = vΔt/Δx past 1: the signal outruns the stencil and the scheme explodes. That is the CFL condition — the hard speed limit on every explicit simulation's time step.

The hidden constraint: ∇·B = 0

Nature has no magnetic monopoles: field lines never start or end, so the divergence of B is exactly zero everywhere. But a computer doesn't know that. Discrete derivatives carry truncation errors, and step by step those errors accumulate into non-zero ∇·B — numerical magnetic monopoles that exert unphysical forces along the field and can wreck a simulation.

MHD codes therefore control divergence deliberately: constrained transport staggers the magnetic field onto cell faces so the update keeps ∇·B = 0 to machine precision, while divergence cleaning adds a correction step that diffuses or propagates the error away. Every serious MHD code does one or the other.

real: closed lineserror: ∇·B ≠ 0 “monopole”

📐 Production simulation scales

Global MHD grid cells
10⁷–10⁹
Time step (explicit, global MHD)
~0.01–1 s
Hybrid-Vlasov (e.g. Vlasiator) memory
tens of TB
Typical run
thousands of CPU/GPU cores for days

What does the CFL condition (C = vΔt/Δx ≤ 1) guarantee in an explicit scheme?

Why do MHD codes need special care with ∇·B = 0?

Spherical Coordinates

Space physics usually trades rectangular (x, y, z) for spherical coordinates (r, θ, φ): the radius, the polar angle measured from the z axis, and the azimuth around it. Most things in space are, after all, spheres.

r=100, θ=45°, φ=45°

Why Spherical?

🎯 Natural Fit

The solar wind expands radially from the Sun; a radial grid aligns the cells with the flow.

📊 Better Resolution

Grid cells concentrate near the body, where the physics is sharpest, and grow with distance.

🌍 Boundary Conditions

Planetary and solar surfaces are spheres — boundaries become single coordinate surfaces.

The price: metric terms in every equation and a coordinate singularity at the poles — extra code complexity that the geometric fit usually justifies.

Why use spherical coordinates for space plasma simulations?

Adaptive Mesh Refinement (AMR)

AMR spends resolution only where it pays: fine cells at shocks and boundaries, coarse cells everywhere else. The result is the accuracy of a uniform fine grid at a tiny fraction of the cost.

Cells: 64 · a uniform grid at the finest size would need 1024

How AMR Works

  1. 1. Start with a base grid: A coarse resolution covers the entire domain
  2. 2. Detect features: Find regions with sharp gradients or important physics
  3. 3. Refine locally: Split those cells 2:1 into smaller children
  4. 4. De-refine: Merge cells back together once the feature moves away
  5. 5. Repeat: The mesh adapts continuously as the simulation evolves

💡 Efficiency Gain

A shock needing 1000×1000 resolution might occupy 1% of the domain. AMR delivers that resolution there with ~10,000 cells instead of 1,000,000 — and the saving compounds, because finer cells also demand smaller time steps (CFL!).

📐 What AMR buys you

Uniform 1000³ grid
10⁹ cells
Same accuracy with AMR (shock in ~1% of volume)
~10⁷ cells
Refinement ratio per level
2:1
Typical refinement levels in magnetosphere codes
5–10

What is the main advantage of adaptive mesh refinement (AMR)?

In standard block AMR, each refinement level…

Putting It All Together

Every piece now meets: MHD physics, spherical geometry, and AMR— solar wind against Earth's magnetosphere, with the refinement hierarchy overlaid on the domain. Even better: drive it with today's actual solar wind, measured upstream of Earth by NOAA's monitors at the L1 point.

· · ·
View:
Sun / solar windEarth's fieldShock frontAMR grid

Raise the wind speed and watch the bow shock move earthward — the AMR patches re-centre on it automatically, exactly as a production code's refinement criteria would.

A CME arrives and the solar-wind pressure jumps 8×. The dayside magnetopause…