philosophie.py 2.46 KB
 mozul committed Jan 08, 2015 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 ``````import numpy import math from pylmgc90.pre_lmgc import * dim = 2 # disk creation radius = 0.1 disk = avatar(type='RBDY2', dimension=dim) disk.addNode( node(type='NO2xx',coor=numpy.array([0.,0.1]),number=1) ) disk.addBulk( rigid2d() ) disk.defineGroups() disk.addContactors(type='DISKx',color='BLUEx',byrd=radius) # foundation creation floor = avatar(type='RBDY2', dimension=dim) floor.addNode( node(type='NO2xx',coor=numpy.array([0.,-0.05]),number=1) ) floor.addBulk( rigid2d() ) floor.defineGroups() floor.addContactors(type='JONCx',color='BLUEx',axe1=1.,axe2=0.05) # materials, model and groups definition mat = material(name='TDURx',type='RIGID',density=1000.) mut = material(name='MOUxx',type='RIGID',density=100.) mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=dim) disk.defineModel(model=mod) disk.defineMaterial(material=mut) disk.computeRigidProperties() floor.defineModel(model=mod) floor.defineMaterial(material=mat) floor.computeRigidProperties() # boundary condition floor.imposeDrivenDof(component=[1,2,3],dofty='vlocy') # column creation import copy nb_disks = 10 column = avatars() for i in range(nb_disks): new_disk = copy.deepcopy(disk) new_disk.translate(dy=i*2.*radius) column.addAvatar(new_disk) # copy column bodies = avatars() nb_columns = 3 for i in range(nb_columns): new_columns = copy.deepcopy(column) new_columns.translate(dx=i*2.*radius) for body in new_columns: bodies.addAvatar(body) # adding floor and rotation sample bodies.addAvatar(floor) bodies.rotate(type='axis', alpha=-math.pi/6., axis=[0., 0., 1.], center=[1.,-0.05]) try: visuAvatars(bodies) except: pass # containers definitions: mats = materials() mats.addMaterial(mat,mut) svs = see_tables() tacts = tact_behavs() # interaction definition: ldkjc=tact_behav(name='iqsc0', type='IQS_CLB', fric=0.3) tacts+=ldkjc svdkjc = see_table(CorpsCandidat='RBDY2', candidat='DISKx', colorCandidat='BLUEx', behav=ldkjc, CorpsAntagoniste='RBDY2', antagoniste='JONCx', colorAntagoniste='BLUEx', alert=.1) svs+=svdkjc svdkdk = see_table(CorpsCandidat='RBDY2', candidat='DISKx', colorCandidat='BLUEx', behav=ldkjc, CorpsAntagoniste='RBDY2', antagoniste='DISKx', colorAntagoniste='BLUEx', alert=.1) svs+=svdkdk # 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/')``````