Skip to content

Add tied-elastic contact in its penalty form - #116

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

mattjolley merged 3 commits into
mainfrom
mattjolley/tied-elastic

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #115 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 does not use the code of row 12; it follows it only because both add rows to the same lists.

What does this change, and why?

Two surfaces that are to stay at the distance they have when they are joined are FEBio's tied-elastic (FETiedElasticInterface at e4df3f8): each integration point of the primary surface is tied to the point of the secondary it projects on along its normal when the interface is activated, 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; tied-node-on-facet has them at nodes and closes the gap. Design note: docs/design/contact.md, section "Tied-elastic contact".

What is built, in contact/tied_elastic.py: one or two passes; the anchors (facet, facet coordinates, gap vector) found at activation and never changed, also for an interface declared in a step; FEBio's forces; both forms of FEBio's stiffness (with the interface's symmetric_stiffness 0 it is the exact derivative of the force, not symmetric; with 1, FEBio's default for this interface, its symmetric part); a penalty on a load curve. 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 with MKL Pardiso holds of a stiffness that is not symmetric (the same mechanism as in row 12, with its own copy of the small kernel so that the two pull requests do not depend on each other; to be shared in a later change).

What the stored triangle costs, in FEBio as here: on te_blocks_stored the same input converges in 3 iterations per time step with the stiffness as computed and in 5 to 14 with one triangle of it.

What is refused, and why: augmented Lagrangian (which the suite's co52 and co53 set; it comes with the augmentation hook of #103, in a later pull request); auto_penalty (built in row 12 and to be shared from there); facets other than quad4. Gradients: the term sets adjoint_ready False, as the other anchored terms do.

FEBio's suite has six inputs with this interface: co52 and co53 (augmented Lagrangian; their rigid body is fixed or moved by the input), two with a fluid and two with shells on solids. None runs yet, so the interface is compared on generated cases.

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 82296c0.

  • Tests added or changed:

    • tests/test_tied_elastic.py, new (14 tests): agreement with FEBio on four small inputs, the anchors and the gap at activation, both stiffness forms against a difference of the forces, the restart record, coverage and refusals.
    • No existing test is changed.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: FEBio 4.13.0 at e4df3f8.

    Input What it is Agreement
    te_blocks Two blocks whose faces do not match, 0.1 apart, tied and then sheared and pulled; one pass, the non-symmetric stiffness, a non-symmetric solver Displacement 1.6e-12, FEBio's iterations in all 10 time steps (3 each)
    te_blocks_two_pass Two passes and the symmetric stiffness, under a symmetric solver 1.7e-12, FEBio's iterations
    te_blocks_stored The non-symmetric stiffness under a symmetric solver 1.7e-12, FEBio's iterations: 5, 6, 7, ... 14
    te_blocks_in_step Declared in the second of two steps, penalty on a load curve 1.7e-12, FEBio's iterations

    The inputs are written by references/small_problems/generate_tied_elastic.py. Their references are from the build of the same commit with MKL Pardiso, not from the pinned skyline build, for the reason given in row 12. The tests hold them to 1e-9 of the largest value.

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

    • At this tip: test_tied_elastic.py (14 tests), test_tied.py (20) and the documentation links, on CPU: none failed. At the tip of segment C, row 14 (bce0a0b), which holds this change: 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.
    • The same change one base earlier, on main df58f1e (tip aac129a, there directly on main), Warp 1.20.0: the full tier of the whole repository, CPU 1,073 tests, none failed (26 skipped); Tesla P100 1,073 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 the tip of segment C 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:57
FEBio's sticky, tied-node-on-facet, tied-elastic and the stick state of
sliding-elastic are one force: a spring of stiffness penalty times area
between a point of the primary surface and a material point of the
secondary surface that is held once chosen (valve_workflow.md, decision
W3). Sticky was that term with its settings fixed in its code.

The kernels and the attachment state of sticky move to
contact/anchored.py unchanged, with what was constant as arguments, and
FEBio's tied-node-on-facet in its penalty form is a second setting of it
(contact/tied.py): anchors chosen at activation and never released,
max_distance, special, offset_shells, a penalty on a load curve, also
declared in a step.

No behavior of sticky changes: on CPU its seven small cases and co42
with held components give the same numbers bit for bit, with the same
iterations.

co26 of FEBio's test suite takes the stored 10 steps and 30 iterations
and the norm to 2.6e-13, on CPU and on a Tesla P100, and six generated
cases agree with FEBio 4.13.0 to 3e-12 with FEBio's iterations.

node_reloc 1 is refused: FEBio moves the reference position of the tied
nodes after its solid elements have stored their reference gradients, so
its result is that of the mesh as written (question 27).

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