Skip to content

Refuse rigid materials that FEBio merges into one body - #120

Open
mattjolley wants to merge 3 commits into
mainfrom
mattjolley/rigid-co27
Open

mattjolley wants to merge 3 commits into
mainfrom
mattjolley/rigid-co27

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #119 and is to be merged after it. Until #119 is merged, the diff here also shows its commits; the one commit of this pull request is the last. It changes nothing of the rows before it: it concerns the rigid bodies of #112.

What does this change, and why?

co27 of FEBio's test suite was reported runnable by the coverage report and then stopped in build_system with ValueError: a dependent entry is listed twice (found by the suite scoreboard run at the end of the Handoff K line, on a Tesla P100 with Warp 1.20.0).

The cause. co27 is a foot: eleven rigid materials, bones and the joints between them, whose parts share nodes with their neighbours. FEBio makes rigid materials whose parts share a node one rigid body (FERigidSystem::CreateObjects at e4df3f8: the body of a node is that of the last rigid part that has it, and two materials are merged whenever an element of one has a node that carries the other, along a chain of shared nodes). The body takes the name and the data of its first material, and a rigid condition on any of the materials acts on that one body. FEBio runs co27 so (normal termination with FEBio 4.13.0 here; the suite stores 24 steps and 133 iterations), with the eleven materials in two bodies beside the floor, by our reading of its mesh. In this code a rigid body is one material (constraints/rigid_parts.py), so since #112 each of the eleven was given unknowns of its own and a shared node was listed as a dependent entry of two bodies.

What changes. Rigid materials that FEBio would merge are refused in the coverage report, with the reason: "its parts share nodes with rigid material(s) ...: FEBio makes them one rigid body (FERigidSystem::CreateObjects), which is not built". rigid_parts.merged_materials finds them. The refusal holds whether the components of the materials are open or all set by the input: read as separate bodies, the conditions of one would not reach the other, so a run would not be FEBio's in either case.

What is not built: merging the materials into one body as FEBio does. It is not a small change (the reading of rigid conditions, the center of mass and the inertia are all per material today), and it is what co27 needs to run. Nodes tied to a body by the boundary condition rigid do not merge bodies in FEBio, and are not concerned.

Effect on coverage: of the solid-module inputs of the suite, only co27 changes, from runnable to not runnable. No input of references/small_problems and none of the model repository copies on the workstation (projects 134, 137, 153) has rigid materials that share nodes.

Validation

All of the following with Warp 1.20.0, at this branch's tip 912a73c.

  • Tests added or changed:
    • tests/test_rigid_refusals.py, new class MergedMaterialTests: a stored input with the last element of its rigid lid given to a second rigid material, so that the two share four nodes, is refused with the reason, with open components and with every component set by the input; inputs whose rigid bodies are apart are not concerned; co27 itself (needs FEBIO_TEST_SUITE): its eleven materials in two groups, refused. Checked that the new test fails without the fix: the split-lid input is then reported runnable and build_system stops with the error co27 gave.
    • No existing test is changed.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: N/A, a refusal. FEBio 4.13.0 at e4df3f8 was run on co27 to confirm that it runs there; nothing of that run is compared.
  • Devices the full tier ran on (CPU, and the GPU model if CUDA; say so clearly if no GPU was used):
    • Quick tier of the whole repository: CPU, 1,259 tests, none failed (96 skipped); Tesla P100 (cuDSS; the versions of the gpu extra), 1,259 tests, one failure (87 skipped): tests/test_history_adjoint.py, ForwardSweep.test_the_jacobian_of_a_static_run_goes_through_the_steps. That is the known GPU failure of the history work, which differs from run to run on a P100 and passes on CPU; it is fixed on main by Hold the history Jacobian test to the sweep's call #106, which the tip of row 16 predates, and it is not of this pull request. (Before the rebase, on main at the merge of Add the dynamics of a rigid body with open components #113, the same change passed the quick tier on both devices: 1,189 tests, none failed.)
    • Full tier of test_rigid_refusals, test_rigid_moved, test_rigid_unknowns, test_rigid_dynamics: 55 tests, none failed, on CPU and on a Tesla P100.
    • The coverage of the suite (tools/suite_scoreboard.py --no-run) before and after: one change, co27.
    • Not run: the full tier of the whole repository, on either device, and the suite scoreboard with runs.

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 3 commits December 2, 2026 20:30
The adjoint refused a system with a tied or sticky interface: the
anchors of such an interface are history, and linearizing at a stored
State would have brought the term there with the anchors of whichever
state it saw last.

A State that a run keeps carries its anchors in its restart record
(contact/anchored.py, "The anchors and the State"). The adjoint now
gives them back to the term before it linearizes at that State, by the
call a restart uses, and again after the term's update, which for a
sticky interface tests for attachment and release anew. The reverse
sweep over steps does the same per State. The anchors are read and not
moved; nothing in contact/ changes, the term's own flag stays False,
and a State without its record is refused as before.

What the gradient is, measured on CPU and on a Tesla P100:

  ti_blocks (tied, anchors placed in the undeformed mesh): the adjoint
  agrees with central differences of the equilibrium solved again from
  the State and with central differences of the whole run, 1e-8. It is
  the derivative of the run.

  st_grasp_quad4 (sticky, 20 nodes attached, three time steps after the
  last event): 1e-8 against the equilibrium with the anchors held, and
  2e-5 to 6e-5 relative against the whole run, which places the anchors
  where the nodes meet the surface. It is the derivative of the model
  with the grasp as found, not of the run.

check_equilibrium_gradients is the check with the anchors held.

Refused, beside a State without its record: a tied interface with
offset_shells, whose stiffness leaves out the turning of the facet
normal, as FEBio's does, so that there is no exact tangent; and the
other terms with anchors (sliding-elastic between two deformable
bodies, tied-elastic), which keep their own refusal.

The anchors are those of contact/anchored.py (the tied and sticky
interfaces of Handoff K, thread K2).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
FEBio's <bc type="linear constraint"> makes one degree of freedom a
linear function of others and gives it no equation: its residual and
stiffness go to the children. It was refused, with the three suite
inputs that miss nothing else (mi04, mi05, mi37).

It is built on the table of dependent entries of the rigid bodies
(assembly/reduction.py), so that the two share one mechanism, as
Handoff K asks. constraints/linear_constraints.py owns the table: each
parent is a dependent entry whose constrained components follow, each
(parent, child) pair a link with the coefficients in its 3 x 3 matrix.
The parents are written after every update by the table's spread, and
a coefficient on a load curve is read at the time being solved. As in
FEBio, nothing of a parent's pending change goes to the first
right-hand side when the offset is zero.

Against the suite's stored values (FEBio 4.13.0 at e4df3f8), on CPU and
on a Tesla P100 with cuDSS: mi04 10 steps and 31 iterations, mi05 10
and 50, mi37 10 and 49, all FEBio's counts, with the norm to 4e-12.

Refused with the reason: a nonzero offset, a constraint declared in a
step, a child at a node that is a parent in another component (FEBio
rules by degree of freedom, the table by entry), a model that also has
a rigid body with unknowns (a system has one table, and the two are not
merged), and gradients, which a system with a table does not have yet.

The table came with the rigid bodies (mattjolley/dependent-entries).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
co27 of FEBio's test suite was reported runnable and then stopped
with "a dependent entry is listed twice". Its eleven bones and joints
are separate rigid materials whose parts share nodes, and FEBio makes
such materials one rigid body (FERigidSystem::CreateObjects). Here a
body is one material, so a shared node was given to two bodies.

Such materials are now refused in the coverage report with that
reason, whether their components are open or all set by the input.
Merging them as FEBio does is not built. No other input of the suite,
of the stored small problems or of the model repository copies has
such materials.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
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