← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3677: Let exist interactions between clumpMembers of the same clump.

 

------------------------------------------------------------
revno: 3677
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2015-06-10 13:04:02 +0200
message:
  Let exist interactions between clumpMembers of the same clump.
  
  It is only in SPH-mode. We need to calculate rho anyway.
modified:
  pkg/common/Collider.cpp
  pkg/common/SPHEngine.cpp


--
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/common/Collider.cpp'
--- pkg/common/Collider.cpp	2014-10-15 06:44:01 +0000
+++ pkg/common/Collider.cpp	2015-06-10 11:04:02 +0000
@@ -16,7 +16,13 @@
 		// might be called with deleted bodies, i.e. NULL pointers
 		(b1!=NULL && b2!=NULL) &&
 		// only collide if at least one particle is standalone or they belong to different clumps
-		(b1->isStandalone() || b2->isStandalone() || b1->clumpId!=b2->clumpId ) &&
+		(b1->isStandalone() || b2->isStandalone() || b1->clumpId!=b2->clumpId 
+		#ifdef YADE_SPH
+		// If SPH-mode enabled, we do not skip interactions between clump-members
+		// to get the correct calculation of density b->rho
+		|| true
+		#endif
+		) &&
 		 // do not collide clumps, since they are just containers, never interact
 		!b1->isClump() && !b2->isClump() &&
 		// masks must have at least 1 bit in common

=== modified file 'pkg/common/SPHEngine.cpp'
--- pkg/common/SPHEngine.cpp	2015-04-29 17:12:57 +0000
+++ pkg/common/SPHEngine.cpp	2015-06-10 11:04:02 +0000
@@ -21,35 +21,35 @@
   if (b->state->rho0<0) {
     b->state->rho0 = rho0;
   }
-  Real rho = 0;
-  
-  // Pointer to kernel function
-  KernelFunction kernelFunctionCurDensity = returnKernelFunction (KernFunctionDensity, Norm);
-  
-  // Calculate rho for every particle
-  for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {
-    const shared_ptr<Body> b2 = Body::byId((*it).first,scene);
-    Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
-    if(!s) continue;
-    
-    if (((*it).second)->geom and ((*it).second)->phys) {
-      const ScGeom geom = *(YADE_PTR_CAST<ScGeom>(((*it).second)->geom));
-      const ViscElPhys phys=*(YADE_PTR_CAST<ViscElPhys>(((*it).second)->phys));
-      
-      if((b2->groupMask & mask)==0)  continue;
-      
-      Real Mass = b2->state->mass;
-      if (Mass == 0) Mass = b->state->mass;
-      
-      const Real SmoothDist = (b2->state->pos - b->state->pos).norm();
-     
-      // [Monaghan1992], (2.7) (3.8) 
-      rho += b2->state->mass*kernelFunctionCurDensity(SmoothDist, h);
+  if (not b->isClump()) {
+    Real rho = 0;
+    
+    // Pointer to kernel function
+    KernelFunction kernelFunctionCurDensity = returnKernelFunction (KernFunctionDensity, Norm);
+    
+    // Calculate rho for every particle
+    for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {
+      const shared_ptr<Body> b2 = Body::byId((*it).first,scene);
+      Sphere* s=dynamic_cast<Sphere*>(b->shape.get());
+      if(!s) continue;
+      
+      if (((*it).second)->geom and ((*it).second)->phys) {
+        const ScGeom geom = *(YADE_PTR_CAST<ScGeom>(((*it).second)->geom));
+        const ViscElPhys phys=*(YADE_PTR_CAST<ViscElPhys>(((*it).second)->phys));
+        
+        Real Mass = b2->state->mass;
+        if (Mass == 0) Mass = b->state->mass;
+        
+        const Real SmoothDist = (b2->state->pos - b->state->pos).norm();
+       
+        // [Monaghan1992], (2.7) (3.8) 
+        rho += b2->state->mass*kernelFunctionCurDensity(SmoothDist, h);
+      }
     }
+    // Self mass contribution
+    rho += b->state->mass*kernelFunctionCurDensity(0.0, h);
+    b->state->rho = rho;
   }
-  // Self mass contribution
-  rho += b->state->mass*kernelFunctionCurDensity(0.0, h);
-  b->state->rho = rho;
 }
 
 Real smoothkernelLucy(const double & r, const double & h) {