[RodStraightSection] Fix rest shape double-offset for non-first sections#224
Open
lkarstensen wants to merge 1 commit intosofa-framework:masterfrom
Open
Conversation
…ons (sofa-framework#223) x_used is the global curvilinear abscissa; adding x_start again placed the rest node at 2*x_start + local_offset instead of x_used. For wires with two or more RodStraightSections this produced enormous elastic restoring forces at every timestep, causing simulation explosion. Fix: use x_used directly, consistent with RodSpireSection and RodMeshSection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #223.
RodStraightSection::getRestTransformOnXcomputed the rest position asx_start + x_used, butx_usedis already the global curvilinear abscissa. This placed rest-shape nodes at2 * x_start + local_offsetinstead ofx_usedfor any section that is not the first in thewireMaterialslist.Example (stiff section 420 mm + flex section 30 mm):
The ~420 mm offset between rest shape and mechanical DOFs caused
AdaptiveBeamForceFieldAndMassto generate huge elastic restoring forces every timestep, leading to simulation explosion on any disturbance (e.g. vessel-wall contact).Fix
This matches the pattern already used correctly by
RodSpireSectionandRodMeshSection. Zero effect on single-section wires (x_start = 0).