define and change the interaction parameter during simulation

Asked by Gao Xiang

Hi, All,
I want to simulate a triaxial test of two materials, firstly, I want to do isotropic compression without friction and rolling resistance (set to zero ) for dense sample, and then I want to add the parameters of friction and rolling resistance in the following simulation. Although I refer to the documents or many discussion here, I still have several doubts and questions when simulating:

1) In CohFrictPhys[2], there is a parameter maxRollPl, and there is etaRoll in CohFrictMat[3], what is the difference, in my opinion, etaRoll represents rolling friction of material and maxRollPl represents the rolling friction of interactions, and maxRollPl = max(etaRoll of mat1,etaRoll of mat2), is it right?

2)In Ip2_CohFrictMat_CohFrictMat_CohFrictPhys[1], the frictAngle between two materials can be defined by MatchMaker , but some other parameters of CohFrictPhys[2] seems not to have this functions, such as the maxRollPl . The materials have different etaRoll values, so I want to customize the maxetaRoll at the interaction of different materials, is it possible?

3. For adding new properties, I know that i should loop the existing interactions and change the material properties. maybe I can use following method to get it?, some pseudo code as following:
#modify the interaction
for i in O.interactions:
    if O.bodies[i.id1].mat==mat1 and O.bodies[i.id2].mat==mat1 #between material 1
    else if O.bodies[i.id1].mat==mat2 and O.bodies[i.id2].mat==mat2 #between material 2
    else #between two different materials
#modify the materials
    However, how I deal with the new interaction with defining a maxRollPl instead of default.


Thanks so much


Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Jérôme Duriez
Last query:
Last reply:
Revision history for this message
Gao Xiang (gaoxiang22) said :

Maybe I find some answers,similar to the 5# in
from the code,the definition is clear, and it seems impossible to define a new etaRoll between two materials except modifying the code.
contactPhysics->maxRollPl = min(sdec1->etaRoll*Da,sdec2->etaRoll*Db);
contactPhysics->maxTwistPl = min(sdec1->etaTwist*Da,sdec2->etaTwist*Db);

But I still want to know how to do if I want to add the rolling resistance parameters etaroll, (it sets zero firstly ) into model during simulations, the following steps are right or not.
step 1: modify the materials properties
step 2:loop and modify the existing interaction? how to do in this step because all the properties had been calculated
             calculated again in the loop, such as Kr and maxRollPl??
             or deleted the interaction and reset by O.interactions.clear() and for id1,id2 in pairs: utils.createInteraction(id1,id2), will this affect the simulation?
step 3: update funtors ip2 or Law2, is it necessary?
Thanks for the response!

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

In a generic YADE workflow, interaction properties such as CohFrictPhys.maxRollPl are computed by the ad-hoc Ip2* at the creation of the interaction, from bodies material parameters such as CohFrictMat.etaRoll.

Sometimes the Ip2 doc is explicit in this aspect, sometimes not and you have to look in the source code.

If one wants to change contact properties during a YADE simulation, the method is thus (maybe you had it right):

- change the corresponding Material parameters. This is the most logical to do first, and it will apply to future i.e. yet-to-come-to-life interactions

- because existing interactions will not see the change in Material parameters (Ip2 will not come back to them a second time), you indeed have to manually update them, which is easy to do in Python (and effective):

for cont in O.interactions:
  cont.phys.something = theValueObtainedAccordingToIp2formulasAndYourNewMaterialParameters

- for deleted interactions, there is nothing to do since they are deleted = absent from your model (and you also should not need to update O.engines and its functors)

Revision history for this message
Gao Xiang (gaoxiang22) said :

thanks jduriez for your help!
That solved most of my problems, and I want to determine something.
Through your method, the parameters of existing interactions can be easily modified to a defined values, what about the new interactions, I also want to use a defined maxRollPl instead of default (though using new material parameters).
Therefore, maybe I should write a function in Python to detect the new interactions of different materials (), and immediately modify the new interactions with a defined value. Is there a existing monitoring function to get the new interaction, or without it I should get them myself?
Thankes a lot

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

New interactions will be duly taken care of by the Ip2 (which will continue to make its job on every new interaction popping up), with the new Material parameters => things will be how you want them to be

Revision history for this message
Gao Xiang (gaoxiang22) said :

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