change mat paras

Asked by zhou qian on 2019-06-04

follow the qusetion 263780:
I want to decrease the material's friction angle each 1000steps. But how can I update the exsiting interactions?
Yours, Joe

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Jérôme Duriez
Last query:
Last reply:
zhou qian (zhoug15) said : #1

I'm not sure how the codes related to mat works.
I mean, if I change the parameters when running like this,
It seems it won't work?

Jan Stránský (honzik) said : #2

Hi Joe,

it depends on used IPhys [1].E.g., for FrictPhys it would be
for i in O.interactions:
   if isinstance(i.phys,FrictPhys):
      i.phys.tangensOfFrictionAngle = someValue # note: not frictionAngle, but its tangens
   elif: ...
   else: ...



Jan Stránský (honzik) said : #3

> if I change the parameters when running like this,
> O.materials[0].fiction=radians(20)
> It seems it won't work?

If it worked, it would be just fiction ;-)
similarly to IPhys, it depends on Material [3], e.g. FrictMat [4]:
O.materials[0].frictionAngle = ...



zhou qian (zhoug15) said : #4

Thanks Jan.
I'm sorry I made a mistake and asked such a stupid question.
And I have another question,

suppose that I define the mat(young = 1.e8)
If I changed the mat like this,
O.bodies[0].mat.young = 2.e8
what will happen to the other spheres in the simulation?
If changing the mat of a sphere won't influence the mat in O.materials, that means mat paras are sent to spheres when simulation initialized rather than when simulation is running. So will it work if I modify the paras in O.materials during the simulation?
Yours, Joe

Best Jérôme Duriez (jduriez) said : #5


What about some testing ?

O.bodies[1].mat.dict()  # shows an initial value of 1.e7 for O.bodies[1].mat.young
O.bodies[0].mat.young = 2.e8
O.bodies[1].mat.dict() # confirms 1.e7 has been changed to 2e8

See for more background infos.

Note that I'm speaking here only about changing Material themselves, not interaction parameters. Follow Jan's #2 philosophy if this is actually your goal.

(Maybe you were somewhat confused saying "If changing the mat of a sphere won't influence the mat in O.materials" : changing Material objects does change Material objects, the problem is "just" that interaction properties are not continuously computed from Material objects)

zhou qian (zhoug15) said : #6

Thanks Jérôme Duriez, that solved my question.