← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1781: A flag "neverErase" is added to the contact law to define if it can

 

------------------------------------------------------------
revno: 1781
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Fri 2009-11-06 18:00:44 +0100
message:
  A flag "neverErase" is added to the contact law to define if it can 
  erase interactions. This flag can be turned on when another constitutive 
  law (e.g. capillaryCohesiveLaw) is in charge of erasing interactions.
modified:
  pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp
  pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.cpp
  pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.hpp
  pkg/dem/PreProcessor/TriaxialTestWater.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 'pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp'
--- pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp	2009-07-17 20:50:55 +0000
+++ pkg/dem/Engine/StandAloneEngine/CapillaryCohesiveLaw.cpp	2009-11-06 17:00:44 +0000
@@ -230,6 +230,7 @@
                                         if (fusionDetection)
                                                 bodiesMenisciiList.remove((*ii));
                                         currentContactPhysics->meniscus = false;
+					ncb->interactions->requestErase(id1,id2);
                                         //cerr <<"currentContactPhysics->meniscus = false;"<<endl;
                                 }
 

=== modified file 'pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.cpp'
--- pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.cpp	2009-08-03 10:02:11 +0000
+++ pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.cpp	2009-11-06 17:00:44 +0000
@@ -14,6 +14,7 @@
 #include<yade/pkg-dem/DemXDofGeom.hpp>
 #include<yade/core/Omega.hpp>
 #include<yade/core/MetaBody.hpp>
+#include<yade/core/MetaBody.hpp>
 
 YADE_PLUGIN((ef2_Spheres_Elastic_ElasticLaw)(Law2_Dem3Dof_Elastic_Elastic)(ElasticContactLaw));
 
@@ -24,6 +25,7 @@
 	#ifdef SCG_SHEAR
 		useShear=false;
 	#endif
+	neverErase = false;
 }
 
 
@@ -43,22 +45,32 @@
 			// these checks would be redundant in the functor (ConstitutiveLawDispatcher does that already)
 			if(!dynamic_cast<SpheresContactGeometry*>(I->interactionGeometry.get()) || !dynamic_cast<ElasticContactInteraction*>(I->interactionPhysics.get())) continue;	
 		#endif
-		functor->go(I->interactionGeometry, I->interactionPhysics, I.get(), rootBody);
+			functor->go(I->interactionGeometry, I->interactionPhysics, I.get(), rootBody, neverErase);
 	}
 }
 
 
 CREATE_LOGGER(ef2_Spheres_Elastic_ElasticLaw);
-void ef2_Spheres_Elastic_ElasticLaw::go(shared_ptr<InteractionGeometry>& ig, shared_ptr<InteractionPhysics>& ip, Interaction* contact, MetaBody* ncb){
+void ef2_Spheres_Elastic_ElasticLaw::go(shared_ptr<InteractionGeometry>& ig, shared_ptr<InteractionPhysics>& ip, Interaction* contact, MetaBody* ncb, bool neverErase){
 	Real dt = Omega::instance().getTimeStep();
 
 			int id1 = contact->getId1(), id2 = contact->getId2();
 			// FIXME: mask handling should move to ConstitutiveLaw itself, outside the functors
 			if( !(Body::byId(id1,ncb)->getGroupMask() & Body::byId(id2,ncb)->getGroupMask() & sdecGroupMask) ) return;
 			SpheresContactGeometry*    currentContactGeometry= static_cast<SpheresContactGeometry*>(ig.get());
-			ElasticContactInteraction* currentContactPhysics = static_cast<ElasticContactInteraction*>(ip.get());
-			// delete interaction where spheres don't touch
-			if(currentContactGeometry->penetrationDepth<0){ ncb->interactions->requestErase(id1,id2); return; }
+			ElasticContactInteraction* currentContactPhysics = static_cast<ElasticContactInteraction*>(ip.get());			
+			
+			// delete interaction where spheres don't touch (or are "far enough" with respect to interactionDeletionFactor)
+			if(currentContactGeometry->penetrationDepth <0)
+			{
+				if (neverErase) {
+					currentContactPhysics->shearForce = Vector3r::ZERO;
+					currentContactPhysics->normalForce = Vector3r::ZERO;}
+				else 	ncb->interactions->requestErase(id1,id2);
+				return;
+			}
+				
+				
 	
 			BodyMacroParameters* de1 				= YADE_CAST<BodyMacroParameters*>(Body::byId(id1,ncb)->physicalParameters.get());
 			BodyMacroParameters* de2 				= YADE_CAST<BodyMacroParameters*>(Body::byId(id2,ncb)->physicalParameters.get());

=== modified file 'pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.hpp'
--- pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.hpp	2009-07-17 20:50:55 +0000
+++ pkg/dem/Engine/StandAloneEngine/ElasticContactLaw.hpp	2009-11-06 17:00:44 +0000
@@ -20,9 +20,10 @@
 
 class ef2_Spheres_Elastic_ElasticLaw: public ConstitutiveLaw{
 	public:
-	virtual void go(shared_ptr<InteractionGeometry>& _geom, shared_ptr<InteractionPhysics>& _phys, Interaction* I, MetaBody* rootBody);
+	virtual void go(shared_ptr<InteractionGeometry>& _geom, shared_ptr<InteractionPhysics>& _phys, Interaction* I, MetaBody* rootBody, bool neverErase=false);
 	int sdecGroupMask;
-	bool momentRotationLaw;
+	bool momentRotationLaw;	
+	
 	#ifdef SCG_SHEAR
 		bool useShear;
 	#endif
@@ -67,13 +68,17 @@
 		#ifdef SCG_SHEAR
 			bool useShear;
 		#endif
+			
+		/*! Turn this true if another law is taking care of removing interaction.
+		 */
+		bool neverErase;
 	
 		ElasticContactLaw();
 		void action(MetaBody*);
 
 		shared_ptr<ef2_Spheres_Elastic_ElasticLaw> functor;
 
-	REGISTER_ATTRIBUTES(InteractionSolver,(sdecGroupMask)(momentRotationLaw)
+		REGISTER_ATTRIBUTES(InteractionSolver,(sdecGroupMask)(momentRotationLaw)(neverErase)
 		#ifdef SCG_SHEAR
 			(useShear)
 		#endif

=== modified file 'pkg/dem/PreProcessor/TriaxialTestWater.cpp'
--- pkg/dem/PreProcessor/TriaxialTestWater.cpp	2009-08-05 07:32:18 +0000
+++ pkg/dem/PreProcessor/TriaxialTestWater.cpp	2009-11-06 17:00:44 +0000
@@ -487,6 +487,7 @@
 	
 	shared_ptr<ElasticContactLaw> elasticContactLaw(new ElasticContactLaw);
 	elasticContactLaw->sdecGroupMask = 2;
+	elasticContactLaw->neverErase = true;
 
 	// capillary
 	shared_ptr<CapillaryCohesiveLaw> capillaryCohesiveLaw(new CapillaryCohesiveLaw); 


Follow ups