AMReX-Astro / AMReX-Astro/Microphysics

SDC cleanup normalizes invalid species before checking for burn failure

Open
#2,066 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Suggested priority: High
Reviewed revision: 3ac0bda4f00da3eed0446beadfc1cd5c51b99a40

Problem and impact

The SDC cleanup calls normalize_abundances_sdc_burn() before checking the species failure thresholds. That function clips partial densities into the physical interval and renormalizes them. The subsequent comparisons therefore inspect repaired values, making the checks ineffective for finite, out-of-range solver output.

An integrator that reports success with a substantially negative or excessive species abundance can be returned to the application as a successful burn with a silently altered composition. This defeats the explicit final-state safety check and can prevent a retry.

Affected code

Reproduction and observed behavior

From the repository root, run:

python3 agent-notes/integration-review-2026-09-06/reproduce.py

Run sdc_validation: pass cleanup an integration state with rho = 1, partial densities (-0.1, 1.1), positive energy, IERR_SUCCESS, and the default species failure tolerance 0.01.

input rhoX=-.1,1.1; success=1 normalized rhoX=1e-30,1 expected success=false

The test executes the actual SDC cleanup and the exact normalizer definition extracted from interfaces/burn_type.H. EOS behavior is stubbed out; no network is needed.

The companion script and captured output are part of this review. These are focused CPU tests with minimal AMReX/physics substitutes, not full network or GPU integration tests. Attach the script when submitting this issue.

Suggested fix and regression coverage

Validate the unmodified integrator output before clipping/normalization, or preserve an unmodified copy for validation. The Strang cleanup already checks int_state.y rather than the normalized burn state. Add negative- and excessive-abundance cases, plus a near-boundary case within the allowed tolerance, and verify the success flag used by the caller.

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

Run python3 agent-notes/integration-review-2026-09-06/reproduce.py from the repository root, then inspect integration/integrator_setup_sdc.H at the referenced lines and interfaces/burn_type.H around line 307. Trace the SDC cleanup's validation and normalization order. Done means negative and excessive abundances fail, near-boundary values within tolerance succeed, and regression coverage verifies the caller's success flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.