← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 3002: - add capability to deactivate the damping in NewtonIntegrator for individual particle via O.bodi...

 

------------------------------------------------------------
revno: 3002
committer: Klaus Thoeni <klaus.thoeni@xxxxxxxxx>
branch nick: yade
timestamp: Tue 2012-01-24 14:29:29 +1100
message:
  - add capability to deactivate the damping in NewtonIntegrator for individual particle via O.bodies[id].state.isDamped=False
  - use this new property in examples/WireMatPM/wirecontacttest.py
modified:
  core/State.hpp
  examples/WireMatPM/wirecontacttest.py
  pkg/dem/NewtonIntegrator.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/State.hpp'
--- core/State.hpp	2011-02-14 08:05:09 +0000
+++ core/State.hpp	2012-01-24 03:29:29 +0000
@@ -59,7 +59,8 @@
 		((Vector3r,inertia,Vector3r::Zero(),,"Inertia of associated body, in local coordinate system."))
 		((Vector3r,refPos,Vector3r::Zero(),,"Reference position"))
 		((Quaternionr,refOri,Quaternionr::Identity(),,"Reference orientation"))
-		((unsigned,blockedDOFs,,,"[Will be overridden]")),
+		((unsigned,blockedDOFs,,,"[Will be overridden]"))
+		((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.")),
 		/* additional initializers */
 			((pos,se3.position))
 			((ori,se3.orientation)),

=== modified file 'examples/WireMatPM/wirecontacttest.py'
--- examples/WireMatPM/wirecontacttest.py	2011-10-06 03:29:16 +0000
+++ examples/WireMatPM/wirecontacttest.py	2012-01-24 03:29:29 +0000
@@ -117,6 +117,7 @@
 
 #### import block as a sphere after net has been created
 bloc=O.bodies.append(sphere([1.0,1.0,0.65],radius=0.15,wire=False,highlight=False,color=[1,1,0],material=blocMat))
+O.bodies[bloc].state.isDamped=False	# switch damping off since free fall under gravity
 
 
 #### plot some results

=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp	2012-01-23 14:43:54 +0000
+++ pkg/dem/NewtonIntegrator.cpp	2012-01-24 03:29:29 +0000
@@ -39,7 +39,7 @@
 void NewtonIntegrator::updateEnergy(const shared_ptr<Body>& b, const State* state, const Vector3r& fluctVel, const Vector3r& f, const Vector3r& m){
 	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.){
+	if(damping!=0. && state->isDamped){
 		scene->energy->add(fluctVel.cwise().abs().dot(f.cwise().abs())*damping*scene->dt,"nonviscDamp",nonviscDampIx,/*non-incremental*/false);
 		// when the aspherical integrator is used, torque is damped instead of ang acceleration; this code is only approximate
 		scene->energy->add(state->angVel.cwise().abs().dot(m.cwise().abs())*damping*scene->dt,"nonviscDamp",nonviscDampIx,false);
@@ -157,7 +157,7 @@
 			if (state->blockedDOFs!=State::DOF_ALL) {
 				// linear acceleration
 				Vector3r linAccel=computeAccel(f,state->mass,state->blockedDOFs);
-				cundallDamp2nd(dt,f,fluctVel,linAccel);
+				if(state->isDamped) cundallDamp2nd(dt,f,fluctVel,linAccel);
 				//This is the convective term, appearing in the time derivation of Cundall/Thornton expression (dx/dt=velGrad*pos -> d²x/dt²=dvelGrad/dt*pos+velGrad*vel), negligible in many cases but not for high speed large deformations (gaz or turbulent flow).
 				linAccel+=prevVelGrad*state->vel;
 				//finally update velocity
@@ -165,11 +165,11 @@
 				// angular acceleration
 				if(!useAspherical){ // uses angular velocity
 					Vector3r angAccel=computeAngAccel(m,state->inertia,state->blockedDOFs);
-					cundallDamp2nd(dt,m,state->angVel,angAccel);
+					if(state->isDamped) cundallDamp2nd(dt,m,state->angVel,angAccel);
 					state->angVel+=dt*angAccel;
 				} else { // uses torque
 					for(int i=0; i<3; i++) if(state->blockedDOFs & State::axisDOF(i,true)) m[i]=0; // block DOFs here
-					cundallDamp1st(m,state->angVel);
+					if(state->isDamped) cundallDamp1st(m,state->angVel);
 				}
 			}