Skip to content

COIL - BUG FIX - Use the exact field of each straight coil segment (PrincetonUniversity/GPEC#361) - #9

Merged
krystophny merged 1 commit into
developfrom
fix/coil-segment-production-20261029
Nov 2, 2026
Merged

krystophny merged 1 commit into
developfrom
fix/coil-segment-production-20261029

Conversation

@krystophny

@krystophny krystophny commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Carries the open upstream PR PrincetonUniversity/GPEC#361 (exact Biot-Savart field of each straight coil segment, coil/field.F) into the production fork. It was stacked on #8; since #8 is merged, it is rebased onto develop (e5273e6) without conflict, and the resulting tree is identical to the tested #8 + #9 tree. When PrincetonUniversity#361 merges upstream, the next fork synchronization absorbs it.

Tested on the TU Graz cluster together with #8 (see there for the build and example results). The test added by PrincetonUniversity#361, regression/test/coil_segment_field.f90, passes:

  • maximum relative error of the segment field against the closed form: 5.9e-15 (tolerance 1e-12);
  • maximum relative difference between a rectangular coil given as 4 sides and as 64 collinear pieces: 3.4e-16 (tolerance 1e-12);
  • largest near-filament field with rmin > 0 divided by the field of a wire of radius rmin: 1.00000 (must not exceed 1 + 1e-6).

Chris&AI

field_bs_psi and field_bs_rzphi evaluated the Biot-Savart integrand of each
polyline segment once, at its midpoint (dl x r/|r|^3). The error is of
order (L/d)^2 for a segment of length L seen from distance d, so coils with
long straight sides gave fields that were wrong by about 10 % on nearby
surfaces. Each segment now contributes its closed-form field (Hanson and
Hirshman, Phys. Plasmas 9, 4410 (2002)), which is exact for the polygon in
the coil file. In field_bs_rzphi the former distance floor dlmin becomes
the radius of a regularizing wire.

regression/test/coil_segment_field.f90 checks the segment field against the
textbook closed form and that field_bs_rzphi does not depend on how the
straight sides of a rectangular coil are split.

(cherry picked from commit 5212ddc)
@krystophny
krystophny force-pushed the fix/coil-segment-production-20261029 branch from b905fd3 to e52d54d Compare October 30, 2026 05:40
@krystophny
krystophny changed the base branch from sync/production-upstream-54991242-20261029 to develop October 30, 2026 05:40
@krystophny
krystophny added this pull request to the merge queue Nov 2, 2026
Merged via the queue into develop with commit 1683807 Nov 2, 2026
7 checks passed
@krystophny
krystophny deleted the fix/coil-segment-production-20261029 branch November 6, 2026 20:33
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