← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3845: Fixed a strange bug in Law2_PolyhedraGeom_PolyhedraPhys_Volumetric and shearForce

 

------------------------------------------------------------
revno: 3845
committer: Jan Stransky <jan.stransky@xxxxxxxxxxx>
timestamp: Tue 2016-04-19 03:27:38 +0200
message:
  Fixed a strange bug in Law2_PolyhedraGeom_PolyhedraPhys_Volumetric and shearForce
  
  rarely the program went to a if branch, which should be evaluated to false (when shearForce was (0,0,0)). Therefore ratio for shearForce was inf and all shearForce nan
modified:
  pkg/dem/Polyhedra.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 'pkg/dem/Polyhedra.cpp'
--- pkg/dem/Polyhedra.cpp	2016-04-15 09:52:40 +0000
+++ pkg/dem/Polyhedra.cpp	2016-04-19 01:27:38 +0000
@@ -481,7 +481,12 @@
 
 		if(shearForce.squaredNorm() > maxFs && maxFs){
 			//PFC3d SlipModel, is using friction angle. CoulombCriterion
-			const Real ratio = sqrt(maxFs) / shearForce.norm();
+			Real ratio = sqrt(maxFs) / shearForce.norm();
+			if (std::isinf(ratio)) {
+				LOG_DEBUG(shearForce.squaredNorm() > maxFs && maxFs); // the condition should be 1 (we are in this branch), but is actually 0
+				LOG_DEBUG(shearForce); // should be (0,0,0)
+				ratio = 0;
+			}
 
 			//Store prev force for definition of plastic slip
 			//Define the plastic work input and increment the total plastic energy dissipated