Test Biot-Savart derivatives against an analytic circular loop - #71
Draft
rogeriojorge wants to merge 1 commit into
Draft
rogeriojorge wants to merge 1 commit into
rogeriojorge wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. |
rogeriojorge
force-pushed
the
test/circular-loop-derivative-oracle
branch
from
September 27, 2026 04:53
8f5e1ea to
7d98744
Compare
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.
Why
Free-boundary equilibrium workflows differentiate coil fields through third spatial order and with respect to coil parameters. The active field tests currently check construction and cylindrical/Cartesian self-consistency, but they do not compare these quantities with an independent physical oracle.
What this adds
A circular filament in the xy plane has the analytic on-axis field
Bz(z) = mu0 I R^2 / (2 (R^2 + z^2)^(3/2)).The source-free axisymmetric expansion around the axis determines every Cartesian component through third spatial order:
The test writes the first three derivatives of
Fexplicitly, then compares all entries ofB,dB/dX,d2B/dX2, andd3B/dX3at a nonzero axial point. It also checks two selectedCoils.with_dofsJVPs against analytic derivatives: one physical ampere through the normalized current coordinate and a common-radius direction through the circle's two Fourier coefficients.Absolute tolerances scale with the largest analytic component at each derivative order or sensitivity. This keeps zero-component checks tied to the corresponding physical scale: T, T/m, T/m^2, T/m^3, T/A, or T/m. The relative tolerance is
2e-11.Scope
This is a full Cartesian tensor check at one symmetry-axis point. It is not an off-axis or full-domain oracle. The parameter test covers two selected directions of the field value; it does not cover the full coil-parameter Jacobian or parameter sensitivities of the spatial derivative tensors.
The oracle found no numerical defect in this tested scope. The change adds regression coverage only and does not modify production code.
Validation
pytest -q tests/test_fields.py: 6 passedgit diff --checkRelated qualification work: VMEX HINT comparison #302. This PR remains draft for manual review.