Repository navigation
COIL - BUG FIX - Use the exact field of each straight coil segment (PrincetonUniversity/GPEC#361) - #9
Merged
Conversation
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
force-pushed
the
fix/coil-segment-production-20261029
branch
from
October 30, 2026 05:40
b905fd3 to
e52d54d
Compare
krystophny
changed the base branch from
sync/production-upstream-54991242-20261029
to
develop
October 30, 2026 05:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ontodevelop(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:rmin > 0divided by the field of a wire of radiusrmin: 1.00000 (must not exceed 1 + 1e-6).Chris&AI