AMReX-Astro / AMReX-Astro/Castro

Hybrid momentum references nonexistent MOL face arrays

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

Nobody has claimed this yet.

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

Description

Location: Source/hydro/Castro_mol_hydro.cpp:623-645.

Finding

The HYBRID_MOMENTUM block reads qx_arr and qy_arr in its radial pressure
gradient. Neither identifier is declared in construct_mol_hydro_source. The
actual face-state data are stored in the direction-indexed qe FArrayBoxes.

This independently blocks true-SDC builds with USE_HYBRID_MOMENTUM=TRUE. That
feature requires DIM=3, so the dimension-guard failure in report 01 is also
present, but correcting that brace alone will not fix these undeclared arrays.

Evidence

Compiled the unchanged MOL object with DIM=3 USE_MPI=FALSE USE_TRUE_SDC=TRUE USE_HYBRID_MOMENTUM=TRUE. GCC explicitly reports qx_arr undeclared at line
641 and qy_arr undeclared at line 642, in addition to the independent
brace-related errors. Build instructions are in README.md.

Proposed fix

Before the hybrid kernel, define const array views from qe[0] and qe[1] and
capture those views in the lambda. Use them for the existing GDPRES differences.
Address report 01 in the same build-validation pass. Audit the hybrid source for
consistency with do_hydro=0 separately before claiming that configuration is
supported.

Validation after fixing

Compile the MOL object and a full three-dimensional true-SDC executable with
hybrid momentum enabled. Run a Cartesian advection or rotating-flow case and
check that the hybrid and linear momenta stay consistent. Exercise both SDC2 and
SDC4 face-state paths.

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/Castro_mol_hydro.cpp:623-645 and read the surrounding HYBRID_MOMENTUM kernel and qe face-state setup. Review README.md build instructions, then compile the MOL object with DIM=3, USE_TRUE_SDC=TRUE, and USE_HYBRID_MOMENTUM=TRUE while addressing report 01. Done means the builds succeed and Cartesian advection or rotating-flow validation covers SDC2 and SDC4 face-state paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc, testing-qa
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.