# 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
#Helix1 = O.bodies.append(geom.facetHelix(center = (0,6,0), radiusOuter=5.5, pitch=2.8, orientation=utils.Quaternion((1,0, 0), pi/2),color=(0.8,0.8,0.8), segmentsNumber=19, angleRange=(0,10*pi), radiusInner=0,wire=False)) #Helix2 = O.bodies.append(geom.facetHelix(center = (0,5,0), radiusOuter=4.5, pitch=2.5, orientation=utils.Quaternion((1,0, 0), pi/2),color=(0,0,1), segmentsNumber=19, angleRange=(0,10*pi), radiusInner=0,wire=False)) #Helix = O.bodies.append(geom.facetHelix(center = (0,0,0), radiusOuter=6, pitch=1, orientation=utils.Quaternion((0, 1, 1), pi/2), segmentsNumber=10, angleRange=None, radiusInner=0)) #Helix = O.bodies.append(geom.facetHelix(center = (0,0,0), radiusOuter=6, pitch=1, orientation=utils.Quaternion((1, 1, 0), pi), segmentsNumber=100, angleRange=None, radiusInner=0)) #Creating a cylinder from facets Cylinder=O.bodies.append(geom.facetCylinder(center=(0,0,0),radius=7,height=14,orientation=utils.Quaternion((1,0,0),pi/2), segmentsNumber=15,wallMask=7,color=(0.3,0.3,0.3),angleRange=None, closeGap=True)) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]), NewtonIntegrator(gravity=(0,-9.8,0),damping=.4,label="newtonCustomLabel"), HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix),#HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix1),HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix2), qt.SnapshotEngine(fileBase='3d-', realPeriod=5000, label='snapshot'),
# 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 SpheresID=[] oriBody = Quaternion(Vector3(0,0,1),(math.pi/2)) SpheresID+=O.bodies.append(ymport.gengeoFile('LSMGenGeo.geo',shift=Vector3(-7.0,-7.0,0.0),scale=1.0,orientation=oriBody,color=(1,0,1),**kw)) #Demonstration of spheresPackDimensions function. The "Edge" particles are colored with blue color geometryParameters = bodiesHandling.spheresPackDimensions(SpheresID) for v in [geometryParameters['minId'],geometryParameters['maxId']]: for i in v: O.bodies[int(i)].shape.color = Vector3(0,0,1)
#sp.makeCloud((.2,0,-0.5),(0.7,0.5,0.5),rMean=r1,rRelFuzz=0) #sp.makeCloud((-.1,-.1,.1),(.1,.1,.6),rMean=.02,rRelFuzz=0)# #sp.toSimulation() #O.bodies.append(utils.wall(-1,axis=2)) sp.toSimulation(color=(1, 1, 1)) # pure green #ids = sp1.toSimulation(color=(1,0,0)) # add the result to simulation with uniform color ################################################### sampling = .01 #second omega = 2 * pi * 0.31 ###################### cylinder ################################1 cylinder = O.bodies.append( geom.facetCylinder(center=(1, 0, 0), radius=1.2, height=1, orientation=utils.Quaternion((1, 0, 0), pi / 2), segmentsNumber=33, wallMask=7, color=(1, 1, 1), angleRange=None, wire=True)) #.bodies.append(utils.wall((0,,-10),axis=2)) ############################ Helix ##################################### #O.bodies.append(utils.geom.facetHelix(center=(1,1,0), radiusOuter=0.6, pitch=1, orientation=utils.Quaternion((1, 0, 0), pi/2), #segmentsNumber=25, angleRange=None, radiusInner=0.1, wire=False, color=(0,1,0) )) ######################## Engines ############################### from yade import * O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop(