← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2917: - fix bug 1) as discussed in (https://answers.launchpad.net/yade/+question/169689)

 

------------------------------------------------------------
revno: 2917
committer: Chiara Modenese <c.modenese@xxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-09-02 19:23:13 +0000
message:
  - fix bug 1) as discussed in (https://answers.launchpad.net/yade/+question/169689)
modified:
  core/Cell.hpp
  pkg/dem/NewtonIntegrator.cpp
  pkg/dem/Shop.cpp


--
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 'core/Cell.hpp'
--- core/Cell.hpp	2011-03-17 15:57:57 +0000
+++ core/Cell.hpp	2011-09-02 19:23:13 +0000
@@ -89,7 +89,7 @@
 	Vector3r intrShiftPos(const Vector3i& cellDist) const { return hSize*cellDist.cast<Real>(); }
 	Vector3r intrShiftVel(const Vector3i& cellDist) const { if(homoDeform==HOMO_VEL || homoDeform==HOMO_VEL_2ND) return velGrad*hSize*cellDist.cast<Real>(); return Vector3r::Zero(); }
 	// return body velocity while taking away mean field velocity (coming from velGrad) if the mean field velocity is applied on velocity
-	Vector3r bodyFluctuationVel(const Vector3r& pos, const Vector3r& vel) const { if(homoDeform==HOMO_VEL || homoDeform==HOMO_VEL_2ND) return (vel-velGrad*pos); return vel; }
+	Vector3r bodyFluctuationVel(const Vector3r& pos, const Vector3r& vel, const Matrix3r& prevVelGrad) const { if(homoDeform==HOMO_VEL || homoDeform==HOMO_VEL_2ND) return (vel-prevVelGrad*pos); return vel; }
 
 	// get/set current shape; setting resets trsf to identity
 	Matrix3r getHSize() const { return hSize; }

=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp	2011-09-01 10:21:18 +0000
+++ pkg/dem/NewtonIntegrator.cpp	2011-09-02 19:23:13 +0000
@@ -132,7 +132,7 @@
 
 			// fluctuation velocity does not contain meanfield velocity in periodic boundaries
 			// in aperiodic boundaries, it is equal to absolute velocity
-			Vector3r fluctVel=isPeriodic?scene->cell->bodyFluctuationVel(b->state->pos,b->state->vel):state->vel;
+			Vector3r fluctVel=isPeriodic?scene->cell->bodyFluctuationVel(b->state->pos,b->state->vel,prevVelGrad):state->vel;
 
 
 

=== modified file 'pkg/dem/Shop.cpp'
--- pkg/dem/Shop.cpp	2011-07-20 07:49:38 +0000
+++ pkg/dem/Shop.cpp	2011-09-02 19:23:13 +0000
@@ -193,7 +193,7 @@
 		Real E=0;
 		if(scene->isPeriodic){
 			/* Only take in account the fluctuation velocity, not the mean velocity of homothetic resize. */
-			E=.5*state->mass*scene->cell->bodyFluctuationVel(state->pos,state->vel).squaredNorm();
+			E=.5*state->mass*scene->cell->bodyFluctuationVel(state->pos,state->vel,scene->cell->velGrad).squaredNorm();
 		} else {
 			E=.5*(state->mass*state->vel.squaredNorm());
 		}