from yade import geom,log shotsId,steelId=O.materials.append([ FrictMat(young=50e9,density=6000,poisson=.2,label='shots'), FrictMat(young=210e9,density=7800, poisson=.3,label='steel'), ]) ## same as # # shotsId,steelId=O.materials.index('shots'),O.materials.index('steel') # O.bodies.append(geom.facetBox(center=(0,0,0),extents=(30e-3,30e-3,0),wallMask=32,wire=False,material='steel',color=(0,1,.3))) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()],verletDist=.05*.29e-3), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_MindlinPhys( # define restitution coefficients between different pairs of material ids, see the functor's documentation for details #en=MatchMaker(fallback='zero',matches=((steelId,shotsId,.4),(shotsId,shotsId,1))) en=MatchMaker(matches=((steelId,shotsId,.4),(shotsId,shotsId,1))) )], [Law2_ScGeom_MindlinPhys_Mindlin(label='contactLaw')] ), NewtonIntegrator(damping=0), ## CircularFactory: disk if length=0 or cylinder if length>0 #CircularFactory(maxParticles=10000,radius=8e-3,length=16e-3,center=(0,-15e-3,15e-3),rMin=0.28e-3,rMax=0.29e-3,vMin=100,vMax=100,vAngle=0,massFlowRate=100./60,normal=(0,1.5,-1),label='factory',materialId=shotsId), ## BoxFactory: a line, plane or cuboid BoxFactory(maxParticles=10000,extents=(8e-3,8e-3,8e-3),center=(0,-15e-3,15e-3),rMin=0.28e-3,rMax=0.29e-3,vMin=100,vMax=100,vAngle=0,massFlowRate=100./60,normal=(0,1.5,-1),label='factory',materialId=shotsId),
### Creating the Buldozer Knife ### from facets, using GTS Knife = [] for i in linspace(pi, pi * 3 / 2, num=numKnifeParts, endpoint=True): Knife.append(Vector3(radiusKnife * cos(i), 0, radiusKnife * sin(i))) KnifeP = [Knife, [p + Vector3(0, lengthKnife, 0) for p in Knife]] KnifePoly = pack.sweptPolylines2gtsSurface(KnifeP, threshold=1e-4) KnifeIDs = [] KnifeIDs = O.bodies.append( pack.gtsSurface2Facets(KnifePoly, color=(1, 0, 0), wire=False)) KnifeIDs += O.bodies.append( geom.facetBox((-lengthKnife / 2 - radiusKnife, lengthKnife / 2, -radiusKnife + buldozerHeight / 2), (lengthKnife / 2, lengthKnife / 2, buldozerHeight / 2.), wallMask=47, color=(0, 1, 0), wire=False)) KnifeIDs += O.bodies.append( geom.facetBox( (-lengthKnife / 2 - radiusKnife - lengthKnife / 4., lengthKnife / 2, -radiusKnife + buldozerHeight * 3. / 2. - buldozerHeight / 4.), (lengthKnife / 4., lengthKnife / 3., buldozerHeight / 4.), wallMask=47, color=(0, 0, 1), wire=False)) O.bodies.append( geom.facetBox((0, lengthKnife / 2, radiusKnife), (lengthKnife * 4, lengthKnife * 4, lengthKnife),
groundId=O.bodies.append(utils.facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground for part in [ pack.regularHexa ( pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1), radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body, pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand ]: O.bodies.appendClumped(part) # Example of geom.facetBox usage oriBody = Quaternion(Vector3(0,0,1),(math.pi/3)) O.bodies.append(geom.facetBox((12,0,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes)) oriBody = Quaternion(Vector3(0,0,1),(math.pi/2)) O.bodies.append(geom.facetBox((0,12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes)) oriBody = Quaternion(Vector3(0,0,1),(math.pi)) O.bodies.append(geom.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes)) # Example of geom.facetCylinder, facetHelix and RotationEngine usage example oriBody = Quaternion(Vector3(1,0,0),(math.pi/2.0)) rotateIDs=O.bodies.append(geom.facetHelix((-7.0,-6.0,-5.0),radiusOuter=2.0,radiusInner=0.1,pitch=2.0,orientation=oriBody,segmentsNumber=50,angleRange=[math.pi*8.0,0],**kwBoxes)) O.bodies.append(geom.facetCylinder((-7.0,-12.0,-5.0),radius=2.0,height=7.0,orientation=oriBody,segmentsNumber=10,wallMask=4,**kwMeshes)) O.bodies.append(geom.facetCylinder((-7.0,-7.0,-5.0),radius=2.0,height=4.0,segmentsNumber=10,wallMask=4,angleRange=[-math.pi*0.2,math.pi*1.2],**kwMeshes)) oriBody = Quaternion(Vector3(0,0,1),(math.pi/2)) O.bodies.append(ymport.gmsh('cone.mesh',orientation=oriBody,**kwMeshes))#generates facets from the mesh file
radius=rad, gap=gap, color=(0, 0, 1), **kw), # right hand pack.regularOrtho(pack.inCylinder((-2, 0, 2), (-5, 0, 4), 1), radius=rad, gap=gap, color=(0, 0, 1), **kw) # left hand ]: O.bodies.appendClumped(part) # Example of geom.facetBox usage oriBody = Quaternion(Vector3(0, 0, 1), (math.pi / 3)) O.bodies.append( geom.facetBox((12, 0, -6 + 0.9), (1, 0.7, 0.9), oriBody, **kwBoxes)) oriBody = Quaternion(Vector3(0, 0, 1), (math.pi / 2)) O.bodies.append( geom.facetBox((0, 12, -6 + 0.9), (1, 0.7, 0.9), oriBody, **kwBoxes)) oriBody = Quaternion(Vector3(0, 0, 1), (math.pi)) O.bodies.append( geom.facetBox((-12, -12, -6 + 0.9), (1, 0.7, 0.9), oriBody, **kwBoxes)) # Example of geom.facetParallelepiped usage oriBody = Quaternion(Vector3(0, 0, 1), (math.pi / 3)) O.bodies.append( geom.facetParallelepiped(center=Vector3(12, 0, -6 + 2.7), extents=Vector3(1, 0.7, 0.9), height=0.5,
from yade import geom, log shotsId, steelId = O.materials.append([ FrictMat(young=50e9, density=6000, poisson=.2, label='shots'), FrictMat(young=210e9, density=7800, poisson=.3, label='steel'), ]) ## same as # # shotsId,steelId=O.materials.index('shots'),O.materials.index('steel') # O.bodies.append( geom.facetBox(center=(0, 0, 0), extents=(30e-3, 30e-3, 0), wallMask=32, wire=False, material='steel', color=(0, 1, .3))) O.engines = [ ForceResetter(), InsertionSortCollider( [Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()], verletDist=.05 * .29e-3), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [ Ip2_FrictMat_FrictMat_MindlinPhys( # define restitution coefficients between different pairs of material ids, see the functor's documentation for details #en=MatchMaker(fallback='zero',matches=((steelId,shotsId,.4),(shotsId,shotsId,1))) en=MatchMaker(matches=((steelId, shotsId, .4),
density = 2700 # facets material params = getViscoelasticFromSpheresInteraction(tc, en, es) facetMat = O.materials.append(ViscElMat( frictionAngle=frictionAngle, **params)) # **params sets kn, cn, ks, cs # default spheres material dfltSpheresMat = O.materials.append( ViscElMat(density=density, frictionAngle=frictionAngle, **params)) O.dt = .05 * tc # time step Rs = 0.1 # particle radius # Create geometry box = O.bodies.append( geom.facetBox((0, 0, 0), (1, 1, 1), wallMask=31, material=facetMat)) # Create clumps... for j in xrange(10): clpId, sphId = O.bodies.appendClumped([ sphere(Vector3(0, Rs * 2 * i, (j + 1) * Rs * 2), Rs, material=dfltSpheresMat) for i in xrange(4) ]) # ... and spheres sphAloneId = O.bodies.append([ sphere(Vector3(0.5, Rs * 2 * i, (j + 1) * Rs * 2), Rs, material=dfltSpheresMat) for i in xrange(4) ])
## Materials facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,tc=tc,en=en,et=es)) sphereMat=O.materials.append(ViscElMat(density=Density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) ### Creating the Buldozer Knife ### from facets, using GTS Knife=[] for i in linspace(pi, pi*3/2, num=numKnifeParts, endpoint=True): Knife.append(Vector3(radiusKnife*cos(i),0,radiusKnife*sin(i))) KnifeP=[Knife,[p+Vector3(0,lengthKnife,0) for p in Knife]] KnifePoly=pack.sweptPolylines2gtsSurface(KnifeP,threshold=1e-4) KnifeIDs=O.bodies.append(pack.gtsSurface2Facets(KnifePoly,color=(1,0,0),wire=False,material=facetMat)) KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False)) KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False)) O.bodies.append(geom.facetBox((0,0,radiusKnife),(lengthKnife*3,lengthKnife*3,lengthKnife),wallMask=16,color=(1,1,1),wire=False,material=facetMat)) ### Creating the material for buldozer colorsph1=Vector3(120,234,150); colorsph2=Vector3(0,0,1); colorsph1.normalize(); colorsph2.normalize(); colorSph=colorsph1 for xyz in itertools.product(arange(0,numBoxes[0]),arange(0,numBoxes[1]),arange(0,numBoxes[2])): ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((xyz[0]*(sizeBox+gapBetweenBoxes),xyz[1]*(sizeBox+gapBetweenBoxes)+sizeBox*0.5,xyz[2]*(sizeBox+gapBetweenBoxes)-radiusKnife+sizeBox*0.6),(sizeBox/2,sizeBox/2,sizeBox/2)),radius=radiusSph,gap=0,color=colorSph,material=sphereMat))
rad = 0.5 # particle radius tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa( pack.inSphere((Vector3(0.0, 0.0, 0.0)), rad), radius=rad / rR, gap=rad / rR * 0.5, material=defMat ) ) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print len(SpheresID) floorId = [] floorId += O.bodies.append( geom.facetBox(geometryParameters["center"], geometryParameters["extends"] / 2.0 * 1.05, material=defMat) ) # Floor # Calculate the mass of spheres sphMass = getSpheresVolume() * density # Create engines O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ), NewtonIntegrator(damping=0, gravity=[0, 0, -9.81]),
params=utils.getViscoelasticFromSpheresInteraction(tc,en,es) defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs O.dt=.1*tc # time step rad=0.5 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),rad),radius=rad/rR,gap=rad/rR*0.5,material=defMat)) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print len(SpheresID) floorId=[] floorId+=O.bodies.append(geom.facetBox(geometryParameters['center'],geometryParameters['extends']/2.0*1.05,material=defMat)) #Floor #Calculate the mass of spheres sphMass = utils.getSpheresVolume()*density # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ), NewtonIntegrator(damping=0,gravity=[0,0,-9.81]), ]
frictionAngle=radians(35) density=2300 defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) O.dt=.1*tc # time step rad=0.5 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),rad),radius=rad/rR,gap=rad/rR*0.5,material=defMat)) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print(len(SpheresID)) floorId=[] floorId+=O.bodies.append(geom.facetBox(geometryParameters['center'],geometryParameters['extends']/2.0*1.05,material=defMat)) #Floor #Calculate the mass of spheres sphMass = getSpheresVolume()*density # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ), NewtonIntegrator(damping=0,gravity=[0,-9.81,0]), ]
frictionAngle=radians(35) density=2300 defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,tc=tc,en=en,et=es)) O.dt=.1*tc # time step rad=0.2 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),0.5),radius=rad,gap=rad*0.5,material=defMat)) floorId=[] floorId+=O.bodies.append(geom.facetBox((0,0,0),(0.6,0.6,0.6),material=defMat)) #Floor #Calculate the weight of spheres sphMass = utils.getSpheresVolume()*density*9.81 # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ), NewtonIntegrator(damping=0.0,gravity=[0.0,0.0,-9.81])
et=es)) O.dt = .1 * tc # time step rad = 0.2 # particle radius tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa(pack.inSphere((Vector3(0.0, 0.0, 0.0)), 0.5), radius=rad, gap=rad * 0.5, material=defMat)) floorId = [] floorId += O.bodies.append( geom.facetBox((0, 0, 0), (0.6, 0.6, 0.6), material=defMat)) #Floor #Calculate the weight of spheres sphMass = utils.getSpheresVolume() * density * 9.81 # Create engines O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ),
@title:Configuration-Container """ from yade import geom, utils from configuration_material import m_wall #building boxes ----- box_length = 800.0 box_height = 100.0 box_depth = 5 #wallMask #determines which walls will be created, in the order #-x(1), +x (2), -y (4), +y (8), -z (16), +z (32). The numbers are ANDed; the #default 63 means to create all walls #parameter1:center #parameter2:size box = geom.facetBox((box_length / 2, box_height / 2, 0), (box_length / 2, box_height / 2, box_depth / 2), wallMask=0, material=m_wall) #push plane wall_right = utils.wall(box_length, axis=0, material=m_wall) wall_left = utils.wall(0, axis=0, material=m_wall) wall_bottom = utils.wall(0, axis=1, material=m_wall) O.bodies.append(wall_right) O.bodies.append(wall_left) O.bodies.append(wall_bottom)
density=2300 params=utils.getViscoelasticFromSpheresInteraction(tc,en,es) defMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs O.dt=.1*tc # time step rad=0.2 # particle radius tolerance = 0.0001 SpheresID=[] SpheresID+=O.bodies.append(pack.regularHexa(pack.inSphere((Vector3(0.0,0.0,0.0)),0.5),radius=rad,gap=rad*0.5,material=defMat)) floorId=[] floorId+=O.bodies.append(geom.facetBox((0,0,0),(0.6,0.6,0.6),material=defMat)) #Floor #Calculate the weight of spheres sphMass = utils.getSpheresVolume()*density*9.81 # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()], ), NewtonIntegrator(damping=0.0,gravity=[0.0,0.0,-9.81])
### Creating the Buldozer Knife ### from facets, using GTS Knife=[] for i in linspace(pi, pi*3/2, num=numKnifeParts, endpoint=True): Knife.append(Vector3(radiusKnife*cos(i),0,radiusKnife*sin(i))) KnifeP=[Knife,[p+Vector3(0,lengthKnife,0) for p in Knife]] KnifePoly=pack.sweptPolylines2gtsSurface(KnifeP,threshold=1e-4) KnifeIDs=[] KnifeIDs=O.bodies.append(pack.gtsSurface2Facets(KnifePoly,color=(1,0,0),wire=False)) KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False)) KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False)) O.bodies.append(geom.facetBox((0,lengthKnife/2,radiusKnife),(lengthKnife*4,lengthKnife*4,lengthKnife),wallMask=16,color=(1,1,1),wire=False)) ### Creating the material for buldozer colorsph1=Vector3(120,234,150); colorsph2=Vector3(1,1,0); colorsph1.normalize(); colorsph2.normalize();
en=.3 # normal restitution coefficient es=.3 # tangential restitution coefficient frictionAngle=radians(35)# density=2700 # facets material params=utils.getViscoelasticFromSpheresInteraction(tc,en,es) facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs # default spheres material dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,**params)) O.dt=.05*tc # time step Rs=0.1 # particle radius # Create geometry box = O.bodies.append(geom.facetBox((0,0,0),(1,1,1),wallMask=31,material=facetMat)) # Create clumps... for j in xrange(10): clpId,sphId=O.bodies.appendClumped([utils.sphere(Vector3(0,Rs*2*i,(j+1)*Rs*2),Rs,material=dfltSpheresMat) for i in xrange(4)]) # ... and spheres sphAloneId=O.bodies.append( [utils.sphere( Vector3(0.5,Rs*2*i,(j+1)*Rs*2), Rs, material=dfltSpheresMat) for i in xrange(4) ] ) # Create engines O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
tolerance = 0.0001 SpheresID = [] SpheresID += O.bodies.append( pack.regularHexa(pack.inSphere((Vector3(0.0, 0.0, 0.0)), rad), radius=rad / rR, gap=rad / rR * 0.5, material=defMat)) geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) print len(SpheresID) floorId = [] floorId += O.bodies.append( geom.facetBox(geometryParameters['center'], geometryParameters['extends'] / 2.0 * 1.05, material=defMat)) #Floor #Calculate the mass of spheres sphMass = getSpheresVolume() * density # Create engines O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_ViscElMat_ViscElMat_ViscElPhys()], [Law2_ScGeom_ViscElPhys_Basic()],