Пример #1
0
# -*- coding: utf-8 -*-
import time

## PhysicalParameters 
Density=2400
frictionAngle=radians(35)
tc = 0.001
en = 0.3
es = 0.3

## Import wall's geometry
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))
from woo import ymport
fctIds=O.bodies.append(ymport.stl('baraban.stl',color=(1,0,0),material=facetMat))
## Spheres
sphereRadius = 0.2
nbSpheres = (10,10,10)
#nbSpheres = (50,50,50)
for i in xrange(nbSpheres[0]):
    for j in xrange(nbSpheres[1]):
        for k in xrange(nbSpheres[2]):
            x = (i*2 - nbSpheres[0])*sphereRadius*1.1
            y = (j*2 - nbSpheres[1])*sphereRadius*1.1
            z = (k*2 - nbSpheres[2])*sphereRadius*1.1
            s=utils.sphere([x,y,z],sphereRadius,material=sphereMat)
            O.bodies.append(s)

## Timestep 
O.dt=.2*tc
Пример #2
0
## PhysicalParameters
Density = 2400
frictionAngle = radians(35)
tc = 0.001
en = 0.3
es = 0.3

## Import wall's geometry
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))
from woo import ymport
fctIds = O.bodies.append(
    ymport.stl('baraban.stl', color=(1, 0, 0), material=facetMat))
## Spheres
sphereRadius = 0.2
nbSpheres = (10, 10, 10)
#nbSpheres = (50,50,50)
for i in range(nbSpheres[0]):
    for j in range(nbSpheres[1]):
        for k in range(nbSpheres[2]):
            x = (i * 2 - nbSpheres[0]) * sphereRadius * 1.1
            y = (j * 2 - nbSpheres[1]) * sphereRadius * 1.1
            z = (k * 2 - nbSpheres[2]) * sphereRadius * 1.1
            s = utils.sphere([x, y, z], sphereRadius, material=sphereMat)
            O.bodies.append(s)

## Timestep
O.dt = .2 * tc
Пример #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from woo import utils
from woo import ymport

sphereRadius = 0.05

## Import wall's geometry
walls = O.bodies.append(ymport.stl('ring.stl'))


def fill_cylinder_with_spheres(sphereRadius, cylinderRadius, cylinderHeight,
                               cylinderOrigin, cylinderSlope):
    spheresCount = 0
    for h in range(0, cylinderHeight / sphereRadius / 2):
        for r in range(1, cylinderRadius / sphereRadius / 2):
            dfi = asin(0.5 / r) * 2
            for a in range(0, 6.28 / dfi):
                x = cylinderOrigin[0] + 2 * r * sphereRadius * cos(dfi * a)
                y = cylinderOrigin[1] + 2 * r * sphereRadius * sin(dfi * a)
                z = cylinderOrigin[2] + h * 2 * sphereRadius
                o.bodies.append(
                    utils.sphere([
                        x, y * cos(cylinderSlope) + z * sin(cylinderSlope),
                        z * cos(cylinderSlope) - y * sin(cylinderSlope)
                    ], sphereRadius))
                spheresCount += 1
    return spheresCount

Пример #4
0
from __future__ import print_function
from builtins import range
from woo import utils
import random
from woo import ymport

## PhysicalParameters

## Variant of mesh
mesh = 'coarse'
#mesh = 'fine'
#mesh = 'tiny'

## Import geometry
rod = O.bodies.append(ymport.stl('rod-' + mesh + '.stl', wire=True))

# Spheres
sphereRadius = 0.01
nbSpheres = (32, 11, 32)
print("Creating %d spheres..." % (nbSpheres[0] * nbSpheres[1] * nbSpheres[2]),
      end=' ')
for i in range(nbSpheres[0]):
    for j in range(nbSpheres[1]):
        for k in range(nbSpheres[2]):
            x = (i * 2 - nbSpheres[0]
                 ) * sphereRadius * 1.1 + sphereRadius * random.uniform(
                     -0.1, 0.1)
            y = -j * sphereRadius * 2.2 - 0.01
            z = (k * 2 - nbSpheres[2]
                 ) * sphereRadius * 1.1 + sphereRadius * random.uniform(
Пример #5
0
o=Omega() 

## PhysicalParameters 
Density=2400
frictionAngle=radians(35)
sphereRadius=0.05
tc = 0.001
en = 0.3
es = 0.3

## Import wall's geometry
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))

walls = O.bodies.append(ymport.stl('ring.stl',material=facetMat))

def fill_cylinder_with_spheres(sphereRadius,cylinderRadius,cylinderHeight,cylinderOrigin,cylinderSlope):
    spheresCount=0
    for h in range(0,cylinderHeight/sphereRadius/2):
            for r in range(1,cylinderRadius/sphereRadius/2):
                dfi = asin(0.5/r)*2
                for a in range(0,6.28/dfi):
                    x = cylinderOrigin[0]+2*r*sphereRadius*cos(dfi*a)
                    y = cylinderOrigin[1]+2*r*sphereRadius*sin(dfi*a)
                    z = cylinderOrigin[2]+h*2*sphereRadius
                    s=utils.sphere([x,y*cos(cylinderSlope)+z*sin(cylinderSlope),z*cos(cylinderSlope)-y*sin(cylinderSlope)],sphereRadius,material=sphereMat)
                    o.bodies.append(s)
                    spheresCount+=1
    return spheresCount
Пример #6
0
## PhysicalParameters
Density = 2400
frictionAngle = radians(35)
sphereRadius = 0.05
tc = 0.001
en = 0.3
es = 0.3

## Import wall's geometry
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))

walls = O.bodies.append(ymport.stl('ring.stl', material=facetMat))


def fill_cylinder_with_spheres(sphereRadius, cylinderRadius, cylinderHeight,
                               cylinderOrigin, cylinderSlope):
    spheresCount = 0
    for h in range(0, cylinderHeight / sphereRadius / 2):
        for r in range(1, cylinderRadius / sphereRadius / 2):
            dfi = asin(0.5 / r) * 2
            for a in range(0, 6.28 / dfi):
                x = cylinderOrigin[0] + 2 * r * sphereRadius * cos(dfi * a)
                y = cylinderOrigin[1] + 2 * r * sphereRadius * sin(dfi * a)
                z = cylinderOrigin[2] + h * 2 * sphereRadius
                s = utils.sphere([
                    x, y * cos(cylinderSlope) + z * sin(cylinderSlope),
                    z * cos(cylinderSlope) - y * sin(cylinderSlope)
Пример #7
0
from __future__ import print_function
from builtins import range
from woo import utils
import random
from woo import ymport

## PhysicalParameters

## Variant of mesh
mesh = "coarse"
# mesh = 'fine'
# mesh = 'tiny'

## Import geometry
rod = O.bodies.append(ymport.stl("rod-" + mesh + ".stl", wire=True))

# Spheres
sphereRadius = 0.01
nbSpheres = (32, 11, 32)
print("Creating %d spheres..." % (nbSpheres[0] * nbSpheres[1] * nbSpheres[2]), end=" ")
for i in range(nbSpheres[0]):
    for j in range(nbSpheres[1]):
        for k in range(nbSpheres[2]):
            x = (i * 2 - nbSpheres[0]) * sphereRadius * 1.1 + sphereRadius * random.uniform(-0.1, 0.1)
            y = -j * sphereRadius * 2.2 - 0.01
            z = (k * 2 - nbSpheres[2]) * sphereRadius * 1.1 + sphereRadius * random.uniform(-0.1, 0.1)
            r = random.uniform(sphereRadius, sphereRadius * 0.9)
            dynamic = True
            color = [0.51, 0.52, 0.4]
            if i == 0 or i == nbSpheres[0] - 1 or j == nbSpheres[1] - 1 or k == 0 or k == nbSpheres[2] - 1:
Пример #8
0
# -*- coding: utf-8 -*-
import time

## PhysicalParameters 
Density=2400
frictionAngle=radians(35)
tc = 0.001
en = 0.3
es = 0.3

## Import wall's geometry
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))
from woo import ymport
fctIds=O.bodies.append(ymport.stl('baraban.stl',color=(1,0,0),material=facetMat))
## Spheres
sphereRadius = 0.2
nbSpheres = (10,10,10)
#nbSpheres = (50,50,50)
for i in xrange(nbSpheres[0]):
    for j in xrange(nbSpheres[1]):
        for k in xrange(nbSpheres[2]):
            x = (i*2 - nbSpheres[0])*sphereRadius*1.1
            y = (j*2 - nbSpheres[1])*sphereRadius*1.1
            z = (k*2 - nbSpheres[2])*sphereRadius*1.1
            s=utils.sphere([x,y,z],sphereRadius,material=sphereMat)
            O.bodies.append(s)

## Timestep 
O.dt=.2*tc
Пример #9
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from woo import utils
import random
from woo import ymport

## PhysicalParameters 

## Variant of mesh
mesh = 'coarse'
#mesh = 'fine'
#mesh = 'tiny'

## Import geometry 
rod = O.bodies.append(ymport.stl('rod-'+mesh+'.stl',wire=True))

# Spheres
sphereRadius = 0.01
nbSpheres = (32,11,32) 
print "Creating %d spheres..."%(nbSpheres[0]*nbSpheres[1]*nbSpheres[2]),
for i in xrange(nbSpheres[0]):
    for j in xrange(nbSpheres[1]):
		for k in xrange(nbSpheres[2]):
			x = (i*2 - nbSpheres[0])*sphereRadius*1.1+sphereRadius*random.uniform(-0.1,0.1)
			y = -j*sphereRadius*2.2-0.01
			z = (k*2 - nbSpheres[2])*sphereRadius*1.1+sphereRadius*random.uniform(-0.1,0.1)
			r = random.uniform(sphereRadius,sphereRadius*0.9)
			dynamic = True
			color=[0.51,0.52,0.4]
			if (i==0 or i==nbSpheres[0]-1 or j==nbSpheres[1]-1 or k==0 or k==nbSpheres[2]-1):
Пример #10
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import print_function
from builtins import range
from woo import utils
from woo import ymport

sphereRadius=0.05

## Import wall's geometry
walls = O.bodies.append(ymport.stl('ring.stl'))

def fill_cylinder_with_spheres(sphereRadius,cylinderRadius,cylinderHeight,cylinderOrigin,cylinderSlope):
    spheresCount=0
    for h in range(0,cylinderHeight/sphereRadius/2):
            for r in range(1,cylinderRadius/sphereRadius/2):
                dfi = asin(0.5/r)*2
                for a in range(0,6.28/dfi):
                    x = cylinderOrigin[0]+2*r*sphereRadius*cos(dfi*a)
                    y = cylinderOrigin[1]+2*r*sphereRadius*sin(dfi*a)
                    z = cylinderOrigin[2]+h*2*sphereRadius
                    o.bodies.append(utils.sphere([x,y*cos(cylinderSlope)+z*sin(cylinderSlope),z*cos(cylinderSlope)-y*sin(cylinderSlope)],sphereRadius))
                    spheresCount+=1
    return spheresCount

## Spheres
spheresCount=0
spheresCount+=fill_cylinder_with_spheres(sphereRadius,0.5,0.10,[0,0,0],radians(0))
print("Number of spheres: %d" % spheresCount)