Repository navigation
Note what gradients through history need - #108
Merged
Merged
Conversation
A static step that follows a dynamic one was refused (decision ST6 of the steps note). Handoff K asks for it, as FEBio does it. FESolidSolver2 tests the analysis type where the mass and the inertial forces enter and where velocity and acceleration follow the displacement, but not in PrepStep: its predictor runs in every time step of a static step too, with nothing to correct it. So the nodes keep a velocity and an acceleration (with the default parameters the velocity changes sign in every time step), and a mass damping load of the static step, which FEBio adds in every analysis type, reads the velocity of the material points: the one the dynamic step ended with on a solid or a shell, the nodal one on a three-field solid or a truss. A dynamic step after the static one starts from what it left. The State of such a time step carries these, the system applies the damping force through its mass blocks, the coverage report says what happens, and gradients through such a step are refused. A model with beams is refused, whose rotations have a predictor of their own. Against FEBio 4.13.0 at e4df3f8, on CPU and on a Tesla P100 with cuDSS: three generated inputs (a shell patch, a three-field hex8, a block on trusses in dynamic, static and dynamic steps) on FEBio's iterations in every time step, with displacement, velocity, acceleration and stress to 3e-12 (references/small_problems/generate_static_after_dynamic.py). tests/test_activity.py asserted the refusal and now asserts the report. After a dynamic step with alpha_f below 1 the velocity kept for a solid or a shell is the interpolated one of the last dynamic update (State.domain_v): on the shell patch with rhoi 0.5 in its dynamic step the static states are then FEBio's to 1e-12 and its 344 iterations are reproduced (a run made once, not a stored case). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Main gained history at the integration points with FEBio's viscoelastic material (pull request 98). New input ve_block_dynamic_then_static: the viscoelastic block under a held force through 6 dynamic time steps, which end with the block in motion, and 6 static ones. FEBio 4.13.0 at e4df3f8 takes 18 and 22 iterations, this code the same in every time step, with displacements and stresses to 2e-12 on CPU and on a GPU. No code was needed: the domain commits its history at the end of every converged time step of either kind of step, and the static predictor does not touch it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Design only. The adjoint refuses every term that keeps something from one converged state to the next: the attachments of sticky contact, the multipliers of an augmented constraint, a beam's rotations. Handoff K asks what it would take to carry such history in the State, first for the anchors of a tied or sticky interface and then for a material with internal variables. Section 14 of the sensitivity note lists the history there is, the reverse sweep with one more adjoint for it, what that needs of the State and of the terms, and which gradients are the derivative of the run and which are not because the run depends on its iterates. Three decisions are put for MJ (S11 to S13). The section names inputs and a section of the steps note that are on the branches of K3-2 and K3-3 and not on main at this date. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Main has a first material with history since pull request 98, with a committed and a trial array in the brick domain and the pair held by every converged State, and the reverse sweep through it since pull request 99. The note said such history was not built for solids and shells. What stays design in section 14 is the rest: anchors, multipliers, the kept velocity. No code. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
3 of 5 tasks
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 pull request sits on #107 (
mattjolley/static-after-dynamic; below it are #105, #104 and #103, all merged) and is to be merged after it. Until those are merged, the diff here also shows their commits; the two commits of this pull request are the last two. It follows them because it names what they build (the multipliers of the augmented constraints, the velocity a static step keeps).What does this change, and why?
A design note and no code: section 14 of docs/design/sensitivity.md, "Gradients through history". One file, 73 lines.
"History" there is anything a term keeps from one converged state to the next. The section lists what history this code has and where it lives (the attachment of a sticky node, the anchor of a tied interface, the multipliers of an augmented constraint, the activation distance of a node distance, the rotation of a beam's sections, the velocity a static step keeps after a dynamic one, the internal variables of a material); writes the reverse sweep with one more adjoint for the history; says what that needs of the State and of the terms; and sorts the cases into three kinds by what a gradient means for each:
It ends with an order of work with the check for each piece, and three decision points for MJ, Steve and the Warp team: S11, where history lives (in the State, or in the terms with the State holding references); S12, whether to return a gradient where the run depends on its iterates, said as such, or to refuse; S13, whether an anchor's own position is a constant of the sweep or on the tape.
The second commit brings the section up to what
maingained the same day: FEBio'sviscoelasticwith history at the integration points (#98) and the reverse sweep through it (#99). For that one kind of history the split the section asks for exists, with the arrays owned by the term and referenced by the State, and the sweep is built; what stays design is the rest of the table (anchors, multipliers, the kept velocity) and S11 to S13.Validation
cb409d5with Warp 1.20.0. The test of the notes' links (tests/test_docs_links.py) passes. Quick tier of the whole repository: CPU, 1,151 tests, none failed (89 skipped); Tesla P100 (cuDSS; the versions of thegpuextra), 1,151 tests, one failure (80 skipped), which is present on unchangedmainat25b5aacon the same GPU and is not of this pull request:tests/test_history_adjoint.py,ForwardSweep.test_the_jacobian_of_a_static_run_goes_through_the_steps(from History in the forward sweep #101; it passes on CPU). Not run: the full tier of the whole repository.Checklist
uvx pre-commit run --all-filespasses. (Run on the one file of this change: passes.)FEBIO_WARP_TEST_LEVEL=full uv run -m unittest discover -s tests, and withFEBIO_WARP_TEST_DEVICE=cuda:0for code that runs on the device. (Not run in full; documents only.)git commit -s).🤖 Generated with Claude Code