How to change material properties during simulation

Asked by Chu on 2019-11-14

Hello,

I'd like to change the material properties during simulation. For example, the frictionAngle in FrictMat(label=spheres), which is the O.materials[0]. I think there are three ways:

(1) O.materials[0].frictionAngle=radians(finalFricDegree)
(2) setContactFriction(radians(finalFricDegree))
(3) O.bodies[10].mat.frictionAngle=radians(finalFricDegree) #where O.bodies[10] is a sphere using material=spheres.

Are the three methods the same?

BTW, if I'd like to change the material properties of particular sphere,

In [1]: O.materials.append(FrictMat(label=sphere2))
Out [1]: 1
In [2]: O.boides[10].mat=O.material[1]

Is this valid for the continuous simulation?

Thanks for your any suggestion.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-11-15
Last query:
2019-11-15
Last reply:
2019-11-14
Best Jan Stránský (honzik) said : #1

Hello,

> Are the three methods the same?

No.
(1) and (3) are same. It changes frictionAngle of specific material, but this change has no effect on existing contacts (!!)

(2) changes:
  - i.phys.tangensOfFrictionAngle of all contacts
  - mat.frictionAngle of all* materials (!!) [1]
      * materials of all dynamic bodies

> BTW, if I'd like to change the material properties of particular sphere,
>
> In [1]: O.materials.append(FrictMat(label=sphere2))
> Out [1]: 1
> In [2]: O.boides[10].mat=O.material[1]
>
> Is this valid for the continuous simulation?

yes, it is valid*, but as for (1) and (3), it has no effect for existing contacts (!!)
* assuming good syntax and attribute names, like O.materials instead of O.material

(Not only) for future reference: the exclamation marks are at places, where the (side)effect(s) might be counter-intuitive.

cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/Shop_02.cpp#L814

Chu (arcoubuntu) said : #2

Thanks Jan Stránský, that solved my question.

Chu (arcoubuntu) said : #3

Thanks Jan Stránský again, I learned a lot from source code.