How can I correct collisions and preserve mesh during dynamic simulation?


During a dynamic simulation, when the mesh starts to have collisions (mesh entering into itself), how should I manage them in FEniCS?
In particular:

  • How do I identify the nodes that enter into collision?
  • How can I computate/apply a nodal force that correct these collisions and preserve the mesh all during the simulation long?

Many thanks,

You can try using the mesh.smooth command, see: How to use ALE for moving boundary problems? - #2 by dokken

Many thanks @dokken.
And in the case of inherent large deformation in which smoothing mesh is not sufficient? I mean, if I really need to compute collisions and anihilate them?

Then I would re-mesh the geometry.
See for instance: Re-meshing in fluid structure interaction - #2 by dokken
Remeshing with cashocs — cashocs 2.0.0-dev documentation
GitHub - wildmeshing/fTetWild: Fast Tetrahedral Meshing in the Wild

Ok, many thanks @dokken. Just one last question: in FEniCS simulation, is collision management compulsory or does FEniCS manages it somehow?

Many thanks!

I’m not sure what you mean by collision management. If your mesh degenerates, you will still be able to solve the problem, but the quality of the solution will degenerate.

FEniCS expects that you send in sensible data, i.e. sensible meshes/geometries, valid boundary conditions etc.

Dear @dokken , many thanks for your answer.

Actually, I have a mesh which interpenetrates/autocollides, as illustrated below. In a real material, I would assume the mesh walls would compress themselves without interpenetrating, but here part of the mesh is just disappearing and that is what I would like to correct.

For now, I am trying to apply a “corrective” force F independently from the variational form (I assume then this force is “numerical” and not “physicial”). Here is the process: I solve the problem, get the deformation, apply deformation to the mesh and in case the new mesh is interpenetrating, I then apply the corrective force doing ALE.move(mesh, F), before going to next timestep.

My questions were actually associated to that issue:

  • Is there a specific way in FEniCS correct interpenetration of the mesh?
  • Is what I am doing correct? Does it make sense?

Many thanks again for your help,

1 Like

This is contact mechanics, and you would need to enforce the contact through your variational formulation, with either a Nitsche method or a penalty approach.

Legacy dolfin

@kamensky has also worked on contact mechanics:
@bleyerj has quite alot of work on contact at: Hertzian contact with a rigid indenter using a penalty approach — Numerical tours of continuum mechanics using FEniCS master documentation


@evzen did his thesis on the subject with DOLFINx: GitHub - evzenkorec/thesis_contact: thesis on high performance solvers for contact mechanics
Some contact mechanics has been implemented by me, Sarah Roggendorf and @chris at: GitHub - Wells-Group/asimov-contact: Contact models for ASiMoV

1 Like

Many thanks @dokken!!! I will have a close look on those works.

Dear @dokken,

I may have a complementary question:
→ I would like to detect the cells in the boundarymesh in which a given surface vertex (and not a random point) is eventually entering into collision in. I found the function compute_entity_collisions() but it returns neighbour cells to the node, so the collision does not have any sense in that case.

Is there any fenics function to get all the boundarymesh cells (and not only the neighbour ones) in which a node enter into collision ?

Many thanks,

I don’t quite understand what you want here. Maybe you could make a coarse sketch that illustrates your question

Hi @dokken,
Below are a scheme and a small animation (slice of the 3D mesh) of what’s happening in my problem: I am experiencing mesh self-collision that I would like to avoid/correct. In the scheme, the two parts of the mesh (in dark and clear blue) actually refer to the same mesh.


To compute the contact forces, I would like to first detect the “triangle3” on the boundarymesh, belonging to the tetraedron “tet3” into which the point x (in red, and belonging to the dark blue part of the mesh), enter into collision. (x is a point on the boundary mesh).

  • I am currently using tets = bbtree_mesh.compute_entity_collisions(x) to get tet3. I wanted to know if there exists a function in fenics that enables to find directly triangle3.

  • Additionnally, when I tried to compute:
    triangles = bbtree_boundarymesh.compute_entity_collisions(x), it returned me only the neighbour triangles (in the dark blue part) and not the triangles contained in tet3.

Could you please help me with that issue?
Many thanks,