Fix MHD hyperbolic cleaning using wrong sign for left fast magnetosonic speed#1180
Fix MHD hyperbolic cleaning using wrong sign for left fast magnetosonic speed#1180sbryngelson 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 |
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Pull request overview
Fixes the sign handling for left-state fast magnetosonic speed enforcement when hyperbolic cleaning is enabled, making it consistent with the right-state treatment.
Changes:
- Replace
min(c_fast%L, -hyper_cleaning_speed)withmax(c_fast%L, hyper_cleaning_speed)under hyperbolic cleaning. - Keep right-state enforcement as
max(c_fast%R, hyper_cleaning_speed)for symmetry.
…ic speed min(c_fast%L, -hyper_cleaning_speed) forces c_fast%L negative, but fast magnetosonic speeds should be positive. Changed to max() to match the right-state treatment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5049adc to
d51aaa7
Compare
Summary
Severity: HIGH — wrong wave speed estimate corrupts MHD flux computation.
File:
src/simulation/m_riemann_solvers.fpp, lines 655-657The hyperbolic divergence cleaning should ensure that the fast magnetosonic speed is at least the cleaning speed in both directions. The right state correctly uses
max(c_fast%R, hyper_cleaning_speed), but the left state usesmin(c_fast%L, -hyper_cleaning_speed), which forces it negative.Before
After
Why this went undetected
MHD with hyperbolic cleaning is a specialized feature. The asymmetric wave speed produces subtly wrong fluxes that may not cause immediate crashes.
Test plan
🤖 Generated with Claude Code
Fixes #1201