Fix moncon_cutoff declared as integer, truncating 1e-8 to 0#1174
Fix moncon_cutoff declared as integer, truncating 1e-8 to 0#1174sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Pull request overview
Fixes a constant type bug in the shared m_constants module where moncon_cutoff was declared as an integer while being assigned a working-precision real literal, which effectively truncated the cutoff to 0 and disabled THINC’s monotonicity constraint.
Changes:
- Change
moncon_cutofffrominteger, parametertoreal(wp), parameterso1e-8_wpis preserved. - Restores intended thresholding behavior for THINC monotonicity checks (used in
src/simulation/m_muscl.fpp).
Comments suppressed due to low confidence (1)
src/common/m_constants.fpp:47
- The inline comment has a spelling/grammar issue: “extremas” should be “extrema” (plural of extremum).
real(wp), parameter :: moncon_cutoff = 1e-8_wp !< Monotonicity constraint's limiter to prevent extremas in THINC
moncon_cutoff is assigned 1e-8_wp but declared as integer, so Fortran silently truncates it to 0. This makes all THINC monotonicity constraint comparisons always true, completely disabling the constraint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e392985 to
e12577c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1174 +/- ##
=======================================
Coverage 44.05% 44.05%
=======================================
Files 70 70
Lines 20498 20498
Branches 1990 1990
=======================================
Hits 9030 9030
Misses 10329 10329
Partials 1139 1139 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Severity: CRITICAL — completely disables the THINC monotonicity constraint.
File:
src/common/m_constants.fpp, line 47moncon_cutoffis declared asintegerbut assigned the real literal1e-8_wp. Fortran silently truncates this to0. Every comparison likemoncon > moncon_cutoffis then always true (sincemoncon_cutoff = 0), so the THINC monotonicity constraint is never enforced.Before
After
Why this went undetected
Fortran truncates real-to-integer conversions at compile time with at most a warning (often suppressed). THINC still produces plausible-looking results without the monotonicity constraint — the interface compression just allows more extrema than intended, which is hard to notice visually.
Test plan
🤖 Generated with Claude Code
Fixes #1195