Segmentation fault on pfacet gridconnection contact

Bug #1852197 reported by Klaus Thoeni
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yade
New
Undecided
Unassigned

Bug Description

I seem to get a Segmentation fault (core dumped) when using GridConnection, PFacet, and randomDensePack. And I am not sure why. I have attached an image and "working" example.

Thanks in advance,
Justin

Edit: I could not seem to upload an picture or example code. Thus code below:

from yade.gridpfacet import *
import numpy as np
from yade import utils
from yade import ymport
import sys,time,math,random

from yade import qt
qt.View()

#print(os.path.basename(__file__))
#quit()
########### ParallelEngine, -j4

boxCenter = (0,0,.025)
## double check that /2 would create correct length, I.e., import based_70 to see if they match... they should
boxDem = (.2123/2,.212/2,.064/2) ### based_70 is 212.3x212.21x63.65

boxDem = (.07,.07,.025) ###

blen = boxDem[0]*2 ## Length of Ball pit
bhei = .025 ## Height of Ball pit

# Spheres information
sphereRadius = .004 # [m]
nu = .48
#G = 300000 # [Pa]
den_rub = 89724 # [kg/m^3]
yng_rub = 3000000 # [Pa]
fric_rub = radians(38) # [degrees]
O.materials.append(FrictMat(frictionAngle=fric_rub,young=yng_rub,density=den_rub,poisson=nu,label='rubber'))
O.materials.append(FrictMat(young=200e9,density=8050,poisson=.3, label='steel')) # used steel properties to make rigid

## Stud informtion
#studStartZ = (.01+.022+.01905)
studStartZ = (.01+bhei+.01905)
transVel = 0.000222*2
rotVel = 0.00872665*2

### pack auto fills, i.e., I no longer pick the amount of spheres
pred = pack.inAlignedBox((-(boxDem[0]-.001),-(boxDem[0]-.001),bhei+sphereRadius/2+.001),((boxDem[0]-.001),(boxDem[0]-.001),bhei+.045))
sp = pack.randomDensePack(pred, radius=sphereRadius, memoizeDb='tmp/single_grass.sqlite', returnSpherePack=True)
sp.toSimulation(wire=False,material='rubber')

## Time step set to 20% of Rayleigh Wave
O.dt=.2*utils.RayleighWaveTimeStep() # 0.0011302534626965682
print(O.dt)

### Steps needed to run sim
sphereFalls = 1000 ### Steps spheres need to fall and level out and turn on studs
startRot = sphereFalls+math.floor((studStartZ-bhei-.01)/transVel/O.dt) ### Step needed for transVel to get studs level with spheres

## Rotation steps
deg_to_rad_length = (60*pi/180); # [rad]
num_sec_roto = deg_to_rad_length/rotVel; # [s]
num_of_steps_roto = num_sec_roto/O.dt;

endSim = startRot + math.floor(num_of_steps_roto) ### total steps in sim

O.engines=[
  ###Reset all forces stored in Scene::forces (O.forces in python). Typically, this is the first engine to be run at every step. In addition, reset those energies that should be reset, if energy tracing is enabled.
  ## Resets forces and moments that act on bodies
  ForceResetter(),

  ## Using bounding boxes find possible body collisions.
  InsertionSortCollider([
  Bo1_Facet_Aabb(),
  Bo1_PFacet_Aabb(),
  Bo1_Sphere_Aabb(),
  Bo1_GridConnection_Aabb(),
  Bo1_PFacet_Aabb(),
  ]),
  InteractionLoop([
   Ig2_Facet_Sphere_ScGeom(),
   Ig2_Wall_PFacet_ScGeom(),
   Ig2_Wall_Sphere_ScGeom(),
   Ig2_Sphere_Sphere_ScGeom(),
   Ig2_Sphere_GridConnection_ScGridCoGeom(),
   Ig2_Sphere_PFacet_ScGridCoGeom(),
   Ig2_GridNode_GridNode_GridNodeGeom6D(),
   Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
   Ig2_GridConnection_PFacet_ScGeom(),
   Ig2_PFacet_PFacet_ScGeom(),
   ],
   [
# Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True), # internal cylinder physics
   Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True), # internal cylinder physics
   ## Currently grass does not interact with facet, probably should not matter, since the spheres will be holding them up.

   Ip2_FrictMat_FrictMat_FrictPhys() # physics for external interactions, i.e., cylinder-cylinder, sphere-sphere, cylinder-sphere
   ],
   [
   Law2_ScGeom_FrictPhys_CundallStrack(), # contact law for sphere-sphere
   Law2_ScGridCoGeom_FrictPhys_CundallStrack(), # contact law for cylinder-sphere
   Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylinder forces
   Law2_GridCoGridCoGeom_FrictPhys_CundallStrack(), # contact law for cylinder-cylinder interaction
  ]),
 NewtonIntegrator(damping=.2,gravity=[0,0,-9.81], label='newtonInt'),
]

## Grass Information
#O.materials.append(CohFrictMat(young=8e5,poisson=0.3,density=4e3,frictionAngle=np.radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='grass')) ## Properties Need to be corrected
O.materials.append(CohFrictMat(young=100,poisson=0.3,density=40,frictionAngle=np.radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='grass'))
#rCyl = 0.0006 ## Radius, Grass was about 1.2 [mm] wide
rCyl = 0.0026 ## Grass was about 1.2 [mm] wide
nL = 4 ## No exact Number here, just trial and error
L = bhei ## Height of spheres

### Grass Creation
### Create all nodes first :
nodesIds=[]
idxc = -1
x_gap = 0.009 ## Between lumps is roughly 9 [mm]
y_gap = 0.01905 ## Between lines of backing is .75 inch apart
range_x = int(math.floor(blen/x_gap)) ## finding the range for x
range_y = int(math.floor(blen/y_gap)) ## finding the range for z
cen_y = -(range_y/2)*y_gap ## Allows the "box" of grass to be center in Z

color=[255./255.,102./255.,0./255.]
steel_r = (1/4*0.00635)/2 ### Converting 1/4 steel to m, to a sphere radius
box = []
box.append(O.bodies.append( gridNode([-boxDem[0],-boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
box.append(O.bodies.append( gridNode([boxDem[0],-boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
box.append(O.bodies.append( gridNode([boxDem[0],boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
box.append(O.bodies.append( gridNode([-boxDem[0],boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
O.bodies.append( gridConnection(box[0],box[1],steel_r,color=color,material='steel') )
O.bodies.append( gridConnection(box[1],box[2],steel_r,color=color,material='steel') )
O.bodies.append( gridConnection(box[2],box[0],steel_r,color=color,material='steel') )
O.bodies.append( gridConnection(box[2],box[3],steel_r,color=color,material='steel') )
O.bodies.append( gridConnection(box[3],box[0],steel_r,color=color,material='steel') )
O.bodies.append( pfacet(box[0],box[1],box[2],wire=False,material='steel',color=color) )
O.bodies.append( pfacet(box[0],box[2],box[3],wire=False,material='steel',color=color) )

O.stopAtIter=endSim ### Stop sim at endSim steps
#O.run()

Revision history for this message
Anton Gladky (gladky-anton) wrote :

I am getting this error:

Traceback (most recent call last):
  File "./../inst/bin/yade-trunk", line 337, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 82, in execfile
    exec_(code, myglobals, mylocals)
  File "2.py", line 41, in <module>
    sp = pack.randomDensePack(pred, radius=sphereRadius, memoizeDb='tmp/single_grass.sqlite', returnSpherePack=True)
  File "/home/anton/dem/yade/inst/lib/x86_64-linux-gnu/yade-trunk/py/yade/pack.py", line 559, in randomDensePack
    _memoizePacking(memoizeDb,sp,radius,rRelFuzz,wantPeri,fullDim)
  File "/home/anton/dem/yade/inst/lib/x86_64-linux-gnu/yade-trunk/py/yade/pack.py", line 400, in _memoizePacking
    conn=sqlite3.connect(memoizeDb)
sqlite3.OperationalError: unable to open database file
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

Revision history for this message
Anton Gladky (gladky-anton) wrote :
Download full text (3.2 KiB)

Ok, found, changed the path to memoizeDb. ASAN says:

=====
==5085==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f7d59ac2c6f bp 0x7f7d40cf7ac0 sp 0x7f7d40cf61d0 T16777215)
==5085==The signal is caused by a READ memory access.
==5085==Hint: address points to the zero page.
In [5]: #0 0x7f7d59ac2c6e in yade::Bo1_PFacet_Aabb::go(boost::shared_ptr<yade::Shape> const&, boost::shared_ptr<yade::Bound>&, yade::Se3<double> const&, yade::Body const*) /trunk/pkg/common/PFacet.cpp:817
    #1 0x7f7d59141278 in yade::BoundDispatcher::processBody(boost::shared_ptr<yade::Body> const&) /trunk/pkg/common/Dispatching.cpp:54
    #2 0x7f7d59142ded in yade::BoundDispatcher::action() [clone ._omp_fn.0] /trunk/pkg/common/Dispatching.cpp:36
    #3 0x7f7d50c11e0e in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0xde0e)
    #4 0x7f7d591433ee in yade::BoundDispatcher::action() /trunk/pkg/common/Dispatching.cpp:31
    #5 0x7f7d59821812 in yade::InsertionSortCollider::action() /trunk/pkg/common/InsertionSortCollider.cpp:309
    #6 0x7f7d58c04381 in yade::Scene::moveToNextTimeStep() /trunk/core/Scene.cpp:98
    #7 0x7f7d58c12613 in yade::SimulationFlow::singleAction() /trunk/core/SimulationFlow.cpp:26
    #8 0x7f7d58ccefc7 in yade::ThreadWorker::callSingleAction() /trunk/core/ThreadWorker.cpp:73
    #9 0x7f7d58cc5259 in yade::ThreadRunner::call() /trunk/core/ThreadRunner.cpp:54
    #10 0x7f7d58cc71cf in yade::ThreadRunner::run() /trunk/core/ThreadRunner.cpp:28
    #11 0x7f7d58cc74c8 in boost::_mfi::mf0<void, yade::ThreadRunner>::operator()(yade::ThreadRunner*) const /usr/include/boost/bind/mem_fn_template.hpp:49
    #12 0x7f7d58cc74c8 in void boost::_bi::list1<boost::_bi::value<yade::ThreadRunner*> >::operator()<boost::_mfi::mf0<void, yade::ThreadRunner>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, yade::ThreadRunner>&, boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:259
    #13 0x7f7d58cc74c8 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, yade::ThreadRunner>, boost::_bi::list1<boost::_bi::value<yade::ThreadRunner*> > >::operator()() /usr/include/boost/bind/bind.hpp:1294
    #14 0x7f7d58cc74c8 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf0<void, yade::ThreadRunner>, boost::_bi::list1<boost::_bi::value<yade::ThreadRunner*> > >, void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:159
    #15 0x7f7d58cccf6b in boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:768
    #16 0x7f7d58cccf6b in boost::detail::thread_data<boost::function0<void> >::run() /usr/include/boost/thread/detail/thread.hpp:117
    #17 0x7f7d55a39f64 (/lib/x86_64-linux-gnu/libboost_thread.so.1.67.0+0x14f64)
    #18 0x7f7d5f80afa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
    #19 0x7f7d5f3514ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xf94ce)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /trunk/pkg/common/PFacet.cpp:817 in yade::Bo1_PFacet_Aabb::go(boost::shared_ptr<yade::Shape> const&, boost::shared_ptr<yade::Bound>&, yade::S...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.