예제 #1
0
파일: checkPerf.py 프로젝트: yankang84/woo
        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()],
예제 #2
0
파일: packs.py 프로젝트: yankang84/woodem
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
예제 #3
0
파일: checkPerf.py 프로젝트: CrazyHeex/woo
 
 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()],
     ),
     GravityEngine(gravity=[0,0,-9.81]),
     NewtonIntegrator(damping=0),
예제 #4
0
## Materials
params=utils.getViscoelasticFromSpheresInteraction(tc,en,es)
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **params sets kn, cn, ks, cs
sphereMat=O.materials.append(ViscElMat(density=Density,frictionAngle=frictionAngle,**params))

### 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))
예제 #5
0
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()],
	),
	GravityEngine(gravity=[0.0,0.0,-9.81]),
예제 #6
0
		
		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()],
			),
			GravityEngine(gravity=[0,0,-9.81]),
			NewtonIntegrator(damping=0),
예제 #7
0
### 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),
예제 #8
0
from woo import geom,utils,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()],sweepLength=.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,massRate=100./60,normal=(0,1.5,-1),label='factory',materialId=shotsId),
	## BoxInlet: a line, plane or cuboid  
	BoxInlet(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,massRate=100./60,normal=(0,1.5,-1),label='factory',materialId=shotsId),
예제 #9
0
from woo import geom, utils, 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()], sweepLength=.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),
예제 #10
0
파일: checkWeight.py 프로젝트: woodem/woo
              **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()],
    ),
예제 #11
0
파일: bulldozer.py 프로젝트: CrazyHeex/woo
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.0),
        wallMask=47,
        color=(0, 1, 0),
        wire=False,
    )
)

KnifeIDs += O.bodies.append(
    geom.facetBox(
        (
            -lengthKnife / 2 - radiusKnife - lengthKnife / 4.0,
            lengthKnife / 2,
            -radiusKnife + buldozerHeight * 3.0 / 2.0 - buldozerHeight / 4.0,
        ),
        (lengthKnife / 4.0, lengthKnife / 3.0, buldozerHeight / 4.0),
        wallMask=47,
        color=(0, 0, 1),