Fix G_K exponential degradation in damage model#1227
Fix G_K exponential degradation in damage model#1227sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
Conversation
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>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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_Koutside the stress loop ins_convert_conservative_to_primitive_variables - Move damage factor application for
Goutside the stress loop ins_convert_primitive_to_conservative_variables
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Superseded by #1242 (batched HPC-sensitive fixes) |
User description
Summary
G_K/Ginside the stress component loop (do i = strxb, strxe), causing the shear modulus to be compounded by the damage factor on each iterationG_K * damage^Ninstead of the intendedG_K * damageTest plan
🤖 Generated with Claude Code
CodeAnt-AI Description
Apply damage factor once to shear modulus to stop exponential weakening
What Changed
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:
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.