← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3933: Minor changes (not affecting results) in these scripts towards an easier understanding

 

------------------------------------------------------------
revno: 3933
committer: Jerome Duriez <jerome.duriez@xxxxxxxxxxxxxxx>
timestamp: Mon 2014-05-05 14:42:06 +0200
message:
  Minor changes (not affecting results) in these scripts towards an easier understanding
modified:
  examples/jointedCohesiveFrictionalPM/gravityBis.py
  examples/jointedCohesiveFrictionalPM/identifBis.py


--
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 'examples/jointedCohesiveFrictionalPM/gravityBis.py'
--- examples/jointedCohesiveFrictionalPM/gravityBis.py	2013-11-04 14:30:22 +0000
+++ examples/jointedCohesiveFrictionalPM/gravityBis.py	2014-05-05 12:42:06 +0000
@@ -18,7 +18,7 @@
 poros=0.13
 rMeanSpheres = dimModele * pow(3.0/4.0*(1-poros)/(pi*nSpheres),1.0/3.0)
 print ''
-print 'Creating a cubic sample of spheres (may take some time)'
+print 'Creating a cubic sample of spheres (may take some time and cause warnings)'
 print ''
 sp = pack.randomDensePack(pred,radius=rMeanSpheres,rRelFuzz=0.3,memoizeDb='/tmp/gts-triax-packings.sqlite',returnSpherePack=True)
 sp.toSimulation(color=(0.9,0.8,0.6),wire=False,material=mat)
@@ -99,20 +99,20 @@
 
 #### dataCollector
 from yade import plot
-plot.plots={'iterations':('v',)}
-#plot.plots={'x':('z',)}
+plot.plots={'iterations':'v','x':'z'}
+
 def dataCollector():
 	R=O.bodies[refPoint]
 	plot.addData(v=R.state.vel[2],z=R.state.pos[2],x=R.state.pos[0],iterations=O.iter,t=O.realtime)
 
 #### joint strength degradation
-stableIter=2000
+stableIter=1000
 stableVel=0.001
 degrade=True
 def jointStrengthDegradation():
     global degrade
     if degrade and O.iter>=stableIter and abs(O.bodies[refPoint].state.vel[2])<stableVel :
-	print '!joint cohesion total degradation!', ' | iteration=', O.iter
+	print 'Equilibrium reached \nJoint cohesion canceled now !', ' | iteration=', O.iter
 	degrade=False
 	for i in O.interactions:
 	    if i.phys.isOnJoint : 
@@ -121,9 +121,7 @@
 		  i.phys.FnMax=0.
 		  i.phys.FsMax=0.
 
-O.step()
-
 print 'Seeking after an initial equilibrium state'
 print ''
 O.run(10000)
-plot.plot()# note the straight line (during sliding step, before free fall) despite the discretization of joint plane with spheres
+plot.plot()# note the straight trajectory (z(x) plot)during sliding step (before free fall) despite the discretization of joint plane with spheres

=== modified file 'examples/jointedCohesiveFrictionalPM/identifBis.py'
--- examples/jointedCohesiveFrictionalPM/identifBis.py	2013-11-04 14:20:24 +0000
+++ examples/jointedCohesiveFrictionalPM/identifBis.py	2014-05-05 12:42:06 +0000
@@ -5,27 +5,19 @@
 # The sample (spheres + facets) has to exist already, with their JCFpmMat
 
 
-############################ engines definition
-interactionRadius=1.;
+### engines definition, according to our only goal that is to detect spheres concerned by joint surfaces
+
 O.engines=[
-
-	ForceResetter(),
-	InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius,label='is2aabb'),Bo1_Facet_Aabb()]),
+	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()],verletDist=0), #verletDist=0 to avoid introducing NewtonIntegrator in engines list
 	InteractionLoop(
-		[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius,label='ss2d3dg'),Ig2_Facet_Sphere_ScGeom()],
+		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
 		[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
 		[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(smoothJoint=True,label='interactionLaw')]
-	),
-	NewtonIntegrator(damping=1)
-
+	)
 ]
 
-############################ timestep + opening yade windows
-O.dt=0.001*utils.PWaveTimeStep()
+O.dt=1 # whatever value is ok
 
-# from yade import qt
-# v=qt.Controller()
-# v=qt.View()
 
 ############################ Identification spheres on joint
 #### color set for particles on joint
@@ -35,9 +27,10 @@
 jointcolor4=(1,1,1)
 jointcolor5=(0,0,0)
 
+
+O.step(); # one step to know interactions
+
 #### first step-> find spheres on facet
-O.step();
-
 for i in O.interactions:
     ##if not i.isReal : continue
     ### Rk: facet are only stored in id1 
@@ -125,36 +118,17 @@
 		    elif facetSphereDir.dot(jointNormalRef)<0:
 			O.bodies[othSph].state.jointNormal1=-jointNormalRef
 
-#### for visualization:
-#bj=0
-#vert=(0.,1.,0.)
-#hor=(0.,1.,1.)
-#for o in O.bodies:
-    #if o.state.onJoint==True : # or o.shape.name=='Facet':
-	##if  o.shape.name=='Facet':
-	    ##o.shape.wire=True
-	##o.state.pos+=(0,50,0)
-	##bj+=1
-	#if o.state.jointNormal1.dot(hor)>0 :
-	    ##o.state.pos+=(0,50,0)
-	    #o.shape.color=jointcolor1
-	#elif o.state.jointNormal1.dot(hor)<0 :
-	    ##o.state.pos+=(0,55,0)
-	    #o.shape.color=jointcolor2
-	#if o.mat.type>2 :
-	    #bj+=1
-	    #o.shape.color=jointcolor5
-	    ##print o.state.jointNormal.dot(vert)
-
-
-##### to delete facets (should be OK to start the simulation after that!
+
+
+##### to delete facets
 for b in O.bodies:
     if isinstance(b.shape,Facet):
 	O.bodies.erase(b.id)
 
 O.resetTime()
 O.interactions.clear()
-print '\n IdentificationSpheresOnJoint executed ! Spheres onJoint (and so on...) detected, facets deleted\n\n'
+
+print '\nIdentificationSpheresOnJoint executed ! Spheres onJoint (and so on...) detected, facets deleted, simulation may go on.\n\n'