-
Notifications
You must be signed in to change notification settings - Fork 341
[Spring] SpringForceField now handles configuration singularity #5822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[Spring] SpringForceField now handles configuration singularity #5822
Conversation
…in simulation by adding regularisation term (so that matrix can be inverted)
| { | ||
| m(j,k) = ((Real)spring.ks-tgt) * u[j] * u[k]; | ||
| m[j][k] = ((Real)spring.ks-tgt) * u[j] * u[k]; | ||
| m[j][k] += (isSingular) ? regParam * spring.ks * (((j==k) ? 1.0: 0.0) - u[j] * u[k]) : 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| m[j][k] += (isSingular) ? regParam * spring.ks * (((j==k) ? 1.0: 0.0) - u[j] * u[k]) : 0.0; | |
| if (isSingular && (j==k)) | |
| m[j][k] += regParam * spring.ks * (1 - u[j] * u[k]); |
This is more readable.
|
Very nice to see your contributions @remibessard 👍 👍 👍 👍 |
| m[j][k] = ((Real)spring.ks-tgt) * u[j] * u[k]; | ||
| m[j][k] += (isSingular) ? regParam * spring.ks * (((j==k) ? 1.0: 0.0) - u[j] * u[k]) : 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| m[j][k] = ((Real)spring.ks-tgt) * u[j] * u[k]; | |
| m[j][k] += (isSingular) ? regParam * spring.ks * (((j==k) ? 1.0: 0.0) - u[j] * u[k]) : 0.0; | |
| m(j,k) = ((Real)spring.ks-tgt) * u[j] * u[k]; | |
| m(j,k) += (isSingular) ? regParam * spring.ks * (((j==k) ? 1.0: 0.0) - u[j] * u[k]) : 0.0; |
| // dF = k_s.U.U^T.dX + f/l.(I-U.U^T).dX = ((k_s-f/l).U.U^T + f/l.I).dX | ||
| auto& m = springForce->dForce_dX; | ||
| Real tgt = forceIntensity * inverseLength; | ||
| Real tol = 1e-8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not use std::limit ?
I agree that a user-defined data would not be appropriate, but I do not like hard-coded value
Update SpringForceField so that it handles configuration singularity in simulation by adding regularization term (so that matrix can be inverted).
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