masonry.py 3.26 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import numpy
import math

from pylmgc90.pre_lmgc import *

dim = 2

bodies = avatars()
mat = material(name='PLEXx',type='RIGID',density=2000.)
mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=dim)

# bricks, half-brick, linteau and opening definition
brick      = brick2D('brick',      1.e-1, 5.e-2)
half_brick = brick2D('half-brick', 5.e-2, 5.e-2)
linteau    = brick2D('linteau',    3.e-1, 5.e-2) 
ghost      = brick2D('ghost',      2.e-1, 5.e-2)


# joint thickness
horizontal_joint_thickness = 0.001
vertical_joint_thickness   = 0.001

# rows definitions
even_row        = [half_brick, brick, brick, brick, brick, half_brick]
odd_row         = [brick, brick, brick, brick, brick]
even_window_row = [half_brick, brick, ghost, brick, half_brick]
odd_window_row  = [brick, half_brick, ghost, half_brick, brick]
linteau_row     = [brick, linteau, brick]

# wall as a list of rows
wall = [even_row,
        odd_row ,
        even_row, 
        odd_row ,
        even_window_row, 
        odd_window_row , 
        even_window_row, 
        linteau_row    , 
        even_row       ]


# wall building :
nb_bricks=0
x=0.
y=0.
for j in xrange(0, len(wall), 1):
   row = wall[j]
   if j % 2 == 0:
      color='BLUEx'
   else:
      color='REDxx'

   x=0.
   for i in xrange(0, len(row), 1):
      nb_bricks += 1
      brick = row[i]
      if i == 0:
         y += 0.5*brick.ly

      x += 0.5*brick.lx
      if brick.name != 'ghost':
         bodies += brick.rigidBrick(center=[x, y], model=mod, material=mat, color=color)

      x += 0.5*brick.lx + vertical_joint_thickness

   y += 0.5*brick.ly + horizontal_joint_thickness

## wall done... everything else (floor and other container)

mats   = materials()
svs    = see_tables()
tacts  = tact_behavs()

mut = material(name='TDURx',type='RIGID',density=2500.)
mats.addMaterial(mat,mut)

floor = rigidJonc(axe1=3.e-1, axe2=2.5e-2, center=[2.5e-1, -2.5e-2], 
                  model=mod, material=mut, color='WALLx')
floor.imposeDrivenDof(component=[1, 2, 3],dofty='vlocy')

bodies += floor

try:
  visuAvatars(bodies)
except:
  pass

# interactions management :
lplpl=tact_behav(name='iqsc0',type='IQS_CLB',fric=0.3)
tacts+=lplpl
lpljc=tact_behav(name='iqsc1',type='IQS_CLB',fric=0.5)
tacts+=lpljc
svbbbb = see_table(CorpsCandidat='RBDY2',candidat='POLYG', colorCandidat='BLEUx',behav=lplpl,
                   CorpsAntagoniste='RBDY2', antagoniste='POLYG',colorAntagoniste='BLEUx',alert=5.e-3)
svs+=svbbbb
svbrbr = see_table(CorpsCandidat='RBDY2',candidat='POLYG', colorCandidat='REDxx',behav=lplpl,
                   CorpsAntagoniste='RBDY2', antagoniste='POLYG',colorAntagoniste='REDxx',alert=5.e-3)
svs+=svbrbr
svbbbr = see_table(CorpsCandidat='RBDY2',candidat='POLYG', colorCandidat='BLEUx',behav=lplpl, 
                   CorpsAntagoniste='RBDY2', antagoniste='POLYG',colorAntagoniste='REDxx',alert=5.e-3)
svs+=svbbbr
svpljc = see_table(CorpsCandidat='RBDY2',candidat='POLYG', colorCandidat='BLEUx',behav=lpljc,
                   CorpsAntagoniste='RBDY2', antagoniste='JONCx',colorAntagoniste='WALLx',alert=5.e-3)
svs+=svpljc

# file 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/')