Vacuum - FEATURE! - Add the 3D surface-current matrix and halve the solve with stellarator symmetry - #437
Draft
jhalpern30 wants to merge 3 commits into
Draft
Conversation
… speedups with RHS multiplication by Fourier operator before inversion + incorporating the mode family phase into the kernel construction and looping through each mode family separately. In 3D, the lu! dominates the cost, so adding the extra kernel calls is outweighed by reducing peak memory and the lu size
… cleaning up since I have no idea what this does, but Claude is reporting a large speedup and memory reduction
Contributor
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
Collaborator
Author
|
Stacked on top of this: #438 (Vacuum - PERF - Serve conjugate toroidal residue classes from one factorization), which targets this branch rather than |
jhalpern30
changed the base branch from
develop
to
feature/vacuum-3d-conformal-wall
September 1, 2026 17:12
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.
Release note
gpec.h5baselines or reference values. 2D is unaffected.The 3D vacuum solve now produces the surface-current matrix
I_v, the same inductance diagnostic the 2D path already provided. It is also substantially cheaper: folding the mode-family phase into the kernel and exploiting stellarator symmetry cut the solve 2.5-7.6x and halved (or quartered) the operator memory, which is what makes production 3D grids fit in memory at all.Regression report
regress --cases diiid_n1,solovev_n1 --refs feature/vacuum-3d-conformal-wall,feature/vacuum-3d-inductance@a61d7ddediiid_n1solovev_n1Both cases are 2D (
nzeta == 1) and exercise none of the 3D code paths this branch touches. Zero movement confirms the 2D path is untouched; it does not cover the 3D result shift described below, which no harness case reaches.Notes for reviewers
Stacked on #436 — this targets
feature/vacuum-3d-conformal-wall, notdevelop, so the 3D conformal wall work is excluded from this diff. Merge #436 first. #438 stacks on top of this one in turn.Review package (diagrams, derivations, benchmarks): https://claude.ai/code/artifact/17fac702-393d-4993-9b49-e290234d3ecc
It covers this branch and #438 as one story.
Two commits
ef9f2036I_v; RHS projected onto the Fourier basis before the solve; mode-family phase folded into the kernel so only the reduced[nb·M x nb·M]operator is stored, one residue class at a timea61d7ddeThe one thing that moves results
Kernel3D.jl:124changed the 5x5 Lagrange stencil selection fromtrunc(Int, u - 2)toroundbefore the offset. This is not an accuracy fix — against a 72x36 reference the two agree to 0.06% and the winner flips with resolution (roundbetter at 24x12 and 32x16,truncbetter at 48x24), and both are exact through degree 4. It is a symmetry fix:truncis not equivariant under the interpolation patch's pi-rotation, so 790 of 800 polar nodes got a stencil that was not the mirror of its partner's, and the operator could not inherit the boundary's symmetry (asymmetry 1.9e-3 nowall / 1.0e-2 with a close wall, versus 5.2e-13 after).It is a prerequisite for stellarator symmetry and buys nothing on its own, so it ships here. Cost: 3D results move once. On
examples/Solovev_ideal_example_3D,et[1]goes7.942458514881e-01->7.959714927451e-01(2.2e-3 relative), comparable to that example's own discretization error.Worth pushing on
nfp > 1example or regression case, andnfpis not plumbed throughPerturbedEquilibrium.jl:72or set by theVacuumInput(equil, ...)constructor atDataTypes.jl:64. Everynfp > 1claim rests on unit tests.use_symmetry=falseis bit-identical to the pre-symmetry code on all seven A/B cases; symmetry-on agrees to <=1.4e-12; an asymmetric boundary falls through bitwise.nfp=164x64, 3.8x at 96x96, 7.6x fornfp=5, k=0. Operator memory 2x, or 4x for a self-conjugate class withnfp > 1.Commit messages
Both commit subjects on this branch are informal and one says the work is unreviewed. Worth squashing or rewording before merge.