~yade-dev/yade/0.80

« back to all changes in this revision

Viewing changes to pkg/dem/Ip2_FrictMat_FrictMat_FrictPhys.cpp

  • Committer: Anton Gladky
  • Date: 2012-05-02 21:50:42 UTC
  • Revision ID: gladky.anton@gmail.com-20120502215042-v1fa9r65usqe7kfk
0.80.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************
 
2
*  Copyright (C) 2007 by Bruno CHAREYRE                                 *
 
3
*  bruno.chareyre@hmg.inpg.fr                                        *
 
4
*                                                                        *
 
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
*************************************************************************/
 
8
 
 
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>
 
16
#include <cassert>
 
17
 
 
18
 
 
19
 
 
20
void Ip2_FrictMat_FrictMat_FrictPhys::go( const shared_ptr<Material>& b1
 
21
                                        , const shared_ptr<Material>& b2
 
22
                                        , const shared_ptr<Interaction>& interaction)
 
23
{
 
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;
 
33
 
 
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;
 
39
 
 
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);
 
44
 
 
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;
 
49
};
 
50
YADE_PLUGIN((Ip2_FrictMat_FrictMat_FrictPhys));
 
51