1
/*************************************************************************
2
* Copyright (C) 2007 by Bruno CHAREYRE *
3
* bruno.chareyre@hmg.inpg.fr *
5
* This program is free software; it is licensed under the terms of the *
6
* GNU General Public License v2 or later. See file LICENSE for details. *
7
*************************************************************************/
9
#include"Ip2_FrictMat_FrictMat_FrictPhys.hpp"
10
#include<yade/pkg/dem/ScGeom.hpp>
11
#include<yade/pkg/dem/DemXDofGeom.hpp>
12
#include<yade/pkg/dem/FrictPhys.hpp>
13
#include<yade/core/Omega.hpp>
14
#include<yade/core/Scene.hpp>
15
#include<yade/pkg/common/ElastMat.hpp>
20
void Ip2_FrictMat_FrictMat_FrictPhys::go( const shared_ptr<Material>& b1
21
, const shared_ptr<Material>& b2
22
, const shared_ptr<Interaction>& interaction)
24
if(interaction->phys) return;
25
const shared_ptr<FrictMat>& mat1 = YADE_PTR_CAST<FrictMat>(b1);
26
const shared_ptr<FrictMat>& mat2 = YADE_PTR_CAST<FrictMat>(b2);
27
interaction->phys = shared_ptr<FrictPhys>(new FrictPhys());
28
const shared_ptr<FrictPhys>& contactPhysics = YADE_PTR_CAST<FrictPhys>(interaction->phys);
29
Real Ea = mat1->young;
30
Real Eb = mat2->young;
31
Real Va = mat1->poisson;
32
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"
41
Real Kn = 2*Ea*Ra*Eb*Rb/(Ea*Ra+Eb*Rb);
42
//same for shear stiffness
43
Real Ks = 2*Ea*Ra*Va*Eb*Rb*Vb/(Ea*Ra*Va+Eb*Rb*Vb);
45
Real frictionAngle = (!frictAngle) ? std::min(mat1->frictionAngle,mat2->frictionAngle) : (*frictAngle)(mat1->id,mat2->id,mat1->frictionAngle,mat2->frictionAngle);
46
contactPhysics->tangensOfFrictionAngle = std::tan(frictionAngle);
47
contactPhysics->kn = Kn;
48
contactPhysics->ks = Ks;
50
YADE_PLUGIN((Ip2_FrictMat_FrictMat_FrictPhys));