Skip to content

Add the rigid wall in its penalty form - #109

Merged
mattjolley merged 5 commits into
mainfrom
mattjolley/rigid-wall
Dec 3, 2026
Merged

mattjolley merged 5 commits into
mainfrom
mattjolley/rigid-wall

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

This pull request sits on #108 (mattjolley/history-gradients-note) 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?

FEBio's rigid_wall constraint (FERigidWallInterface) holds the nodes of a surface on one side of a plane. Four inputs of FEBio's test suite miss nothing else (co08, co10, tu03, and the dynamic dy03), and it is the first piece of Handoff K, thread K1; it has nothing to do with rigid bodies. Design note: docs/design/rigid_bodies.md (the next pull request), sections 4.6 and 13; this pull request records it in docs/design/constraints.md.

What is built (constraints/rigid_wall.py), read from FERigidWallInterface.cpp at e4df3f8:

  • A term on the displacement entries of the surface nodes. The gap of a node from the plane, moved by offset; a force of penalty times gap times the nodal area along the constant normal where the gap is positive; one stiffness block per node, in the fixed pattern of the system.
  • The nodal area is FEBio's. The facets are integrated at their nodes, since the base class FESurfaceConstraint asks for nodal integration. On a curved quad4 surface that differs from a Gauss rule: with a Gauss rule dy03 (a ball on a wall) gave 165 iterations and a norm 7 percent from FEBio's, and a FEBio run beside it showed the two part at the first iterate in contact.
  • penalty and offset on load curves, so the wall can move (co08).
  • Two tangents. Newton gets FEBio's block; linearize(exact=True) gives the derivative, which differs by the squared length of the plane's vector (1 for a unit vector, which every suite input but one has).
  • Gradients. The term is differentiable between the events of a node entering or leaving the wall; penalty is a parameter.

Refused, with the reason in the coverage report: augmented Lagrangian (not built for the wall; the hook of #103 is what it would use), a wall declared in a step, facets other than quad4 and tri3. Not compared with FEBio: the wall force at a prescribed component is left out of the nodal reaction force, as for the contact terms.

Validation

All of the following with Warp 1.20.0.

  • Tests added or changed:

    • tests/test_rigid_wall.py, new (9 tests): the four suite inputs; the nodal area of a skewed quad4 and a tri3 against the cross products written out; the gap, the force and both stiffness blocks for a plane whose vector is not a unit vector, with offset and penalty on load curves; the exact block against central differences of the force; the gradient with respect to penalty against central differences of a run; what is refused.
    • No existing test is changed.
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: FEBio's test suite at 986005f, with the preset FEBIO_4_13: the suite's stored steps, iterations and solution norm.

    Input Steps, here and FEBio Iterations, here and FEBio Norm
    co08 (the wall moves by its offset) 12 and 12 105 and 105 4e-9 on CPU, 7e-9 on the P100 (FEBio converges it to dtol 1e-3)
    co10 10 and 10 48 and 48 3e-13
    tu03 11 and 11 88 and 88 2e-12
    dy03 (a ball falling on a wall, dynamic) 40 and 40 167 and 167 1e-11

    The same counts on CPU and on a Tesla P100. These need a checkout of the suite (FEBIO_TEST_SUITE) and are skipped without one. The small cases are made from bk_body_force of references/small_problems and are not compared with FEBio.

  • 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 cedd204, on CPU: tests/test_rigid_wall.py in the full tier and the document links, 10 tests, none failed.
    • 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-wall at its earlier tip: 1,037 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 5 commits December 2, 2026 17:27
A static step that follows a dynamic one was refused (decision ST6 of
the steps note). Handoff K asks for it, as FEBio does it.

FESolidSolver2 tests the analysis type where the mass and the inertial
forces enter and where velocity and acceleration follow the
displacement, but not in PrepStep: its predictor runs in every time
step of a static step too, with nothing to correct it. So the nodes
keep a velocity and an acceleration (with the default parameters the
velocity changes sign in every time step), and a mass damping load of
the static step, which FEBio adds in every analysis type, reads the
velocity of the material points: the one the dynamic step ended with on
a solid or a shell, the nodal one on a three-field solid or a truss. A
dynamic step after the static one starts from what it left.

The State of such a time step carries these, the system applies the
damping force through its mass blocks, the coverage report says what
happens, and gradients through such a step are refused. A model with
beams is refused, whose rotations have a predictor of their own.

Against FEBio 4.13.0 at e4df3f8, on CPU and on a Tesla P100 with cuDSS:
three generated inputs (a shell patch, a three-field hex8, a block on
trusses in dynamic, static and dynamic steps) on FEBio's iterations in
every time step, with displacement, velocity, acceleration and stress
to 3e-12 (references/small_problems/generate_static_after_dynamic.py).

tests/test_activity.py asserted the refusal and now asserts the report.

After a dynamic step with alpha_f below 1 the velocity kept for a solid
or a shell is the interpolated one of the last dynamic update
(State.domain_v): on the shell patch with rhoi 0.5 in its dynamic step
the static states are then FEBio's to 1e-12 and its 344 iterations are
reproduced (a run made once, not a stored case).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Main gained history at the integration points with FEBio's viscoelastic
material (pull request 98). New input ve_block_dynamic_then_static: the
viscoelastic block under a held force through 6 dynamic time steps,
which end with the block in motion, and 6 static ones. FEBio 4.13.0 at
e4df3f8 takes 18 and 22 iterations, this code the same in every time
step, with displacements and stresses to 2e-12 on CPU and on a GPU.

No code was needed: the domain commits its history at the end of every
converged time step of either kind of step, and the static predictor
does not touch it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Design only. The adjoint refuses every term that keeps something from
one converged state to the next: the attachments of sticky contact, the
multipliers of an augmented constraint, a beam's rotations. Handoff K
asks what it would take to carry such history in the State, first for
the anchors of a tied or sticky interface and then for a material with
internal variables.

Section 14 of the sensitivity note lists the history there is, the
reverse sweep with one more adjoint for it, what that needs of the State
and of the terms, and which gradients are the derivative of the run and
which are not because the run depends on its iterates. Three decisions
are put for MJ (S11 to S13).

The section names inputs and a section of the steps note that are on
the branches of K3-2 and K3-3 and not on main at this date.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
Main has a first material with history since pull request 98, with a
committed and a trial array in the brick domain and the pair held by
every converged State, and the reverse sweep through it since pull
request 99. The note said such history was not built for solids and
shells. What stays design in section 14 is the rest: anchors,
multipliers, the kept velocity. No code.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
FEBio's rigid_wall constraint holds the nodes of a surface on one side
of a plane. Four suite inputs miss nothing else (co08, co10, tu03 and
the dynamic dy03); it is the first piece of Handoff K, thread K1, and
independent of rigid bodies.

Read from FERigidWallInterface.cpp at e4df3f8. The facets are
integrated at their nodes, since the base class asks for nodal
integration; on the curved surface of dy03 a Gauss rule gives another
result. Newton uses FEBio's stiffness and the adjoint the derivative,
which differ by the squared length of the plane's vector.

The four inputs take FEBio's time steps and iterations on CPU and on a
Tesla P100. Augmented Lagrangian is refused: it is not built for the
wall yet.

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