code of penetrationVolume in yade

Asked by lip on 2019-05-29

hello
i am reading the source code of yade recent days, and i am quite interesting in how penetrationVolume is calculate in yade, but i can not find the source code which defined penetrationVolume and how penetrationVolume calculated, would you please tell me where is it?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-05-30
Last query:
2019-05-30
Last reply:
2019-05-29
Deepak (deepak-kn1990) said : #1

Hi,

a quick tip: you can use the grep command to look for files, variable names etc. in your present directory.
So you can look for penetrationVolume in trunk/pkg or trunk like this : In terminal type : grep -r 'penetrationVolume' which gives me these results:

(pyvirtual)dkunhappan@dt-com012:~/yadeTrunk/trunk/pkg$ grep -r 'penetrationVolume'

dem/Polyhedra_Ig2.cpp: bang->penetrationVolume=min(A->GetVolume(),B->GetVolume());
dem/Polyhedra_Ig2.cpp: bang->penetrationVolume=volume;
dem/Polyhedra_Ig2.cpp: bang->penetrationVolume=volume;
dem/Polyhedra_Ig2.cpp: bang->penetrationVolume=volume;
dem/Polyhedra.hpp: ((Real,penetrationVolume,NaN,,"Volume of overlap [m³]"))
dem/Tetra.hpp: ((Real,penetrationVolume,NaN,,"Volume of overlap [m³]"))
dem/Tetra.hpp: ((Real,penetrationVolume,NaN,,"Volume of overlap [m³]"))
dem/Tetra.hpp: bool checkVertexToTriangleCase(const Triangle tA[4], const Point pB[4], const Segment sB[6], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Tetra.hpp: bool checkEdgeToEdgeCase(const Segment sA[6], const Segment sB[6], const Triangle tA[4], const Triangle tB[4], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Tetra.hpp: bool checkEdgeToTriangleCase1(const Triangle tA[4], const Segment sB[6], const Point pB[4], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Tetra.hpp: bool checkEdgeToTriangleCase2(const Triangle tA[4], const Triangle tB[4], const Segment sA[6], const Segment sB[6], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Tetra.hpp: bool checkVertexToEdgeCase(const Point pA[4], const Segment sA[6], const Triangle tA[4], const Segment sB[6], const Triangle tB[4], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Tetra.hpp: bool checkVertexToVertexCase(const Point pA[4], const Point pB[4], const Segment sA[6], const Triangle tA[4], const Triangle tB[4], Vector3r& normal, Vector3r& contactPoint, Real& penetrationVolume);
dem/Polyhedra.cpp: if(!(contactGeom->equivalentPenetrationDepth > 1E-18) || !(contactGeom->penetrationVolume > 0)) {
dem/Polyhedra.cpp: Real prop = std::pow(contactGeom->penetrationVolume,volumePower);
dem/Polyhedra.cpp: fprintf(fin,"volume\t%e\n",contactGeom->penetrationVolume);
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = TetrahedronVolume(v);
dem/Tetra.cpp: if (penetrationVolume > .5*vol) { penetrationVolume = vol-penetrationVolume; }
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = TetrahedronVolume(p);
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = v1 + v2 + v3;
dem/Tetra.cpp: contactPoint = (v1*cg1 + v2*cg2 + v3*cg3) / penetrationVolume;
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = v1 + v2 + v3;
dem/Tetra.cpp: contactPoint = (v1*cg1 + v2*cg2 + v3*cg3) / penetrationVolume;
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = v1 + v2 + v3;
dem/Tetra.cpp: contactPoint = (v1*cg1 + v2*cg2 + v3*cg3) / penetrationVolume;
dem/Tetra.cpp: Real& penetrationVolume)
dem/Tetra.cpp: penetrationVolume = v1 + v2;
dem/Tetra.cpp: contactPoint = (v1*cg1 + v2*cg2) / penetrationVolume;
dem/Tetra.cpp: geom->penetrationVolume = V; \
dem/Tetra.cpp: geom->penetrationVolume = (Real)-1.;
dem/Tetra.cpp: bang->penetrationVolume=V;
dem/Tetra.cpp: if ( geom->flag == 0 || geom->penetrationVolume <= 0. ) {
dem/Tetra.cpp: Real& un=geom->penetrationVolume;

Best Jan Stránský (honzik) said : #2

theory: https://www.yade-dem.org/doc/publications.html, Elias2013, Elias2014

code:

assignment from 'volume' variable
https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/Polyhedra_Ig2.cpp#L113

computating 'volume' from intersecting polyhedron 'Int'
https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/Polyhedra_Ig2.cpp#L87

computing intersecting polyhedron 'Int'
https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/Polyhedra_Ig2.cpp#L82

Polyhedron Polyhedron_Polyhedron_intersection function implementation
https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/Polyhedra_support.cpp#L595

cheers
Jan

lip (mr.xie) said : #3

Thanks Jan Stránský, that solved my question.