granular.py 2.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import math

from pylmgc90.pre_lmgc import *

nb_particles = 10000
radius_min   = 1.0
radius_max   = 2.5
radii = granulo_Random(nb_particles, radius_min, radius_max)

lx = 150.
ly = 100.
[nb_laid_particles, coors] = depositInBox2D(radii,lx,ly)


mat = material(name='TDURx', type='RIGID', density=100.)
mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=2)

# generate the triangles
bodies = avatars()
nb_vertices = 3
for i in range(nb_laid_particles):
  body = rigidPolygon(radius=radii[i], center=coors[2*i:2*i+2], nb_vertices=nb_vertices, model=mod, material=mat, color='BLUEx')
  bodies.addAvatar(body)


max_radius = max(radii)
mut    = material(name='TDURx', type='RIGID', density=1000.)

# left wall : rough wall
left   = roughWall(  center=[-radius_max, 0.5*ly], theta=-0.5*math.pi, l=ly + 2.*radius_max,
                     r=radius_max, model=mod, material=mut, color='WALLx')
left.imposeDrivenDof(component=[1,2,3], dofty='vlocy')
bodies.addAvatar(left)

# right wall : not too rough wall
right  = fineWall(   center=[lx+radius_max, 0.5*ly], theta= 0.5*math.pi, l=ly + 2.*radius_max,
                     r=radius_max, model=mod, material=mut, color='WALLx')
right.imposeDrivenDof(component=[1,2,3], dofty='vlocy')
bodies.addAvatar(right)

# bottom wall : small wall (why not use a JONCx ?)
bottom = smoothWall( center=[0.5*lx, -radius_max], theta=0., l=lx + 2.*radius_max,
                     h=2.*radius_max, nb_polyg=12, model=mod, material=mut, color='WALLx')
bottom.imposeDrivenDof(component=[1,2,3], dofty='vlocy')
bodies.addAvatar(bottom)

try:
  visuAvatars(bodies)
except:
  pass

mats = materials()
mats.addMaterial(mat,mut)
svs   = see_tables()
tacts = tact_behavs()

# interaction definition:
lplpl=tact_behav(name='iqsc0', type='IQS_CLB', fric=0.3)
tacts+=lplpl
svplpl = see_table(CorpsCandidat='RBDY2', candidat='POLYG', colorCandidat='BLUEx', behav=lplpl,
                   CorpsAntagoniste='RBDY2', antagoniste='POLYG', colorAntagoniste='BLUEx', alert=.1)
tacts+=svplpl
svdkpl = see_table(CorpsCandidat='RBDY2', candidat='DISKx', colorCandidat='BLUEx', behav=lplpl,
                   CorpsAntagoniste='RBDY2', antagoniste='POLYG', colorAntagoniste='WALLx', alert=.1)
svs+=svdkpl

# files writing
writeBodies(bodies,chemin='DATBOX/')
writeBulkBehav(mats,chemin='DATBOX/')
writeTactBehav(tacts,svs,chemin='DATBOX/')
writeDrvDof(bodies,chemin='DATBOX/')
writeDofIni(bodies,chemin='DATBOX/')
writeVlocRlocIni(chemin='DATBOX/')