About this simulation

What the model solves

Plasma is a two-dimensional, WebGPU-native magnetohydrodynamics simulator. The evolved state is the conservative MHD state: mass density, three momentum components, total energy, two face-centered in-plane magnetic-field components, and an out-of-plane magnetic field. The display is two-dimensional, but the velocity and magnetic field are 2.5D, so out-of-plane shear and guide-field dynamics can still participate in the energy budget.

The base equations are ideal MHD with resistive and source-term extensions. In conservative form, the system couples fluid advection, thermal pressure, magnetic pressure, and magnetic tension. Optional source layers add radiative cooling and heating, anisotropic conduction, Hall electromotive force, ambipolar diffusion, Biermann battery generation, viscosity, self-gravity, cylindrical geometry terms, and sponge damping near selected boundaries. The canonical verification presets keep these source terms off except for guard flags, while the extended and driven-boundary presets opt into them explicitly.

Numerical method

The hyperbolic step is finite-volume MHD. Primitive states are reconstructed with piecewise parabolic reconstruction, then limited in characteristic variables. Intercell fluxes come from the HLLD approximate Riemann solver, with HLLC and HLL fallbacks for degenerate wave fans. Time integration uses the three-stage SSP RK3 scheme, with one macro timestep reused across all RK stages.

The magnetic field uses constrained transport. The in-plane magnetic components live on cell faces, and the update applies the curl of a corner-centered electric field. This is the discrete reason the scheme preserves div B: the face-difference divergence of a curl cancels by matching edge contributions with opposite signs. The EMF has two modes: the older Balsara-Spicer arithmetic average and the Gardiner-Stone upwind form, with the upwind form used by default.

Resistivity is applied as curl(eta J) on the same staggered grid, so it shares the divergence-preserving structure of constrained transport. Stiff source terms use exact integration, subcycling, or explicit stability reductions depending on the term. The current implementation still uses operator splitting after the main hyperbolic and resistive step; Strang splitting and larger implicit or super-time-stepped source solvers are still future work.

Presets and diagnostics

Orszag-Tang starts from a smooth periodic vortex and quickly produces shocks, magnetic islands, and current sheets. Harris current sheet is pressure-balanced and lets reconnection develop around a perturbed sheet. Brio-Wu and Sod isolate one-dimensional shock-tube behavior. The Hall whistler, conduction front, cooling instability, and Jeans presets isolate individual source terms. Driven wind + cloud uses a fixed west inflow and open boundaries to exercise the newer boundary and microphysics stack.

The default scalar view is out-of-plane current density J_z because it makes reconnection and sheet formation visible. Other views show density, pressure, velocity magnitude, magnetic-field strength, temperature, heat flux, gravitational potential, and the dual-energy entropy proxy K = p / rho^gamma. Animated line integral convolution stays active over scalar views, so the magnetic-field topology remains visible while inspecting thermodynamic or transport diagnostics.

Prerequisites

The simulation runs without any background, but the diagnostics land best with vector calculus (gradient, divergence, and curl), an introductory grasp of fluid dynamics and conservation laws, and electromagnetism through Maxwell's equations and the Lorentz force. Familiarity with hyperbolic conservation laws, Riemann problems, and finite-volume discretization helps in reading the numerical-method notes, but is not required to explore the presets. A modern desktop browser with WebGPU enabled (recent Chrome, Edge, or Safari 26+) is needed to run the GPU compute pipeline.

Learning outcomes

Accessibility

The simulator can be paused, stepped, reset, and driven from keyboard-reachable controls. The UI uses ARIA labels for the canvas, toolbar, sidebar, and probe controls; the site theme toggle provides light and dark contrast modes. The simulation is animated and visually dense, but it has no sound and no flashing-light dependency. If motion is uncomfortable, pause the simulation and use single-step mode.

References

See also

For related simulations on the same site, see geon for relativistic field dynamics, shoals for stochastic finance and risk, cyano for biological patterning, and gerry for district geometry.