← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2533: 1. Fix examples, delete a few other ones

 

------------------------------------------------------------
revno: 2533
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-11-07 09:55:43 +0100
message:
  1. Fix examples, delete a few other ones 
  2. Fix a bug in post2d
removed:
  examples/chain-distant-interactions.py
  examples/constitutive-law.py
  examples/cylindrical-layer-packing.py
renamed:
  examples/dynamic_simulation_tests/ => examples/ring2d/
  examples/mindlin_test.py => scripts/test/mindlin.py
  examples/rod_penetration/ => examples/rod-penetration/
  examples/rotatingCylinder.py => examples/rotating-cylinder.py
modified:
  examples/bulldozer/bulldozer.py
  examples/concrete/uniax.py
  examples/ring2d/ringCundallDamping.py
  examples/ring2d/ringSimpleViscoelastic.py
  examples/rod-penetration/model.py
  pkg/common/GravityEngines.hpp
  py/post2d.py
  examples/rotating-cylinder.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/bulldozer/bulldozer.py'
--- examples/bulldozer/bulldozer.py	2010-10-29 10:12:44 +0000
+++ examples/bulldozer/bulldozer.py	2010-11-07 08:55:43 +0000
@@ -80,5 +80,6 @@
 qt.View()
 r=qt.Renderer()
 r.lightPos=Vector3(0,0,50)
-O.run(2000); O.wait()
+O.stopAtIter=2000
+O.run()
 #utils.encodeVideoFromFrames(snapshooter.savedSnapshots,out='/tmp/bulldozer.ogg',fps=2)

=== removed file 'examples/chain-distant-interactions.py'
--- examples/chain-distant-interactions.py	2010-09-27 17:47:59 +0000
+++ examples/chain-distant-interactions.py	1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-
-O.engines=[
-	ForceResetter(),
-	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
-	InteractionLoop(
-		## Create geometry information about each potential collision.
-		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
-		## Create physical information about the interaction.
-		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
-		## Constitutive law
-		[Law2_ScGeom_ViscElPhys_Basic()],
-	),
-	TorqueEngine(subscribedBodies=[1],moment=(0,1000,0)),
-	GravityEngine(gravity=(0,0,1e-2)),
-	NewtonIntegrator(damping=0.2)
-]
-
-from yade import utils
-from math import *
-for n in range(5):
-	O.bodies.append(utils.sphere([0,n,0],.5,dynamic=(n>0),color=[1-(n/20.),n/20.,0]))
-	# looks for metaengine found in Omega() and uses those
-	if n>0: utils.createInteraction(n-1,n)
-for i in O.interactions: i.phys['ks']=1e7
-
-
-O.dt=utils.PWaveTimeStep()
-O.saveTmp('init')
-
-try:
-	from yade import qt
-	qt.View()
-	renderer=qt.Renderer()
-	renderer.wire=True
-	renderer.intrGeom=True
-except ImportError: pass

=== modified file 'examples/concrete/uniax.py'
--- examples/concrete/uniax.py	2010-09-27 17:47:59 +0000
+++ examples/concrete/uniax.py	2010-11-07 08:55:43 +0000
@@ -50,7 +50,7 @@
 	relDuctility=30,
 
 	intRadius=1.5,
-	dtSafety=.01,
+	dtSafety=.8,
 	damping=0.4,
 	strainRateTension=.05,
 	strainRateCompression=.5,
@@ -65,7 +65,7 @@
 	isoPrestress=0,
 
 	# use the ScGeom variant
-	scGeom=True
+	scGeom=False
 )
 
 from yade.params.table import *
@@ -177,7 +177,9 @@
 		'sigma.50':utils.forcesOnCoordPlane(coord_50,axis)[axis]/area_50+isoPrestress,
 		'sigma.75':utils.forcesOnCoordPlane(coord_75,axis)[axis]/area_75+isoPrestress,
 		})
-
+plot.plot()
+O.run()
+utils.waitIfBatch()
 #initTest()
 # sleep forever if run by yade-multi, exit is called from stopIfDamaged
 #if os.environ.has_key('PARAM_TABLE'): time.sleep(1e12)

=== removed file 'examples/constitutive-law.py'
--- examples/constitutive-law.py	2010-10-29 10:12:44 +0000
+++ examples/constitutive-law.py	1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-O.engines=[
-	ForceResetter(),
-	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
-	InteractionLoop(
-		[Ig2_Sphere_Sphere_ScGeom()],
-		[Ip2_FrictMat_FrictMat_FrictPhys()],
-		[Law2_ScGeom_FrictPhys_CundallStrack()]
-	),
-	GravityEngine(gravity=(0,0,-1000)),
-	NewtonIntegrator(damping=0.2)
-]
-
-for n in range(30):
-	O.bodies.append(utils.sphere([0,n,0],.50001,dynamic=(n>0),color=[1-(n/20.),n/20.,0]))
-O.bodies[len(O.bodies)-1].dynamic=False
-#	# looks for metaengine found in Omega() and uses those
-#	if n>0: utils.createInteraction(n-1,n)
-#for i in O.interactions: i.phys['ks']=1e9
-
-O.dt=utils.PWaveTimeStep()*0.001
-O.saveTmp('init')
-
-try:
-	from yade import qt
-	qt.View()
-	renderer=qt.Renderer()
-	renderer.wire=True
-	renderer.intrGeom=True
-except ImportError: pass
-
-O.run(100000,True)
-

=== removed file 'examples/cylindrical-layer-packing.py'
--- examples/cylindrical-layer-packing.py	2010-10-29 10:12:44 +0000
+++ examples/cylindrical-layer-packing.py	1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-from math import *
-
-
-O.engines=[
-	ForceResetter(),
-	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
-	IGeomDispatcher([Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()]),
-	IPhysDispatcher([Ip2_FrictMat_FrictMat_FrictPhys()]),
-	ElasticContactLaw(),
-	#GlobalStiffnessTimeStepper(defaultDt=1e-5,active=True,timeStepUpdateInterval=500),
-	AxialGravityEngine(axisPoint=(0,0,0),axisDirection=(1,0,0),acceleration=1e3),
-	NewtonIntegrator(damping=.4)
-]
-
-rCenter=4
-rBall=.2
-wallThickness=2*rBall
-wallSize=5*rCenter
-wallDist=5*rBall
-#central cylinder composed of several spheres
-nMax=10
-for n in range(nMax):
-	x=wallDist*(n/nMax-.5)
-	O.bodies.append(utils.sphere([x,0,0],rCenter))
-
-#lateral walls, they have wallDist gap inbetween
-wLat1=utils.box([0+.5*wallDist+.5*wallThickness,0,0],[.5*wallThickness,wallSize,wallSize]); O.bodies.append(wLat1);
-wLat2=utils.box([0-.5*wallDist-.5*wallThickness,0,0],[.5*wallThickness,wallSize,wallSize]); O.bodies.append(wLat2);
-
-#angle walls, they cross at the x-axis
-wAng1=utils.box([0,0,0],[.55*wallDist,.5*wallThickness,wallSize*sqrt(2)]); wAng1.state.ori=Quaternion((1,0,0),pi/4); O.bodies.append(wAng1); 
-wAng2=utils.box([0,0,0],[.55*wallDist,.5*wallThickness,wallSize*sqrt(2)]); wAng2.state.ori=Quaternion((1,0,0),-pi/4); O.bodies.append(wAng2)
-
-#cap
-wCap=utils.box([0,0,wallSize],[.55*wallDist,wallSize,.5*wallThickness]); O.bodies.append(wCap)
-
-# all bodies up to now are fixed and only wire is will be shown
-for b in O.bodies:
-	b.shape.wire=True
-	b.dynamic=False
-
-import random
-def randomColor():
-	return [random.random(),random.random(),random.random()]
-
-### now the falling balls in 
-maxima=[.5*(wallDist/rBall),rCenter/rBall,rCenter/rBall] # number of spheres in x,y,z directions
-for ix in range(int(maxima[0])):
-	for iy in range(int(maxima[1])):
-		for iz in range(int(maxima[2])):
-			x,y,z=2.0*rBall*(ix-maxima[0]/2+.5),2.0*rBall*(iy-maxima[1]/2+.5),2.0*rBall*iz+2*rCenter
-			#print x,y,z,rBall
-			O.bodies.append(utils.sphere([x,y,z],rBall))
-
-O.dt=.1*utils.PWaveTimeStep()
-
-O.saveTmp()
-
-try:
-	from yade import qt
-	qt.Controller()
-	qt.View()
-except ImportError: pass
-

=== renamed directory 'examples/dynamic_simulation_tests' => 'examples/ring2d'
=== modified file 'examples/ring2d/ringCundallDamping.py'
--- examples/dynamic_simulation_tests/ringCundallDamping.py	2010-10-29 10:12:44 +0000
+++ examples/ring2d/ringCundallDamping.py	2010-11-07 08:55:43 +0000
@@ -4,12 +4,6 @@
 from yade import utils
 from yade import ymport
 
-## Omega
-o=Omega() 
-
-## PhysicalParameters 
-#Density=500
-#frictionAngle=radians(30)
 sphereRadius=0.05
 
 ## Import wall's geometry
@@ -55,13 +49,12 @@
 	NewtonIntegrator(damping=0.3),
 
 	## Apply kinematics to walls
-    ## angularVelocity = 0.73 rad/sec = 7 rpm
+   ## angularVelocity = 0.73 rad/sec = 7 rpm
 	RotationEngine(subscribedBodies=walls,rotationAxis=[0,0,1],rotateAroundZero=True,angularVelocity=0.73)
 ]
 
 for b in o.bodies:
-    if b.shape.name=='Sphere':
-        b.state.blockedDOFs=['z'] # blocked movement along Z
+    if isinstance(b.shape,Sphere): b.state.blockedDOFs=['z'] # blocked movement along Z
 
 o.dt=0.02*utils.PWaveTimeStep()
 

=== modified file 'examples/ring2d/ringSimpleViscoelastic.py'
--- examples/dynamic_simulation_tests/ringSimpleViscoelastic.py	2010-10-27 14:59:02 +0000
+++ examples/ring2d/ringSimpleViscoelastic.py	2010-11-07 08:55:43 +0000
@@ -72,8 +72,8 @@
 ]
 
 for b in o.bodies:
-    if b.shape.name=='Sphere':
-        b.state.blockedDOFs=['z']
+    if isinstance(b.shape.name,Sphere):
+		 b.state.blockedDOFs=['z']
 
 o.dt=0.02*tc
 

=== renamed directory 'examples/rod_penetration' => 'examples/rod-penetration'
=== modified file 'examples/rod-penetration/model.py'
--- examples/rod_penetration/model.py	2010-10-29 10:12:44 +0000
+++ examples/rod-penetration/model.py	2010-11-07 08:55:43 +0000
@@ -75,6 +75,9 @@
 from yade import qt
 qt.View()
 
+O.stopAtIter=nbIter
+O.run()
+
 #for t in xrange(2):
 #	start=time.time();O.run(nbIter);O.wait();finish=time.time() 
 #	speed=nbIter/(finish-start); print '%g iter/sec\n'%speed

=== renamed file 'examples/rotatingCylinder.py' => 'examples/rotating-cylinder.py'
--- examples/rotatingCylinder.py	2010-10-29 10:12:44 +0000
+++ examples/rotating-cylinder.py	2010-11-07 08:55:43 +0000
@@ -2,8 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """The script demonstrates rotating cylinder, created with GTS-help (http://gts.sourceforge.net/).
-Inside the cylinder there are a "cloud" of spheres."""
-
+Inside the cylinder there is a "cloud" of spheres."""
 
 cylHt,cylRd=1,.2
 nSpheres=2e4
@@ -22,7 +21,7 @@
 	of height 2 and radius 2, centered at origin, axis coincident with
 	the z-axis.
 
-	@param nDiv: polyhedron approximating circle.
+	:param int nDiv: polyhedron approximating circle.
 	"""
 	import numpy; from yade import pack
 	thetas=numpy.linspace(0,2*pi,nDiv,endpoint=True)

=== modified file 'pkg/common/GravityEngines.hpp'
--- pkg/common/GravityEngines.hpp	2010-11-05 14:13:01 +0000
+++ pkg/common/GravityEngines.hpp	2010-11-07 08:55:43 +0000
@@ -54,11 +54,11 @@
 	public:
 	Vector2i readSysfsFile(const std::string& name);
 	virtual void action();
-	YADE_CLASS_BASE_DOC_ATTRS(HdapsGravityEngine,GravityEngine,"Read accelerometer in Thinkpad laptops (`HDAPS <http://en.wikipedia.org/wiki/Active_hard_drive_protection>`__ and accordingly set gravity within the simulation. This code draws from `hdaps-gl <https://sourceforge.net/project/showfiles.php?group_id=138242>`__ .",
+	YADE_CLASS_BASE_DOC_ATTRS(HdapsGravityEngine,GravityEngine,"Read accelerometer in Thinkpad laptops (`HDAPS <http://en.wikipedia.org/wiki/Active_hard_drive_protection>`__ and accordingly set gravity within the simulation. This code draws from `hdaps-gl <https://sourceforge.net/project/showfiles.php?group_id=138242>`__ . See :ysrc:`scripts/test/hdaps.py` for an example.",
 		((string,hdapsDir,"/sys/devices/platform/hdaps",,"Hdaps directory; contains ``position`` (with accelerometer readings) and ``calibration`` (zero acceleration)."))
 		((Real,msecUpdate,50,,"How often to update the reading."))
 		((int,updateThreshold,4,,"Minimum difference of reading from the file before updating gravity, to avoid jitter."))
-		((Real,lastReading,-1,Attr::hidden|Attr::noSave,"Time of the last reading."))
+		((Real,lastReading,-1,(Attr::hidden|Attr::noSave),"Time of the last reading."))
 		((Vector2i,accel,Vector2i::Zero(),(Attr::noSave|Attr::readonly),"reading from the sysfs file"))
 		((Vector2i,calibrate,Vector2i::Zero(),,"Zero position; if NaN, will be read from the *hdapsDir* / calibrate."))
 		((bool,calibrated,false,,"Whether *calibrate* was already updated. Do not set to ``True`` by hand unless you also give a meaningful value for *calibrate*."))

=== modified file 'py/post2d.py'
--- py/post2d.py	2010-11-02 12:02:13 +0000
+++ py/post2d.py	2010-11-07 08:55:43 +0000
@@ -218,7 +218,7 @@
 	ddd2=numpy.zeros((len(yyy),len(xxx)),float)
 	# set the type of average we are going to use
 	if perArea==0:
-		def compAvg(gauss,coord): return float(gauss.avg(coord))
+		def compAvg(gauss,coord,cellCoord): return float(gauss.avg(coord))
 	elif perArea==1:
 		def compAvg(gauss,coord,cellCoord): return gauss.avgPerUnitArea(coord)
 	elif perArea==2:

=== renamed file 'examples/mindlin_test.py' => 'scripts/test/mindlin.py'