Skip to content

Pair each analytic vacuum coefficient with the mode the caller supplies it for - #31

Open
CharlesCNorton wants to merge 1 commit into
jonathanschilling:masterfrom
CharlesCNorton:nestor-analytic-mode-pairing
Open

Pair each analytic vacuum coefficient with the mode the caller supplies it for#31
CharlesCNorton wants to merge 1 commit into
jonathanschilling:masterfrom
CharlesCNorton:nestor-analytic-mode-pairing

Conversation

@CharlesCNorton

@CharlesCNorton CharlesCNorton commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

analysum2 accumulates the analytic (tangent-plane) add-back into bvec and grpmn. Mode (m, n) takes tlp/slp and mode (m, -n) takes tlm/slm, but analyt supplies those arguments the other way round, so each mode is assembled from the coefficient computed for its toroidal mirror. This swaps the pairing to match what the caller passes.

The same change in VMEC++ is proximafusion/vmecpp#825, which carries the coefficient-level comparison against an independent evaluation of the subtracted kernels.

PARVMEC pairs them the way this change does. Its analyt.f calls analysum2 with the arguments crossed relative to the dummy names declared in analysum2.f, which has the same effect as the swap here, so after this change the two implementations agree.

The pairing is decided by an exact case. A line of dipoles on the axis of a helically deformed torus has zero vacuum field on the surface, so whatever the vacuum solver reconstructs there is its error. PARVMEC 10.0 at master_dev gives a residual of 7e-6 with its pairing and 4.9e-3 with the pairing declared in analysum2, and 4e-5 against 4.9e-3 in an asymmetric variant. The error is independent of ntheta, nzeta, mpol and ntor, since it is in the analytic term rather than in the quadrature, and it vanishes on an axisymmetric surface where the metric cross terms are zero.

On fb/input.cth_like_free_bdy the equilibrium moves:

quantity before after
boundary, rms 0.485 mm
boundary, max 1.093 mm
volume 0.307272521 0.306997848
aspect 5.43497342 5.43326512
iota on axis 1.265884 1.268986
betatotal 0.00187375583 0.00187211302

ctest passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant