# yade-users team mailing list archive

## [Question #689814]: How to use matchMaker on frictionAngle and etaRoll of CohFrictMat

```New question #689814 on Yade:

Hi,
I used CohFricMat as material and CohesionMoment for the Contact law.

In my simulation I have 2 materials, mat1 and mat2 which are defined as:

mat1= O.materials.append(CohFrictMat(isCohesive=True,young=young,alphaKr=KrKt,alphaKtw=KrKt,\
poisson=0.3,frictionAngle=f1,etaRoll=etaRoll1,etaTwist=etaRoll1,\
density=2650.0,normalCohesion=1e6, shearCohesion=1e6,\
momentRotationLaw=True))
mat2 = O.materials.append(CohFrictMat(isCohesive=True,young=young,alphaKr=KrKt,alphaKtw=KrKt,\
poisson=0.3,frictionAngle=f2,etaRoll=etaRoll2,etaTwist=etaRoll2,\
density=2650.0,normalCohesion=1e6, shearCohesion=1e6,\
momentRotationLaw=True))

Where f1 < f2 and eta1 < eta2.

Question 1: etaRoll

What I want is that: using etaRoll1 for mat1-mat1 contact, and using etaRoll2 for mat1-mat1 and mat2-mat2 contact, i.e., matches=((mat1,mat1,eta1),(mat1,mat2,eta2),(mat2,mat2,eta2)).
But when I put it into Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(etaRoll=MatchMaker(matches=((0,0,etaRoll1),(0,1,etaRoll2),(1,1,etaRoll2))), error shows as: AttributeError: No such attribute: etaRoll.

Is there any way to achieve the control of etaRoll?

Question 2: frictionAngle

Referring to https://answers.launchpad.net/yade/+question/670376, I use the following MWE to test if I can use matchMaker on frictionAngle for Ip2_CohFrictMat_CohFrictMat_CohFrictPhys().

MWE:
#####
matchMak = MatchMaker(algo='max') # or 'min' (default)

ig2fun = [Ig2_Sphere_Sphere_ScGeom6D()]
ip2fun = [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(frictAngle=matchMak)]
law2fun = [Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]

O.bodies.append(sphere(Vector3(0,0,0),1,material=mat1)) # the assignment of material without using O.materials may not be the best practice from a general point of view
O.bodies.append(sphere(Vector3(0,0,2),1,material=mat2))

O.engines.geomDispatcher.functors = ig2fun
O.engines.physDispatcher.functors = ip2fun
O.engines.lawDispatcher.functors = law2fun

O.step()
print 'tan(phiLocal)',O.interactions[0,1].phys.tangensOfFrictionAngle # 1 here or 0 if MatchMaker.algo='min'
####

I copied the MWE and got the following error:

Traceback (most recent call last):
File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
File "test.py", line 10, in <module>
ip2fun = [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(frictAngle=matchMak)]
AttributeError: No such attribute: frictAngle.

The Yade version I use is 2018.02b (ubuntu 18.04) and I checked my pkg/dem/CohesiveFrictionalContactLaw.cpp and  pkg/dem/CohesiveFrictionalContactLaw.hpp. This is how it looks like in cpp and hpp, respectively:

Real fa 	= sdec1->frictionAngle;
Real fb = sdec2->frictionAngle;
Real Kn = 2.0*Ea*Da*Eb*Db/(Ea*Da+Eb*Db);//harmonic average of two stiffnesses
Real frictionAngle = (!frictAngle) ? std::min(fa,fb) : (*frictAngle)(sdec1->id,sdec2->id,fa,fb);

contactPhysics->kr = Da*Db*Ks*AlphaKr;
contactPhysics->ktw = Da*Db*Ks*AlphaKtw;
contactPhysics->tangensOfFrictionAngle = std::tan(frictionAngle);

((shared_ptr<MatchMaker>,frictAngle,,,"Instance of :yref:`MatchMaker` determining how to compute interaction's friction angle. If ``None``, minimum value is used."))

Any ideas about why it doesn't work?

Thanks,
Leonard