← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2371: - Replace of .isDynamic (deprecated) by .dynamic in some python scripts

 

------------------------------------------------------------
revno: 2371
committer: jduriez <jduriez@c1solimara-l>
branch nick: trunk
timestamp: Fri 2010-07-16 12:25:03 +0200
message:
  - Replace of .isDynamic (deprecated) by .dynamic in some python scripts
  
  - Re-use of go(..., Scene *) in Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity::go() (but why this note in https://www.yade-dem.org/sphinx/prog.html#scene)
   => solves "my" problems with Bruno's changes (unrelated thus...)
  
  - missing line in KinemCTDEngine.cpp
  
  - Line commented in NormalInelasticityTest.py, and the Ip2 corrected
added:
  scripts/SimpleShear.py
modified:
  examples/cylindrical-layer-packing.py
  examples/simple-scene/simple-scene.py
  pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp
  pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.hpp
  pkg/dem/Engine/PartialEngine/KinemCTDEngine.cpp
  scripts/NormalInelasticityTest.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 'examples/cylindrical-layer-packing.py'
--- examples/cylindrical-layer-packing.py	2010-05-29 20:52:10 +0000
+++ examples/cylindrical-layer-packing.py	2010-07-16 10:25:03 +0000
@@ -48,7 +48,7 @@
 # all bodies up to now are fixed and only wire is will be shown
 for b in o.bodies:
 	b.shape.wire=True
-	b.isDynamic=False
+	b.dynamic=False
 
 import random
 def randomColor():

=== modified file 'examples/simple-scene/simple-scene.py'
--- examples/simple-scene/simple-scene.py	2010-05-29 20:52:10 +0000
+++ examples/simple-scene/simple-scene.py	2010-07-16 10:25:03 +0000
@@ -94,7 +94,7 @@
 	# Create empty body object
 	b=Body()
 	# set the isDynamic body attribute
-	b.isDynamic=False
+	b.dynamic=False
 	# Assign geometrical model (shape) to the body: a box of given size
 	b.shape=Box(extents=[.5,.5,.5],diffuseColor=[1,0,0])
 	# physical parameters:

=== modified file 'pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp'
--- pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp	2010-07-15 11:29:59 +0000
+++ pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp	2010-07-16 10:25:03 +0000
@@ -16,7 +16,7 @@
 
 
 
-void Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity::go(shared_ptr<InteractionGeometry>& iG, shared_ptr<InteractionPhysics>& iP, Interaction* contact)
+void Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity::go(shared_ptr<InteractionGeometry>& iG, shared_ptr<InteractionPhysics>& iP, Interaction* contact, Scene* scene)
 {
 
 	const Real& dt = scene->dt;

=== modified file 'pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.hpp'
--- pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.hpp	2010-07-15 11:29:59 +0000
+++ pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.hpp	2010-07-16 10:25:03 +0000
@@ -20,7 +20,7 @@
 class Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity : public LawFunctor
 {
 	public :
-		virtual void go(shared_ptr<InteractionGeometry>&, shared_ptr<InteractionPhysics>&, Interaction*);
+		virtual void go(shared_ptr<InteractionGeometry>&, shared_ptr<InteractionPhysics>&, Interaction*, Scene*);
 
 	FUNCTOR2D(ScGeom,NormalInelasticityPhys);
 

=== modified file 'pkg/dem/Engine/PartialEngine/KinemCTDEngine.cpp'
--- pkg/dem/Engine/PartialEngine/KinemCTDEngine.cpp	2010-07-15 11:29:59 +0000
+++ pkg/dem/Engine/PartialEngine/KinemCTDEngine.cpp	2010-07-16 10:25:03 +0000
@@ -25,6 +25,7 @@
 
 	scene->forces.sync();
 	Real current_NormalForce=(scene->forces.getForce(id_topbox)).y();
+	KinemSimpleShearBox::computeScontact();
 	current_sigma=current_NormalForce/(1000.0*Scontact);	// so we have the current value of sigma, in kPa
 
 	if( ((compSpeed > 0) && (current_sigma < targetSigma)) || ((compSpeed < 0) && (current_sigma > targetSigma)) )

=== modified file 'scripts/NormalInelasticityTest.py'
--- scripts/NormalInelasticityTest.py	2010-07-12 12:57:29 +0000
+++ scripts/NormalInelasticityTest.py	2010-07-16 10:25:03 +0000
@@ -24,7 +24,7 @@
 	InsertionSortCollider(),
 	InteractionDispatchers(
 			      [Ig2_Sphere_Sphere_ScGeom()],
-			      [Ip2_2xCohFrictMat_NormalInelasticityPhys()],
+			      [Ip2_2xNormalInelasticMat_NormalInelasticityPhys()],
 			      [Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity()]
 			      ),
 	PeriodicPythonRunner(iterPeriod=1,command='letMove()')
@@ -74,28 +74,28 @@
 
 # ------ Test of the law in the tangential direction, using StepDisplacer ------ #
 
-DPos=Vector3.Zero
-Vector3.__init__(DPos,1*O.dt,0,0)
-
-O.engines=O.engines[:4]+[StepDisplacer(subscribedBodies=[1],deltaSe3=(DPos,Quaternion.Identity),setVelocities=True)]+O.engines[5:]
-O.run(1000)
-plot.plots={'step':('gamma',),'gamma':('Fx',)}
-plot.plot()
-plot.plots={'Normfn':('Fx',)}
-plot.plot()
-#Comments => 	- evolution of Fx with gamma normal (flat at the beginning because of the order of engines)
-#		- un decreases indeed during this shear, but a zoom on the curves is needed to see it.
-#		- We can observe that the force state of the sample decreases a line with a slope equal to tan(~34.5°)=tan(~0.602 rad). Why not strict equality ? Because of the measure of the slope or because something else ? To see...
-
-
-
-# ------ Test of the law for the moment, using blockedDOF_s ------ #
-O.loadTmp('EndComp')
-
-#To use blockedDOF_s, the body has to be dynamic....
-UpperSphere.isDynamic=True
-UpperSphere.state.blockedDOFs='x','rx','y','ry','z','rz'
-UpperSphere.state.angVel=Vector3(0,0,1)
+#DPos=Vector3.Zero
+#Vector3.__init__(DPos,1*O.dt,0,0)
+
+#O.engines=O.engines[:4]+[StepDisplacer(subscribedBodies=[1],deltaSe3=(DPos,Quaternion.Identity),setVelocities=True)]+O.engines[5:]
+#O.run(1000)
+#plot.plots={'step':('gamma',),'gamma':('Fx',)}
+#plot.plot()
+#plot.plots={'Normfn':('Fx',)}
+#plot.plot()
+##Comments => 	- evolution of Fx with gamma normal (flat at the beginning because of the order of engines)
+##		- un decreases indeed during this shear, but a zoom on the curves is needed to see it.
+##		- We can observe that the force state of the sample decreases a line with a slope equal to tan(~34.5°)=tan(~0.602 rad). Why not strict equality ? Because of the measure of the slope or because something else ? To see...
+
+
+
+## ------ Test of the law for the moment, using blockedDOF_s ------ #
+#O.loadTmp('EndComp')
+
+##To use blockedDOF_s, the body has to be dynamic....
+#UpperSphere.dynamic=True
+#UpperSphere.state.blockedDOFs='x','rx','y','ry','z','rz'
+#UpperSphere.state.angVel=Vector3(0,0,1)
 
 
 

=== added file 'scripts/SimpleShear.py'
--- scripts/SimpleShear.py	1970-01-01 00:00:00 +0000
+++ scripts/SimpleShear.py	2010-07-16 10:25:03 +0000
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+
+# J. Duriez duriez@xxxxxxxxxxxxxxx
+# "PreProcessor" script to define a numerical model for simple shear box
+# In order to test various Kinem...Engine
+
+
+from yade import plot
+from yade.pack import *
+
+
+O=Omega() 
+O.initializers=[
+		BoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()])
+]
+O.engines=[
+	ForceResetter(),
+	BoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
+	InsertionSortCollider(),
+	InteractionDispatchers(
+		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
+		[Ip2_2xNormalInelasticMat_NormalInelasticityPhys()],
+		[Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity()]
+	),
+	NewtonIntegrator(damping=.2)
+	,PeriodicPythonRunner(iterPeriod=1,command='print O.interactions.countReal()')
+	]
+
+
+#Def of the material which will be used
+O.materials.append(NormalInelasticMat(density=2600,young=4.0e9,poisson=.04,frictionAngle=.6,coeff_dech=3.0,label='Materiau1'))
+
+#Def of dimensions of the box
+#length=5
+#height=1
+#width=2
+length=0.1
+height=0.02
+width=0.04
+thickness=0.001
+
+porosity = 0.7
+Nspheres=800
+Rmean = pow( ((1-porosity) * length * height * width) / (Nspheres * 4.0/3.0 * pi) , 1.0/3.0 )
+
+#Definition of bodies constituing the numerical model : six boxes corresponding to sids of the simple shear box, containing a particle samples
+pred=inAlignedBox((0,0,-0.02),(0.1,0.02,0.02))
+
+LeftBox = utils.box( center=(-thickness/2.0,(height)/2.0,0), extents=(thickness/2.0,5*(height/2.0+thickness),width/2.0) ,dynamic=False,wire=True)
+
+LowBox = utils.box( center=(length/2.0,-thickness/2.0,0), extents=(length/2.0,thickness/2.0,width/2.0) ,dynamic=False,wire=True)
+
+RightBox = utils.box( center=(length+thickness/2.0,height/2.0,0), extents=(thickness/2.0,5*(height/2.0+thickness),width/2.0) ,dynamic=False,wire=True)
+
+UpBox = utils.box( center=(length/2.0,height+thickness/2.0,0), extents=(length/2.0,thickness/2.0,width/2.0) ,dynamic=False,wire=True)
+
+BehindBox = utils.box( center=(length/2.0,height/2.0,-width/2.0-thickness/2.0), extents=(2.5*length/2.0,height/2.0+thickness,thickness/2.0), dynamic=False,wire=True)
+
+InFrontBox = utils.box( center=(length/2.0,height/2.0,width/2.0+thickness/2.0), extents=(2.5*length/2.0,height/2.0+thickness,thickness/2.0), dynamic=False,wire=True)
+
+O.bodies.append([LeftBox,LowBox,RightBox,UpBox,BehindBox,InFrontBox])
+
+memoizeDb='/tmp/simpleshear-triax-packings.sqlite'
+#ListSph=randomDensePack(pred,radius=0.002,rRelFuzz=0.15,memoDbg=True,memoizeDb=memoizeDb)
+#ListSph=randomDensePack(pred,radius=0.002,rRelFuzz=0.15,memoDbg=True,memoizeDb=memoizeDb,spheresInCell=100)
+#O.bodies.append(ListSph)
+
+sp=yade._packSpheres.SpherePack()
+sp.makeCloud(Vector3(0,0.0,-width/2.0),Vector3(length,height,width/2.0),Rmean,.15)
+O.bodies.append([utils.sphere(s[0],s[1]) for s in sp])
+
+from yade import qt
+qt.View()
+#O.save("SimpleShearReady.xml")
+O.saveTmp("InitialState")
+
+
+#Compression
+O.engines = O.engines+[KinemCTDEngine(compSpeed=0.5,sigma_save=(),temoin_save=(),targetSigma=2000.0,LOG=False)]
+#from yade import log
+#log.setLevel("KinemCTDEngine",log.TRACE)
+#log.setLevel('',log.TRACE)
+O.dt=.4*utils.PWaveTimeStep()
+O.run()