← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3948: Add blockedMovement parameter to state of body

 

------------------------------------------------------------
revno: 3948
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2014-05-13 20:54:16 +0200
message:
  Add blockedMovement parameter to state of body
  
  This parameter (Fault by default) prevents moving
  of bodies, even if they have a velocity.
  
  It can be usefull for instance in the cases, when
  you need to simulate something like a conveyor with
  a complicated shape.
modified:
  core/State.hpp
  pkg/dem/NewtonIntegrator.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 'core/State.hpp'
--- core/State.hpp	2014-03-27 14:52:07 +0000
+++ core/State.hpp	2014-05-13 18:54:16 +0000
@@ -60,6 +60,7 @@
 		((Vector3r,refPos,Vector3r::Zero(),,"Reference position"))
 		((Quaternionr,refOri,Quaternionr::Identity(),,"Reference orientation"))
 		((unsigned,blockedDOFs,,,"[Will be overridden]"))
+		((bool,blockedMovement,false,,"If True, the body will not move/rotate. But can have a linear and angular velocity"))
 		((bool,isDamped,true,,"Damping in :yref:`Newtonintegrator` can be deactivated for individual particles by setting this variable to FALSE. E.g. damping is inappropriate for particles in free flight under gravity but it might still be applicable to other particles in the same simulation."))
 		((Real,densityScaling,1,,"|yupdate| see :yref:`GlobalStiffnessTimeStepper::targetDt`.")),
 		/* additional initializers */

=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp	2014-04-08 19:11:03 +0000
+++ pkg/dem/NewtonIntegrator.cpp	2014-05-13 18:54:16 +0000
@@ -226,18 +226,20 @@
 	//NOTE : dVel defined without wraping the coordinates means bodies out of the (0,0,0) period can move realy fast. It has to be compensated properly in the definition of relative velocities (see Ig2 functors and contact laws).
 		//Reflect mean-field (periodic cell) acceleration in the velocity
 	if(scene->isPeriodic && homoDeform) {Vector3r dVel=dVelGrad*state->pos; state->vel+=dVel;}
-	state->pos+=state->vel*dt;
+	if (not(state->blockedMovement)) {
+		state->pos+=state->vel*dt;
+	}
 }
 
 void NewtonIntegrator::leapfrogSphericalRotate(State* state, const Body::id_t& id, const Real& dt )
 {
 	Real angle2=state->angVel.squaredNorm();
-	if (angle2!=0) {//If we have an angular velocity, we make a rotation
+	if (angle2!=0 and not(state->blockedMovement)) {//If we have an angular velocity, we make a rotation
 		Real angle=sqrt(angle2);
 		Quaternionr q(AngleAxisr(angle*dt,state->angVel/angle));
 		state->ori = q*state->ori;
 	}
-	if(scene->forces.getMoveRotUsed() && scene->forces.getRot(id)!=Vector3r::Zero()) {
+	if(scene->forces.getMoveRotUsed() && scene->forces.getRot(id)!=Vector3r::Zero() and not(state->blockedMovement)) {
 		Vector3r r(scene->forces.getRot(id));
 		Real norm=r.norm(); r/=norm;
 		Quaternionr q(AngleAxisr(norm,r));


Follow ups