← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3817: Fix 2 bugs linked to the Grids :

 

------------------------------------------------------------
revno: 3817
committer: Francois <francois.kneib@xxxxxxxxx>
timestamp: Wed 2014-02-12 14:18:59 +0100
message:
  Fix 2 bugs linked to the Grids :
  - in utils.py : remove a factor 2 in the calculation of the bending stiffness kr.
  - in Grid.cpp : fix a bug that occured in the Sphere-GridConnection contact. The contact was not detected in a very specific case : if the sphere was next to a node and the node goes from a convex (angle>180°) form to a concav (angle<180°) form.
modified:
  pkg/common/Grid.cpp
  py/utils.py


--
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/Grid.cpp'
--- pkg/common/Grid.cpp	2013-11-12 08:29:26 +0000
+++ pkg/common/Grid.cpp	2014-02-12 13:18:59 +0000
@@ -219,8 +219,14 @@
 				// ... and check whether the sphere projection is before the neighbours connections too.
 				const shared_ptr<Interaction> intr = scene->interactions->find(c->id1,gridNo1->ConnList[i]->getId());
 				if(relPosPrev<=0){ //if the sphere projection is outside both the current Connection AND this neighbouring connection, then create the interaction if the neighbour did not already do it before.
-					if(intr && intr->isReal() && isNew) return false;
-					if(intr && intr->isReal() && !isNew) {scm->isDuplicate=1;/*cout<<"Declare "<<c->id1<<"-"<<c->id2<<" as duplicated."<<endl;*/}
+					const shared_ptr<Interaction> intr = scene->interactions->find(c->id1,gridNo1->ConnList[i]->getId());
+					if(intr && intr->isReal()){
+						shared_ptr<ScGridCoGeom> intrGeom=YADE_PTR_CAST<ScGridCoGeom>(intr->geom);
+						if(!intrGeom->isDuplicate==1){ //skip contact.
+							if (isNew) {return false;}
+							else {scm->isDuplicate=1;}/*cout<<"Declare "<<c->id1<<"-"<<c->id2<<" as duplicated."<<endl;*/
+						}
+					}
 				}
 				else{//the sphere projection is outside the current Connection but inside the previous neighbour. The contact has to be handled by the Prev GridConnection, not here.
 					if (isNew)return false;
@@ -247,10 +253,15 @@
 					if(abs(segtNext[j])<1e-14) segtNext[j]=0.0;
 				}
 				Real relPosNext = (branchN.dot(segtNext))/(segtNext.norm()*segtNext.norm());
-				const shared_ptr<Interaction> intr = scene->interactions->find(c->id1,gridNo2->ConnList[i]->getId());
 				if(relPosNext<=0){ //if the sphere projection is outside both the current Connection AND this neighbouring connection, then create the interaction if the neighbour did not already do it before.
-					if(intr && intr->isReal() && isNew) return false;
-					if(intr && intr->isReal() && !isNew) {scm->isDuplicate=1;/*cout<<"Declare "<<c->id1<<"-"<<c->id2<<" as duplicated."<<endl;*/}
+					const shared_ptr<Interaction> intr = scene->interactions->find(c->id1,gridNo2->ConnList[i]->getId());
+					if(intr && intr->isReal()){
+						shared_ptr<ScGridCoGeom> intrGeom=YADE_PTR_CAST<ScGridCoGeom>(intr->geom);
+						if(!intrGeom->isDuplicate==1){
+							if (isNew) return false;
+							else scm->isDuplicate=1;/*cout<<"Declare "<<c->id1<<"-"<<c->id2<<" as duplicated."<<endl;*/
+						}
+					}
 				}
 				else{//the sphere projection is outside the current Connection but inside the previous neighbour. The contact has to be handled by the Prev GridConnection, not here.
 					if (isNew)return false;

=== modified file 'py/utils.py'
--- py/utils.py	2014-01-09 12:39:24 +0000
+++ py/utils.py	2014-02-12 13:18:59 +0000
@@ -303,7 +303,7 @@
 	I=math.pi*(2.*radius)**4/64.
 	E=nodeMat.young
 	i.phys.kn=E*math.pi*(radius**2)/L
-	i.phys.kr=2.*E*I/L
+	i.phys.kr=E*I/L
 	i.phys.ks=12.*E*I/(L**3)
 	G=E/(2.*(1+nodeMat.poisson))
 	i.phys.ktw=2.*I*G/L