yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #23157
[Question #690872]: Adding a method in the yade class files associated to a new contact law
New question #690872 on Yade:
https://answers.launchpad.net/yade/+question/690872
Hello,
This question follows the previous answers and advices of Jan (https://answers.launchpad.net/yade/+question/690825)
I want to add a method in my yade classes of a contact law for different tests.
- If I refer to the syntax for previous classes ( Cpmphys in ConcretePM.hpp):
https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/ConcretePM.hpp#L202
They use .def() with all the parameters then the declaration of staticmethod
This doesn't exactly look like what Jan proposes in #5 of https://answers.launchpad.net/yade/+question/690825 ...
- Concerning the implementation of the method in the .cpp file, here is how it looks for me copying the syntax used for ConcretePM.cpp:
********************************************************************************************************************
CREATE_LOGGER(Law2_ScGeom_VsmPhys_Vsm);
bool Law2_ScGeom_VsmPhys_Vsm::go(shared_ptr<IGeom>& ig, shared_ptr<IPhys>& ip, Interaction* contact)
{
int id1 = contact->getId1(), id2 = contact->getId2();
ScGeom* geom = static_cast<ScGeom*>(ig.get());
VsmPhys* phys = static_cast<VsmPhys*>(ip.get());
Omega* om = static_cast<Omega*>(ip.get());
if (geom->penetrationDepth < 0) {
if (neverErase) {
phys->shearForce = Vector3r::Zero();
phys->normalForce = Vector3r::Zero();
} else
return false;
}
Real& Rav = 2 * (geom->refR1 * geom->refR2)/(geom->refR1 + geom->refR2)
Real& mun = 3 * phys->viscos *(3.14159*Rav**2)*(phys->alfa)**(1/2)
Real& mut = mun/3
Real& Epsilonpn = geom->incidentVel * geom->normal * 1/(geom->refR1 + geom->refR2 - geom->penetrationDepth)*geom->normal
Real& Fwakai = phys->Gamma * Rav * (-11.53 * (alfa) + 13.58 * (alfa)**(1/2) + 0.40)
phys->normalForce = (mun * Epsilonpn - Fwakai)* geom->normal;
phys->shearForce = mut*geom->shearIncrement()/om->dt
phys->alfa = alfa + om->dt *( (1-alfa)/(alfa)**(1/2)*(0.38/phys->viscos)*(mun * Epsilonpn - Fwakai)/(3.14159*Rav**2) + (3/4*(3.14159)**(1/2))**(1/3)*(phys->surftens/phys->viscos)*((3.14159*Rav**2)**(-3/2) )
*********************************************************************************************************************
so how should i modify this eventually to implement Jan's option of definition of the method in .cpp ?? :
"
Real MyPhys :: computeNewAlpha(...) {
// here you put the computation, wither directly or possibly using other functions, depends..
return newAlpha;
"
I hope this is clear enough....
Thanks for your input,
All the best
V.
--
You received this question notification because your team yade-users is
an answer contact for Yade.