Changing joint frictional properties for specific bodies later

Asked by Christoph Tuitz on 2020-08-24

Hi,

I defined the material properties for the whole assembly and want to change the jointFrictionAngle for specific particles afterwards.
Looping through the spheres and changing the colour works great, but I cannot achieve it for the jointFrictionAngle.

Thanks

for o in O.bodies:
   if isinstance(o.shape,Sphere):

      ## seperate assembly
       if o.state.pos[1]>(dimModele/2) :
   o.shape.color=(1,0,1)
  o.JCFpmMat.jointFrictionAngle = radians(80)
 else:
  o.shape.color=(0,0,1)
   o.JCFpmMat.jointFrictionAngle = radians(80)

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Christoph Tuitz
Solved:
2020-08-24
Last query:
2020-08-24
Last reply:
2020-08-24
Jan Stránský (honzik) said : #1

Hello,

bodies has their material attribute, accessible as
b.material
or
b.mat
You can change it easily:
b.mat.jointFrictionAngle = whatever

b.mat is a reference to already instantiated material, so you can achieve the same by e.g.
O.materials[0].jointFrictionAngle = whatever
or
###
mat = JCFpmMat(...)
...
mat.jointFrictionAngle = whatever
###
(depending on how you use materials in the script)

However (!!!):
- note1: b.mat is a reference to existing Material instance, possibly (most likely) shared among other particles. If you modify it from one particle, it will affect all other particles sharing this material
- note2: it will have no effect on existing interactions

solution of note1 (if undesired): assign new material to the bodies (it will leave the existing material untouched for the rest of particles)
###
newMat = JCFpmMat(...)
for b in bodiesToBeUpdated:
   b.material = newMat
###

solution of note2 (if undesired): loop over O.interactions and modify i.phys accordingly
###
for i in O.interactions:
   if i.id1 in idsToBeUpdated or i.id2 in idsToBeUpdated:
      i.phys.someAttribute = someValue
###

cheers
Jan

Christoph Tuitz (t-chris3) said : #2

Hi Jan, awesome works perfectly!

Christoph Tuitz (t-chris3) said : #3

Thanks again!