Extract shared GC Gauss implicit-RK core (orbit_rk_core); drop CPP and symplectic FO#429
Merged
Merged
Conversation
Lift the Gauss-collocation residual, Jacobian, dense LU solve, and Newton shell out of orbit_symplectic into a new device-callable module orbit_rk_core. f_rk_gauss and jac_rk_gauss become thin wrappers that call rk_gauss_residual/rk_gauss_jacobian with MODEL_GC; the arithmetic is moved byte-identically, so GC numerics are unchanged (all golden-record regressions pass). rk_gauss_newton and rk_solve are retained for the deferred fortnum multiroot wiring; the CPU GC path still uses dgesv. This is the keep-worthy nucleus of the shelved shared-symplectic-core work. The CPP pusher and the symplectic full-orbit prototype, their mock field/ metric providers, and the associated tests are not brought over.
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.
Summary
Rebase-and-strip of the shelved shared-symplectic-core work (PR #407) onto
current
main. Keeps only the keep-worthy nucleus: the guiding-centre (GC)Gauss implicit-RK / Newton core, extracted into a new device-callable module
orbit_rk_core. Everything CPP and symplectic-full-orbit is dropped.What lands
src/orbit_rk_core.f90: the GC Gauss-collocation residual, analyticJacobian, a device-portable dense LU solve (
rk_solve), and a device-callableNewton shell (
rk_gauss_newton). Reduced to a single GC kernel; the formerMODEL_CPP/MODEL_FO_SYMPLcodes and their dispatch shells are gone.src/orbit_symplectic.f90:f_rk_gauss/jac_rk_gaussbecome thin wrappersover the shared core (
MODEL_GC). The arithmetic is moved byte-identically,so GC numerics do not change.
src/CMakeLists.txt: compileorbit_rk_core.f90beforeorbit_symplectic.f90.What is dropped (not merged)
orbit_cpp.f90,MODEL_CPP) and its tests(
test_cpp_equals_gc_largestep,test_cpp_invariants).orbit_full.f90,MODEL_FO_SYMPL), its provider seam (orbit_full_provider.f90) and the twomocks, and their tests (
test_fo_symplectic,test_full_orbit,test_orbit_model_dispatch).params.f90/simple_main.f90orbit_modelhunks:mainalready owns
orbit_model(ORBIT_GC=0,ORBIT_FULL_ORBIT=7) and thevalidated explicit Boris full-orbit pusher (PR Add full-orbit (FO) Boris pusher (orbit_model=7) #426), which this PR leaves
untouched.
Why
orbit_rk_coreis the single home for the GC Gauss step shared by the CPUintegrator and (later) the OpenACC GPU kernel; it is written
!$acc routine seq-ready with its own device-portable LU. CPP is retired; the full-orbit pathis the explicit Cartesian Boris (
orbit_model=7), not the shelved symplecticprototype.
Verification
make CONFIG=Fast: build OK.make test: 100% tests passed, 0 failed out of77 (total 677.80 s). All 14 golden-record regression cases (albert,
albert_coils, boozer, boozer_ncsx, canonical, classifier, classifier_combined,
classifier_fast, collision, meiss, meiss_coils, and the tokamak variants)
pass, confirming the GC numerics are byte-identical after the extraction.
Before (on
main): the same 14 golden-record cases pass with the inlined GCresidual/Jacobian. After (this branch): identical results with the arithmetic
moved into
orbit_rk_core-- a pure refactor, no numeric change.Follow-ups (separate PRs)
rk_gauss_newton/rk_solveonto the fortnum multiroot core in place ofdgesvfor the CPU GC Newton; must preserve the verified GC numerics.multiroot_step(fortnum PR for the device-capable solver), keepingorbit_rk_coreas the shared CPU+GPU home.