AMReX-Astro / AMReX-Astro/Castro

The stage CFL check repeatedly inspects the unchanged old state

Open
#3,400 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

Locations: Source/driver/Castro_advance_sdc.cpp:158-163 and
Source/hydro/Castro_hydro.cpp:180-354.

Finding

Inside the node loop, check_for_cfl_violation is called with S_old. Its
implementation derives density, velocity, and sound speed from the passed
MultiFab, not from the stage primitive variables. Every call therefore checks
the same initial state, even after burning, forcing, or compression increases
the stage wave speed.

True SDC also skips the post-advance timestep validity check in
finalize_do_advance. A step that begins within the CFL bound but violates it
at later nodes can thus pass every intended stage check.

Evidence

Static inspection confirms that S_old aliases the fixed first time node, while
S_new and Sborder hold the current stage when the checker is called. For
example, an initial Courant number 0.5 and a later stage wave speed three times
larger would still be checked as 0.5 instead of 1.5.

This report concerns the state supplied to the check, not a new claim about the
optimal stability limit of the SDC iteration.

Proposed fix

Pass the cleaned current stage, S_new or Sborder, to the checker. Also check the
final updated state, since the final-node RHS evaluation is intentionally
skipped. Preserve the existing abort behavior unless true-SDC retry support is
implemented separately.

Validation after fixing

Use a source-driven or reacting case whose initial state is safely below the
bound but whose stage sound speed crosses it. Require the stage check to detect
the violation. A stable control must complete without changing its solution.

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 in Source/driver/Castro_advance_sdc.cpp:158-163 and Source/hydro/Castro_hydro.cpp:180-354, tracing which stage state is passed to check_for_cfl_violation and how finalize_do_advance handles the final state. Validate with a source-driven or reacting case that crosses the CFL bound during a stage, plus a stable control whose solution remains unchanged; done means the violation is detected while preserving existing abort behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.