Skip to content

Make the NEMO total-energy under-relaxation check reachable - #2884

Merged
bigfooted merged 8 commits into
su2code:developfrom
babybluechips:fix_nemo_energy_underrelaxation
Sep 16, 2026
Merged

bigfooted merged 8 commits into
su2code:developfrom
babybluechips:fix_nemo_energy_underrelaxation

Conversation

@bellonarts

@bellonarts bellonarts commented Sep 5, 2026

Copy link
Copy Markdown

The total energy check was nested inside the species block, so it could never execute. This makes the energy check independent and applies the tighter species or total energy limit.

The loop logic is now the small ComputeUnderRelaxationFactor helper requested in review. Its direct test with manufactured data covers small and excessive energy updates, opposing species updates, which limit wins, and cancellation for a tiny factor.

Validation after the latest develop merge

Updated with develop 8118ee0f507b5fb0fd70b819e6f1351c1b3c6d28 after #2883 merged. The approved helper and its direct tests are unchanged.

The combined source validation tested merge commit 7e89cb6be1a869a61f9425bd069dc1ac6aa3d699 on Linux x86 and ARM with separate serial and MPI builds. All 52 solver runs completed, and every repeated row agreed within its architecture and build. All four full normal unit suites passed. Both MPI builds included Mutation++ support.

That validation run failed its comparisons against the old cone references. Commit 53b8b75affdf3b1c29ff56691fc2333dd32cbd88 updates four cone arrays from the repeated results, with three residual entries changed in each. All 52 recorded rows pass the updated references under the original tolerances. Other references, configurations and restart inputs are unchanged.

Full upstream CI on 53b8b75affdf3b1c29ff56691fc2333dd32cbd88 passed: all 31 regression workflow jobs, including unit tests and both sanitizer suites. Code Style, CodeQL, labels and CodeFactor also passed.

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

bellonarts and others added 2 commits September 3, 2026 13:25
In CNEMOEulerSolver::ComputeUnderRelaxationFactor the total-energy check
(iVar == nVar-2) was nested inside the species block (iVar < nSpecies).
Total energy sits at nSpecies+nDim, so the check could never run and the
energy update was never under-relaxed. Close the species block first and
evaluate the energy check on its own; no new logic is added.

This changes the implicit update wherever the energy bound is active, so
the affected NEMO regression vectors are rebaselined (serial: invwedge,
visc_cone; parallel: invwedge_a, invwedge_msw, invwedge_roe, invwedge_lax,
invwedge_ss_inlet, visc_cone, super_cat, ion_gy). The aarch64 vectors are
left for a maintainer. A unit test builds a NEMO Euler solver on the unit
box and checks that an over-large energy update is limited (it stays
unlimited on the previous code) alongside a species control.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Update the branch-specific serial and two-rank aarch64 expectations from GitHub Actions run 33998938091 at exact pre-update head a495681. Artifact digest: sha256:4c9d814dd9a373592fce4c9f33f74e565e26016ee855b2df8660bbcc99e4d560. No x86 expectation or solver source changes.
@bigfooted

Copy link
Copy Markdown
Contributor

you don't have to write almost 100 lines to explain basically the movement of a closing brace :-)

Comment thread UnitTests/SU2_CFD/solvers/CNEMOEulerSolver_tests.cpp
Extract the per-point limiter into a shared function and test it with manufactured inputs.

Validation: 9 limiter assertions and 33 supported native unit cases pass. Restoring the original brace error fails 4 limiter assertions. The data-driven fluid-model test is excluded because MLPCpp is disabled in this local build.

@pcarruscag pcarruscag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some regressions are failing, maybe from floating point changes due to taking out the function, please update the gold values when you can.

Refresh eight reference arrays from independently repeated Linux serial and two-rank MPI runs on x86 and ARM. All x86 selected outputs match upstream CI. Keep the reviewed limiter helper and tests, existing tolerances, ion iteration 99 and restart protection.
Remove the 37 existing E221 spacing issues reported by CodeFactor. Both complete Python ASTs and every numerical reference remain identical.
@bellonarts

Copy link
Copy Markdown
Author

Thanks Pedro. I updated the gold values after repeating the affected cases on Linux x86 and ARM. The repeated runs agree, and the tolerances are unchanged. The helper and its direct tests are still in place. The full CI run is underway.

The serial and MPI cone rows repeat exactly on Linux x86 and ARM. Update the four cone arrays for the combined energy and distance fixes. All four full normal unit runs passed, and all 52 recorded rows accept the updated references with unchanged tolerances.
@bigfooted
bigfooted merged commit 93da641 into su2code:develop Sep 16, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants