-
Notifications
You must be signed in to change notification settings - Fork 127
Bug fix for CFL adaptive time stepping #1027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) & | ||
| /minval(1/(rho*Re_l)) | ||
| /maxval(1/(rho*Re_l)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Prevent a potential division-by-zero error by adding a small epsilon value to the denominator rho*Re_l inside the maxval function call. [possible issue, importance: 8]
| vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) & | |
| /minval(1/(rho*Re_l)) | |
| /maxval(1/(rho*Re_l)) | |
| vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) & | |
| /maxval(1/(rho*Re_l + epsilon(0.0_wp))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR corrects the viscous CFL time-step calculation for 1D and 3D cases by changing minval to maxval when computing the kinematic viscosity term, ensuring consistency with the 2D case and the inverse stability calculation in s_compute_stability_from_dt.
- Fixes incorrect use of
minvaltomaxvalfor viscous CFL calculations - Ensures consistent physics across all dimensionalities (1D, 2D, 3D)
- Aligns with the inverse calculation in
s_compute_stability_from_dt
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1027 +/- ##
=======================================
Coverage 44.36% 44.36%
=======================================
Files 71 71
Lines 20590 20590
Branches 1994 1994
=======================================
Hits 9134 9134
Misses 10310 10310
Partials 1146 1146 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
CodeAnt AI is reviewing your PR. |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis change modifies viscous CFL timestep calculations in a simulation helper module. Three instances of Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
|
CodeAnt AI is running Incremental review |
|
CodeAnt AI Incremental review completed. |
User description
User description
Description
Bug fix for CFL adaptive time stepping. The denominators should be
maxvalnotminvalin order to capture the worst case. Thanks to Mike VandenBoom for pointing this error out to me.Type of change
Please delete options that are not relevant.
Scope
PR Type
Bug fix
Description
Fix CFL adaptive time stepping denominator calculation
Change
minvaltomaxvalfor worst-case scenarioAffects 3D, 2D, and 1D viscous flow calculations
Diagram Walkthrough
File Walkthrough
m_sim_helpers.fpp
Replace minval with maxval in viscous CFL calculationssrc/simulation/m_sim_helpers.fpp
minval(1/(rho*Re_l))tomaxval(1/(rho*Re_l))in 3D viscouscase
minval(1/(rho*Re_l))tomaxval(1/(rho*Re_l))in 1D viscouscase
Note
Replace
minval(1/(rho*Re_l))withmaxval(1/(rho*Re_l))in viscous CFL timestep calculations to enforce the strongest constraint in 3D and 1D paths.src/simulation/m_sim_helpers.fpp:minval(1/(rho*Re_l))withmaxval(1/(rho*Re_l))ins_compute_dt_from_cfl.grid_geometry == 3) and Cartesian branches.Written by Cursor Bugbot for commit 2485e7e. Configure here.
CodeAnt-AI Description
Base CFL viscous time step on worst-case viscosity term
What Changed
Impact
✅ Avoids CFL violations in viscous runs✅ Ensures 3D/1D viscous steps stay within the strictest time limit✅ Keeps simulation stability tied to worst-case viscosity💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.