22
23
, const shared_ptr<Interaction>& interaction)
24
25
if(interaction->phys) return;
25
27
const shared_ptr<FrictMat>& mat1 = YADE_PTR_CAST<FrictMat>(b1);
26
28
const shared_ptr<FrictMat>& mat2 = YADE_PTR_CAST<FrictMat>(b2);
30
Real Ra,Rb;//Vector3r normal;
31
assert(dynamic_cast<GenericSpheresContact*>(interaction->geom.get()));//only in debug mode
32
GenericSpheresContact* sphCont=YADE_CAST<GenericSpheresContact*>(interaction->geom.get());
33
Ra=sphCont->refR1>0?sphCont->refR1:sphCont->refR2;
34
Rb=sphCont->refR2>0?sphCont->refR2:sphCont->refR1;
36
//The two contitions above are used in the case of a ViscElMat/FrictMat contact, if kn and ks are set for the ViscElMat. Young and Poisson are deduced. This is not a perfect solution and the user should set young/poisson only.
37
if( b1->getClassIndex()==ViscElMat::getClassIndexStatic()){
38
const shared_ptr<ViscElMat>& mat1 = YADE_PTR_CAST<ViscElMat>(b1);
39
if( (!isnan(mat1->kn)) && (!isnan(mat1->ks)) ){
40
mat1->young=mat1->kn/(2.*Ra);
41
mat1->poisson=mat1->ks/mat1->kn;
44
if( b2->getClassIndex()==ViscElMat::getClassIndexStatic()){
45
const shared_ptr<ViscElMat>& mat2 = YADE_PTR_CAST<ViscElMat>(b2);
46
if( (!isnan(mat2->kn)) && (!isnan(mat2->ks)) ){
47
mat2->young=mat2->kn/(2.*Rb);
48
mat2->poisson=mat2->ks/mat2->kn;
27
52
interaction->phys = shared_ptr<FrictPhys>(new FrictPhys());
28
53
const shared_ptr<FrictPhys>& contactPhysics = YADE_PTR_CAST<FrictPhys>(interaction->phys);
29
54
Real Ea = mat1->young;
31
56
Real Va = mat1->poisson;
32
57
Real Vb = mat2->poisson;
34
Real Ra,Rb;//Vector3r normal;
35
assert(dynamic_cast<GenericSpheresContact*>(interaction->geom.get()));//only in debug mode
36
GenericSpheresContact* sphCont=YADE_CAST<GenericSpheresContact*>(interaction->geom.get());
37
Ra=sphCont->refR1>0?sphCont->refR1:sphCont->refR2;
38
Rb=sphCont->refR2>0?sphCont->refR2:sphCont->refR1;
40
//harmonic average of the two stiffnesses when (Ri.Ei/2) is the stiffness of a contact point on sphere "i"
59
//harmonic average of the two stiffnesses when (2*Ri*Ei) is the stiffness of a contact point on sphere "i"
41
60
Real Kn = 2*Ea*Ra*Eb*Rb/(Ea*Ra+Eb*Rb);
42
61
//same for shear stiffness
43
62
Real Ks = 2*Ea*Ra*Va*Eb*Rb*Vb/(Ea*Ra*Va+Eb*Rb*Vb);