← Back to team overview

yade-dev team mailing list archive

Re: contact logic (again)

 



A quick review found nothing wrong. I was just a little surprised by the fact interactions are erased in 2 different places (in the core of "action()" and in "updateOverlapingBBset"). I don't think this is a recent change though.
Yes, it's been there since long.
InteractionGeometryMetaEngine can in fact only set isReal=true (in case of geometrical "interaction", i.e. overlap), it cannot revert to isReal=false. So, the interaction will be marked !isReal by the contact law only, not the IGME. The IGME code is :

/if (penetrationDepthSq>0 || c->isReal){
               if (isNew) {
                   create and initialise the interaction geometry;
                  isNew = false;
       }
       return true;
   }
   else return false;
/
(and then the returned value is used by the dispatcher to set isReal for this interaction.)

Second potential problem with haveDistantTransient is that you can have multiple constitutive laws, of which one will want to keep distant interaction and the other would not (there are no transient/persistent interactions anymore).

I don't really see the relation between this problem and the haveDistantTransient flag. The correct behaviour would be that a contact is "Real" IF there is a geometrical overlap OR at least one physical interaction exists.
Since interactions are indexed by body id's, there can be only one "physical" interaction between two bodies. Otherwise agreed, real means:

1. geometrical overlap, but not physical interaction yet: it will be created in the very same iteration, however.
2. geometrical overlap and physical interaction: ok
3. no geometrical overlap and physical interaction: ok
If the interaction of type1 persists while the interaction of type 2 disapears, and if law2 is after law1 in metabody->engines, then the second law2 will make the interaction deletable even if it should not.
No way. Constitutive laws (in the sense of ConstitutiveLaw) are functors in one ConstitutiveLawDispatcher, which makes sure each interaction gets processed exactly once.
Perhaps it needs an additional flag "isPhysical", which would be false at the beggining of each timestep, and set equal to (isPhysical || hasTypeX) in InteractionLawX. The collider would set isReal = isPhysical at the very begining of each step. There is perhaps a smarter way to do this, since isPhysical would play almost the same role as isReal (the only difference is isReal must not be reset at each step).
See summary at the end.

- PersistentTriangulationCollider : experimental stuff, it is slower than the default collider but it works, and since some simulations are (or will be) maintaining a triangulation (e.g. JF Jerier for the volumic contact law or Emanuele Catalano in the near future), it is interesting to use it for contact detection at the same time.
Good.

- SAPCollider : I don't know this. A very old collider from early ages of Yade IIRC. Can be removed safely.

- DistantPersistentSAPCollider : the specific features of this one are now included in PersistentSAPcollider (the "if (haveDistantTransient) {...}" code that you want by default now). It can be safely removed, except that it is still used in CohesiveFrictionalTriaxialTest. Switching to the "normal" collider in this demo will be a good way to check that everything works fine.
Will be removed, I will make sure that all other code compiles, of course.

To summarize:

1. Colliders:
a) create potential (isNew !isReal) interactions, for overlapping AABBs
b) delete interactions that were potential (isNew&!isReal) but now don't have overlapping AABBs
c) keep isReal interactions (regardless of geometrical overlap)

2. InteractionGeometryMetaEngine:
a) set isReal on interactions that are real (bodies collide not only with AABBs, but also with their volumes)

3. ConstitutiveLaws
a) may set !isReal, they do not change anything else (let alone deleting interactions directly!)

Remaining problem: who deletes interaction that was ever only potential and now there is no AABB overlap anymore? It would have to keep track of when was the interaction seen last (something like Interaction::cycle). I propose long Interaction::lastSeen for iteration number. All interactions that are isNew && !isReal && lastSeen<currentIteration can be deleted safely. Whould that be OK? Currently, PersistentSAPCollider sets isReal=false at the beginning of the loop.

Best, Vaclav



Follow ups

References