Skip to content

Add friction to sliding-elastic contact: stick and slip - #117

Merged
mattjolley merged 3 commits into
mainfrom
mattjolley/sliding-elastic-friction
Dec 3, 2026
Merged

mattjolley merged 3 commits into
mainfrom
mattjolley/sliding-elastic-friction

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #116 and is to be merged after it. Until that one is merged, the diff here also shows its commits; the one commit of this pull request is the last. It builds on the code of row 12 (contact/sliding_pair.py), which it needs.

What does this change, and why?

A device against tissue may hold by friction, and five inputs of FEBio's suite set fric_coeff on sliding-elastic. This adds the friction of that interface in its penalty form, for the term between two surfaces that move (FESlidingElasticInterface::ContactTraction, SlipTangent and the two branches of StiffnessMatrix, at e4df3f8): fric_coeff, slip_tol, and knmult 1, which FEBio sets itself whenever there is friction. Design note: docs/design/contact.md, section "Friction".

Friction is the anchored-point force with a release rule. At the start of a time step every integration point takes the secondary facet and facet coordinates it has then as its anchor. In every residual a point with an anchor is tried as a spring to it: if the normal part of that traction is compressive and its shear part is below fric_coeff times it, the point sticks; otherwise it slips, with a traction of the pressure times (normal + fric_coeff times the slip direction of the time step).

  • contact/sliding_friction.py: the trial, stick and slip of ContactTraction in one kernel, and FEBio's two stiffness branches transcribed with FEBio's names, including the terms in knmult. With fric_coeff 0 and knmult 0 these kernels give the forces and the stiffness of the frictionless ones of row 12 (tested), which stay in use for that case.
  • The anchor of a point that sticks is renewed every time step. FESolidSolver2::PrepStep updates the model, which projects every point at the last converged state, before it calls the interface's PrepStep, which takes the anchors. So a sticking point is held to where it was at the end of the time step before, not to where it first stuck. With the first anchor kept instead, co47 is 1e-5 off in its third time step; with this rule, 9e-14.
  • Stick or slip depends on the iterates, as the attachment of sticky does: the branch is chosen in every residual. Agreement at round-off needs FEBio's iterates, and a run with another Newton strategy than the input's converges to a slightly different state (row 8e of deviations.md holds for friction too).

What is refused, and why: friction with tension 1 (FEBio stops such an input); augmented Lagrangian, which the suite's other friction inputs set (co48, co44, co45; it comes with the augmentation hook of #103, in a later pull request); friction against a fixed rigid target (co46: the term of shape enforcement keeps fixed targets and has no friction). Gradients: refused with the term.

Seen in FEBio itself: without slip_tol, FEBio 4.13.0 does not converge on a generated one-pass friction case in the time step in which the blocks first touch (full Newton, dtol 1e-7), so that case sets slip_tol 0.001. co47 has none and runs, with Broyden at dtol 1e-3.

Validation

All of the following with Warp 1.20.0, on CPU and on a Tesla P100 (cuDSS; the versions of the gpu extra), at this branch's tip bce0a0b, which is the tip of segment C.

  • Tests added or changed:

    • tests/test_sliding_pair.py (added by row 12): eight more tests for friction and knmult, and its coverage test for what is refused follows the change (friction is read; friction with tension, and knmult 2, are refused).
    • tests/test_febio_suite.py: co47 and co34 added to FEBIO_STRATEGY (full tier).
    • No test of main is changed.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: FEBio 4.13.0 at e4df3f8, with the preset FEBIO_4_13 for the suite inputs.

    Input What it is Agreement
    Suite co47 fric_coeff 0.5, two passes, auto_penalty, Broyden with max_ups 10, a non-symmetric solver (2,016 nodes) The stored 51 steps and 292 iterations, FEBio's count in each of the 51 steps; norm to 2.2e-12; every state within 9e-13 of FEBio's log of the same input
    Suite co34 knmult 1 without friction, two passes, auto_penalty The stored 20 steps and 42 iterations; norm to 1.2e-12
    sd_blocks_friction The blocks of row 12 with fric_coeff 0.3 and slip_tol: the points stick while the block is pressed down and slip when it is dragged Displacement 5.6e-13, stress 2.7e-12, FEBio's iterations in all 20 time steps
    sd_blocks_friction_two_pass Two passes, auto_penalty, fric_coeff 0.5, slip_tol 5.5e-13, 2.5e-12, FEBio's iterations
    sd_blocks_knmult No friction, knmult 1 5.3e-13, 3.0e-12, FEBio's iterations

    FEBio's own results with and without friction on these blocks differ by 15 percent of the largest displacement. The three small inputs are written by references/small_problems/generate_sliding.py; their references are from the build with MKL Pardiso, as in row 12. The suite inputs need FEBIO_TEST_SUITE and are skipped without it, so CI does not run them; they ran here.

  • Devices the full tier ran on (CPU, and the GPU model if CUDA; say so clearly if no GPU was used):

    • At this tip, for the whole of segment C (rows 11 to 14): quick tier of the whole repository, CPU 1,246 tests, none failed (95 skipped); Tesla P100 (cuda:5) 1,246 tests, one failure (86 skipped), the known one on main named below. Full tier of test_tied, test_sticky, test_sliding_pair, test_sliding_elastic, test_tied_elastic and test_febio_suite: CPU 104 tests, none failed; Tesla P100 (cuda:4) 104 tests, none failed. At this branch's own tip the sliding tests in the full tier (39 tests, with co07, co41, sh28, co34, co47) also ran on CPU on their own: none failed (1 skipped).
    • The same change one base earlier, on main df58f1e (tip eb03cb8, there on row 12 only), Warp 1.20.0: the full tier of the whole repository, CPU 1,084 tests, none failed (26 skipped); Tesla P100 1,084 tests, none failed (13 skipped).
    • Known failure on main at 25b5aac on a P100, not of this pull request: tests/test_history_adjoint.py, ForwardSweep.test_the_jacobian_of_a_static_run_goes_through_the_steps. It showed in the quick tier at this tip on the P100 (cuda:5), as the only failure, and in no run on CPU.
    • Not run at this tip: the full tier of the whole repository, on either device.

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 at this tip; 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 19:59
The sliding-elastic term on main covers a fixed rigid target. A new
term, contact/sliding_pair.py, reads the interface where the secondary
surface can move, in its penalty form without friction: forces on the
secondary nodes, FEBio's stiffness coupling the two surfaces, two
passes, auto_penalty, an offset, and the release of a point in tension
when tension is 0. The term for a fixed target is unchanged;
sliding_elastic.term chooses by the secondary surface.

Two things in FEBio's source decide whether the suite's stored values
are met, and both are followed:

The auto penalty uses a compliance from tens4ds::inverse, which has no
factors for the shear rows, so it is the modulus only for a facet
normal along an axis. With E A / V co41 ends 9e-4 from FEBio; with
FEBio's number, 2e-12 (question 28).

A solver that asks for a symmetric stiffness stores one triangle of the
interface's stiffness, which is not symmetric. co07 takes the stored
182 iterations with the lower triangle mirrored, as FEBio with MKL
Pardiso; 185 with the whole matrix; 188 with the upper triangle, as
FEBio's skyline solver does on the same commit (question 29).

co07, co41 and sh28 (shells against a rigid body the input moves) take
the suite's stored steps and iterations and the norm to 3e-13, 2e-12
and 3e-13, on CPU and on a Tesla P100, and three generated cases agree
with FEBio 4.13.0 to 5e-13 with FEBio's iterations.

The adjoint refuses the term: FEBio's stiffness is not the derivative
of the force. contact.md has what a sliding pair costs the linear
solve. co51 waits on shell bottoms and auto_penalty on shells.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
FEBio's tied-elastic interface holds two surfaces at the separation
they have when the interface is activated: each integration point of
the primary surface is tied to the point of the secondary it projects
on along its normal, and the vector between the two is kept. It is the
anchored-point force of valve_workflow.md, section 4.1, with the points
at integration points.

contact/tied_elastic.py has it as a term of a run: one or two passes,
both forms of FEBio's stiffness (the non-symmetric one is the exact
derivative of the force), a penalty on a load curve, also declared in a
step. Under a solver that asks for a symmetric matrix the term gives
Newton the lower triangle of its stiffness mirrored, which is what
FEBio's symmetric format holds of it.

Four generated two-block cases agree with FEBio 4.13.0 (the build with
MKL Pardiso) to 2e-12 with FEBio's iterations in every time step, on
CPU and on a Tesla P100. One of them shows what the stored triangle
costs: 5 to 14 iterations per time step where the whole stiffness takes
3, in FEBio as here.

The suite's co52 and co53 wait on rigid bodies with unknowns and on the
augmented Lagrangian form; auto_penalty is refused until it is shared
with sliding-elastic.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
The friction of FEBio's sliding-elastic interface in its penalty form,
for the term between two surfaces that move: fric_coeff, slip_tol, and
knmult 1, which FEBio sets itself with friction. It is the
anchored-point force with a release rule: a point is held to where it
was on the secondary surface at the end of the time step before while
the shear part of that traction stays below fric_coeff times its
pressure, and slips otherwise.

contact/sliding_friction.py has the trial, stick and slip of FEBio's
ContactTraction and the two branches of its stiffness, transcribed with
FEBio's names. With fric_coeff 0 and knmult 0 they give the forces and
the stiffness of the frictionless kernels, which stay in use there.

The anchors of a time step are the projection of the last converged
state, also for a point that stuck (FESolidSolver2::PrepStep updates
the model before the interface takes them). With the first anchor kept
instead, co47 is 1e-5 off in its third time step.

co47 takes the suite's stored 51 steps and 292 iterations, FEBio's
count in each step, and the norm to 2e-12, on CPU and on a Tesla P100;
three generated cases agree with FEBio 4.13.0 to 6e-13. co34, which
sets knmult 1 without friction, takes its stored 20 steps and 42
iterations and the norm to 1e-12.

This branch is cut from mattjolley/sliding-elastic-deformable, which it
needs. The suite's other friction inputs, co48 and co44, set augmented
Lagrangian, which waits on an augmentation loop in the Newton solver.

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 15415ef 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