change mat paras

Asked by zhou qian

Hi:
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

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
Last reply:
Revision history for this message
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,
 O.materials[0].fiction=radians(20)
It seems it won't work?

Revision history for this message
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: ...
###

cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#iphys
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FrictPhys.tangensOfFrictionAngle

Revision history for this message
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 = ...

Jan

[3] https://yade-dem.org/doc/yade.wrapper.html#material
[4] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.FrictMat.frictionAngle

Revision history for this message
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

Revision history for this message
Best Jérôme Duriez (jduriez) said :
#5

Hi,

What about some testing ?

O.bodies.append(sphere((0,0,0),1))
O.bodies.append(sphere((0,0,2),1))
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 https://yade-dem.org/doc/prog.html#returning-attribute-by-value-or-by-reference 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)

Revision history for this message
zhou qian (zhoug15) said :
#6

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