~ubuntu-branches/debian/sid/yade/sid

« back to all changes in this revision

Viewing changes to pkg/dem/Ip2_FrictMat_FrictMat_FrictPhys.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2014-01-13 20:13:14 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20140113201314-4x3stisjce4t0pdx
Tags: 1.07.0-1
* [d42c7de] Imported Upstream version 1.07.0
* [a421b10] Remove patch, applied by upstream.
* [d151f88] Set Standards-Version: 3.9.5. No changes.
* [a9616c6] Add upstream file.
* [c078bb4] Inject additional parameters for weak archs. 
            Thanks to Roland Stigge <stigge@antcom.de>. (Closes: #733152)
* [21a2430] Fix version definition for IPython>1.0.0.
* [8204093] Remove google-scripts from documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include<yade/core/Omega.hpp>
14
14
#include<yade/core/Scene.hpp>
15
15
#include<yade/pkg/common/ElastMat.hpp>
 
16
#include<yade/pkg/dem/ViscoelasticPM.hpp>
16
17
#include <cassert>
17
18
 
18
19
 
22
23
                                        , const shared_ptr<Interaction>& interaction)
23
24
{
24
25
        if(interaction->phys) return;
 
26
        
25
27
        const shared_ptr<FrictMat>& mat1 = YADE_PTR_CAST<FrictMat>(b1);
26
28
        const shared_ptr<FrictMat>& mat2 = YADE_PTR_CAST<FrictMat>(b2);
 
29
        
 
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;
 
35
        
 
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;
 
42
                }
 
43
        }
 
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;
 
49
                }
 
50
        }
 
51
        
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;
33
58
 
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"
 
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);