delete particles with active capillary law

Asked by Christian Jakob on 2012-07-30

Hi,

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?

O.bodies.erase(id)

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():
  O.interactions.erase(i.id1,i.id2)

O.bodies.erase(id)

O.run(1,True)

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.

Law2_ScGeom_CapillaryPhys_Capillarity.dead=True
Law2_ScGeom_MindlinPhys_Mindlin.neverErase=False
O.interactions.clear()

O.bodies.erase(id)

Law2_ScGeom_MindlinPhys_Mindlin.neverErase=True
Law2_ScGeom_CapillaryPhys_Capillarity.dead=False

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

Christian

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Christian Jakob
Solved:
2012-08-08
Last query:
2012-08-08
Last reply:
2012-07-31

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

Hi,

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.

Anton

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:

https://bugs.launchpad.net/yade/+bug/1031644

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

Hello,

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

Christian Jakob (jakob-ifgt) said : #6

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