Skip to content

Contact potential in a run (first template), FEBio suite table test, documentation - #10

Merged
mattjolley merged 10 commits into
mainfrom
mattjolley/contact-in-run-template
Nov 28, 2026
Merged

mattjolley merged 10 commits into
mainfrom
mattjolley/contact-in-run-template

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

What does this change, and why?

A first template of the contact potential as a term of a run, the FEBio test suite as a table-driven test, and the documentation brought up to date. Design note: contact_in_run.md.

Third of three pull requests merged in order. It is merged by the author so the basic parts run on main and the contact work can build on them, and is left here as the record for review afterwards: comments on a merged pull request are welcome and will be acted on. This is a starting point for contact, not its design. Contact is the next area of work and will be approached with FEBio's implementation and the original formulation (Kamensky et al. 2018) side by side.

Commit What
Contact: a first template of the contact potential in a run Contact points from the model's SurfacePair, pairs found at every iterate, the repulsive forces as an external force with FEBio's sign, the tangent in a matrix of its own so the structural pattern stays fixed. A step is cut if a node moves farther than R_out in one iterate
Verification: FEBio test suite problems, read from the suite Of the 549 suite inputs the coverage report accepts 23. Eight reproduce the suite's step count, iteration count and solution norm exactly, among them co62, the suite's contact potential problem (20 steps, 85 iterations); nine more agree on the norm; the rest are listed with the reason
Contact: apply FEBio's default for exclude_neighbors FEBio excludes element pairs that share a node unless the input says otherwise; the reader here had the default the other way round
Docs README status and the P3 CHD link, the index of the design notes, CONTRIBUTING, the design overview, the reference READMEs
Two merge commits main (one README commit) and the dynamics branch (a one-line fix), so this branch merges without conflicts

What works and what does not. Two blocks pressed together agree with FEBio to 4e-13 and a shell folded onto itself, with the contact settings of the open mitral input, to 4e-11. The coverage report now accepts the open mitral input (P2Prolapse_Mitral.feb, FEBio model repository project 134), which is a statement about features and not about results: with its contact removed the run completes; with contact it stops converging as the leaflets close. First experiments point to a line search and a step limit as what is missing. Two facts about the reference for that input are recorded in references/febio/originals/cardiofem/valve_pressurization/README.md: the stored FEBio 4.9.0 run of it ends in an error termination at time 0.0135 of 0.02, and FEBio 4.13.0 rejects its <laugon>PENALTY</laugon> as written.

Where this differs from FEBio (rows 5, 6 and 20 of docs/design/deviations.md): w_tol is applied per point pair here and per element pair in FEBio, and the coverage report says so; the R_out step rule has no FEBio counterpart; the contact tangent is kept in a matrix of its own. Not built: activation by step, the projected tangent, contact under the adjoint.

Validation

  • Tests added or changed: tests/test_contact_in_run.py, tests/test_febio_suite.py, and changes to tests/test_cli.py, tests/test_run_path.py and tests/test_contact_potential.py.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: bk_contact_potential_patch (reaction force and stress, 1e-10), sh_self_contact_fold (reaction force 1e-8, displacements 1e-9); FEBio test suite at 986005f, values read from the suite's own linuxGoldStandards.py.
  • Devices the full tier ran on (CPU, and the GPU model if CUDA; say so clearly if no GPU was used): CPU with CUDA hidden (229 tests) and a Quadro RTX 8000 (cuda:0, 229 tests) before the last three small commits (the exclusion default, the documentation pass, the merges); after them the quick tier on CPU and the contact and suite tests on the GPU.

Checklist

  • I have read the contributing guide.
  • uvx pre-commit run --all-files passes.
  • The full tier passes: WARP_FEBIO_TEST_LEVEL=full uv run -m unittest discover -s tests, and with WARP_FEBIO_TEST_DEVICE=cuda:0 for code that runs on the device. (See the note under Validation on the last three commits.)
  • 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). (One exception: "Update README.md" is a copy of the commit of that name already on main, which was made on GitHub without a sign-off line.)

🤖 Generated with Claude Code

mattjolley and others added 10 commits November 28, 2026 09:29
The contact potential joins the run path as a term
(contact/in_run.py): contact points from the model's SurfacePair, the
pair search at every iterate, the repulsive forces as an external
force with FEBio's sign, and the tangent in a matrix of its own that
the system adds to the structural matrix before the solve, so the
structural pattern and its map stay fixed. One surface named twice is
self-contact. As in FEBio, the initial accelerations of a dynamic step
are solved with the mass alone, and contact forces are not counted in
the nodal reaction forces.

A step is rejected and cut if a node moves farther than R_out in one
iterate, a rule of the contact note made a rule of the step.

Against stored FEBio results: two blocks pressed together to 4e-13,
and a shell folded onto itself, with the contact settings of the open
mitral input, to 4e-11.

The coverage report now accepts the open mitral input, which is a
statement about features and not about results: the run stops
converging at time 0.005 of 0.02, as the leaflets close. w_tol is
applied per point pair here and per element pair in FEBio, and the
report says so. Activation by step, the projected tangent and contact
under the adjoint are not built. This is a starting point for the
contact work, not its design.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
tests/test_febio_suite.py compares problems of the FEBio test suite
with the step count, iteration count and solution norm the suite
stores, read from the checkout FEBIO_TEST_SUITE points to. Of the 549
inputs at suite commit 986005f the coverage report accepts 23.

- co62 (the contact potential between two blocks), mi06, mi24 and sh54
  take FEBio's steps and iterations exactly and reproduce the norm; so
  do bt01, di01, di02, dy07 and dy16, which are in the tests of their
  sections.
- Nine more (mi02, mi25, mi31, sh02 to sh05, sh11, sh56), which FEBio
  ran with BFGS or where its line search acted, agree on the solution
  norm to 1e-5 or better.
- The rest are listed in the file with the reason: di03 and sh06 need
  a line search; sh58 follows FEBio until FEBio's line search acts;
  sh52 and mi16 end at a zero solution, where the stored norm is only
  what the iteration leaves at its tolerance.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
The README status table and diagram, and the index of the design
notes, are brought up to date with the chordae elements, dynamics and
mass damping, the direct solves, and the first contact template. The
index points to deviations.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
- CONTRIBUTING: test times; how to run the FEBio test suite problems
  (FEBIO_TEST_SUITE); what is optional and skipped without it (the
  suite, cuDSS, the GPU-only patches); OMP_NUM_THREADS on machines with
  many cores; how a FEBio reference is made and described.
- docs/design/overview.md: the tables of what follows FEBio and of the
  first templates, for trusses and springs, loads, dynamics, the linear
  solves, contact in a run and sensitivity.
- references/small_problems/README.md: which inputs are compared today.
- references/febio/originals: what each patch folder holds and where it
  is tested; the status of the open mitral input, including that the
  stored FEBio 4.9.0 run of it ends in an error at time 0.0135.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
(cherry picked from commit 2c3aa7b)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
main gained one commit after these branches were cut, which adds the
P3CHD project to the first paragraph of the README. This branch already
carries that sentence with a link, so the merge keeps the linked form.
After this merge the branch merges into main without conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
FEBio's contact potential excludes element pairs that share a node
unless the input sets exclude_neighbors to 0 (FEContactPotential.h:
m_excludeNeighbors = true; before FEBio 4.12 neighbors were always
excluded). The reader here mapped a missing exclude_neighbors to
"element" exclusion, the opposite, and the contact note stated that as
FEBio's default.

The open mitral input does not set the parameter, so pairs between
adjacent leaflet elements were left to w_tol alone: with w_tol 0 the
run had 89,843 active pairs where a few thousand are expected. The
small reference cases and suite problem co62 give the same results
with either setting.

Found in a side-by-side reading of FEContactPotential.cpp and the
contact code here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
…ate branch

Carries the one-line docstring fix made on mattjolley/dynamics-template
so that pre-commit passes on this branch too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
main now holds the chordae elements and the dynamics, loads and solver
work (pull requests 8 and 9), which this branch was built on. The merge
brings in their two merge commits; the files of this branch are
unchanged by it.

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 543da85 into main Nov 28, 2026
2 checks passed
@mattjolley
mattjolley deleted the mattjolley/contact-in-run-template branch November 28, 2026 15:27
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