Repository navigation
Abort on a fluid cell with no valid time step instead of dropping it from the dt reduction - #1952
Merged
Merged
Conversation
…from the dt reduction min() discards a NaN candidate, so a cell whose state went NaN or unphysical vanished from the adaptive-dt reduction and dt came from the cells still valid, until the bad state spread and a later step was sized wrong. Flag such a cell in the same reduction and abort with its rank, indices and coordinates.
sbryngelson
marked this pull request as ready for review
October 8, 2026 16:51
Lines of Code
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The reduction, index decoding, diagnostics, and CPU/GPU behavior are consistent with existing code patterns.
0 open findings
What changed in this PR
Adds immediate diagnostics when a fluid cell produces an invalid inviscid time-step candidate.
Changes:
- Detects NaN or non-positive inviscid time steps during GPU reduction.
- Reports the responsible rank, local indices, and coordinates before aborting.
| File | Description |
|---|---|
src/simulation/m_time_steppers.fpp |
Adds invalid-cell reduction and location-aware abort handling. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1952 +/- ##
==========================================
- Coverage 62.66% 61.75% -0.91%
==========================================
Files 86 86
Lines 22435 22787 +352
Branches 3325 3357 +32
==========================================
+ Hits 14058 14073 +15
- Misses 6119 6225 +106
- Partials 2258 2489 +231 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
s_compute_dttakes amin()over fluid cells.min()drops a NaN operand, so a cell whose state has gone NaN or unphysical (e.g. negative pressure, so a NaN sound speed) silently leaves the reduction: dt is set by the cells that are still valid, the bad state keeps spreading, and the run dies some steps later at the next save, or after an oversized step, far from where it started.This flags any fluid cell whose inviscid dt candidate is not
> 0(NaN or non-positive) inside the same reduction (amaxover its linear index) and aborts with the rank, local indices and coordinates of that cell..not. (x > 0)is used rather thanieee_is_nan, which MFC does not use in device code (only behind__INTEL_COMPILER).Motivation
Found while running particle-resolved reacting-carbon cases with hot isothermal IBs (#1821). The NaN was first reported at a later save, on a rank with no particles; the first bad cells were next to particle surfaces.
Testing
./mfc.sh test --no-mpi -o Chemistry(15) and-o IBM(61): pass, unchanged (CCE 19, CPU). No golden changes: the check only fires on a state that would otherwise go on to fail.No valid time step: rank 0, local cell (j,k,l) = 78 75 45, x = 5.4167E-05 6.2917E-04 3.7917E-04, 2.4 cells from a particle surface.s_compute_dtkernel is 0.87 ms per call with the check, 0.16% of GPU time. No communication is added../mfc.sh lintpasses excepttest_thermochem.py::test_precision_and_directives[dp-acc], which also fails without this change here: LLNL's gfortran 13.3.1 offloads OpenACC to nvptx, whose device libm lackslog10.This PR was written and tested with Claude Code (AI) on LLNL Tuolumne (CCE 19 CPU; OpenMP offload on MI300A).
Acknowledgement