Skip to content

[HyperElastic] Fix inverted Stable Neo-Hookean scene and add regression coverage - #6377

Merged
hugtalbot merged 5 commits into
sofa-framework:masterfrom
lililii124:fix/6220-stable-neohookean-regression
Nov 5, 2026
Merged

hugtalbot merged 5 commits into
sofa-framework:masterfrom
lililii124:fix/6220-stable-neohookean-regression

Conversation

@lililii124

@lililii124 lililii124 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6220.

The inverted Stable Neo-Hookean example develops non-finite states. This restores the uniform nodal mass used in #4603, explicitly sets totalMass="1.0", and keeps the original time step of 5e-5. It also separates the inverted grid from the rest topology and makes the force-field topology and fixed-node positions explicit.

Following the review, scene history traced the mass replacement to #4687 (d5e0fdb). On a fixed SOFA 3873f08 runtime, the scene before that change remains finite for 1,000 steps; the scene after it becomes non-finite at step 977. In the latest upstream scene, replacing only MeshMatrixMass with UniformMass changes the result from failure at step 42 to 1,000 finite steps. Historical inputs received plugin/component name migrations and an explicit totalMass="1.0" to preserve the old default. These are scene-history replays and single-component controls, not a compiled historical git bisect.

Adds four material tests for negative-J stress and tangent consistency, including an analytical reflection case. Production material formulas are unchanged.

Validation on Windows Release, double precision:

  • All 28 HyperElastic tests pass.
  • The corrected scene stays finite for 5,000 steps at dt=5e-5 (0.25 seconds), with zero fixed-node drift and no inverted tetrahedra at the end.
  • Regenerated 100 reference frames; repeating CompareState gives zero error and the full-precision trajectories agree exactly. Removing the force field gives an error of 0.12800 against the 1e-4 threshold.

Scene validation uses a native C++ harness with SOFA's simulation engine and official WriteState/CompareState visitors. The runSofa CLI, upstream Regression_test executable and cross-platform CI were not exercised.

The scene is intentionally kept outside the state regression suite for now, as requested in review. The previously generated references remain available at sofa-framework/Regression#142 for future consideration.

AI assistance was used for implementation, tests and validation. Requested label: pr: AI-aided.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

…on coverage

Signed-off-by: yz <3318283120@qq.com>
@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Oct 11, 2026
@alxbilger

Copy link
Copy Markdown
Contributor

Thanks a lot for this investigation. However, in the PR where I introduced this scene, we can observe a different behavior: #4603.

I think most of the changes you made make sense, except the timestep size. According to the PR, it is supposed to work... I was not able to detect the issue in the scene. I guess a git bisect would help...

@lililii124

Copy link
Copy Markdown
Contributor Author

The issue regarding the timestep size has been resolved; please review.

Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Nov 5, 2026
@hugtalbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution @lililii124 👍

@hugtalbot
hugtalbot merged commit ef3c3b5 into sofa-framework:master Nov 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing regression on Stable NeoHookean

5 participants