# Self-contact only — Issue with augmented Lagrangian method

**URL:** <https://getfem.discourse.group/t/self-contact-only-issue-with-augmented-lagrangian-method/81>\
**Category:** General\
**Created:** [May 7, 2025, 9:27pm UTC](https://getfem.discourse.group/t/self-contact-only-issue-with-augmented-lagrangian-method/81 "2025-05-07T21:27:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djoumessi](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@Djoumessi](https://getfem.discourse.group/u/Djoumessi)\
**Post date:** [May 7, 2025, 9:27pm UTC](https://getfem.discourse.group/t/self-contact-only-issue-with-augmented-lagrangian-method/81/1 "2025-05-07T21:27:08Z")

</div>

Dear all,

I am currently working on a **self-contact problem** in large deformation elasticity using the **augmented Lagrangian method** in GetFEM++.

I’ve designed my code in a modular way so that it can be extended later not only to handle self-contact but also **contact between multiple bodies**.

While the approach works in some cases, it fails in others — for instance, the contact is not properly detected, or the solver becomes unstable or fails to converge.  
I’ve experimented with several parameters, including:

- the **augmented Lagrangian parameter** ,
- the **realised distance threshold** ,
- and other factors such as **mesh refinement** and **initial configurations**.  
Despite this, I still can’t identify the root cause of the failures.

Below is an excerpt of the code responsible for the contact implementation.  
I would greatly appreciate it if you could take a look and let me know if anything seems incorrect or poorly defined.

Thank you in advance for your help and time.

Best regards,

```auto
    md1.add_raytracing_transformation("raytrace", release_dist)
    md1.define_variable_group("u_r", "u") # can be extend for u1, u2, u3 etc ...
    md1.add_master_contact_boundary_to_raytracing_transformation("raytrace", m, "u_r", 911) 
    md1.add_nonlinear_term(mim_contact2, "-contact_mult2.Test_u", 911) 
    md1.add_nonlinear_term(mim_contact2, "-(1/c)*contact_mult2.Test_contact_mult2", 911) 
    md1.add_macro("normal2", "Normalized(Inv(F1').Normal)")
    md1.add_macro("gap2", "(Interpolate(X,raytrace)+Interpolate(u_r,raytrace)-X-u).normal2")
    md1.add_nonlinear_term(mim_contact2,
        "Interpolate_filter(raytrace,(-1/c)*neg_part(contact_mult2.normal2+c*gap2)*normal2.Test_contact_mult2, 1)", 911) 
    md1.add_nonlinear_term(mim_contact2,
                        "Interpolate_filter(raytrace, -neg_part(contact_mult2.normal2+c*gap2)*normal2.Interpolate(Test_u,raytrace), 1)",
                        911) 

```

---

<div class="post-metadata">

**Author:** ![Konstantinos.Poulios](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Konstantinos.Poulios](https://getfem.discourse.group/u/Konstantinos.Poulios)\
**Post date:** [May 9, 2025, 12:37pm UTC](https://getfem.discourse.group/t/self-contact-only-issue-with-augmented-lagrangian-method/81/2 "2025-05-09T12:37:27Z")

</div>

To get a robust contact formulation that works in all cases is very difficult. Commercial programs use a lot of heuristics and special treatment of corner cases.

One strategy is to start with an imprecise penalized contact formulation (i.e. with a low penalty parameter) which is quite robust. Then you can use the solution from the imprecise model as a start guess for your precise model with the augmented lagrangian formulation.

---

<div class="post-metadata">

**Author:** ![Djoumessi](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@Djoumessi](https://getfem.discourse.group/u/Djoumessi)\
**Post date:** [May 12, 2025, 11:46pm UTC](https://getfem.discourse.group/t/self-contact-only-issue-with-augmented-lagrangian-method/81/3 "2025-05-12T23:46:21Z")

</div>

Dear @Konstantinos.Poulios

Thank you so much for your advice, I’ll implement and let you know.

Best
