Skip to content

Add periodic Fourier kernel assembly and solve#179

Open
krystophny wants to merge 5 commits into
mainfrom
feat/flux-pumping/wp5-periodic-solve
Open

Add periodic Fourier kernel assembly and solve#179
krystophny wants to merge 5 commits into
mainfrom
feat/flux-pumping/wp5-periodic-solve

Conversation

@krystophny

@krystophny krystophny commented Jul 12, 2026

Copy link
Copy Markdown
Member

Third split item of #175: the discrete solve on the periodized modes.
fourier_periodic_m (KIM/src/fourier_periodic/fourier_periodic_m.f90)
provides the mode grid k_m = 2 pi m / L, the matrix elements
K_{m,m'} = (2 pi / L) times the one-period equidistant r_g quadrature of
the restored kernels, the dense LAPACK solve of the screened Poisson system
(k_m^2 delta - 4 pi K^{rho Phi}) Phi = rhs, and the inverse expansion
f(r) = sum_m f_m exp(i k_m r).

Stack: parent branch feat/flux-pumping/wp5-periodization at 4671fb10
(#178), on top of #177; the diff is cumulative until the parents merge.
Driver integration behind a config switch and the hat-basis/Vaclavik
benchmarks are the remaining split items; nothing calls this module yet.

Invariant preserved

  • Absolute-coordinate phases: the assembly quadrature and the inverse
    expansion use the same exp(i k r) convention as the
    exp(i (k_r - k_r') r_g) factor inside the kernels, so the uniform
    background is exactly diagonal through discrete Fourier orthogonality
    of the equidistant midpoint rule (exact for |m - m'| < N_quad).
  • The uniform diagonal reproduces the adiabatic screening value
    -sum_s lambda_{D,s}^{-2} / (4 pi), so the system matrix carries
    k_m^2 + sum_s lambda_{D,s}^{-2}: the sign convention of the historical
    k-space Debye demonstrator. The kinetic term regularizes the k_0 = 0
    mode, so no separate gauge handling is needed.
  • Midpoint quadrature is the lowest-order rule the note prescribes for the
    periodic integrand; no interpolation, truncation, or padding enters.
  • CGS-Gaussian units; existing solver paths and golden records untouched.

Verification

Test fails on the flipped kinetic sign

$ sed -i 's|system = -4.0d0*pi*kernel_rho_phi_matrix|system = 4.0d0*pi*kernel_rho_phi_matrix|' fourier_periodic_m.f90
$ ctest --test-dir build -R test_fourier_periodic --output-on-failure
1/1 Test #26: test_fourier_periodic ............***Failed    0.08 sec
 FAIL mode solve matches the screened solution

Test passes after restore

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

Full suite

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

Checks (1e-12 relative): centered mode grid, exact uniform diagonality,
adiabatic screening diagonal on every mode, the screened point-charge
solve against the analytic per-mode solution, L-periodicity of the
expansion, and a real potential at the charge location. Quadrature
convergence on a radially varying background is exercised in the driver
integration item, where real profiles enter.

Relation to Markus's Fokker-Planck periodic branch

This PR assembles and solves the restored Krook kernels. Its mode-grid, quadrature, dense-solve, and manufactured-Debye tests may be reusable infrastructure, but its kernel and Poisson conventions are not an authority for the FP branch. The matched FP boundary-value problem is #188; final selection is #191.

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