Repository navigation
Sensitivity: gradients through a solve with self-contact, tested - #17
Merged
Merged
Conversation
On sh_self_contact_fold the adjoint gradient of a displacement with respect to the four material parameters of the shell, through a solve with active self-contact, matches central differences of the whole run to 7e-9 with the smooth contact tier. With FEBio's form of the law it is off by up to 7 percent, since that form's tangent is not the derivative of its force. No new code was needed: the adjoint solves with the system matrix, which carries the contact tangent, with the pairs as they are at the converged state; with the smooth tier that is exact, because pairs enter and leave at zero force and zero stiffness. GradientThroughContactTests keeps both checks (the FEBio-form one in the full tier). The contact, sensitivity and README notes are updated. Not built: gradients with respect to the contact parameters, and through the dynamic steps of a closure. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
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.
What does this change, and why?
Records, as tests and in the notes, that adjoint gradients through a solve with active self-contact work with the smooth contact tier of pull request 16. This is piece 6 of the plan in contact_in_run.md, for one equilibrium solve. No library code changes: the adjoint already solves with the system matrix, which carries the contact tangent, with the pairs as they are at the converged state.
On
sh_self_contact_fold, the gradient of a displacement with respect to the four material parameters of the shell, against central differences of the whole run:With the smooth tier the frozen-pair adjoint is exact, because the contact tangent is the derivative of the contact force and pairs enter and leave at zero force and zero stiffness. FEBio's form has a Newton tangent that is not that derivative (FEBio has no adjoint, so this is not a defect there); the second row is why this code's adjoint is not built on it (decision K7).
Not built: gradients with respect to the contact parameters themselves, and through the dynamic steps of a closure.
Merged by the author; comments afterwards are welcome.
Validation
tests/test_contact_in_run.py,GradientThroughContactTests(the smooth-tier check in the quick tier, the FEBio-form check in the full tier).cuda:0); quick tier on CPU (240 tests). The full tier as a whole was not rerun.Checklist
uvx pre-commit run --all-filespasses.git commit -s).🤖 Generated with Claude Code