⚡ Cosmic Electric Field Lab: 2D Potentials, Field Lines and Test-Charge Motion

The science

2D electrostatics. Line charges in a plane give E = k q r / (r^2 + ε^2) (a 1/r field) and potential φ = -(k q / 2) ln(r^2 + ε^2), summed over sources by superposition. ε is a softening length that removes the singularity at r = 0 (it smooths the point into a small core).

Test charges. Acceleration a = (Q/m) E, integrated with kick-drift-kick leapfrog, a symplectic scheme: energy per mass ½ v^2 + (Q/m) φ oscillates but does not drift. The energy plot and the drift readout show this. Negative Q/m is attracted to positive sources.

Gauss's law in 2D. The flux of E through a closed loop is 2π k Σ q_enclosed; the field is curl-free, so its circulation around any loop is 0. Both are verified numerically below by independent quadrature around a loop that encloses two of three charges.

Dipole far field. For charges ±q separated by d, on the axis φ ≈ k q d / R; the check compares the full superposition at R = 10.

Honest simplifications. Flat 2D, static sources, no magnetic field, no radiation, no collisions or interaction between test charges. Real cosmic plasmas are 3D and magnetised; here the only goal is to build intuition for potential, field lines and energy conservation. Units are dimensionless (k = 1).

What you are looking at

Charged sources create a field. Drag them, add more, and release test charges. Colour is the electric potential (red positive, blue negative), dark bands are equipotentials and white curves are field lines. This is the physics behind charge motion in plasmas and magnetospheres, simplified to a flat 2D world.

Presets

Parameters

x1

Live readouts

Independent numerical checks