← Back to team overview

yade-users team mailing list archive

[Question #706695]: do_intersect (yade: Polyhedron)

 

New question #706695 on Yade:
https://answers.launchpad.net/yade/+question/706695

I am trying to create a gravity deposition of 4 predefined polyhedral shapes in a box and then remove the side of the box, however, as the polyhedra deposit i always get the following error: "Polyhedra_support.cpp:234 bool yade::do_intersect(yade::Polyhedron, yade::Polyhedron, std::vector<int>&): Unhandled switch case:0, function do_inte"

When the error pops up, the rest of the polyhedra stop moving.

I would appreciate help on this.

This is my code:

from __future__ import print_function
from yade import plot, polyhedra_utils
import numpy as np
wire = False


######################################################################
# Need to define polyhedral material for Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys() to work


m = PolyhedraMat() #defines polyhedral properties
m.density = 2600 #kg/m^3 
m.Ks = 130000
m.Kn = 160000 #Pa
m.frictionAngle = 0.6 #rad
O.materials.append(m) #adds material to yade


######################################################################
# Defining polyhedra shapes in terms of their vertices so technically defining vertices, dimaters are 1 cm

t1_coords =       ((0.33091155911506355, -0.3242136881048748, -0.33985697995026614),
                   (0.33091155911506355, 0.38088860029783984, -0.33985697995026614),
                   (-0.3662726180924643, -0.3242136881048748, -0.33985697995026614),
                   (-0.08498849969921465, -0.3242136881048748, 0.3440300800075135),
                   (0.33091155911506355, 0.0956749508999913, 0.3055457315613278),
                   (0.33091155911506355, 0.38088860029783984, 0.25920106521738856),
                   (-0.3662726180924643, 0.38088860029783984, 0.20493952283110147),
                   (-0.3662726180924643, -0.3242136881048748, 0.32033663438746235))


t2_coords =         ((-0.14309681589806823, -0.2272260744496193, 0.38401015387691325),
                    (0.358010967088001, -0.2272260744496193, 0.38401015387691325),
                    (0.6643612513710932, -0.2272260744496193, -0.11312310165154156),
                    (0.09399535164170355, -0.2272260744496193, -0.4453308199780648),
                    (0.28983044257111084, 0.06624457321674196, -0.2657890485909965),
                    (-0.3263752923764808, 0.09806342306798776, -0.21177708099387714),
                    (-0.14309681589806823, 0.5961347452425924, 0.05063802822300939),
                    (-0.27303541351821494, 0.2667732486219123, 0.18065628098092602),
                    (0.37721690590733186, -0.0964985942102914, 0.3057083518969001),
                    (-0.47649283929694435, -0.2272260744496193, -0.11312310165154156))


t3_coords =        ((0.2600238357760947, 0.2851848128988758, -0.24701557197894438),
                   (0.16012830358156934, 0.3484895606572876, -0.18513953373961826),
                   (-0.16008801057746095, 0.3484895606572876, -0.18513953373961826),
                   (-0.26000224348968266, 0.2851848128988758, -0.24701557197894438),
                   (-0.38471948905778405, 0.2025288577517229, -0.0915820081211398),
                   (-0.38471948905778405, -0.20256899286437123, -0.0915820081211398),
                   (-0.23030565260400093, -0.40365230950484085, 0.2613542406089658),
                   (-0.16008801057746095, -0.500774842940389, 0.18311089846328836),
                   (0.16012830358156934, -0.500774842940389, 0.18311089846328836),
                   (0.23034594560810932, -0.40365230950484085, 0.2613542406089658),
                   (0.38475978206189245, -0.20256899286437123, -0.0915820081211398),
                   (0.38475978206189245, 0.2025288577517229, -0.0915820081211398),
                   (0.23034594560810932, 0.40361217439219253, 0.2613542406089658),
                   (0.16012830358156934, 0.500734707827741, 0.18311089846328836),
                   (-0.16008801057746095, 0.500734707827741, 0.18311089846328836),
                   (-0.23030565260400093, 0.40361217439219253, 0.2613542406089658),
                   (-0.16008801057746095, 0.2025288577517229, 0.4286664300572351),
                   (-0.16008801057746095, -0.20256899286437123, 0.4286664300572351),
                   (0.16012830358156934, -0.20256899286437123, 0.4286664300572351),
                   (0.16012830358156934, 0.2025288577517229, 0.4286664300572351),
                   (0.16012830358156934, 0.2025288577517229, -0.4030812475869826),
                   (-0.16008801057746095, 0.2025288577517229, -0.4030812475869826),
                   (-0.16008801057746095, -0.20256899286437123, -0.4030812475869826),
                   (0.16012830358156934, -0.20256899286437123, -0.4030812475869826),
                   (0.2600238357760947, -0.2852249480115241, -0.24701557197894438),
                   (0.16012830358156934, -0.348529695769936, -0.18513953373961826),
                   (-0.16008801057746095, -0.348529695769936, -0.18513953373961826),
                   (-0.26000224348968266, -0.2852249480115241, -0.24701557197894438))



t4_coords =        ((0.4254514979111890, 0.4106636864106340 ,0.4149508885978020),
                    (0.5684762836292130, 0.3280882876319440, 0.3323754918191100),
                    (0.5684762836292130, -0.3283734251788300, 0.3323754918191100),
                    (0.4254514979111890, -0.4109488219575220, 0.4149508885978020),
                    (-0.0000362362424167, -0.6566042805842190, -0.0105368442558058),
                    (-0.4069085993778770, -0.4216964118784300, -0.4174092086912640),
                    (-0.5685487555140470, -0.3283734231788330, -0.3240862209916650),
                    (-0.5685487555140470, 0.3280882876319440, -0.3240862209916650),
                    (-0.4069085993778770, 0.4214112753315430, -0.4174092086912640),
                    (-0.0000362362424167, 0.6563191440373320, -0.0105368442558058),
                    (0.5684762836292130, 0.3280882876319440, -0.3240862209916650),
                 (0.5684762836292130, -0.3283734231788330, -0.3240862209916650),
                 (0.4068361274930420, -0.4216964118784300, -0.4174092086912640),
                 (0.1268671643942450, -0.3283734231788330, -0.5790493638274360),
                 (-0.1269396372790780, -0.3283734231788330, -0.5790493638274360),
                 (-0.0000362362424167, 0.0371246810048347, -0.6523170763970530),
                 (-0.1269396372790780, 0.3280882876319440, -0.5790493638274360),
                 (0.1268671643942450 ,0.3280882876319440, -0.5790493638274360),
                 (0.4068361274930420, 0.4214112753315430, -0.4174092086912640),
                 (0.1777253035751180, 0.3280882876319440, 0.5579756743158260),
                 (-0.0000362362424167, 0.0371246810048347, 0.6606063472244980),
                 (0.1777253035751180, -0.3283734231788330, 0.5579756743158260),
                 (-0.1777977764599510, -0.3283734231788330, 0.5579756743158260),
                 (-0.4255239707960220, -0.4109488219575220, 0.4149508885978020),
                 (-0.5685487555140470, -0.3283734231788330, 0.3323754918191100),
                 (-0.5685487555140470, 0.3280882876319440, 0.3323754918191100),
                 (-0.4255239707960220, 0.4106636864106340, 0.4149508885978020),
                 (-0.1777977764599510, 0.3280882876319440, 0.5579756743158260))


shapes = [t1_coords, t2_coords, t3_coords, t4_coords]


bottom = polyhedron(((-5,-0.2,15),(50,-0.2,15),(50,0,15),(-5,0,15),(-5,-0.2,-5),(50,-0.2,-5),(50,0,-5),(-5,0,-5)),fixed=True,color=(0.1,0.2,0.5),wire=wire)

leftside = polyhedron(((-0.2,0,10),(0,0,10),(0,8,10),(-0.2,8,10),(-0.2,0,0),(0,0,0),(0,8,0),(-0.2,8,0)),fixed=True,color=(0.1,0.2,0.5),wire=wire)

rightside = polyhedron(((10,0,10),(10.2,0,10),(10.2,8,10),(10,8,10),(10,0,0),(10.2,0,0),(10.2,8,0),(10,8,0)),fixed=True,color=(0.1,0.2,0.5),wire=wire) #side that will be removed

back = polyhedron(((0,0,10.2),(10,0,10.2),(10,8,10.2),(0,8,10.2),(0,0,10),(10,0,10),(10,8,10),(0,8,10)),fixed=True,color=(0.1,0.2,0.5),wire=wire)

front = polyhedron(((0,0,0),(10,0,0),(10,8,0),(0,8,0),(0,0,-0.2),(10,0,-0.2),(10,8,-0.2),(0,8,-0.2)),fixed=True,color=(0.1,0.2,0.5),wire=wire)


######################################################################
# Setting polyhedra positions in terms of their centers of mass


part_list = [] # Creates an empty list


i = 0 # counter


for x in np.linspace(0.2, 9.8, num=3): # (min coordinate, max coordinate, number of points) box width is 10 mm
    for y in np.linspace(15, 25, num=2): # box height is 8 mm and we are dropping into the box so drop from a heigher height
        for z in np.linspace(0.2, 9.8, num=3): # width is 10 mm
            shape_id = np.random.randint(0,4) # chooses a number between zero and 3
            shape = shapes[shape_id] # uses the random number to pick one of the 4 shapes
            part_list += [polyhedron(shape,color=(1,1,1),wire=wire)] # adds a new particle to the particle list
            part_list[i].state.pos = (x,y,z)
            i = i + 1
            
# centroid location

         
bottom.state.pos = (22.5,-0.1,5)

leftside.state.pos = (-0.1,4,5)

rightside.state.pos = (10.1,4,5)

back.state.pos = (5,4,10.1)

front.state.pos = (5,4,-0.1)

part_list = part_list + [bottom] + [leftside] + [rightside] + [back] + [front]


######################################################################
# Adding the bodies to the simulation, to see how to assign material properties to different polyhedra check O.bodies.append used in free-fall.py


O.bodies.append(part_list)


######################################################################
# Simulation loop


O.engines=[
   # Reset forces
   ForceResetter(),
   # Appropriate collision detection, create interactions
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   # Handle interaction
   InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]   # contact law -- apply forces
   ),
   # GravityEngine(gravity=(0,0,-9.81)), and Newton Integrator which updates position using Newton's equation
   NewtonIntegrator(damping=0.10,gravity=(0,-9.81,0)),
   # VTKRecorder(fileName='./vtk/Trial',label='vtkRecorder',iterPeriod=1000), disabled for the time being because takes too much space
]


######################################################################
# Time step


O.dt = 4.03E-7



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.