Skip to content

Preserve helical source during reconstruction replay#149

Open
krystophny wants to merge 23 commits into
mainfrom
feat/flux-pumping/reconstruction-replay
Open

Preserve helical source during reconstruction replay#149
krystophny wants to merge 23 commits into
mainfrom
feat/flux-pumping/reconstruction-replay

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

  • apply the helical source during local reconstruction replay
  • restore reconstructed incoming rows after all local source assembly
  • initialize unused Legendre padding before whole-array collisionality scaling
  • test both boundary directions and two Laguerre blocks

Closes #143. Stacked after #148 and remains unmerged with the programme stack.

Reconstructed incoming rows remain authoritative. The drift-kinetic operator, collision model, Runge-Kutta stencil, eta/Laguerre layout, sparse solve, convergence criteria, qflux normalization, memory layout, ABI, and generated dispatch are unchanged. Valid Legendre entries are overwritten exactly as before; only unused padding is initialized.

Verification

Test fails on main

$ fo exec --no-build --cwd "$RUN" neo_2_ql.x
ERROR STOP mode-1 helical drive does not support reconstruction mode

The focused boundary-precedence fixture also fails to compile on the parent because apply_reconstructed_incoming_rows does not exist.

Test passes after fix

$ fo build && fo test helical_source_test
helical_source_test                         PASS       0.11s
Summary: 1 passed, 0 failed, 0 skipped

$ FO_CMAKE_ARGS='-DCMAKE_Fortran_FLAGS=' fo
Static: OK (341 modules, 341 changed, 341 affected)
Build: OK
Tests: OK
Lint: OK
All stages passed (1.8s)

The single-rank HELCORE process fixture was then run through prop_reconstruct=0, 1, and 2 with prop_write=2:

stage 0: 398 propagator files, 198 boundary files, final joined propagator present
stage 1: 199 reconstructed-boundary files, exit 0
stage 2: 199 files in each of phi_mesh, dentf_p/m, spitf_p/m, enetf_p/m,
         and sizeplot_etalev; exit 0
finite scan: 0 NaN/Inf files
trap build: -fcheck=all -ffpe-trap=invalid,zero,overflow; exit 0
runtime marker scan: 0 ERROR/IEEE/SIGFPE/runtime-error matches

isw_qflux_NA=1 with in_file_pert='none' assembles an identically zero
non-axisymmetric source. That zero vector is the Arnoldi seed, so its
normalization divides by zero (0/0 -> NaN) and zhseqr then fails to
converge at every step, spinning without qflux output. Reject the
configuration in check() with a clear message instead.
Add an optional right-hand side to the non-axisymmetric solve: the
drive of a single-helicity perturbation given by a radial corrugation
field (delta B^s/B_0^phi)_mn and an electrostatic potential harmonic
Phi_mn. The vpar corrugation piece enters the A1/A2 force channels
with velocity weights a3m and x^2 (sigma-odd), the ExB piece with
weights x^-1 and a1m (sigma-even); the two new velocity moments are
computed in compute_sources. Input via new &ntv_input variables
(isw_hel_drive, m_theta_hel, hel_brad_re/im, hel_phim_re/im), default
off. Band profiles, moments and dimensional prefactors follow a
CAS-checked derivation (see issue #118).

Off by default: golden-record QL summary.h5 is reproduced to 1e-15
against a main build.
Review findings on the drive commit: fold the x^(3k-4) weight into a
single power so the x=0 quadrature node stays finite; skip the moment
quadrature on the precomputed-matrix-element path and reject
isw_hel_drive at run time when the moments are unavailable; reject the
unvalidated relativistic branch, reconstruction mode and unset species
data; deallocate asource_hel in collop_unload.
The zero-source guard added upstream rejects isw_qflux_NA=1 with
in_file_pert='none'. With the misalignment drive, that configuration is
valid: the drive supplies the non-axisymmetric source. Relax the guard
so it fires only when the drive is off or all its amplitudes are zero.
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.

[ql-15] Preserve helical source during local reconstruction replay

1 participant