Segmentation fault (core dumped) Engines

Asked by János Mészáros on 2020-11-17

Dear all,

I am very new to yade so I only know a few things. Probably my problem is in principle but unfortunately I cannot locate the problem itself more accurately. I am just suggesting that it is in the the FIRST engine. usually it occurs about 6000-7000 iters. I am using:
Welcome to Yade 2020.01a
Using python version: 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]

I would like to ask for help to somehow track the problem that occurs the segmentation fault and if it is located then tell me what did I do wrong.
Thank you very much in advance!

from yade import pack, plot, qt
import itertools

EA = 2.1e5 #Young' module of steel
nuA = .3 #Poisson ratio of steel
densA = 7850 #Density of steel
frictAngA = .52 #Friction half cone angle of steel

#Let's define and add the materials to the models:

steel = O.materials.append(FrictMat(young=EA,poisson=nuA,density=densA,frictionAngle=frictAngA,label='steel'))

#Creating bodies:

channel = O.bodies.append(geom.facetBox((.005,.025,.1),(.01,.05,.2), wallMask=15, material = 'steel'))
trash = O.bodies.append(geom.facetBox((.05,.025,-.15),(.15,.15,.025), wallMask=31, material = 'steel'))
lamella1 = O.bodies.append(geom.facetBox((.005,.045,.225),(.01,.0575,.001), orientation=Quaternion((1,0,0),1), wallMask=63, material = 'steel'))
lamella2 = O.bodies.append(geom.facetBox((.005,0.005,.1125),(.01,.0575,.001), orientation=Quaternion((1,0,0),-1), wallMask=63, material = 'steel'))
lamella3 = O.bodies.append(geom.facetBox((.005,.045,0),(.01,.0575,.001), orientation=Quaternion((1,0,0),1), wallMask=63, material = 'steel'))
vane = O.bodies.append(geom.facetBox((.005,.025,-.1),(.01,.0575,.001), wallMask = 63, material = 'steel'))

#Creating clumps:

#Defining engines and recorders: (I think the problem is here)

       #handle sphere+sphere and facet+sphere collisions
   #Limit the quantity of spheres:
   # call the checkUnbalanced function (defined below) every 2 seconds
   # call the addPlotData function every 100 steps


def move():
 if O.iter > 2000 :
  O.engines = O.engines + [TranslationEngine(ids=vane,translationAxis=(1,0,0),velocity=.3)]

def stop():
 if O.iter > 4200 :
  O.engines = O.engines + [TranslationEngine(ids=vane,translationAxis=(1,0,0),velocity=0)]


# if the unbalanced forces goes below .00001, the packing is considered stabilized, therefore we stop collected data history and stop

def checkUnbalanced():
   if unbalancedForce()<.00001:

# collect history of data which will be plotted

def addPlotData():
# color particles based on rotation amount
   for b in O.bodies:
  # rot() gives rotation vector between reference and current position

O.engines=O.engines + [PyRunner(command='move()',iterPeriod = 1,firstIterRun=2000,iterLast=4200)]
O.engines=O.engines + [PyRunner(command='stop()',iterPeriod = 1)]


Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Jan Stránský
Last query:
Last reply:
Best Jan Stránský (honzik) said : #1


> I am very new to yade

welcome :-)

> I am just suggesting that it is in the the FIRST engine


> somehow track the problem that occurs the segmentation fault

try to run
catchsegv yade
or simply how you run yade, but put "catchsegv" before and provide the output

> what did I do wrong

probably is not related to the problem, but:

> O.engines = O.engines + [...]

while it might be perfectly OK, I consider it a "dangerous" operation (especially if slicing is involved).
Especially before any step/run (like this case) and no if condition, there is no reason not to put the engines directly inside the original O.engines = [...] definition.
Just be careful while modifying the O.engines

> O.engines=O.engines + [PyRunner(command='move()',iterPeriod = 1,firstIterRun=2000,iterLast=4200)]
> def move():
> if O.iter > 2000 :
> O.engines = O.engines + [TranslationEngine(ids=vane,translationAxis=(1,0,0),velocity=.3)]

like here. You are adding 2200 instances of "the same" TranslationEngine to O.engines, probably not what you want..
Adding one (possibly dead initially) at the very beginning and modifying its dead attribute (or other attributes as well) should be enough.


János Mészáros (cerebeus) said : #2

Hello Jan,

Thank you for your fast reply and suggestions!

The reason why I was suggesting that the problem is in the first engine is just a pure suggestion. I thought I understand the rest of the code but it seems not so I need to modify them as you recommend.
I will learn how to use the "dead" command and will come back if it solved it or not.

I've run the script as you said and it showed me this (unfortunately I do not know what it means):
*** Segmentation fault
Register dump:

 RAX: 0000001000000000 RBX: 00007f90b45c2a00 RCX: 0000000000000000
 RDX: 00007f90f8b60cd0 RSI: 00007f90f8b487b0 RDI: 0000439f0000439e
 RBP: 00007f90b45a3100 R8 : 0000c32db45c6d9c R9 : 00007f90be12be30
 R10: 00007f90f8ddbe90 R11: 0000000000000000 R12: 0000000000000000
 R13: 0000000000000000 R14: 00007f90f4ccb1b0 R15: 0000000000000000
 RSP: 00007ffc3926a9d0

 RIP: 00007f90f4521f04 EFLAGS: 00010206

 CS: 0033 FS: 0000 GS: 0000

 Trap: 0000000d Error: 00000000 OldMask: 00000000 CR2: 00000000

 FPUCW: 0000037f FPUSW: 00000020 TAG: 00007f90
 RIP: bf238afd RDP: 00000000

 ST(0) ffff 8000000000000000 ST(1) 0000 0000000000000000
 ST(2) 0000 0000000000000000 ST(3) ffff 81ceb32c4b43fcf5
 ST(4) ffff 8000000000000000 ST(5) ffff 8000000000000000
 ST(6) ffff 8000000000000000 ST(7) d440 d440920000000000
 mxcsr: 1fa0
 XMM0: 00000000000000000000000000000000 XMM1: 00000000000000000000000000000000
 XMM2: 00000000000000000000000000000000 XMM3: 00000000000000000000000000000000
 XMM4: 00000000000000000000000000000000 XMM5: 00000000000000000000000000000000
 XMM6: 00000000000000000000000000000000 XMM7: 00000000000000000000000000000000
 XMM8: 00000000000000000000000000000000 XMM9: 00000000000000000000000000000000
 XMM10: 00000000000000000000000000000000 XMM11: 00000000000000000000000000000000
 XMM12: 00000000000000000000000000000000 XMM13: 00000000000000000000000000000000
 XMM14: 00000000000000000000000000000000 XMM15: 00000000000000000000000000000000


Jérôme Duriez (jduriez) said : #3

Is that all you've got from catchsegv ? There should be many other lines after that

Since Jan most probably pointed a significant flaw (a probably meaningless repeated addition of an Engine) in your script, I'd first correct this if I were you ;-)

János Mészáros (cerebeus) said : #4

Thanks Jan Stránský, that solved my question.

János Mészáros (cerebeus) said : #5

Thank you very much for your help! :)
Now I only need to somehow stop the "vane" automatically at 4200 iters but that is another topic for me.

Best regards,