← Back to team overview

yade-users team mailing list archive

[Question #244984]: Clumps,sphere and walls IDs

 

New question #244984 on Yade:
https://answers.launchpad.net/yade/+question/244984

Hi everybody,

I have made an assembly of clumps using clump templates. There are some atand-alone sphere and of course some walls in the model.
I have difficulty in assiging different colors to each type of bodies(clump, sphere and walls) in the model. It seems that the IDs are very polluted.

In a very simple script as follows when I try;

for i in O.bodies:
         if i.isClump:
             O.bodies[i.id].shape.color=(.1,.7,.9)
         else:
             O.bodies[i.id].shape.color=(1,1,1)

Changes the color of all bodies (yes, including the wall) to  (1,1,1) means that it does not consider them as clump members. 

Any idea? What's going on here? 



#=================================================================================
#define material for all bodies:
id_Mat=O.materials.append(FrictMat(young=1e7,poisson=0.3,density=1000,frictionAngle=1))
Mat=O.materials[id_Mat]

#define engines:
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(damping=0.7,gravity=[0,0,-10])
]

#create a box:
id_box = O.bodies.append(box((0,0,0),(8,8,.5),fixed=True,material=Mat))


s1=utils.sphere([3,-1,8],2.015,material=Mat)
s2=utils.sphere([0,5,8],2.015,material=Mat)

O.bodies.append(s1)
O.bodies.append(s2)



relRadList1 =[0.000471583,0.00060213,0.000631454,0.000493144,0.000695336,0.000395284,0.000550567,0.00037674,0.000656561,0.000218143,0.000223094,0.000484354,0.00036813,0.000514327,0.000395357,0.000377391,0.000454081,0.000355504,0.00061375,0.00068747,0.000508243,0.000447592,0.000549008,0.000486356,0.000664425,0.000587608,0.00015184,0.000695789,0.000484995,0.000443755]


relPosList1 = [[0.000213504,0.000920219,5.17294e-005],[0.000181129,-0.000693148,-0.000301356],[0.000191565,0.000550929,0.000472726],[-6.9806e-005,0.000814473,0.000504795],[-0.00016687,-4.19741e-005,0.000273102],[-0.000632058,-0.000285906,0.000255655],[8.5103e-005,-2.87712e-006,0.000608655],[-0.000369852,6.12296e-006,-0.00056701],[7.38905e-005,0.000497426,2.97204e-005],[0.000135818,0.000562643,-0.000842692],[0.000748387,0.00077499,0.000784656],[7.88683e-005,0.000626452,-0.00032004],[0.000526651,-0.000553811,0.000109479],[0.000136113,0.000176874,-0.000254769],[-0.000209755,-0.000765094,-0.000832511],[-0.000945048,-0.00034182,-0.000150738],[0.000425963,-0.000381421,-0.000472185],[0.000544025,0.000492145,0.000918189],[-0.000262527,0.000319288,0.000244014],[-0.0002573,-0.000432994,-0.000293022],[0.000500309,-0.000741747,-0.000145635],[0.000354013,4.94286e-005,0.000772469],[7.59e-005,-0.0014,-0.00029],[0.00015904,0.000954791,0.00058286],[0.000106567,-0.000252692,2.9281e-005],[-0.000616653,-0.000235914,-0.000163413],[-0.00114642,8.90673e-005,-0.000146111],[-0.000361004,-0.000311422,-0.000152367],[-0.000655366,-2.8257e-005,-0.000169021],[-0.000501808,-6.06848e-005,-0.000385601]]


relRadList2 =[0.000471583,0.00060213,0.000631454,0.000493144,0.000695336,0.000395284,0.000550567,0.00037674,0.000656561,0.000218143,0.000223094,0.000484354,0.00036813,0.000514327,0.000395357,0.000377391,0.000454081,0.000355504,0.00061375,0.00068747]

relPosList2 = [[0.000213504,0.000920219,5.17294e-005],[0.000181129,-0.000693148,-0.000301356],[0.000191565,0.000550929,0.000472726],[-6.9806e-005,0.000814473,0.000504795],[-0.00016687,-4.19741e-005,0.000273102],[-0.000632058,-0.000285906,0.000255655],[8.5103e-005,-2.87712e-006,0.000608655],[-0.000369852,6.12296e-006,-0.00056701],[7.38905e-005,0.000497426,2.97204e-005],[0.000135818,0.000562643,-0.000842692],[0.000748387,0.00077499,0.000784656],[7.88683e-005,0.000626452,-0.00032004],[0.000526651,-0.000553811,0.000109479],[0.000136113,0.000176874,-0.000254769],[-0.000209755,-0.000765094,-0.000832511],[-0.000945048,-0.00034182,-0.000150738],[0.000425963,-0.000381421,-0.000472185],[0.000544025,0.000492145,0.000918189],[-0.000262527,0.000319288,0.000244014],[-0.0002573,-0.000432994,-0.000293022]]


templates= []
templates.append(clumpTemplate(relRadii=relRadList1,relPositions=relPosList1))
templates.append(clumpTemplate(relRadii=relRadList2,relPositions=relPosList2))

O.bodies.replaceByClumps(templates,[.5,.5])
O.dt=1e-6

s3=utils.sphere([11,5,18],5.0,material=Mat)

O.bodies.append(s3)

qt.View()

#=============================================================================



-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.