Uh oh!
There was an error while loading. Please reload this page.
VACUUM - Migrate surface current calculation into the VACUUM module - #345
Conversation
…uum module and making it a flag to compute it
… comments from Claude
…egularization in L calculation and moving to ResponseMatrices.jl
…g advantage of it to remove some lines
…SIONToolkit/GPEC into feature/vacuum-surface-inductance
jhalpern30
commented
Aug 3, 2026
Regression tests - this only really affects PerturbedEquilibrium so I ran DIIID The small changes are due to slight variations in the order that Hermitization is performed. The 1 changed value is not physical, since it is just slightly above the arbitrary limit of 1e-10 that we set |
jhalpern30
commented
Aug 3, 2026
@claude review |
Review: #345 — Migrate surface current calculation into VACUUM moduleVerified the core refactor algebraically: the interior-kernel solve now uses Issues
Regression harnessGood to see this was already run and posted ( Removed try/catch regularization in surface inductanceAgree with removing the ad hoc regularization/try-catch fallback in the old No pull request should be merged without human review. Per this repo's CLAUDE.md, this is non-negotiable — please make sure a third-party human reviewer signs off before merging into |
logan-nc
commented
Aug 11, 2026
Will review weds during cleanup session |
logan-nc
left a comment
There was a problem hiding this comment.
Great cleanup. One suggestion regarding the helper function, which left repeated 3-line chunks that could all be in a one-line helper.
| weight `1/(J|∇ψ|)` cancels the Jacobian in the vacuum solver's source density — so `Φ_x = 𝕀` | ||
| and `L = I_v⁻¹`, carrying the `μ₀(2π)²` normalization. | ||
| """ | ||
| function calc_surface_inductance(I_v::Matrix{ComplexF64})::Matrix{ComplexF64} |
There was a problem hiding this comment.
This is a nice helper, but it seems unnecessarily small. All calls are proceeded by the same set of lines to set the vac_input at a psi, compute_vacuum_response, and then call this to invert Iv. the vac_input and Iv are never needed... It seems cleaner to have the helper function just take the psi of interest, do those two lines and this inversion all internally, and return the L matrix.
…pooled allocation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d restore Hermitization rationale Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r review Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dd calc_surface_inductance test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…face-inductance # Conflicts: # .claude/agent-memory/fortran-physics-reviewer/fortran_correspondence_map.md # src/PerturbedEquilibrium/SingularCoupling.jl
logan-nc
commented
Aug 14, 2026
Regression harness after the review fixes + develop merge ( This is the known Hermitization-ordering roundoff (Iᵛ is now Hermitized before inversion rather than L after, equal to O(ε²) in the anti-Hermitian discretization residual — now annotated at the call site in Two things flagged during review for human eyes, no code change made:
|
logan-nc
left a comment
There was a problem hiding this comment.
Updated to address original review. Approved now
Uh oh!
There was an error while loading. Please reload this page.
Replace the use_riccati / use_parallel / parallel_threads / populate_dense_xi flag set with a single integrator = "forward" | "riccati" | "galerkin" key plus an nchunks knob, per the ForceFreeStates modularization plan (PR 1 of 5). - Delete the standalone serial-Riccati driver and the populate_dense_xi dense-xi re-run; no integration result is merged with another. - Rename serial_eulerlagrange_integration -> forward_eulerlagrange_integration and give the STRIDE propagator driver the freed riccati_ name. - Chunk sizing no longer reads Threads.nthreads(), so Riccati outputs are identical at any thread count; nchunks is the only tunable and clamps up to the singular-surface floor with a warning. - Kinetic runs now error on the Riccati path rather than silently mis-crossing. - The four retired keys join _DEPRECATED_FFS_KEYS and the toml-no-deprecated-keys hook, so old decks and gpec.h5 replays warn and continue. - New examples/DIIID-like_riccati_deltaprime_example plus the diiid_n1_riccati regression case keep the delta-prime matrix covered once the DIIID-like deck moves to the forward integrator. Verified on origin/develop: full suite 59 testsets / 2044 assertions / 0 failures; docs build clean; harness diiid_n1, solovev_n1 and diiid_slayer_n1 all unchanged; delta-prime bit-identical between -t 1 and -t 4. REFACTOR_PLAN.md is amended in the same commit: #363 and #345 merged before this sequence branched, so the plan now records that it builds on the new HDF5 schema. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR moves the surface inductance calculation (or at least the majority of it) into the VACUUM module. The surface inductance calculation is fundamentally a vacuum quantity. It was hacked into GPEC to avoid cross-code changes, but can more simply be integrated into the VACUUM module and passed into the PerturbedEquilibrium module.
This also makes it a boolean if it is computed or not. For the standard stability calculation where only Wv is needed, computing the surface current calculation costs an extra matrix inversion + storage since it requires forming and solving the interior kernel, which can add up especially when making the Wv spline in the edge. I didn't benchmark the speedup in 2D since its not massive, but this will be very helpful for 3D.
I have looked at the Fortran and checked that no not-yet-ported code will require the old way of doing this. And if anything new does, its more suitable to be coded up in the VACUUM module instead anyway.
Some notes on specific changes:
I_vcompute_surface_current_from_greensis now drastically simplifiedSingularCoupling.jl. I looked at the Fortran and this was unfounded, and screamed "Claude did this because it had one failing test case while porting over the code and added try/catch logic". This same type of code appeared when we were doing the edge matrix splining forpsiedge < 1logic.Update (2026-08-14): Addressed review feedback and merged latest
develop:calc_surface_inductancenow takes ψ and does the fullVacuumInput→compute_vacuum_response(compute_Iv=true)→ inversion chain internally; both call sites collapse to one line (per review)compute_Ivbranch (in-place difference intogrriscratch)kernelsign=-1convention; the θ handedness is handled entirely byconj!), restored the Hermitization physics rationale, and documentedI_v's stored normalization and the Hermitize-before-inversion deviation from Fortrancalc_surface_inductance(Solovev, nowall); fixed a stale test commentorigin/develop(tearing tests now buildSingTypewithout the removedgrri/grrefields; kept develop's new_hermite_cubic_deriv, dropped the now-unused_reverse_theta)