Skip to content

Comments

Fix G_K exponential degradation in damage model#1227

Closed
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/damage-GK-exponential
Closed

Fix G_K exponential degradation in damage model#1227
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson:fix/damage-GK-exponential

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Feb 21, 2026

User description

Summary

  • The continuous damage factor was applied to G_K/G inside the stress component loop (do i = strxb, strxe), causing the shear modulus to be compounded by the damage factor on each iteration
  • With N stress components, this produced an effective G_K * damage^N instead of the intended G_K * damage
  • Fix moves the damage application before the loop in both cons-to-prim and prim-to-cons paths

Test plan

  • Verify damage model test cases produce physically correct stress degradation
  • Golden file regeneration likely needed for damage model cases

🤖 Generated with Claude Code


CodeAnt-AI Description

Apply damage factor once to shear modulus to stop exponential weakening

What Changed

  • The damage multiplier is applied a single time to the shear modulus before iterating stress components instead of being multiplied inside the component loop.
  • Shear contribution to pressure and elastic stress now uses the correctly degraded shear modulus rather than an N-times compounded reduction.
  • No change to user-facing inputs; results for damage-model cases will change to the physically intended stress degradation.

Impact

✅ Correcter stress degradation for damage cases
✅ Restored shear strength in damaged cells
✅ Fewer unexpected differences in damage-model outputs

💡 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 damage factor was applied inside the stress component loop, causing
G_K (and G) to be multiplied by the damage factor on every iteration.
With N stress components, the effective shear modulus was reduced by
damage^N instead of damage^1. Move the damage application before the
loop so it is applied exactly once per cell.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

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.

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 critical bug in the continuous damage model for hypoelastic materials. The damage factor was incorrectly applied to the shear modulus G_K/G inside the stress component loop, causing exponential degradation with each stress component iteration. The fix moves the damage application to before the loop in both the conservative-to-primitive and primitive-to-conservative conversion paths.

Changes:

  • Move damage factor application for G_K outside the stress loop in s_convert_conservative_to_primitive_variables
  • Move damage factor application for G outside the stress loop in s_convert_primitive_to_conservative_variables

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.04%. Comparing base (d048c4b) to head (e9ad948).
⚠️ Report is 19 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1227      +/-   ##
==========================================
- Coverage   44.07%   44.04%   -0.03%     
==========================================
  Files          70       70              
  Lines       20431    20498      +67     
  Branches     1974     1991      +17     
==========================================
+ Hits         9004     9029      +25     
- Misses      10291    10329      +38     
- Partials     1136     1140       +4     

☔ 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
Copy link
Member Author

Superseded by #1242 (batched HPC-sensitive fixes)

@sbryngelson sbryngelson deleted the fix/damage-GK-exponential 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.

1 participant