Skip to content

Solve for rigid bodies with open components - #112

Merged
mattjolley merged 6 commits into
mainfrom
mattjolley/rigid-body-unknowns
Dec 3, 2026
Merged

mattjolley merged 6 commits into
mainfrom
mattjolley/rigid-body-unknowns

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #111 (mattjolley/dependent-entries) 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 one.

What does this change, and why?

A rigid body with a component that no condition holds was refused. It is the most common reason an input of FEBio's test suite does not run, and the last stage of the published clip procedure frees its clip. This solves for such a body as FEBio's rigid solver does, in static steps (the next pull request adds dynamic ones). Design note: docs/design/rigid_bodies.md, sections 5 and 13; docs/design/constraints.md has the status.

What is built, to FEBio 4.13.0 at e4df3f8:

  • Two entries per body in the field table, after those of the nodes: the translation of the center of mass and the rotation vector, each component free, fixed or prescribed per analysis step, from the replay of FEBio's activation that constraints/rigid_parts.py already made. The nodes of the body (of its parts, and tied to it by the boundary condition rigid) are dependent entries of the table of the previous pull request.
  • The rigid system term (constraints/rigid_system.py): FEBio's update of a body (FERigidSolverNew), with the rotation increments of a time step composed through the Cayley transform and the orientation kept as a quaternion; the rule for a step in which all three rotations are known (question 14, followed as it is); rigid_force and rigid_moment with load_type LOAD. The bodies are few, so their kinematics are computed on the host; the nodes are placed and their arms formed by kernels.
  • A body with no open component stays on the path of November 29 (geometry, nodes prescribed): decision R3. One test runs a moved body on both paths and gets the same displacements to round-off.
  • The coverage report names, per step, the open components of each body.

Refused, with the reason: such a body in a dynamic step (the next pull request); a prescribed rotation beside an open one (an error in FEBio); FOLLOW, TARGET and relative loads; connectors under load; a contact interface with a surface on such a body (its stiffness, kept in a matrix of its own, is not carried to the body in this pull request); nodes of a shell part tied to a body, and a rigid shell part; gradients (adjoint_ready is False).

Existing tests that change, named plainly. Three assertions in tests/test_rigid_moved.py and two coverage tests in tests/test_sticky.py asserted that an input is refused because its body can move. Those inputs now run, and each is replaced by a comparison with FEBio in this pull request (bk_rigid_lid_released, bk_rigid_lid_reopened, bk_rigid_tied_free; suite co42 as published). Every comparison of a body as moving geometry is unchanged.

Validation

All of the following with Warp 1.20.0.

  • Tests added or changed:

    • tests/test_rigid_unknowns.py, new: the suite inputs and the three generated inputs below; the two paths; the quaternion functions and the Cayley composition against closed forms; equilibrium of a body under a load; the entries and the report; every refusal.
    • tests/test_rigid_moved.py and tests/test_sticky.py: the five assertions named above.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: FEBio's test suite at 986005f with the preset FEBIO_4_13 (steps, iterations and solution norm, which counts the unknowns of the bodies), and three generated inputs with references from FEBio 4.13.0 at e4df3f8 (displacement of every logged node and stress at every state; compared at 1e-9).

    Input What it has Iterations, here and FEBio Agreement
    Suite ri01 A body free in all six, tied nodes, rigid_force 30 and 30, in 10 steps Norm to 4e-13
    Suite ri03 Open, prescribed and fixed components together 41 and 41, in 10 steps Norm to 2e-12
    Suite ri07 A knee: one body free about one axis, springs 81 and 81, in 8 steps Norm to 3e-13
    Suite co42 The sticky peel input as published 241 and 241, in 27 steps Norm to 5e-13
    bk_rigid_lid_released A translation open in one step of four 52 and 52 2.7e-12
    bk_rigid_lid_reopened A rotation FEBio opens when a condition of a step ends 30 and 30 2.2e-12
    bk_rigid_tied_free Tied nodes and a free rotation 26 and 26 4.3e-12

    The same counts on CPU and on a Tesla P100. The three generated inputs are stored inputs with one rigid condition taken out (references/small_problems/generate.py). Running that generator on the workstation rewraps the comments of ten inputs that are already stored; those were restored and only new files are added.

  • 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 5aa376b, on CPU: test_rigid_unknowns, test_rigid_moved, test_rigid_refusals, test_reduction, test_sticky and the document links in the full tier: 79 tests, none failed (run before a one-line correction of the number of inputs stated in the references README; not rerun after it).
    • 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 (rigid-body-unknowns at its earlier tip: 1,054 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:58
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>
A rigid body with a component that no condition holds was refused. It
is the most common reason a suite input does not run, and the last
stage of the published clip procedure needs it (Handoff K, thread K1).

Such a body now has two entries in the field table, its translation
and its rotation vector, and its nodes are dependent entries that the
system eliminates. The orientation is a quaternion updated as FEBio's
rigid solver updates it; rigid_force and rigid_moment are read with
load_type LOAD. Static steps only: the mass and inertia of a body are
not built yet, and a contact surface on such a body is refused until
its stiffness is carried to the body.

Suite inputs ri01, ri03, ri07 and co42 as published take FEBio's time
steps and iterations on CPU and on a Tesla P100. Three generated
inputs with a released component agree with FEBio 4.13.0 to 4e-12,
and a moved body gives the same result on the old path and the new.
A body with no open component stays on the old path.

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 bec7683 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