How to change material properties during simulation

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:

(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?

Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-11-15
Last query:
2019-11-15
2019-11-14
 Jan Stránský (honzik) said on 2019-11-14: #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

 Chu (arcoubuntu) said on 2019-11-15: #2

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

 Chu (arcoubuntu) said on 2019-11-15: #3

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