Add periodic-Fourier run mode behind config switch#180
Open
krystophny wants to merge 6 commits into
Open
Conversation
This was referenced Jul 12, 2026
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.
Fourth split item of #175: the periodic-Fourier solve wired behind the
existing run-type switch.
rt_fourier_periodic_m(
KIM/src/fourier_periodic/rt_fourier_periodic.f90) registerstype_of_run = 'fourier_periodic'in thekim_mod_mfactory, runs thestandard init pipeline, replaces the global background with its
periodization around the resonant surface, assembles the kernel matrices
on
k_m = 2 pi m / L, solves the screened Poisson system, and writes/fields/Phi_periodicand/fields/Br_periodicon a one-period grid.Stack: parent branch
feat/flux-pumping/wp5-periodic-solveatca5d2776(#179), on top of #178 and #177; the diff is cumulative until the parents
merge.
Config
New
KIM_SETUPnamelist keys with safe defaults (absent keys keepdefaults, so existing configuration files are unaffected):
fp_r_res,fp_dr_layer,fp_dr_transition(cm; required positive for this runtype, validated with explicit errors),
fp_n_modes(128),fp_n_quad(512),
fp_grid_points(2048).Invariants
Er, B0, q, ks, kp) are periodized onto a uniform grid spanning three
half-periods on each side of
fp_r_res;om_E = -c ks Er / B0isrecomputed algebraically; gradients come from differentiating the
periodized profiles through the existing pipeline stencil; vT, omega_c,
lambda_D, nu, z0 are recomputed by the existing
calculate_plasma_backs;A1/A2 use the pipeline's exact formula. Periodizing a gradient is wrong
in the transition zones and the test proves the feed does not do it.
type_br_field = 12(constant unit Br, matching the hat-basiskernel-weighted right-hand side
rhs = 4 pi K^{rho B} B_rwithB_{r,m} = delta_{m,0}) is the only supported perturbation;rescale_densityis rejected because the second pass through thecollision-frequency formulas would rescale twice.
golden records are untouched; the new mode only reads shared state.
Verification
Test fails on a wrong-period feed (mutated periodization widths)
Test passes after restore
Full suite
The feed test builds the plasma state directly (linear density, uniform
temperature), so it exercises
build_periodized_backgroundwithout aconfiguration file. The end-to-end case run and the hat-basis no-op
benchmark are the next split item: they need a packaged electrostatic
case, which the benchmark scouting identified as new work
(
KIM/nmls/KIM_config.nmlis the template; golden CI currently carriesonly the electromagnetic case).
Relation to Markus's Fokker-Planck periodic branch
This PR contains the strongest reusable integration pieces from the independent stack: run-type registration, explicit configuration, and a per-species periodized-background feed. Its solver still uses the separate Krook kernel path. Compare and port the seams only after #185, #186, #187, and #188 establish the FP physics; #191 owns reconciliation.