Repository navigation
Fix NEMO history MAX_/BGS_ residual groups: species-first indexing and finite maximum residuals - #2882
Merged
bigfooted merged 8 commits intoOct 2, 2026
Conversation
…d finite maximum residuals The NEMO solution vector is species-first, but CNEMOCompOutput wrote the MAX_RES and BGS_RES history groups with calorically-perfect indexing: max[RhoV] read Res_Max(2), which is the residual of species 2, and the momentum, energy, and vibrational-electronic maxima were never written at all. Register and load both groups with the same species-first layout as RMS_RES (max[Rho_0..n], max[RhoU], max[RhoV], max[RhoW], max[RhoE], max[RhoEve]; likewise bgs[*]). Res_Max and Res_Max_BGS also had no floor, unlike the EPS^2 floor applied to the RMS reductions in CSolver::SetResidual_RMS, so an exactly-zero residual, for example an inert trace species at a cold start, printed a literal "-inf" into history.csv and the screen table, breaking numeric consumers of the history file. Floor both maxima at EPS^2, matching the RMS convention (log10 floor of -32). Verified on a cold-start AIR-5 NEMO case: the pre-fix max[Rho], max[RhoU], and max[RhoE] values reappear bit-identically as max[Rho_0], max[Rho_1], and max[Rho_4]; the inert-species -inf cell prints -32; the newly written momentum and energy maxima satisfy max >= rms; every previously existing non-max column is bit-identical. The compressible QuickStart history is byte-identical before and after the fix. GetRes_Max has no in-tree consumer besides the log10 output sites. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Exercise species-first MAX/BGS output in 2D and 3D, the zero-MAX finite log floor, and the real multizone BGS load path. Remove the unused Residual_Max_BGS floor: BGS output reads Residual_BGS, which is already floored. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…_max_bgs_residual_output
Author
|
I updated this with the latest develop and all the checks are passing. The tests cover the MAX and BGS mapping for each species and confirm finite output when a residual is zero. I also clarified which history fields were renamed and which configs need updating. |
Contributor
|
If you update again I go through it and we can probably merge this week. |
Author
|
Updated with the latest develop, and all checks are now passing. Thanks for rerunning the affected jobs. |
bigfooted
approved these changes
Oct 1, 2026
bigfooted
left a comment
Contributor
There was a problem hiding this comment.
LGTM
@joshkellyjak can you do a final check before merging?
joshkellyjak
requested changes
Oct 1, 2026
joshkellyjak
requested changes
Oct 2, 2026
joshkellyjak
left a comment
Contributor
There was a problem hiding this comment.
Just the SetHistoryOutputFields helper function change and then LGTM
joshkellyjak
approved these changes
Oct 2, 2026
5 of 6 tasks
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.
Proposed Changes
NEMO's MAX_RES and BGS_RES groups used the calorically perfect variable layout even though the solution vector starts with one density per species. For AIR-5, fields labeled as momentum and energy therefore read species residuals, and the actual momentum, energy, and vibrational-electronic residuals were missing. This change registers and loads the complete species-first layout in 2D and 3D. RMS/MAX/BGS share one loading lambda, with energy at
nSpecies + nDim. Species loop counters are local and useauto iSpecies = 0u.CSolver::SetResidual_RMSfloors maximum residuals atEPS*EPSafter the value and location reductions, matching the RMS convention and preventinglog10(0)in output. This shared reducer also applies to non-NEMO solvers. BGS history uses the already-flooredResidual_BGS; the distinctResidual_Max_BGSstorage remains unchanged.Breaking NEMO field-name change: replace
MAX_DENSITYandBGS_DENSITYwith explicitMAX_DENSITY_iandBGS_DENSITY_iselectors inCONV_FIELD,HISTORY_OUTPUT, andSCREEN_OUTPUT. Update relative and zone-qualified selectors similarly, for exampleREL_MAX_DENSITY_0orBGS_DENSITY_0[0]. The old unsuffixed fields sampled species zero, not total mixture density. List every species that must satisfy the stopping criterion. New vibrational-electronic fields areMAX_ENERGY_VEandBGS_ENERGY_VE.Obsolete NEMO
CONV_FIELDnames now produce an actionable startup error instead of being discarded and potentially weakening a mixed stopping condition. The check requires a registered per-species replacement, preserving valid non-NEMO names. Screen/history requests retain the existing unavailable-field handling.The residual assembly and solution-update formulas are unchanged. Corrected group membership changes
AVG_MAX_RESandAVG_BGS_RES, including zone-qualified averages used by multizone convergence monitoring. AIR-5 groups now include nine variables in 2D or ten in 3D, so runs monitoring corrected fields or averages can stop at different iterations.Validation
Current head: d193edebce. This follow-up only changes the 13 species-loop declarations to unsigned
auto, as requested in review. Recompiled current production/test objects passed 547 assertions in 4 focused cases on macOS arm64, non-MPI. This was an incremental diagnostic using existing native libraries.The complete RunPod matrix below was run at parent 24162ed571, before that loop-style follow-up. A clean Linux x86_64 build used GCC 13.3.0, MPI and MLPCpp enabled. All 9,458 packaged source/dependency files matched their recorded hashes; retained build/test artifacts were retrieved and SHA-256 verified.
OpenMP, AD, DD and sanitizer builds were not tested on RunPod. Fresh upstream checks at the current head remain the merge gate; earlier-head green checks are not treated as validation of this head. Original cold-start AIR-5 and QuickStart comparisons remain historical evidence and were not rerun for this revision.
Related Work
This PR repairs NEMO residual output indexing and maximum-residual reporting, and protects convergence configuration during the field-name migration. It is independent of the mass-fraction tolerance change in #2880 and interrupt-exit reporting in #2881.
PR Checklist
pre-commit run --all. Direct pinned formatter checks were used for this revision; the complete hook was not run locally.