Debye-Huckel shortcut creates a discontinuous screening factor

Aperta
#2,097 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Inizia da screening/screen.H alle righe 637-641 e dall’implementazione di Debye-Huckel alle righe 159-179, quindi esamina screening/_parameters alle righe 4-5 e le istruzioni dell’harness in README.md. Riproduci il caso di una coppia di protoni in idrogeno puro, quindi convalida la transizione per tutti i metodi, le composizioni e le coppie di ioni supportati, incluse le derivate automatiche, le differenze finite, l’errore dello shortcut e una baseline senza shortcut.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ai-code-audit screening

Summary

Enabling screening.enable_debye_huckel_skip switches abruptly between
the Debye-Huckel result and the selected screening method when the
Debye-Huckel log enhancement crosses the threshold. Those expressions
do not generally agree at the switching point.

The default threshold therefore creates a finite discontinuity in
screened rates for an arbitrarily small thermodynamic perturbation.
The returned automatic derivative only describes the selected branch.

Suggested priority: medium. This affects an opt-in optimization; the
default configuration, with skipping disabled, is unaffected.

Affected code

  • screening/screen.H:637-641: abrupt early-return condition.
  • screening/screen.H:159-179: Debye-Huckel approximation.
  • screening/_parameters:4-5: shortcut flag and default threshold.

Reviewed commit: e4b401b7637894a3db5ffa1e4b401509a332a1d6.
Related changes: PR #1688 (66a8b4a8) introduced the shortcut; PR #1939
(f030dab7) converted this interface to logarithmic screening.

Reproduction

Run the harness described in README.md. Use pure hydrogen, a
proton-proton screening pair, rho = 2.832060336326698 g/cm^3, and enable
the shortcut with its default threshold 0.01.

At T0 = 1.e7 K, the Debye-Huckel log enhancement is 0.01.
Production actual_log_screen gives:

Method          h at T0*(1-1.e-9)    h at T0*(1+1.e-9)
screen5         0.014148946308996     0.009999999985000
chugunov2007    0.009731498882572     0.009999999985000
chugunov2009    0.009494974234645     0.009999999985000
chabrier1998    0.011535400733560     0.009999999985000

For screen5, this is a jump of about 0.004149 in h, corresponding
to about 0.416% in the multiplicative rate enhancement. It does not shrink
as the temperature probe approaches the threshold.

In particular, screen5's weak-screening formula uses z2bar + zbar,
whereas this Debye-Huckel formula uses the ionic contribution z2bar.
They do not become identical merely by choosing a weakly coupled state.

Proposed fix

Introduce a finite transition interval in log enhancement. Return only
Debye-Huckel below its lower endpoint, use the full method above its upper
endpoint, and blend within the interval. For example, with a normalized
coordinate u from 0 to 1, use:

w = u*u*(3 - 2*u)
h = (1 - w)*h_DH + w*h_full

Compute u and w using number_t so automatic differentiation includes
the blend derivative. This retains the inexpensive early return below
the interval and matches both endpoint values and first derivatives.
Document the interval and the fact that the threshold applies to h.

For screen5, also consider using its own weak-screening expression as
the shortcut so that the intended weak-screening physics is preserved.

Validation

Sweep across both transition endpoints for every supported full method,
with several compositions and ion pairs. Verify continuity, compare
automatic derivatives with finite differences, and quantify shortcut
error relative to the full method. Keep a no-shortcut baseline.

Lingua principale
C++
Stelle
44
Fork
47
Merge medio
18h 2m
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AMReX-Astro/Microphysics

Tutte le issue di AMReX-Astro/Microphysics

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.