← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2190: Some examples clean

 

------------------------------------------------------------
revno: 2190
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-05-02 17:59:40 +0200
message:
  Some examples clean
added:
  examples/bulldozer/
  examples/bulldozer/README
renamed:
  examples/buldozer.py => examples/bulldozer/bulldozer.py
  examples/buldozerVTK.py => examples/bulldozer/bulldozerVTK.py
  examples/collider-perf/ => scripts/test/collider-perf/
  examples/triax-perf/ => scripts/test/triax-perf/
modified:
  examples/concrete/uniax.py
  examples/dynamic_simulation_tests/ringCundallDamping.py
  examples/dynamic_simulation_tests/ringSimpleViscoelastic.py
  examples/funnel.py
  examples/rod_penetration/model.py
  py/ymport.py
  examples/bulldozer/bulldozer.py
  examples/bulldozer/bulldozerVTK.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
=== added directory 'examples/bulldozer'
=== added file 'examples/bulldozer/README'
--- examples/bulldozer/README	1970-01-01 00:00:00 +0000
+++ examples/bulldozer/README	2010-05-02 15:59:40 +0000
@@ -0,0 +1,9 @@
+bulldozer.py and bulldozerVTK.py show how simple it is possible to simulate relatively difficult things.
+
+bulldozer.py is using Law2_Dem3DofGeom_FrictPhys_Basic constitutive law for interaction between elements.
+It stores screenshots from simulation in /tmp/bulldozer-????.png files and creates video then.
+
+bulldozerVTK.py is using Law2_ScGeom_ViscElPhys_Basic - visco-elastic model for interaction between elements.
+Also it saves snapshots in VTK-format in /tmp/bulldozer-*.vtk files. If you open those with paraview
+(or other VTK-based) programm, you can create video from them, make screenshots etc.
+

=== renamed file 'examples/buldozer.py' => 'examples/bulldozer/bulldozer.py'
--- examples/buldozer.py	2010-03-07 19:53:42 +0000
+++ examples/bulldozer/bulldozer.py	2010-05-02 15:59:40 +0000
@@ -69,7 +69,7 @@
 	GravityEngine(gravity=(0,0,-9.8)),
 	TranslationEngine(translationAxis=[1,0,0],velocity=5,subscribedBodies=KnifeIDs), # Buldozer motion
 	NewtonIntegrator(damping=.3),
-	SnapshotEngine(iterPeriod=1600,fileBase='/tmp/buldozer-',viewNo=0,label='snapshooter'),
+	SnapshotEngine(iterPeriod=100,fileBase='/tmp/bulldozer-',viewNo=0,label='snapshooter'),
 ]
 
 O.saveTmp()
@@ -77,7 +77,6 @@
 qt.Controller()
 qt.View()
 r=qt.Renderer()
-r['Light_position']=Vector3(0,0,50)
-O.run(1500000); O.wait()
-utils.encodeVideoFromFrames(snapshooter['savedSnapshots'],out='/tmp/buldozer.ogg',fps=30)
-
+r.lightPos=Vector3(0,0,50)
+O.run(2000); O.wait()
+utils.encodeVideoFromFrames(snapshooter.savedSnapshots,out='/tmp/bulldozer.ogg',fps=2)

=== renamed file 'examples/buldozerVTK.py' => 'examples/bulldozer/bulldozerVTK.py'
--- examples/buldozerVTK.py	2010-04-10 15:11:48 +0000
+++ examples/bulldozer/bulldozerVTK.py	2010-05-02 15:59:40 +0000
@@ -11,6 +11,7 @@
 numKnifeParts = 10
 radiusKnife=1
 lengthKnife=2
+buldozerHeight=1.2
 radiusSph = 0.05
 numBoxes = Vector3(8,5,2)
 gapBetweenBoxes = 0.05
@@ -37,6 +38,11 @@
 KnifeP=[Knife,[p+Vector3(0,lengthKnife,0) for p in Knife]]
 KnifePoly=pack.sweptPolylines2gtsSurface(KnifeP,threshold=1e-4)
 KnifeIDs=O.bodies.append(pack.gtsSurface2Facets(KnifePoly,color=(1,0,0),wire=False,material=facetMat))
+
+KnifeIDs+=O.bodies.append(utils.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False))
+
+KnifeIDs+=O.bodies.append(utils.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False))
+
 O.bodies.append(utils.facetBox((0,0,radiusKnife),(lengthKnife*3,lengthKnife*3,lengthKnife),wallMask=16,color=(1,1,1),wire=False,material=facetMat))
 
 
@@ -51,8 +57,8 @@
 	ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((xyz[0]*(sizeBox+gapBetweenBoxes),xyz[1]*(sizeBox+gapBetweenBoxes)+sizeBox*0.5,xyz[2]*(sizeBox+gapBetweenBoxes)-radiusKnife+sizeBox*0.6),(sizeBox/2,sizeBox/2,sizeBox/2)),radius=radiusSph,gap=0,color=colorSph,material=sphereMat))
 	for id in ids_spheres[1]:
 		s=O.bodies[id]
-		p=utils.getViscoelasticFromSpheresInteraction(s.state['mass'],tc,en,es)
-		s.mat['kn'],s.mat['cn'],s.mat['ks'],s.mat['cs']=p['kn'],p['cn'],p['ks'],p['cs']
+		p=utils.getViscoelasticFromSpheresInteraction(s.state.mass,tc,en,es)
+		s.mat.kn,s.mat.cn,s.mat.ks,s.mat.cs=p['kn'],p['cn'],p['ks'],p['cs']
 	if (colorSph==colorsph1):
 		colorSph=colorsph2
 	else:
@@ -69,12 +75,12 @@
 	InteractionDispatchers(
 		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
 		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
-		[Law2_Spheres_Viscoelastic_SimpleViscoelastic()],
+		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
 	GravityEngine(gravity=[0,0,-9.8]),
 	TranslationEngine(translationAxis=[1,0,0],velocity=2,subscribedBodies=KnifeIDs), # Buldozer motion
 	NewtonIntegrator(damping=0),
-	VTKRecorder(virtPeriod=0.01,fileName='/tmp/buldozer-',recorders=['spheres','facets'])
+	VTKRecorder(iterPeriod=1000,fileName='/tmp/bulldozer-',recorders=['spheres','facets'])
 ]
 
 O.saveTmp()
@@ -82,7 +88,7 @@
 qt.Controller()
 qt.View()
 r=qt.Renderer()
-r['Light_position']=Vector3(0,0,50)
-O.run()
+r.lightPos=Vector3(0,0,50)
+O.run(20000)
 #qt.makeSimulationVideo('/tmp/buldozer.ogg',iterPeriod=1000,fps=30)
 

=== modified file 'examples/concrete/uniax.py'
--- examples/concrete/uniax.py	2010-04-19 10:18:42 +0000
+++ examples/concrete/uniax.py	2010-05-02 15:59:40 +0000
@@ -106,7 +106,7 @@
 plot.maxDataLen=4000
 
 #O.saveTmp('initial');
-O.saveXML('/tmp/init.xml')
+O.save('/tmp/init.xml')
 
 O.timingEnabled=False
 
@@ -119,7 +119,7 @@
 	if O.iter>0:
 		O.wait();
 		#O.loadTmp('initial')
-		O.loadXML('/tmp/init.xml')
+		O.load('/tmp/init.xml')
 		print "Reversing plot data"; plot.reverseData()
 	strainer.strainRate=abs(strainRateTension) if mode=='tension' else -abs(strainRateCompression)
 	try:

=== modified file 'examples/dynamic_simulation_tests/ringCundallDamping.py'
--- examples/dynamic_simulation_tests/ringCundallDamping.py	2010-03-07 19:53:42 +0000
+++ examples/dynamic_simulation_tests/ringCundallDamping.py	2010-05-02 15:59:40 +0000
@@ -70,13 +70,13 @@
     if b.shape.name=='Sphere':
         b.state.blockedDOFs=['z'] # blocked movement along Z
 
-o.dt=0.2*utils.PWaveTimeStep()
+o.dt=0.02*utils.PWaveTimeStep()
 
 o.saveTmp('init');
 
 from yade import qt
 renderer=qt.Renderer()
-renderer['Body_wire']=True
+renderer.wire=True
 #qt.Controller()
 qt.View()
 O.run()

=== modified file 'examples/dynamic_simulation_tests/ringSimpleViscoelastic.py'
--- examples/dynamic_simulation_tests/ringSimpleViscoelastic.py	2010-04-10 15:11:48 +0000
+++ examples/dynamic_simulation_tests/ringSimpleViscoelastic.py	2010-05-02 15:59:40 +0000
@@ -31,8 +31,8 @@
 					y = cylinderOrigin[1]+2*r*sphereRadius*sin(dfi*a)
 					z = cylinderOrigin[2]+h*2*sphereRadius
 					s=utils.sphere([x,y*cos(cylinderSlope)+z*sin(cylinderSlope),z*cos(cylinderSlope)-y*sin(cylinderSlope)],sphereRadius,material=sphereMat)
-					p=utils.getViscoelasticFromSpheresInteraction(s.state['mass'],tc,en,es)
-					s.mat['kn'],s.mat['cn'],s.mat['ks'],s.mat['cs']=p['kn'],p['cn'],p['ks'],p['cs']
+					p=utils.getViscoelasticFromSpheresInteraction(s.state.mass,tc,en,es)
+					s.mat.kn,s.mat.cn,s.mat.ks,s.mat.cs=p['kn'],p['cn'],p['ks'],p['cs']
 					o.bodies.append(s)
 					spheresCount+=1
 	return spheresCount
@@ -68,7 +68,7 @@
 		## Create physical information about the interaction.
 		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
 		## Constitutive law
-		[Law2_Spheres_Viscoelastic_SimpleViscoelastic()],
+		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
 	## Apply gravity
 	GravityEngine(gravity=[0,-9.81,0]),
@@ -84,13 +84,13 @@
     if b.shape.name=='Sphere':
         b.state.blockedDOFs=['z']
 
-o.dt=0.2*tc
+o.dt=0.02*tc
 
 o.saveTmp('init');
 
 from yade import qt
 renderer=qt.Renderer()
-renderer['Body_wire']=True
+renderer.wire=True
 #qt.Controller()
 qt.View()
 O.run()

=== modified file 'examples/funnel.py'
--- examples/funnel.py	2010-03-15 14:35:44 +0000
+++ examples/funnel.py	2010-05-02 15:59:40 +0000
@@ -27,4 +27,6 @@
 O.dt=utils.PWaveTimeStep()
 
 
-
+from yade import qt
+qt.Controller()
+qt.View()

=== modified file 'examples/rod_penetration/model.py'
--- examples/rod_penetration/model.py	2010-03-07 19:53:42 +0000
+++ examples/rod_penetration/model.py	2010-05-02 15:59:40 +0000
@@ -16,7 +16,7 @@
 o=Omega() 
 
 ## Import geometry 
-rod = O.bodies.append(ymport.stl('rod-'+mesh+'.stl',wire=True))
+#rod = O.bodies.append(ymport.stl('rod-'+mesh+'.stl',wire=True))
 
 # Spheres
 sphereRadius = 0.01

=== modified file 'py/ymport.py'
--- py/ymport.py	2010-05-02 14:35:55 +0000
+++ py/ymport.py	2010-05-02 15:59:40 +0000
@@ -39,7 +39,7 @@
 	for b in facets:
 		b.dynamic=dynamic
 		b.shape.postProcessAttributes(True)
-		b.shape.diffuseColor=color if color else utils.randomColor()
+		b.shape.Color=color if color else utils.randomColor()
 		b.shape.wire=wire
 		b.shape.highlight=highlight
 		utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBound,material=material,resetState=False)

=== renamed directory 'examples/collider-perf' => 'scripts/test/collider-perf'
=== renamed directory 'examples/triax-perf' => 'scripts/test/triax-perf'