Repository navigation
Conversation
…is around like collision detection from FreeMotion
…complement encapsulating the whole system
…steps even if it increases the norm; first working version
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.
This PR introduces a new type of animation loop : the NewtonRaphson.
First the animation loop is an endangered species : it has been supersed by TimeIntegrator, and in the future all animation loop will be deprecated given that the NewtonRaphson behaves exaclty as before when forcing it to make only one newton step on fmoving forward in time
And if any constraint solver si found in the simulation it behaves like the good ol' FreeMotionAnimationLoop
And can do more !!! --> Of course, setting any other number in maxNbIterationsNewton and/or maxNbIterationsLineSearch will enable the Newton-Raphson algorithm for the body dynamics.
To do this multiple changes has been made to the IS API, sacrificing some optimization in the computation of the residual (especially for the position update). The first version I wanted to build didn't work for some mathematical reason where the residual I started from wasn't really the one I was moving towards with the line search, breaking the newton for some non-linear models.
Plus, this PR adds a new mechanism to provide a first guess for the unknown : the UnknownPredictor. For exemple :
sofa/examples/Component/AnimationLoop/NewtonRaphson_MR.scn
Lines 31 to 34 in 25ec9d6
in this scene, the newton is initialized at a state which is not the current position/velocity, but a state where a 'guessed' dv has already been integrated. In the specific case of 'ConstantVelocityPredictor' the guess is that dv=0, so we integrate the velocity as if it staid contant over the timestep, enabling to already integrate the previous timetep dynamics and start closer to the solution.
A second one is proposed : the ConstantAccelerationPredictor. The idea is that we can now plug any kind of predictor. Even AI-based...
Finally, a new visito had to be introduced. It is a multipurpose visitor, I call it the NewtonRaphson army knife. The idea is that is serves 6 different purposes : setuping the step, computing bot sides, evaluating residual, updating states with unknown, finalizing the step... I didn't want to add 6+ new visitor in a time where they became Componenta non grata, so I decided to create this monstrosity and wrap it inside of a helper, enabling easy trigger of all those tasks from the Newton-Raphson. This is of course subject to discussion if you have better idea.
TODOs:
Next steps :
[ci-depends-on https://github.com/sofa-framework/SofaGLFW/pull/309]
[ci-depends-on https://github.com/sofa-framework/SofaPython3/pull/659]
[with-all-tests]
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