Direct coil predictors for Coilstellaration
Networks for the Coilstellaration benchmark, which asks for a stellarator coilset given a plasma boundary and four engineering targets. Each file maps the boundary's Fourier coefficients and the targets to the Fourier coefficients and currents of the coils in one forward pass, and none holds a loop.
| File | Tracks | What it is |
|---|---|---|
model.onnx |
fixed_shape |
a residual multilayer perceptron |
corrected.onnx |
fixed_shape |
that network followed by a corrector network, which reads the field error and clearances of the first network's coilset and returns a change to it |
variable.onnx |
fixed_shape, variable_shape |
one residual multilayer perceptron for the dataset's 17 shapes |
corrected_variable.onnx |
fixed_shape, variable_shape |
a network of that kind followed by a corrector network, which also reads the gradient of the requirement penalties |
The networks were trained on the training split of proxima-fusion/coilstellaration, on the benchmark's four requirements computed for their own outputs by a differentiable model of the metrics, with boundaries blended from pairs of training boundaries beside the split's own. A twentieth of the training boundaries were held out for model selection, and the benchmark's eval split was not read. The Python files are the training and export code.
Interface
The graphs follow the benchmark's ONNX contract. Their inputs are boundary_r_cos and boundary_z_sin (float32, [5, 9]), requirement_metrics (float32, [4]), and n_field_periods and n_coils_per_half_period (int64 scalars). Their outputs are coil_x_n, coil_y_n and coil_z_n (float32, [n_coils, 15], Fourier order 7 in DESC's [sin(7) .. sin(1), const, cos(1) .. cos(7)] layout) and currents (float32, [n_coils], amperes). model.onnx and corrected.onnx are for three field periods and five coils; the other two take any of the 17 shapes.
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
session = ort.InferenceSession(hf_hub_download("phanerozoic/coilstellaration-direct", "variable.onnx"))
r_cos = np.zeros((5, 9), np.float32)
z_sin = np.zeros((5, 9), np.float32)
r_cos[0, 4], r_cos[1, 4], z_sin[1, 4] = 1.0, 0.15, 0.15
coil_x_n, coil_y_n, coil_z_n, currents = session.run(
["coil_x_n", "coil_y_n", "coil_z_n", "currents"],
{
"boundary_r_cos": r_cos,
"boundary_z_sin": z_sin,
"requirement_metrics": np.array([0.4, 0.8, 3.0, 0.05], np.float32),
"n_field_periods": np.asarray(4, np.int64),
"n_coils_per_half_period": np.asarray(6, np.int64),
},
)