Skip to content

Fix wrong 4th arg in viscous gradient call#1230

Closed
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:fix/viscous-gradient-arg
Closed

Fix wrong 4th arg in viscous gradient call#1230
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:fix/viscous-gradient-arg

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Feb 21, 2026

Copy link
Copy Markdown
Member

User description

Summary

  • The finite-difference viscous gradient call passed dq_prim_dy_qp(1)%vf(i) as both the 3rd and 4th arguments
  • The 4th argument should be dq_prim_dz_qp(1)%vf(i) (z-gradient), matching the WENO branch above it
  • This caused the z-derivative to never be computed in the FD viscous path

Test plan

  • Verify 3D viscous FD cases produce correct results
  • Golden file regeneration may be needed for affected test cases

🤖 Generated with Claude Code


CodeAnt-AI Description

Fix viscous finite-difference so z-gradient is computed in 3D

What Changed

  • The 3D finite-difference viscous gradient now computes the z-derivative instead of repeating the y-derivative
  • This corrects viscous-gradient values used in 3D viscous finite-difference simulations, changing computed viscous forces/terms where previously the z-gradient was missing
  • Affected 3D viscous FD test outputs may change and may require golden-file regeneration

Impact

✅ Correct 3D viscous gradients
✅ Fewer incorrect simulation outputs for 3D viscous cases
✅ More accurate CFD results where z-derivative matters

💡 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

The finite-difference gradient call passed dq_prim_dy_qp (y-gradient)
as the 4th argument instead of dq_prim_dz_qp (z-gradient). This meant
the z-derivative was never computed in the FD path, and the y-derivative
was written twice.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 21, 2026 22:58
@codeant-ai

This comment has been minimized.

@coderabbitai

This comment has been minimized.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@codeant-ai

This comment has been minimized.

@codeant-ai

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 critical bug in the finite-difference viscous gradient computation where the z-direction gradient was incorrectly replaced with a duplicate y-direction gradient. The fix ensures that 3D viscous simulations using finite-difference methods now correctly compute all three spatial derivatives.

Changes:

  • Corrected the 4th argument in s_compute_fd_gradient call from dq_prim_dy_qp(1)%vf(i) to dq_prim_dz_qp(1)%vf(i)

@codecov

codecov Bot commented Feb 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.04%. Comparing base (d048c4b) to head (e4ac9c1).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_viscous.fpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1230      +/-   ##
==========================================
- Coverage   44.07%   44.04%   -0.03%     
==========================================
  Files          70       70              
  Lines       20431    20498      +67     
  Branches     1974     1990      +16     
==========================================
+ Hits         9004     9029      +25     
- Misses      10291    10330      +39     
- Partials     1136     1139       +3     

☔ 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.

@sbryngelson sbryngelson deleted the fix/viscous-gradient-arg branch February 22, 2026 21:59
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.

2 participants