← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2851: - initialization of many variables in Law2_Normal....

 

------------------------------------------------------------
revno: 2851
committer: jduriez <jduriez@c1solimara-l>
branch nick: yade
timestamp: Tue 2011-05-03 18:17:23 +0200
message:
  - initialization of many variables in Law2_Normal....
  - relative difference considered in check test, instead of absolute one
modified:
  pkg/dem/NormalInelasticityLaw.cpp
  pkg/dem/NormalInelasticityLaw.hpp
  scripts/test/checks/checkTestNormalInelasticity.py


--
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/NormalInelasticityLaw.cpp'
--- pkg/dem/NormalInelasticityLaw.cpp	2011-01-24 14:45:35 +0000
+++ pkg/dem/NormalInelasticityLaw.cpp	2011-05-03 16:17:23 +0000
@@ -39,9 +39,8 @@
 
 //	********	Computation of normal Force : depends of the history			*******	 //
 
-	Real Fn; // Fn's value, computed by different means
 // 	cout << " Dans Law2 valeur de kn : " << currentContactPhysics->kn << endl;
-	Real un = geom->penetrationDepth; // >0 for real penetration
+	un = geom->penetrationDepth; // >0 for real penetration
 
 // 	cout << "un = " << un << " alors que unMax = "<< currentContactPhysics->unMax << " et previousun = " << currentContactPhysics->previousun << " et previousFn =" << currentContactPhysics->previousFn << endl;
 
@@ -94,8 +93,7 @@
 		// Update of shear force corresponding to shear displacement increment:
 		shearForce -= currentContactPhysics->ks * geom->shearIncrement();
 
-                Real maxFs = 0;
-                Real Fs = currentContactPhysics->shearForce.norm();
+                Fs = currentContactPhysics->shearForce.norm();
                 maxFs = std::max((Real) 0,Fn*currentContactPhysics->tangensOfFrictionAngle);
 
                 if ( Fs  > maxFs )
@@ -110,7 +108,7 @@
                 }
 
 
-                Vector3r f	= currentContactPhysics->normalForce + shearForce;
+                f	= currentContactPhysics->normalForce + shearForce;
 		scene->forces.addForce (id1,-f);
 		scene->forces.addForce (id2, f);
 		scene->forces.addTorque(id1,-(geom->radius1-0.5*geom->penetrationDepth)* geom->normal.cross(f));
@@ -131,10 +129,9 @@
 			if (!momentAlwaysElastic)
 			{
 				Real normeMomentMax = currentContactPhysics->forMaxMoment * std::fabs(Fn);
-				Real normeMoment = moment.norm();
-				if(normeMoment>normeMomentMax)
+				if(moment.norm()>normeMomentMax)
 					{
-					moment *= normeMomentMax/normeMoment;
+					moment *= normeMomentMax/moment.norm();
 					}
 			}
 			scene->forces.addTorque(id1,-moment);

=== modified file 'pkg/dem/NormalInelasticityLaw.hpp'
--- pkg/dem/NormalInelasticityLaw.hpp	2010-11-12 08:03:16 +0000
+++ pkg/dem/NormalInelasticityLaw.hpp	2011-05-03 16:17:23 +0000
@@ -19,7 +19,13 @@
 class Law2_ScGeom6D_NormalInelasticityPhys_NormalInelasticity : public LawFunctor
 {
 	private :
-		Vector3r moment; // contact torque of the interaction
+		Vector3r moment // contact torque of the interaction
+			,f// contact force
+			;
+		Real Fn	 // value of normal force in the interaction
+		    ,Fs // shear force
+		    ,maxFs; // maximum value of shear force according to Coulomb-like criterion
+		Real un;	 // value of interpenetration in the interaction
 	public :
 		virtual void go(shared_ptr<IGeom>&, shared_ptr<IPhys>&, Interaction*);
 
@@ -27,11 +33,16 @@
 
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(Law2_ScGeom6D_NormalInelasticityPhys_NormalInelasticity,
 				LawFunctor,
-				"Contact law used to simulate granulate filler in rock joints [Duriez2009a]_, [Duriez2010]_. It includes possibility of cohesion, moment transfer and inelastic compression behaviour (to reproduce the normal inelasticity observed for rock joints, for the latter).\n\n The moment transfer relation corresponds to the adaptation of the work of Plassiard & Belheine (see in [DeghmReport2006]_ for example), which was realized by J. Kozicki, and is now coded in :yref:`ScGeom6D`.\n\n As others :yref:`LawFunctor`, it uses pre-computed data of the interactions (rigidities, friction angles -with their tan()-, orientations of the interactions); this work is done here in :yref:`Ip2_2xNormalInelasticMat_NormalInelasticityPhys`.\n\n To use this you should also use :yref:`NormalInelasticMat` as material type of the bodies.\n\n The effects of this law are illustrated in scripts/normalInelasticityTest.py",
+				"Contact law used to simulate granulate filler in rock joints [Duriez2009a]_, [Duriez2011]_. It includes possibility of cohesion, moment transfer and inelastic compression behaviour (to reproduce the normal inelasticity observed for rock joints, for the latter).\n\n The moment transfer relation corresponds to the adaptation of the work of Plassiard & Belheine (see in [DeghmReport2006]_ for example), which was realized by J. Kozicki, and is now coded in :yref:`ScGeom6D`.\n\n As others :yref:`LawFunctor`, it uses pre-computed data of the interactions (rigidities, friction angles -with their tan()-, orientations of the interactions); this work is done here in :yref:`Ip2_2xNormalInelasticMat_NormalInelasticityPhys`.\n\n To use this you should also use :yref:`NormalInelasticMat` as material type of the bodies.\n\n The effects of this law are illustrated in scripts/normalInelasticityTest.py",
 				((bool,momentRotationLaw,true,,"boolean, true=> computation of a torque (against relative rotation) exchanged between particles"))
 				((bool,momentAlwaysElastic,false,,"boolean, true=> the torque (computed only if momentRotationLaw !!) is not limited by a plastic threshold"))
 				,
 				moment=Vector3r::Zero();
+				f=Vector3r::Zero();
+				Fn=0.0;
+				Fs=0.0;
+				maxFs=0.0;
+				un=0.0;
 				);
 	
 };

=== modified file 'scripts/test/checks/checkTestNormalInelasticity.py'
--- scripts/test/checks/checkTestNormalInelasticity.py	2011-05-03 15:04:37 +0000
+++ scripts/test/checks/checkTestNormalInelasticity.py	2011-05-03 16:17:23 +0000
@@ -84,10 +84,12 @@
 dT=tRef-t
 
 tolerance=0.01
-if (dF.norm()>tolerance or dT.norm()>tolerance):
-  print "Regression concerning normalInelasticity-test. We compare loads acting on one sphere, moving with respect to another. At the end of the script (after some relative movements) we have a difference, compared to reference values, of"
-  print "- force (the norm) equal to ", dF.norm()
-  print "- torque (the norm) equal to ", dT.norm()
+if ( (dF.norm()/fRef.norm())>tolerance or (dT.norm()/tRef.norm())>tolerance):
+  print "Regression concerning normalInelasticity-test. We compare loads acting on one sphere, moving with respect to another. At the end of the script (after some relative movements) we have a relative difference, compared to reference values, of"
+  print "- force (the norm) equal to ", dF.norm()/fRef.norm()
+  print "- torque (the norm) equal to ", dT.norm()/tRef.norm()
   print "Whereas tolerance is ", tolerance
+  print "Indeed here, we have f=",f
+  print "And t=",t
   resultStatus +=1
 


Follow ups