Repository navigation
Add differentiable physical section flux and filament potential - #148
Open
rogeriojorge wants to merge 10 commits into
Open
rogeriojorge wants to merge 10 commits into
rogeriojorge wants to merge 10 commits into
Conversation
rogeriojorge
marked this pull request as ready for review
October 7, 2026 20:11
Member
Author
|
Merged main. surfaces.toroidal_flux/poloidal_flux were dead before (BiotSavart had no A); with field.A they now run, and a short test checks toroidal_flux against section_flux on a circular section (orientation is opposite, as documented). |
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.
Adds two physical-flux primitives in the existing field module:
section_fluxintegratesB_phi dR dZover a supplied section polygon, andBiotSavart.Aevaluates the filament vector potential using the existing coil quadrature. Field and vertex derivatives are retained. The section measure has no extra radius factor; the equivalent circulation for the positive toroidal normal traverses the boundary clockwise in(R,Z).The caller must supply a simple, resolved polygon and a field regular over its signed triangle fan. These functions do not locate turnstiles, identify manifold branches or qualify a coil-design objective. There is no new dependency, tracer or topology package.
Independent tests cover the analytic
B_phi=C/Rrectangle, field reversal, polygon orientation, concave geometry, field and shape derivatives, JIT/VMAP/JVP/VJP,curl(A)=B, closed-loop Stokes and gauge invariance. Inserting an extra radius deliberately makes the analytic oracle fail. All 57 field/coil tests pass; coverage reaches 22/22 changed executable lines and 4/4 new validation branches. The upstream fatal flake8 selectors pass.The full local suite reports 323 passed, 1 xfailed, 2 failed (535.55 s). Both failures are bitwise adaptive8 survivor-compaction comparisons and reproduce on unchanged baseline
043047f6f0ccfe51ec85c655497c73af855a39bbin the same environment, with maximum absolute array mismatch6.94e-18. Those failures are preserved; the suite is not claimed green. Environment: Apple M4 CPU, Python 3.13.7, JAX/JAXlib 0.11.0, x64, one BLAS/OpenMP thread. At revision74afb895f2e1fe91263175898c6ccffb2b59beff, the Python 3.10, 3.11 and 3.12 CI suites and patch-coverage check all pass.The patch adds 50 source lines, 65 test lines and 10 README lines. It has no performance or new physical-result claim. Related open #99 owns the cylindrical return map, #139 changes coil conversion, and #146 changes broader field algebra/tracing; this patch leaves those implementations alone. Review this bounded diagnostic independently of any future lobe or optimization work.
Current-main integration: merge
ed6d61772048a2bc98f41b9125f6a3c46c6b1c66includes upstream0d1f9b6267af404c5a8585c1c36335ade385b797(#147). The flux/coil source, tests and README are byte-identical to the previously qualified patch. All 74 field, coil and augmented-Lagrangian tests pass on the integrated revision (181.40 s, same shared CPU environment), and fatal flake8 selectors report zero. Python 3.10/3.11/3.12 CI and patch coverage all pass on this integrated revision.