Skip to content

Add radial background periodization#178

Open
krystophny wants to merge 4 commits into
mainfrom
feat/flux-pumping/wp5-periodization
Open

Add radial background periodization#178
krystophny wants to merge 4 commits into
mainfrom
feat/flux-pumping/wp5-periodization

Conversation

@krystophny

@krystophny krystophny commented Jul 12, 2026

Copy link
Copy Markdown
Member

Second split item of #175: the radial periodization of the background.
periodize_m (KIM/src/background_equilibrium/periodize_m.f90) provides the
C-infinity localizer weight and the periodized profile value for a tabulated
profile: untouched inside the resonant layer |r - r_m| <= dr_layer, blended
with its period-shifted copies in the transition zones, periodic with
L = 2 (dr_layer + dr_transition).

Stack: parent branch feat/flux-pumping/wp5-kernel-restore at 3959cf6c
(#177); this PR's diff is cumulative until the parent merges. Pipeline
integration behind a config switch is the fourth split item; nothing calls
the new module yet.

Invariant preserved

  • The construction is the circulated prototype term-for-term: localizer
    weight exp(-2 pi/(1-t) exp(-sqrt(2)/t)) with clamped ends, wrap into
    [r_m - L/2, r_m + L/2), then the two shifted-copy blends.
  • Verified symbolically before implementation (programme CAS record):
    the layer is left unmodified, the result is exactly L-periodic, values
    and derivatives through order 4 are continuous at the seam, and the
    localizer's derivatives vanish at both transition ends.
  • Gradients must be taken of the periodized profile; periodizing a
    gradient differs in the transition zone (also part of the CAS record).
    The module documents that ordering constraint.
  • Profile lookups reuse the repository's 4-point binsrc/plag_coeff
    Lagrange interpolation; the tabulation must cover three half-periods on
    each side of r_m, guarded by explicit errors.

Verification

Test fails on a degraded localizer (linear blend mutation)

$ sed -i 's|localizer_weight = exp(...)|localizer_weight = 1.0d0 - t|' periodize_m.f90
$ ctest --test-dir build -R test_periodize --output-on-failure
1/1 Test #25: test_periodize ...................***Failed    0.07 sec
 FAIL transition edge slopes agree
   got  =    82.996000000093773
   want =    3.4919999999374340

Test passes after restore

$ ctest --test-dir build -R test_periodize
1/1 Test #25: test_periodize ...................   Passed    0.06 sec

Full suite

$ ctest --test-dir build
100% tests passed, 0 tests failed out of 28

Checks: resonant layer unmodified (4-point Lagrange exact on the quadratic
profile, 1e-12 relative), exact L-periodicity across five periods, an
already-L-periodic profile passes through unchanged (1e-8), and one-sided
finite-difference slopes agree at the period seam and at the layer edge
(1e-3 relative, against an O(1) kink for a non-smooth blend).

Relation to Markus's Fokker-Planck periodic branch

This PR is an independent implementation of the C-infinity periodizer. Compare its seam, derivative, and untouched-layer behavior with feature/kim-forced-periodicity; do not retain two hidden periodizers. Multispecies preservation is specified in #186 and the final selection belongs to #191.

@krystophny krystophny force-pushed the feat/flux-pumping/wp5-periodization branch from 8d4b7e4 to 57b4ad0 Compare July 12, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant