(The aspiration. torux is in development, and vacuum only for now: no finite pressure.)
The method · Usage · What is checked · Results
Coils in, vacuum flux surface out: max |B·n|/|B| of 10⁻¹⁵, in seconds, with nothing to tune.
It has done that for 231,878 of the 371,701 coil sets in QUASR, starting from the surfaces stored with each. A second field evaluator, sharing no code with the solver's, checked every one. For 5,206 more it returned a certificate that the surface asked for cannot exist, a theorem with its hypotheses checked numerically, and for another 846 a weaker one. It never guesses: the other 133,771 it calls undetermined, three in four of them after a solve of under a minute.
Above: twelve kinds of magnet, one solver. Nine carry the surface torux verified for them, drawn as light. The other three (a tokamak's poloidal coils, its perturbation coils, a levitated dipole) carry none, and that is an answer too: their field lines, the thin grey ones, never go round the machine, so no surface can enclose toroidal flux, and torux proves it. (A tokamak's surfaces need the current in its plasma, and a dipole holds its plasma on the closed lines themselves.) Each one, close up. Draw one yourself: uvx torux render quasr:954 mine.png.
Three hundred coil sets drawn at random from QUASR. Every tool gets the same coils, the same requested flux and an hour on four threads for each. The other five need settings, and we chose them: the route each tool's documentation recommends, pushed wherever that paid on six coil sets outside the 300. torux has no settings to choose. One judge: an evaluator that shares no code with any of them, working in extended precision at 4,000 random points of each surface. A dot is a coil set, placed at the largest |B·n|/|B| on its surface. How each tool was run, and how to run a row again.
torux's surfaces have a median max |B·n|/|B| of 1.1 × 10⁻¹⁵, within 2.9 times what an exact surface written in double precision reads. The worst of its 201 is at 6.8 × 10⁻¹⁵. On the 199 coil sets both solved, the closest tool, SIMSOPT BoozerExact, is 700,000 times higher: 5 orders of magnitude. The surfaces the designs are stored with, where every solve starts, are at 8.9 × 10⁻⁴: they are coarse, a few hundred Fourier terms each, where torux's take thousands. Every dot is a row of results/compare300.csv.
| surfaces returned | median max |B·n|/|B| | within 10⁻¹² | median seconds | |
|---|---|---|---|---|
| torux | 201 of 300 | 1.1 × 10⁻¹⁵ | 201 | 4.2 |
| SIMSOPT BoozerLS | 283 of 300 | 2.4 × 10⁻⁸ | 38 | 824 |
| SIMSOPT BoozerExact | 288 of 300 | 2.7 × 10⁻⁸ | 51 | 67 |
| SIMSOPT QFM | 297 of 300 | 3.3 × 10⁻⁷ | 14 | 1,770 |
| VMEC++ | 252 of 300 | 9.4 × 10⁻⁴ | 0 | 1,525 |
| DESC | 199 of 300 | 2.6 × 10⁻³ | 0 | 885 |
| QUASR's stored surface | 300 of 300 | 8.9 × 10⁻⁴ | 0 |
Nobody needs fifteen digits of a flux surface. What you need is never to wonder whether the surface is wrong or the solver. And at this precision "there is no surface" stops being a solve that failed and becomes an answer torux can certify: 22 of these 300, and 16 more by its weaker kind of certificate. The other 61 stayed undetermined.
The same 300 coil sets on one processor (AMD EPYC 7742), four threads each. A dot is a surface a tool returned, placed at the time at which the tool had it, the tool's own checks included. torux: 4.2 s in the median, and then it stops. The others were set to spend their hour on accuracy and go on working after the surface they return, VMEC++ and SIMSOPT QFM nearly always until the hour ends: that later time is not counted here.
- SIMSOPT BoozerExact: 67 s. On the 199 coil sets both solved it was faster on 12 and more accurate on 0.
- SIMSOPT BoozerLS: 824 s. On the 199 coil sets both solved it was faster on 2 and more accurate on 0.
- DESC: 885 s. On the 141 coil sets both solved it was faster on 0 and more accurate on 0.
- VMEC++: 1,525 s. On the 177 coil sets both solved it was faster on 1 and more accurate on 0.
- SIMSOPT QFM: 1,770 s. On the 199 coil sets both solved it was faster on 0 and more accurate on 0.
The surface is a Fourier series: R and Z in cos and sin of mθ − nNfpφ, the series VMEC, DESC and SIMSOPT read. φ is the cylindrical angle and θ the poloidal angle in which field lines are straight. The coefficients and ι are the unknowns of one square system, solved by Newton's method on the coils' Biot-Savart field: no finite elements, and no fit to traced lines. Where a flux surface exists it is the quadratic-flux-minimising surface, in the one parameterisation where field lines are straight.
The method, in five figures: the equation, the start the solver makes for itself from the magnetic axis, why the answer reaches rounding error, and the certificates that there is no surface.
pip install torux # or: conda install -c conda-forge torux
torux solve quasr:954
uvx torux solve quasr:954 # or run it once, with nothing installedsurface verified: the solver's check and an independent evaluator agree
toroidal flux 0.069106905814 Wb
rotational transform -0.0975229741144
radii major 0.999994679 m, minor 0.150000523 m, aspect ratio 6.66661
volume 0.444132929 m^3
Fourier series M, N = 48, 32, with 2 field periods
field across it 1.1e-15 of |B| (the solver's own check)
independent check 3.3e-15 of |B| across it, and the same flux to within 8e-16
time 0.7 s
The first run compiles for up to a minute. After that, seconds.
Every answer is one of three. A surface, which a second field code sharing none with the solver's has checked at 4,096 random points. No surface, with a certificate: the island chain or the edge of confinement that forbids it, and the flux it rules out. Or undetermined, never a guess.
import torux
s = torux.solve("coils.json", minor_radius=0.15) # or flux=0.07 (Wb), volume=0.44 (m³), largest=True
print(s) # what it found and how it was checked, or why there is no surface
s.iota, s.volume, s.aspect_ratio # the numbers
s.save("input.mine") # a VMEC input: VMEC, VMEC++, DESC and SIMSOPT read it
s.plot("mine.png") # the first picture below
s.render("hero.png") # the second: the answer drawn as the machines at the top, cut open or closed
s.poincare().plot("lines.png") # the field's own lines through planes of constant φ, the surface among them
s.boozer().quasisymmetry # |B| in Boozer angles, and how far it is from quasi-symmetry
torux.check("coils.json", "wout_other.nc") # a surface from another code: how much of the field crosses it
torux.many(files, table="answers.csv") # a folder of designs, one row each
Nothing to tune: torux asks for no resolution, no tolerance and no starting guess. More time (budget_s) can settle more. The coils are a file (SIMSOPT and QUASR JSON, MAKEGRID, FOCUS, permanent magnets, wireframes, a tokamak's coils), a QUASR design by its number, or a SIMSOPT or DESC object you already hold. Usage and formats. The method and what is checked, and by what.
Outside a finite-beta plasma: give torux the plasma's boundary and its current (SurfaceCurrent) with the coils, and it returns the verified flux surface of the field outside the plasma, as in vacuum, or says why there is none it can verify. Outside a plasma. Release notes.
Used torux? Say so, so the next person finds it:
Flux surfaces computed with torux.
@software{bogdan2026torux,
author = {Bogdan, Philipp},
title = {torux: vacuum flux surfaces at the limit of double-precision arithmetic},
year = {2026},
url = {https://github.com/philippbogdan/torux}
}Public domain, CC0 1.0, all but the picture of the twelve machines: six of them are drawn from files under GPL, LGPL and CC BY licences, and those renderings stay under their sources' terms. The coil sets torux was run on are other people's work, under their own licences: credits.