AMReX-Astro / AMReX-Astro/Castro

`riemann_solvers.H`: multigroup radiation state storage overwrites `QRAD` instead of writing `QRAD+g`

Open
#3,215 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-code-audit radiation
Dominant language
C++
Stars
340
Forks
105
Avg merge
3d 8h
Merged PRs (30d)
8

Description

Location

Source/hydro/riemann_solvers.H:174-176

Problem

In compute_flux_q(..., store_full_state=true) under #ifdef RADIATION, the loop over groups writes:

for (int g = 0; g < NGROUPS; g++) {
    qgdnv(i,j,k,QRAD) = qint.er[g];
}

This overwrites the same component (QRAD) every iteration, leaving only the last group value and not populating QRAD+1... components.

Impact
  • Incorrect full-state Godunov interface data for multigroup radiation.
  • Derived quantities / diagnostics / downstream logic reading QRAD+g can see corrupted or stale values.
Steps to Reproduce
  1. Run with RADIATION enabled and NGROUPS > 1.
  2. Trigger path where store_full_state is true.
  3. Inspect qgdnv(i,j,k,QRAD+g) components.
  4. Observe only QRAD is updated repeatedly; higher groups are not written correctly.
Expected Behavior

Each radiation group should be stored in its own component.

Actual Behavior

All groups are written to QRAD only.

Proposed Fix
for (int g = 0; g < NGROUPS; g++) {
    qgdnv(i,j,k,QRAD+g) = qint.er[g];
}

Prepared by Codex

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 at Source/hydro/riemann_solvers.H:174-176 in compute_flux_q(..., store_full_state=true) under RADIATION, and inspect how the loop over groups populates qgdnv. Confirm that each group is stored in its corresponding QRAD+g component, then validate with RADIATION enabled and NGROUPS greater than one by inspecting the full-state interface data.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.