Skip to content

Reject zero Lorentz join columns#135

Open
krystophny wants to merge 16 commits into
mainfrom
fix/flux-pumping/join-zero-column
Open

Reject zero Lorentz join columns#135
krystophny wants to merge 16 commits into
mainfrom
fix/flux-pumping/join-zero-column

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

  • validate Lorentz flux-conservation normalization factors before division
  • report direction, column, factor, propagator tags, and pass dimensions
  • return join error 5 for an exact-zero or nonfinite normalization factor
  • extend the join diagnostic fixture with rejected-zero and accepted-finite cases

Stack dependency: #133 at 03f5b9dacdbf7c882fac01c37972e8e266575351. This PR remains pointed at main and must not merge before its dependency.

For every nonzero finite column, the existing normalization and column-sum-one conservation law are unchanged. The patch does not choose a physical replacement for a zero column and does not change join algebra, linear solves, discretization, tolerances, array layout, ABI, or generated nonzero values. It converts an undefined 0/0 into an exact diagnostic rejection. The upstream meaning of the zero column remains tracked in #134.

Verification

Failing before (03f5b9d), exact HELCORE source-only replay with IEEE-invalid trapping:

join_ripples.f90:294
facnorm=0
SIGFPE: 0/0

Passing diagnostic after (6e30459):

join_failure_diagnostic_test ... Passed
100% tests passed, 0 tests failed out of 1
Static analysis passed (335 Fortran files checked)
Build passed
Tests passed
Lint passed

The same trapped replay now reports:

join_ripples: normalization direction=p
join_ripples: normalization column=2
join_ripples: normalization factor=0.000000000000000E+00
join_ripples: old propagator tags= 12 13
join_ripples: new propagator tags= 13 13
join_ripples: pass dimensions= 24 24
Error from Joining, ierr=5

It exits without SIGFPE, IEEE invalid, NaN, zhseqr, or DGBSV failure. This is a diagnostic safety result, not a valid transport calculation; partial qflux files are rejected.

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.

1 participant