delete particles with active capillary law

Asked by Christian Jakob on 2012-07-30


I need to delete some particles inside my model and I dont know what is the best and physical/numerical correct way to do this.
If I say O.bodies.erase(id) it erases the body and the interactions will be erased in the next time step by InteractionLoop. But when I have capillary law active, I have to use neverErase flag as True to avoid a segmentation fault. So there are three options how to do this and I want to know what is the best option:

OPTION 1: only erase bodies
Because neverErase flag is True, interaction will still be active and can influence results, right? So if I later simulate increasing water level by deleting liquid bridges this remaining interactions from non-existant bodies can lead to instability, right?


OPTION 2: erase interactions manually first and erase bodies afterwards
To avoid the influence of interactions from non-existant bodies, one can erase the interactions before erasing the associated bodies. This normally leads to a segmentation fault. One can del with the segmantation fault by simply run 1 step after every erased body.

for i in O.bodies[id].intrs():


OPTION 3: deactivate capillary law, set neverErase=False, erase all interactions, delete bodies, set neverErase=True, activate capillary law again
I did not test this option, so I dont know if it works.




So what do you think is the best option in this case?


Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Christian Jakob
Last query:
Last reply:

I have no experience in deleting bodies with capillary law active, so I have no clear idea. Option 2 sounds ok, no? Does it have a problem?

It seems you are actually trying to find workaround while the best would be to (option 4) solve this bug:

> I have to use neverErase flag as True to avoid a segmentation fault

Could you please open a bug and attach a short example script there?

Anton Gladky (gladky-anton) said : #2


I do not clearly understand why and where it segfaults. Bruno is right,
short example and opening a bug maybe will give some more chance
to get the bug fixed.


Christian Jakob (jakob-ifgt) said : #3

I tried to reproduce the segfault with a small sample script. I found a bug, but not the one I explained above, see here:

Christian Jakob (jakob-ifgt) said : #4

I could not reproduce the described bug. Maybe it was fixed on-the-fly by another bug-fix related to clumps and/or erase command.

Seungcheol Yeom (scyeom79) said : #5


I am wondering how this problem was solved.
Is the 2nd option best?
I have a similar thing to do.

Christian Jakob (jakob-ifgt) said : #6

O.bodies.erase(id) is working fine in this case.