← Back to team overview

yade-users team mailing list archive

Re: [Question #251218]: Modifying the Cohesive Frictional Contact Law

 

Question #251218 on Yade changed:
https://answers.launchpad.net/yade/+question/251218

Bruno Chareyre proposed the following answer:
I was away from keyboard. Sorry for slow reply Behzad.
I think you can keep the 3 variables of CohFrictPhys even if you don't need them. It is harmless, and there is in fact a very good reason to keep them. If later you or somebody else wants to combine the Burger model with contact moments - and trust me it is likely to happen, it will be possible (for free! no need to write new code).
Jan's suggestion to introduce an intermediate class is also good, but it does not enable such combination of components.

I agree with Jan to delay the clean integration, just it is good to
anticipate it as it can guide the way you do the dirty tricks already.

As a simple example of how a good integration can look like,
Ip2_CohBurgersMat can inherit from Ip2_CohFrictMat so that:

void Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys::go(b1,b2,i)
{
    Ip2_CohFrictMat_CohFrictMat_CohFrictPhys::go(b1,b2,i); //here re-use
    i->phys->kelvinViscosity = ... //here do the additional stuff
}

In this case you don't duplicate lines. If someone is fixing something
in Ip2_CohFrictMat_CohFrictMat_CohFrictPhys you will recieve the fix. If
you duplicate, the duplicated code will slowly diverge and bugs may
never be fixed.

Notes:
1/ This requires that you inherit from 
2/ I don't see any kelvin/maxwell viscosity and stiffness in CohBurgersPhys at the moment. I guess you will have to add something for some of them (not all, since they can be partly covered by the inherited stiffness and viscosity values).
3/ the example above can apply for Law2 functor as well (see [1]), but not always. If you find that the burger model needs to insert lines in the middle of the Law2::go() block of code (I mean if there is really no way to put all new lines before or after the inherited go()) then we will need to think a bit more. 

I hope it helps

[1]
https://github.com/yade/trunk/blob/master/pkg/dem/ElasticContactLaw.cpp#L102

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.