← Back to team overview

yade-dev team mailing list archive

[svn] r1605 - in trunk/pkg/dem: DataClass/InteractionPhysics Engine/StandAloneEngine

 

Author: chareyre
Date: 2009-01-04 21:53:49 +0100 (Sun, 04 Jan 2009)
New Revision: 1605

Modified:
   trunk/pkg/dem/DataClass/InteractionPhysics/ElasticContactInteraction.cpp
   trunk/pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp
Log:
1. Fixed a critical bug in ElasticContactInteraction (kn, was not registered and left undefined after loading a simulation).
2. Test if fn!=0 (i.e. contact exists) before adding kn/ks to the global stiffness.





Modified: trunk/pkg/dem/DataClass/InteractionPhysics/ElasticContactInteraction.cpp
===================================================================
--- trunk/pkg/dem/DataClass/InteractionPhysics/ElasticContactInteraction.cpp	2009-01-04 20:15:19 UTC (rev 1604)
+++ trunk/pkg/dem/DataClass/InteractionPhysics/ElasticContactInteraction.cpp	2009-01-04 20:53:49 UTC (rev 1605)
@@ -22,12 +22,10 @@
 
 void ElasticContactInteraction::registerAttributes()
 {
-//	SimpleElasticInteraction::registerAttributes();
+	NormalShearInteraction::registerAttributes();
 	REGISTER_ATTRIBUTE(prevNormal);
-	REGISTER_ATTRIBUTE(ks);
-	REGISTER_ATTRIBUTE(shearForce);
-	REGISTER_ATTRIBUTE(initialKn);
-	REGISTER_ATTRIBUTE(initialKs);
+	//REGISTER_ATTRIBUTE(initialKn);
+	//REGISTER_ATTRIBUTE(initialKs);
 	REGISTER_ATTRIBUTE(tangensOfFrictionAngle);
 	REGISTER_ATTRIBUTE(unMax);
 	REGISTER_ATTRIBUTE(previousun);

Modified: trunk/pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp
===================================================================
--- trunk/pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp	2009-01-04 20:15:19 UTC (rev 1604)
+++ trunk/pkg/dem/Engine/StandAloneEngine/GlobalStiffnessCounter.cpp	2009-01-04 20:53:49 UTC (rev 1605)
@@ -64,8 +64,12 @@
 		// FIXME? NormalShearInteraction knows nothing about whether the contact is "active" (force!=0) or not;
 		// former code: if(force==0) continue; /* disregard this interaction, it is not active */.
 		// It seems though that in such case either the interaction is accidentally at perfect equilibrium (unlikely)
-		// or it should have been deleted already. Right?
+		// or it should have been deleted already. Right? 
+		//ANSWER : some interactions can exist without fn, e.g. distant capillary force, wich does not contribute to the overall stiffness via kn. The test is needed.
+		Real fn = (static_cast<ElasticContactInteraction *> (contact->interactionPhysics.get()))->normalForce.SquaredLength();
 
+		if (fn!=0) {
+
 		//Diagonal terms of the translational stiffness matrix
 		Vector3r diag_stiffness = Vector3r(std::pow(normal.X(),2),std::pow(normal.Y(),2),std::pow(normal.Z(),2));
 		diag_stiffness *= kn-ks;
@@ -89,6 +93,8 @@
 		s = static_cast<GlobalStiffness*>(st);
 		s->stiffness += diag_stiffness;
 		s->Rstiffness += diag_Rstiffness*pow(radius2,2);
+		
+		}
 	}
 }