Skip to content

Comments

Fix integral zmin/zmax never initialized (copy-paste of ymin/ymax)#1177

Open
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/integral-zbounds-init
Open

Fix integral zmin/zmax never initialized (copy-paste of ymin/ymax)#1177
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/integral-zbounds-init

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Feb 21, 2026

Summary

Severity: CRITICAL — 3D volume integrals use garbage z-bounds.

File: src/simulation/m_global_parameters.fpp, lines 817-818

The initialization loop for volume integral bounds repeats ymin/ymax on the lines that should set zmin/zmax, a copy-paste error from the y-bounds initialization just above.

Before

integral(i)%xmin = dflt_real
integral(i)%xmax = dflt_real
integral(i)%ymin = dflt_real
integral(i)%ymax = dflt_real
integral(i)%ymin = dflt_real   ! should be zmin
integral(i)%ymax = dflt_real   ! should be zmax

After

integral(i)%xmin = dflt_real
integral(i)%xmax = dflt_real
integral(i)%ymin = dflt_real
integral(i)%ymax = dflt_real
integral(i)%zmin = dflt_real
integral(i)%zmax = dflt_real

Why this went undetected

Only affects 3D simulations that use volume integral diagnostics. The y-bounds are initialized twice (harmlessly), masking the fact that z-bounds are never set.

Test plan

  • Run 3D simulation with volume integral output and verify z-bounds

🤖 Generated with Claude Code

Fixes #1198

Copilot AI review requested due to automatic review settings February 21, 2026 03:22
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 21, 2026

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 ·
Reddit ·
LinkedIn

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Warning

Rate limit exceeded

@sbryngelson has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Feb 21, 2026
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 21, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • GPU/device consistency
    The integral array fields are initialized on the host here but I could not find corresponding GPU declarations/updates for these fields. If integral is accessed on device kernels, ensure the device-side declaration/synchronization ($:GPU_DECLARE/$:GPU_UPDATE or equivalent) includes the integral bounds to avoid stale/uninitialised values on the device.

  • Initialization coverage
    The PR fixes an obvious copy-paste bug by initializing integral(i)%zmin/zmax. Confirm there are no other similar copy-paste misses for other derived-type fields or other initialization loops (e.g., newly added/other bounds elsewhere, or any post-input reinitialization paths). Also check that all code paths that rely on integral z-bounds are tested (including cases with p==0 or 2D runs).

@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 21, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

Copilot AI left a 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 fixes a copy-paste error in the volume integral initialization code where z-axis bounds were incorrectly set to y-axis bounds, leaving zmin and zmax uninitialized.

Changes:

  • Corrected initialization of integral(i)%zmin and integral(i)%zmax to use zmin/zmax instead of the duplicated ymin/ymax

cubic-dev-ai[bot]

This comment was marked as off-topic.

The z-bounds initialization for volume integrals repeats ymin/ymax
instead of zmin/zmax. 3D volume integrals use uninitialized z-bounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.05%. Comparing base (84c46e0) to head (97e530d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1177   +/-   ##
=======================================
  Coverage   44.05%   44.05%           
=======================================
  Files          70       70           
  Lines       20498    20499    +1     
  Branches     1990     1990           
=======================================
+ Hits         9030     9031    +1     
  Misses      10329    10329           
  Partials     1139     1139           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

bc_x%ve3 never MPI-broadcast (duplicate ve2 in list)

1 participant