Skip to content

Add dependent entries, eliminated after assembly - #111

Merged
mattjolley merged 6 commits into
mainfrom
mattjolley/dependent-entries
Dec 3, 2026
Merged

mattjolley merged 6 commits into
mainfrom
mattjolley/dependent-entries

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #110 (mattjolley/rigid-bodies-note) and is to be merged after it. Until that is merged, the diff here also shows its commits; the commits of this pull request are the last two.

What does this change, and why?

A node of a rigid body, and the parent of a linear constraint, has no equation of its own in FEBio: what is assembled on it is carried to other equations (FERigidSolver::RigidStiffnessSolid, FEResidualVector::Assemble; FELinearConstraintManager). This adds that mechanism once, for both: decision R1 of docs/design/rigid_bodies.md, section 5.2 (route A of constraints.md, section 7). The rigid bodies of the next pull request and the linear constraint boundary condition of thread K3 (mattjolley/linear-constraint-bc, later in the line) are its two owners.

What is built:

  • assembly/reduction.py, class Reduction. A table of dependent entries: for each, its master entries and two 3x3 matrices per link, one for columns and one for rows (FEBio takes the two arms of a rigid node at different configurations when alpha_f is below 1, so they are kept apart). Three operations, each a kernel: carry the residual to the masters, carry the stiffness blocks, spread a vector to the dependent entries.
  • In System (set_reduction): the terms assemble on node entries as before; the residual is carried after them, the blocks that touch a dependent entry are carried into an extra slice of the block list with fixed (row, column) pairs, and apply_tangent is the product of the reduced matrix. No term changes, and the matrix pattern stays fixed.
  • The state DEPENDENT of a component in the field table, beside free, fixed and prescribed.
  • The second commit is a one-line fix: a table with no block to carry (a rigid body that shares no element with anything) raised on an empty slice.

No run changes with this pull request alone: no owner of a table exists until the next one. Gradients: the adjoint and the forward sensitivities refuse a system with a table, since the adjoint solution is not yet spread to the dependent entries.

Validation

All of the following with Warp 1.20.0.

  • Tests added or changed:
    • tests/test_reduction.py, new (6 tests): on a table built by hand over a small elastic problem (one entry with two masters, one of them prescribed; one entry that follows in x only and keeps two components; row matrices that are not the transposes of the column matrices), the matrix of the linear solve, the carried residual and the product against the dense product L K T on the host; a run with a term of the test as owner (the constraints hold, the carried residual is zero, Newton takes the iterations it takes without the table); what is refused.
    • No existing test is changed.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: N/A. The reduced matrix is defined by the product, and the test compares with that. FEBio's use of it is compared in the next pull request (rigid bodies) and in K3's (mi04, mi05, mi37, which K3 reports at FEBio's counts on this table).
  • Devices the full tier ran on (CPU, and the GPU model if CUDA; say so clearly if no GPU was used):
    • At this branch's own tip 9d1af69, on CPU: tests/test_reduction.py, 6 tests, none failed.
    • At the tip of the five rigid body pull requests (mattjolley/rigid-body-dynamics d876c2e, which contains this one), Warp 1.20.0: quick tier of the whole repository on CPU, 1,187 tests, none failed (91 skipped); on a Tesla P100 (cuDSS; the versions of the gpu extra), 1,187 tests, one failure (82 skipped): tests/test_history_adjoint.py, ForwardSweep.test_the_jacobian_of_a_static_run_goes_through_the_steps (from History in the forward sweep #101), which fails on unchanged main at 25b5aac on the same GPU and passes on CPU; it is not of this pull request. The full tier of the nine test files these five pull requests add, change or meet (test_rigid_wall, test_reduction, test_rigid_unknowns, test_rigid_dynamics, test_rigid_moved, test_rigid_refusals, test_sticky, test_alpha_f, test_static_after_dynamic): 125 tests, none failed, on CPU and on a Tesla P100.
    • Not run: the full tier of the whole repository, on either device. Not run: the quick tier at this branch's own tip on the present base; it ran on CPU and on a Tesla P100 on the base of earlier today (dependent-entries at its first commit: 1,039 tests on each, none failed), with Warp 1.19.0. The suite scoreboard was not run again on this base.

Checklist

  • I have read the contributing guide.
  • uvx pre-commit run --all-files passes. (Run on the files of this change: passes.)
  • The full tier passes: FEBIO_WARP_TEST_LEVEL=full uv run -m unittest discover -s tests, and with FEBIO_WARP_TEST_DEVICE=cuda:0 for code that runs on the device. (Not run in full; see Validation.)
  • If this changes what a design note says, the note is updated; open design questions are in its decision points, not only in this pull request.
  • The change is focused, and every commit is signed off (git commit -s).

🤖 Generated with Claude Code

mattjolley and others added 6 commits December 2, 2026 18:56
FEBio's rigid_wall constraint holds the nodes of a surface on one side
of a plane. Four suite inputs miss nothing else (co08, co10, tu03 and
the dynamic dy03); it is the first piece of Handoff K, thread K1, and
independent of rigid bodies.

Read from FERigidWallInterface.cpp at e4df3f8. The facets are
integrated at their nodes, since the base class asks for nodal
integration; on the curved surface of dy03 a Gauss rule gives another
result. Newton uses FEBio's stiffness and the adjoint the derivative,
which differ by the squared length of the plane's vector.

The four inputs take FEBio's time steps and iterations on CPU and on a
Tesla P100. Augmented Lagrangian is refused: it is not built for the
wall yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Handoff K, thread K1, asks for the note before the code: how body
unknowns enter the field table, how the elimination is done on the
device, what happens to the matrix pattern, the rotation update, what
is differentiable, and FEBio's conventions of the body state. It also
fixes the mechanism (dependent entries, eliminated at the level of the
system) that the linear constraints of thread K3 share.

Written from FEBio's source at e4df3f8, compared with develop e71ed382.
Design only; nothing was run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
main gained an augmentation loop on December 2, which settles most of
decision R4. The rigid wall is built on its own branch; its area rule
and what was measured are recorded here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
MJ answered R4: thread K3 builds the augmentation hook, and K1 uses
it. Section 13 now has the elimination, bodies with open components
in static and dynamic steps, and what the building found in FEBio.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
A node of a rigid body, and the parent of a linear constraint, has no
equation of its own in FEBio: what is assembled on it is carried to
other equations. This adds that mechanism once, for both (decision R1
of docs/design/rigid_bodies.md), so that the rigid bodies of thread K1
and the linear constraints of thread K3 share it.

The terms assemble on node entries as before. The system then carries
the residual and the blocks of a dependent entry to its masters, in
three kernels, and the matrix pattern stays fixed. An owner fills the
table; none exists yet, so no run changes. The adjoint and the forward
sensitivities refuse a system with a table.

Checked against the dense product on a small elastic problem, on CPU
and on a Tesla P100.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
A rigid body that shares no element with anything (dy05 of the suite)
has dependent entries and no carried block, and the empty slice of the
block list raised.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
@mattjolley
mattjolley merged commit f9ecc49 into main Dec 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant