AMReX-Astro / AMReX-Astro/Microphysics

Debye-Huckel shortcut creates a discontinuous screening factor

Open
#2,097 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-code-audit screening
Dominant language
C++
Stars
43
Forks
46
Avg merge
2d 18h
Merged PRs (30d)
15

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with screening/screen.H lines 637-641 and the Debye-Huckel implementation at lines 159-179, then inspect screening/_parameters lines 4-5 and the harness instructions in README.md. Reproduce the pure-hydrogen proton-pair case, then validate the transition across all supported methods, compositions, and ion pairs, including automatic derivatives, finite differences, shortcut error, and a no-shortcut baseline.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, performance, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.