Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

he-burn approximate rates need denominator guard

Open
#1,947 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
hpc

Research direction

Search the *_approx helpers in networks/he-burn/ase/reaclib_rates.H and networks/he-burn/cno-he-burn-33a/reaclib_rates.H for denominator calculations using r_pg + r_pa. Review the rate and derivative expressions together, then add the proposed low-temperature/high-screening stress coverage. Done means no inf/nan in rate or drate_dT and no regressions in standard burn trajectories.

Written by the indexing model from the issue text.

Description

ai-code-audit

Approximate effective-rate helpers divide by (r_pg + r_pa) without denominator floor

Summary

Multiple approximate-rate helper functions in he-burn reaclib_rates.H files compute:

dd = 1.0_rt / (r_pg + r_pa)

with no protection against near-zero or zero denominator. Under extreme conditions (very small screened rates), this can produce inf/nan and destabilize RHS/Jacobian evaluation.

Severity

Medium

Affected Code

  • networks/he-burn/*/reaclib_rates.H
    • families of functions named *_approx using dd = 1.0_rt / (r_pg + r_pa)
    • examples:
      • networks/he-burn/ase/reaclib_rates.H (e.g. around lines 1934, 1953, ...)
      • networks/he-burn/cno-he-burn-33a/reaclib_rates.H (e.g. around lines 3824, 3843, ...)

Why This Is a Bug

Even if uncommon, exact/underflow-zero denominator can occur in screened-rate arithmetic, and current code has no numerical guard. A single inf/nan can contaminate burn state and Jacobian entries.

Proposed Patch

Use a denominator floor (and derivative-consistent handling) in all affected helpers:

-    amrex::Real dd = 1.0_rt / (r_pg + r_pa);
+    constexpr amrex::Real denom_floor = 1.0e-300_rt;
+    const amrex::Real denom = amrex::max(r_pg + r_pa, denom_floor);
+    amrex::Real dd = 1.0_rt / denom;

For derivative expressions containing dd * dd, reuse denom consistently.

Validation

  • Add a stress test at low-temperature/high-screening conditions where both channel rates become tiny.
  • Verify no inf/nan in rate or drate_dT and no regressions in standard burn trajectories.
Dominant language
C++
Stars
44
Forks
46
Avg merge
3d 7h
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from AMReX-Astro/Microphysics

All issues in AMReX-Astro/Microphysics

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.