Recompute z0 after interpolation and add collision-frequency scale#225
Merged
marjohma merged 2 commits intoJul 15, 2026
Merged
Conversation
Extract the two salvageable pieces of the retired wp5 flux-pumping stack onto the forced-periodicity lineage. Krook argument z0 (was #183): interpolate_plasma_backs interpolated the DERIVED z0 alongside the primitives. z0 carries a 1/|k_parallel| singularity at the resonance, so a four-point Lagrange stencil spanning k_parallel=0 returns values that violate the defining formula. Interpolate primitives only and recompute z0 = -(omega_E - omega - i nu)/(|k_parallel| sqrt(2) v_T) on the target grid. Observed before the fix at k_par=2e-4: 36% relative error, growing without bound toward the resonance. Collision-frequency scale (was #182): new positive KIM_CONFIG key collision_frequency_scale multiplies the calculated electron and ion collision frequencies before z0 and the FP susceptibility inputs are assembled. Default 1.0 leaves every collision formula, profile, unit, and output unchanged. Rejected at startup if non-positive; displayed when not 1.0 and stored in HDF5 provenance. Scope: z0 is consumed only by Krook_kernel_plasma_prefacs, so the Fokker-Planck path (which recomputes x1/x2/A1/A2/I^kl after interpolation) is unaffected; this repairs the Krook hat path, whose nml still marks it unstable. Test test_collision_scale_z0 asserts the z0 invariant across and away from the resonance and that the scale reaches both nu and z0. Watched fail on the pre-fix code (36% relative error) before landing. Validation: full build; ctest excluding known reds 32/32.
This was referenced Jul 15, 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.
Summary
Extracts the two salvageable pieces of the retired wp5 flux-pumping stack onto the forced-periodicity lineage. The rest of that stack (#177–#181, #184) is closed as superseded.
Krook argument
z0(was #183)interpolate_plasma_backsinterpolated the derivedz0alongside the primitives.z0carries a1/|k_parallel|singularity at the resonance, so a four-point Lagrange stencil spanningk_parallel = 0returns values that violate its own defining formula. The fix interpolates primitives only and recomputeson the target grid — the same invariant the periodized-background path already follows.
Scope:
z0is consumed only byKrook_kernel_plasma_prefacs.f90. The Fokker-Planck path recomputesx1/x2/A1/A2/I^{kl}after interpolation and never readsz0, so FP results are bit-unchanged. This repairs the Krook hat path, whose nml still marks it(unstable)— plausibly part of why.Collision-frequency scale (was #182)
New positive
&KIM_CONFIGkeycollision_frequency_scalemultiplying the calculated electron and ion collision frequencies beforez0and the FP susceptibility inputs are assembled. Default1.0leaves every collision formula, profile, unit, and output unchanged. Non-positive values are rejected at startup; the value is displayed when it differs from 1.0 and stored in HDF5 provenance. Same shape as the existingion_flr_scale_factorknob. No benchmark-acceptance claim — it is a sensitivity parameter.Tests
test_collision_scale_z0(new) asserts thez0invariant on a stencil straddlingk_parallel = 0and away from it, and that the scale reaches bothnuandz0(including the imaginary part ofz0tracking it).Developed red-first: against the pre-fix code the test fails with a 36% relative
z0error at k_par = 2e-4 (got (-0.0983, 0.0129)vswant (-0.4543, 0.0599)), growing without bound toward the resonance.Validation
make— clean buildctest -E 'test_rhs_balance|test_periodic_convergence|test_periodic_vs_global'— 32/32 passedKnown red gates excluded as usual: the pre-existing
test_rhs_balancebaseline failure, the periodization-deformation gate, and the periodic-vs-global 5% gate — none touched by this change.Supersedes #182, #183.