Validation
Validation is performed against:
The reference
virtual-casingC++ implementation.SIMSOPT virtual casing tests and benchmarks.
Analytical or semi-analytical test cases (e.g., axisymmetric surfaces).
To keep these checks self-contained, the repository includes a small
subset of SIMSOPT test assets under tests/test_files/ (W7-X/QH
VMEC outputs and BNORM data) plus the input.QH_finitebeta VMEC
input under examples/inputs/. These files are used only for
validation and example runs.
Test Categories
Surface Operator Parity
FFT-based resampling and derivatives match C++ outputs.
Surface normals, dot/cross products, and area elements match dumps.
Kernel Parity
Laplace and Biot-Savart kernels match analytic formulas and reference scaling (
1/(4*pi)).
Boundary Integral Parity
Singular-corrected
LaplaceFxdUmatches reference at ~1e-3 relative error on small grids.Singular-corrected
LaplaceFxd2U(Hedgehog order 8) matches reference at ~5e-3 relative error on the GradB parity case.Baseline direct-sum
LaplaceFxdUmatches reference up to singular-correction errors.Double-layer self-test returns
0.5jump for constant density.
End-to-End Virtual Casing Parity
VirtualCasingTestDataB/GradB datasets are regenerated in JAX and matched against C++ dumps (case_testdata_axisym).Baseline
ComputeBusing direct-sum integrals matches reference within coarse tolerances.Singular-corrected
ComputeBachieves ~1e-4 relative error on small grids.Internal
ComputeBandComputeGradBmatch reference on the internal parity cases (case_vc_intandcase_simsopt_int).ComputeGradBmatches reference within ~5e-3 on the GradB parity case.VirtualCasingJAX.compute_external_gradBmatches reference on the internal test case and SIMSOPT VMEC case.VirtualCasingJAX.compute_internal_gradBmatches reference on the internal test case and SIMSOPT VMEC case.VirtualCasingJAX.compute_external_Bmatches reference on the internal test case and SIMSOPT VMEC case.VirtualCasingJAX.compute_internal_Bmatches reference on the internal test case and SIMSOPT VMEC case.VirtualCasingJAX.compute_external_Bmatches the W7-X parity case (case_vc_w7x) to ~1e-3 relative error.VirtualCasingJAX.compute_external_gradBmatches the W7-X parity case (case_vc_w7x) to ~2e-2 relative error.Large-grid parity cases (
case_vc_large,case_vc_w7x_large,case_simsopt_large) exercise higher-resolution B/GradB paths.Off-surface B/GradB parity includes larger target sets via
case_vc_large.Autodiff of
compute_external_B_autodiffmatches the C++ComputeGradBoutputs on both parity cases.B_external_normalmatches reference for SIMSOPT and BIEST test cases.Off-surface
ComputeBOffSurfbaseline is validated using upsampled direct-sum quadrature.Off-surface adaptive refinement is validated against the reference for small target sets.
Off-surface
ComputeGradBOffSurfmatches reference on the internal virtual-casing test case.Off-surface adaptive
GradBis validated against a finite-difference gradient ofComputeBOffSurf.
Tolerance Policy
We use strict tolerances for small grids and looser tolerances for large-scale problems where floating point and algorithmic noise are amplified.