← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2552: 1. Fix erroneous assert in the integrator (energy & clumps)

 

------------------------------------------------------------
revno: 2552
committer: Václav Šmilauer <eu@xxxxxxxx>
branch nick: yade
timestamp: Mon 2010-11-15 18:18:44 +0100
message:
  1. Fix erroneous assert in the integrator (energy & clumps)
  2. Fix bug in distance computation in SpherePack.makeClumpCloud
  3. Make scripts/test/energy.py use clumps (and no friction) to have rotations, as Bruno suggested.
modified:
  pkg/dem/NewtonIntegrator.cpp
  pkg/dem/SpherePack.cpp
  scripts/test/energy.py


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp	2010-11-13 21:11:39 +0000
+++ pkg/dem/NewtonIntegrator.cpp	2010-11-15 17:18:44 +0000
@@ -123,7 +123,7 @@
 
 			// track energy -- numerical damping and kinetic energy
 			if(trackEnergy){
-				assert(b->isStandalone() || b->isClumpMember());
+				assert(b->isStandalone() || b->isClump());
 				// always positive dissipation, by-component: |F_i|*|v_i|*damping*dt (|T_i|*|ω_i|*damping*dt for rotations)
 				if(damping!=0.){
 					scene->energy->add(fluctVel.cwise().abs().dot(f.cwise().abs())*damping*dt,"nonviscDamp",nonviscDampIx,/*non-incremental*/false);

=== modified file 'pkg/dem/SpherePack.cpp'
--- pkg/dem/SpherePack.cpp	2010-11-12 08:03:16 +0000
+++ pkg/dem/SpherePack.cpp	2010-11-15 17:18:44 +0000
@@ -282,9 +282,9 @@
 		SpherePack c2(*c); 
 		c2.translate(c2.midPt()); //recenter
 		clumps.push_back(c2);
-		Real rSq=0;
-		FOREACH(const Sph& s, c2.pack) rSq=max(rSq,s.c.squaredNorm()+pow(s.r,2));
-		boundRad.push_back(sqrt(rSq));
+		Real r=0;
+		FOREACH(const Sph& s, c2.pack) r=max(r,s.c.norm()+s.r);
+		boundRad.push_back(r);
 		Vector3r cMn,cMx; c2.aabb(cMn,cMx); // centered at zero now, this gives margin
 		//margins.push_back(periodic?cMx:Vector3r::Zero()); 
 		//boxMargins=boxMargins.cwise().max(cMx);

=== modified file 'scripts/test/energy.py'
--- scripts/test/energy.py	2010-11-15 16:31:43 +0000
+++ scripts/test/energy.py	2010-11-15 17:18:44 +0000
@@ -1,8 +1,10 @@
 from yade import pack,plot
 
+sp=pack.SpherePack();
 # bunch of balls, with an infinite plane just underneath
-sp=pack.SpherePack();
-sp.makeCloud((0,0,0),(1,1,1),.05,.5);
+if 0: sp.makeCloud((0,0,0),(1,1,1),.05,.5);
+# use clumps of 2 spheres instead, to have rotation without friction 
+else: sp.makeClumpCloud((0,0,0),(1,1,1),[pack.SpherePack([((0,0,0),.05),((0,0,.08),.02)])],periodic=False)
 sp.toSimulation()
 O.bodies.append(utils.wall(position=0,axis=2))
 
@@ -21,6 +23,7 @@
 
 # turn on energy tracking
 O.trackEnergy=True
+O.saveTmp()
 # run a bit to have all energy categories in O.energy.keys().
 
 # The number of steps when all energy contributions are already non-zero