How to implement the penalty method to avoid self-contact

This is far from a trivial question, especially since your deformation is quite large, and the gap has to be computed for each step.
There has been done quite a lot of work on this at: GitHub - Wells-Group/asimov-contact: Contact models for ASiMoV using DOLFINx and an unbiased Nitsche method for enforcement of contact conditions.

1 Like