Computing Library › Visualization & Interfaces
Visualization & Interfaces

Magnetic Field-Line Tracing

Following field lines through a magnetic configuration reveals confinement structure, flux surfaces, and where confinement breaks down.

A specialized streamline

Tracing a magnetic field line is integrating dx/ds = B(x)/|B|, following the field direction through space. It is a streamline problem, but the physics gives it special meaning: in a confined plasma, field lines lie on nested flux surfaces, and their behavior classifies the whole configuration.

What the traces show

Poincare plots

Rather than draw tangled 3D curves, one records each crossing of a field line through a chosen poloidal plane over many transits. Points that fall on a closed curve indicate an intact flux surface; scattered points indicate island chains or stochasticity. This is the standard, information-dense view of magnetic topology.

Numerical care

Field lines are sensitive to integration error; a small step and an accurate scheme are needed to distinguish a true surface from numerical diffusion. The field itself comes from an equilibrium or a coil model, so the trace is only as good as the field.

python

def field_line_step(x, B, ds):
    b = B(x); b = b/np.linalg.norm(b)
    return x + ds*b  # use RK4 in practice

Kronos use

Field-line tracing and Poincare sections visualize the simulated confinement geometry of the breeder tokamak and the burner mirror, showing where surfaces are intact.