AMReX-Astro / AMReX-Astro/Castro

`compute_flux_q` passes total pressure to hybrid momentum flux in radiation mode

Open
#3,247 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

In the HYBRID_MOMENTUM branch of compute_flux_q, the state passed to compute_hybrid_flux uses qint.p (total pressure) for GDPRES, while the surrounding radiation flux logic uses gas pressure (qint.p_g) for hydro momentum/energy fluxes. This creates an inconsistent pressure source in hybrid momentum flux construction.

Location

  • Source/hydro/riemann_solvers.H:125
  • Source/hydro/riemann_solvers.H:136
  • Source/hydro/riemann_solvers.H:206

Problem Details

In radiation mode, the base flux is built as:

F(..., im1) += qint.p_g;
F(..., UEDEN) = qint.un * (rhoetot + qint.p_g);

But the hybrid override uses:

qgdnv_zone[GDPRES] = qint.p;
compute_hybrid_flux(qgdnv_zone, ...);

compute_hybrid_flux uses state[GDPRES] directly in pressure-force terms, so this substitutes total pressure into hybrid momentum fluxes while non-hybrid
hydro terms are gas-pressure based. The same routine later stores reduced Godunov state with GDPRES = qint.p_g under RADIATION, which further indicates the
intended field is gas pressure.

Impact

  • In RADIATION + HYBRID_MOMENTUM builds, hybrid momentum components can include a pressure contribution inconsistent with the rest of the hydro flux update.
  • Can introduce direction-dependent momentum/energy mismatch and non-physical force balance when radiation pressure is significant.

Suggested Patch

diff --git a/Source/hydro/riemann_solvers.H b/Source/hydro/riemann_solvers.H
--- a/Source/hydro/riemann_solvers.H
+++ b/Source/hydro/riemann_solvers.H
@@
-    qgdnv_zone[GDPRES] = qint.p;
+#ifdef RADIATION
+    qgdnv_zone[GDPRES] = qint.p_g;
+#else
+    qgdnv_zone[GDPRES] = qint.p;
+#endif

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

Read Source/hydro/riemann_solvers.H at the compute_flux_q and compute_hybrid_flux locations listed in the issue. Compare the GDPRES source used by the HYBRID_MOMENTUM branch with the surrounding radiation-mode flux construction. Done means radiation-mode hybrid momentum fluxes use the pressure source intended by the surrounding hydro flux logic without changing non-radiation behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.