← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4125: make PFV compatible with clumps (clumps are treated as spheres with equivalent radius - valid for...

 

------------------------------------------------------------
revno: 4125
committer: Christian Jakob <jakob@xxxxxxxxxxxxxxxxxxx>
timestamp: Fri 2014-08-01 13:16:21 +0200
message:
  make PFV compatible with clumps (clumps are treated as spheres with equivalent radius - valid for nearly spherical clumps)
modified:
  pkg/pfv/FlowEngine.hpp.in
  pkg/pfv/FlowEngine.ipp.in


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/pfv/FlowEngine.hpp.in'
--- pkg/pfv/FlowEngine.hpp.in	2014-06-20 15:28:21 +0000
+++ pkg/pfv/FlowEngine.hpp.in	2014-08-01 11:16:21 +0000
@@ -40,6 +40,7 @@
 #include<yade/lib/triangulation/FlowBoundingSphere.hpp>
 #include<yade/lib/triangulation/PeriodicFlow.hpp>
 #include<yade/pkg/pfv/FlowEngine.hpp>
+#include<yade/core/Clump.hpp>
 
 template<class _CellInfo, class _VertexInfo, class _Tesselation=CGT::_Tesselation<CGT::TriangulationTypes<_VertexInfo,_CellInfo> >, class solverT=DEFAULTSOLVER >
 class TemplateFlowEngine_@TEMPLATE_FLOW_NAME@ : public PartialEngine
@@ -62,7 +63,7 @@
 		shared_ptr<FlowSolver> backgroundSolver;
 		volatile bool backgroundCompleted;
 		Cell cachedCell;
-		struct posData {Body::id_t id; Vector3r pos; Real radius; bool isSphere; bool exists; posData(){exists=0;}};
+		struct posData {Body::id_t id; Vector3r pos; Real radius; bool isSphere; bool isClump; bool exists; posData(){exists=0;}};
 		vector<posData> positionBufferCurrent;//reflect last known positions before we start computations
 		vector<posData> positionBufferParallel;//keep the positions from a given step for multithread factorization
 		//copy positions in a buffer for faster and/or parallel access

=== modified file 'pkg/pfv/FlowEngine.ipp.in'
--- pkg/pfv/FlowEngine.ipp.in	2014-07-03 07:16:58 +0000
+++ pkg/pfv/FlowEngine.ipp.in	2014-08-01 11:16:21 +0000
@@ -275,14 +275,20 @@
 	buffer.clear();
 	buffer.resize(scene->bodies->size());
 	shared_ptr<Sphere> sph ( new Sphere );
-        const int Sph_Index = sph->getClassIndexStatic();
+	const int Sph_Index = sph->getClassIndexStatic();
 	FOREACH ( const shared_ptr<Body>& b, *scene->bodies ) {
-                if (!b || ignoredBody==b->getId()) continue;
-                posData& dat = buffer[b->getId()];
+		if (!b || ignoredBody==b->getId() || b->isClumpMember()) continue;
+		posData& dat = buffer[b->getId()];
 		dat.id=b->getId();
 		dat.pos=b->state->pos;
 		dat.isSphere= (b->shape->getClassIndex() ==  Sph_Index);
+		dat.isClump = b->isClump();
 		if (dat.isSphere) dat.radius = YADE_CAST<Sphere*>(b->shape.get())->radius;
+		if (dat.isClump) {
+			const shared_ptr<Clump>& clump = YADE_PTR_CAST<Clump>(b->shape);
+			const shared_ptr<Body>& member = Body::byId(clump->members.begin()->first,scene);
+			dat.radius = pow( (3*b->state->mass)/(4*Mathr::PI*member->material->density) , 1.0/3.0); //use equivalent radius of clump (just valid for nearly spherical clumps)
+		}
 		dat.exists=true;
 	}
 }
@@ -293,7 +299,7 @@
         solver->xMin = Mathr::MAX_REAL, solver->xMax = -Mathr::MAX_REAL, solver->yMin = Mathr::MAX_REAL, solver->yMax = -Mathr::MAX_REAL, solver->zMin = Mathr::MAX_REAL, solver->zMax = -Mathr::MAX_REAL;
         FOREACH ( const posData& b, buffer ) {
                 if ( !b.exists ) continue;
-                if ( b.isSphere ) {
+                if ( b.isSphere || b.isClump ) {
                         const Real& rad = b.radius;
                         const Real& x = b.pos[0];
                         const Real& y = b.pos[1];
@@ -358,11 +364,9 @@
 ///Using one-by-one insertion
 	vector<posData>& buffer = multithread ? positionBufferParallel : positionBufferCurrent;
 	FOREACH ( const posData& b, buffer ) {
-                if ( !b.exists ) continue;
-                if ( b.isSphere ) {
-			if (b.id==ignoredBody) continue;
-                        flow.tesselation().insert ( b.pos[0], b.pos[1], b.pos[2], b.radius, b.id );}
-        }
+		if ( !b.exists || b.id==ignoredBody ) continue;
+		if ( b.isSphere || b.isClump ) flow.tesselation().insert ( b.pos[0], b.pos[1], b.pos[2], b.radius, b.id );
+	}
 	flow.tesselation().redirected=true;//By inserting one-by-one, we already redirected
 	flow.shearLubricationForces.resize ( flow.tesselation().maxId+1 );
 	flow.shearLubricationTorques.resize ( flow.tesselation().maxId+1 );