Skip to content

Correct surface flux quadrature and add coil vector potential - #182

Open
rogeriojorge wants to merge 3 commits into
mainfrom
fix/surface-flux-quadrature
Open

rogeriojorge wants to merge 3 commits into
mainfrom
fix/surface-flux-quadrature

Conversation

@rogeriojorge

Copy link
Copy Markdown
Member

The surface flux helpers used vector potentials at polygon vertices with chord displacements, which introduces quadrature error and falsely closes half-period toroidal arcs. They now integrate A·dx using analytic surface tangents and periodic angular quadrature, dropping duplicated endpoints. poloidal_flux requires a full torus, and both helpers document their signed loop orientation.

Add the Cartesian filament vector potential to BiotSavart using the same coil quadrature and current normalization as its magnetic field. This enables flux matching when exporting optimized coil boundaries to VMEC/VMEX.

Validation: 58 tests passed (ESSOS_CPU_DEVICES=1 JAX_ENABLE_X64=1 python3.11 -m pytest -q tests/test_fields.py tests/test_surface_flux.py). Coverage includes analytic toroidal/vertical fields, open and closed angular grids, curl(A)=B, independent disk flux integration, and shape/current derivatives checked against finite differences.

@gftd13 Please review and test these helpers in the single-stage boundary export workflow, including the signed loop flux conversion to VMEC PHIEDGE.

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.

2 participants