← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 3032: Use gravity inside of NewtonIntegrator in examples and in tests.

 

------------------------------------------------------------
revno: 3032
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2012-02-16 17:11:06 +0100
message:
  Use gravity inside of NewtonIntegrator in examples and in tests.
modified:
  examples/CapillaryPhys-example.py
  examples/WireMatPM/wirecontacttest.py
  examples/baraban/baraban.py
  examples/bulldozer/bulldozer.py
  examples/bulldozer/bulldozerVTK.py
  examples/funnel.py
  examples/gts-horse/gts-horse.py
  examples/mill.py
  examples/packs/packs.py
  examples/ring2d/ringCundallDamping.py
  examples/ring2d/ringSimpleViscoelastic.py
  examples/rod-penetration/model.py
  examples/rotating-cylinder.py
  examples/simple-scene/simple-scene-energy-tracking.py
  examples/simple-scene/simple-scene-plot.py
  examples/simple-scene/simple-scene.py
  py/plot.py
  py/tests/cohesive-chain.py
  py/tests/core.py
  scripts/test/checks/checkGravity.py
  scripts/test/checks/checkWeight.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/CapillaryPhys-example.py'
--- examples/CapillaryPhys-example.py	2011-11-10 11:04:14 +0000
+++ examples/CapillaryPhys-example.py	2012-02-16 16:11:06 +0000
@@ -46,8 +46,7 @@
 			[Law2_ScGeom_MindlinPhys_Mindlin()]#for hertz model only
 		),
 		Law2_ScGeom_CapillaryPhys_Capillarity(CapillaryPressure=10000,hertzOn=True),#for hertz model only
-		GravityEngine(gravity=(0,0,-9.81)),
-		NewtonIntegrator(damping=local_damping),
+		NewtonIntegrator(damping=local_damping,gravity=(0,0,-9.81)),
 	]
 	ContactModel.betan=viscous_normal
 	ContactModel.betas=viscous_shear
@@ -62,8 +61,7 @@
 			[Law2_ScGeom_FrictPhys_CundallStrack()],	#for linear model only
 		),
 		Law2_ScGeom_CapillaryPhys_Capillarity(CapillaryPressure=10000,hertzOn=False),#for linear model only
-		GravityEngine(gravity=(0,0,-9.81)),
-		NewtonIntegrator(damping=local_damping),
+		NewtonIntegrator(damping=local_damping,gravity=(0,0,-9.81)),
 	]
 
 #set time step and run simulation:

=== modified file 'examples/WireMatPM/wirecontacttest.py'
--- examples/WireMatPM/wirecontacttest.py	2012-01-24 03:29:29 +0000
+++ examples/WireMatPM/wirecontacttest.py	2012-02-16 16:11:06 +0000
@@ -142,8 +142,7 @@
 	[Ip2_WireMat_WireMat_WirePhys(label='wire_wire'),Ip2_FrictMat_FrictMat_FrictPhys(label='block_wire')],
 	[Law2_ScGeom_WirePhys_WirePM(label='Law_1'),Law2_ScGeom_FrictPhys_CundallStrack(label='Law_2')]
 	),
-	GravityEngine(gravity=[0,0,-9.81],label='gravity'),
-	NewtonIntegrator(damping=0.2),
+	NewtonIntegrator(damping=0.2,gravity=[0,0,-9.81],label='NewtonGravity'),
 	PyRunner(initRun=True,iterPeriod=100,command='addPlotData()'),
 ]
 

=== modified file 'examples/baraban/baraban.py'
--- examples/baraban/baraban.py	2010-10-27 14:59:02 +0000
+++ examples/baraban/baraban.py	2012-02-16 16:11:06 +0000
@@ -47,9 +47,8 @@
 		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
 	## Apply gravity
-	GravityEngine(gravity=[0,-9.81,0]),
 	## Cundall damping must been disabled!
-	NewtonIntegrator(damping=0),
+	NewtonIntegrator(damping=0,gravity=[0,-9.81,0]),
 ## Saving results
 	#VTKRecorder(virtPeriod=0.04,fileName='/tmp/stlimp-',recorders=['spheres','facets']),
 	## Apply kinematics to walls

=== modified file 'examples/bulldozer/bulldozer.py'
--- examples/bulldozer/bulldozer.py	2011-01-26 21:26:42 +0000
+++ examples/bulldozer/bulldozer.py	2012-02-16 16:11:06 +0000
@@ -69,9 +69,8 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_L3Geom_FrictPhys_ElPerfPl()],
 	),
-	GravityEngine(gravity=(0,0,-9.8)),
 	TranslationEngine(translationAxis=[1,0,0],velocity=5,ids=KnifeIDs), # Buldozer motion
-	NewtonIntegrator(damping=.3),
+	NewtonIntegrator(damping=.3,gravity=(0,0,-9.8)),
 	#qt.SnapshotEngine(iterPeriod=100,fileBase='/tmp/bulldozer-',label='snapshooter'),
 ]
 

=== modified file 'examples/bulldozer/bulldozerVTK.py'
--- examples/bulldozer/bulldozerVTK.py	2011-10-23 08:28:16 +0000
+++ examples/bulldozer/bulldozerVTK.py	2012-02-16 16:11:06 +0000
@@ -73,9 +73,8 @@
 		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
 		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
-	GravityEngine(gravity=[0,0,-9.8]),
 	TranslationEngine(translationAxis=[1,0,0],velocity=2,ids=KnifeIDs), # Buldozer motion
-	NewtonIntegrator(damping=0),
+	NewtonIntegrator(damping=0,gravity=[0,0,-9.8]),
 	VTKRecorder(iterPeriod=1000,fileName='/tmp/bulldozer-',recorders=['spheres','facets'])
 ]
 

=== modified file 'examples/funnel.py'
--- examples/funnel.py	2010-10-29 10:12:44 +0000
+++ examples/funnel.py	2012-02-16 16:11:06 +0000
@@ -24,8 +24,7 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()]
 	),
-	GravityEngine(gravity=(0,0,-9.81)),
-	NewtonIntegrator(),
+	NewtonIntegrator(gravity=(0,0,-9.81)),
 	VTKRecorder(iterPeriod=100,recorders=['spheres','facets','colors'],fileName='/tmp/p1-')
 ]
 O.dt=utils.PWaveTimeStep()

=== modified file 'examples/gts-horse/gts-horse.py'
--- examples/gts-horse/gts-horse.py	2011-01-29 22:47:18 +0000
+++ examples/gts-horse/gts-horse.py	2012-02-16 16:11:06 +0000
@@ -39,8 +39,7 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_L3Geom_FrictPhys_ElPerfPl()],
 	),
-	GravityEngine(gravity=[0,0,-5000]),
-	NewtonIntegrator(damping=.1),
+	NewtonIntegrator(damping=.1,gravity=[0,0,-5000]),
 	PyRunner(iterPeriod=1000,command='timing.stats(); O.pause();'),
 	PyRunner(iterPeriod=10,command='addPlotData()')
 ]

=== modified file 'examples/mill.py'
--- examples/mill.py	2010-10-29 10:12:44 +0000
+++ examples/mill.py	2012-02-16 16:11:06 +0000
@@ -67,9 +67,8 @@
 		[Ig2_Sphere_Sphere_Dem3DofGeom(),Ig2_Facet_Sphere_Dem3DofGeom()],
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
-	),	
-	GravityEngine(gravity=(0,0,-50)), # gravity artificially high, to make it faster going ;-)
-	NewtonIntegrator(damping=.3),
+	),
+	NewtonIntegrator(damping=.3,gravity=(0,0,-50)),
 	RotationEngine(rotateAroundZero=True,zeroPoint=(0,0,0),rotationAxis=(1,0,0),angularVelocity=-20,ids=millIds),
 	#SnapshotEngine(iterPeriod=30,fileBase='/tmp/mill-',viewNo=0,label='snapshooter'),
 	#VTKRecorder(iterPeriod=100,recorders=['all'],fileName='/tmp/millVTK-')

=== modified file 'examples/packs/packs.py'
--- examples/packs/packs.py	2011-07-26 12:38:18 +0000
+++ examples/packs/packs.py	2012-02-16 16:11:06 +0000
@@ -120,8 +120,7 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_ScGeom_FrictPhys_CundallStrack()],
 	),
-	GravityEngine(gravity=(1e-2,1e-2,-1000)),
-	NewtonIntegrator(damping=.1,exactAsphericalRot=True),
+	NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(1e-2,1e-2,-1000)),
 	RotationEngine(
 		ids=rotateIDs,
 		angularVelocity=100.0,

=== modified file 'examples/ring2d/ringCundallDamping.py'
--- examples/ring2d/ringCundallDamping.py	2011-04-15 06:20:10 +0000
+++ examples/ring2d/ringCundallDamping.py	2012-02-16 16:11:06 +0000
@@ -44,10 +44,8 @@
 		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
 	),
 	## Apply gravity
-	GravityEngine(gravity=[0,-9.81,0]),
-
 	## NOTE: Non zero Cundall damping affected a dynamic simulation!
-	NewtonIntegrator(damping=0.3),
+	NewtonIntegrator(damping=0.3,gravity=[0,-9.81,0]),
 
 	## Apply kinematics to walls
    ## angularVelocity = 0.73 rad/sec = 7 rpm

=== modified file 'examples/ring2d/ringSimpleViscoelastic.py'
--- examples/ring2d/ringSimpleViscoelastic.py	2011-04-15 06:20:10 +0000
+++ examples/ring2d/ringSimpleViscoelastic.py	2012-02-16 16:11:06 +0000
@@ -62,9 +62,8 @@
 		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
 	## Apply gravity
-	GravityEngine(gravity=[0,-9.81,0]),
 	## Cundall damping must been disabled!
-	NewtonIntegrator(damping=0),
+	NewtonIntegrator(damping=0,gravity=[0,-9.81,0]),
 	## Apply kinematics to walls
     ## angularVelocity = 0.73 rad/sec = 7 rpm
 	RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True,angularVelocity=0.73)

=== modified file 'examples/rod-penetration/model.py'
--- examples/rod-penetration/model.py	2010-11-07 08:55:43 +0000
+++ examples/rod-penetration/model.py	2012-02-16 16:11:06 +0000
@@ -57,9 +57,8 @@
 		[Law2_ScGeom_FrictPhys_CundallStrack()]
 	),
 	## Apply gravity
-	GravityEngine(gravity=[0,-9.81,0]),
 	## Motion equation
-	NewtonIntegrator(damping=0.3),
+	NewtonIntegrator(damping=0.3,gravity=[0,-9.81,0]),
 	## Apply kinematics to rod
 	TranslationEngine(ids=rod,translationAxis=[0,-1,0],velocity=0.075),
 	## Save force on rod

=== modified file 'examples/rotating-cylinder.py'
--- examples/rotating-cylinder.py	2010-11-07 08:55:43 +0000
+++ examples/rotating-cylinder.py	2012-02-16 16:11:06 +0000
@@ -48,9 +48,8 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
 	),
-	GravityEngine(gravity=(0,0,-1e3)), # gravity artificially high, to make it faster going ;-)
 	RotationEngine(rotateAroundZero=True,zeroPoint=(0,0,0),rotationAxis=(0,1,1),angularVelocity=30*(2*pi/60),ids=cylIds,label='rotor'),
-	NewtonIntegrator(damping=.3),
+	NewtonIntegrator(damping=.3,gravity=(0,0,-1e3)), # gravity artificially high, to make it faster going ;-)
 ]
 O.dt=utils.PWaveTimeStep()
 O.stopAtIter=int(2*pi/(rotor.angularVelocity*O.dt))

=== modified file 'examples/simple-scene/simple-scene-energy-tracking.py'
--- examples/simple-scene/simple-scene-energy-tracking.py	2011-04-21 16:03:07 +0000
+++ examples/simple-scene/simple-scene-energy-tracking.py	2012-02-16 16:11:06 +0000
@@ -47,9 +47,8 @@
 		[Ip2_2xCohFrictMat_CohFrictPhys()],
 		[law]
 	),
-	GravityEngine(gravity=(0,0,-g)),
 	GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=50),
-	NewtonIntegrator(damping=damping,kinSplit=True),
+	NewtonIntegrator(damping=damping,kinSplit=True,gravity=(0,0,-g)),
 	PyRunner(iterPeriod=20,command='myAddPlotData()')
 ]
 

=== modified file 'examples/simple-scene/simple-scene-plot.py'
--- examples/simple-scene/simple-scene-plot.py	2010-10-29 10:12:44 +0000
+++ examples/simple-scene/simple-scene-plot.py	2012-02-16 16:11:06 +0000
@@ -11,8 +11,7 @@
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_ScGeom_FrictPhys_CundallStrack()]
 	),
-	GravityEngine(gravity=(0,0,-9.81)),
-	NewtonIntegrator(damping=.2),
+	NewtonIntegrator(damping=.2,gravity=(0,0,-9.81)),
 	###
 	### NOTE this extra engine:
 	###

=== modified file 'examples/simple-scene/simple-scene.py'
--- examples/simple-scene/simple-scene.py	2010-12-05 17:10:06 +0000
+++ examples/simple-scene/simple-scene.py	2012-02-16 16:11:06 +0000
@@ -39,13 +39,12 @@
 	),
 	## Apply gravity: all bodies will have gravity applied on them.
 	## Note the engine parameter 'gravity', a vector that gives the acceleration.
-	GravityEngine(gravity=[0,0,-9.81]),
 	## Forces acting on bodies are damped to artificially increase energy dissipation in simulation.
 	## (In this model, the restitution coefficient of interaction is 1, which is not realistic.)
 	## This MetaEngine acts on all PhysicalActions and selects the right EngineUnit base on type of the PhysicalAction.
 	#
 	# note that following 4 engines (till the end) can be replaced by an optimized monolithic version:
-	NewtonIntegrator(damping=0.1)
+	NewtonIntegrator(damping=0.1,gravity=[0,0,-9.81])
 ]
 
 

=== modified file 'py/plot.py'
--- py/plot.py	2011-05-03 15:04:37 +0000
+++ py/plot.py	2012-02-16 16:11:06 +0000
@@ -139,7 +139,7 @@
 	>>> O.dt=utils.PWaveTimeStep()
 	>>> O.engines=[
 	...    ForceResetter(),
-	...    GravityEngine(gravity=(0,0,-10)),
+	...    GravityEngine(gravity=(0,0,-10),warnOnce=False),
 	...    NewtonIntegrator(damping=.4,kinSplit=True),
 	...    # get data required by plots at every step
 	...    PyRunner(command='yade.plot.addAutoData()',iterPeriod=1,initRun=True)
@@ -158,7 +158,7 @@
 		from yade import *
 		from yade import plot,utils
 		O.reset()
-		O.engines=[ForceResetter(),GravityEngine(gravity=(0,0,-10)),NewtonIntegrator(damping=.4,kinSplit=True),PyRunner(command='yade.plot.addAutoData()',iterPeriod=1,initRun=True)]
+		O.engines=[ForceResetter(),GravityEngine(gravity=(0,0,-10),warnOnce=False),NewtonIntegrator(damping=.4,kinSplit=True),PyRunner(command='yade.plot.addAutoData()',iterPeriod=1,initRun=True)]
 		O.bodies.append(utils.sphere((0,0,0),1)); O.dt=utils.PWaveTimeStep()
 		plot.resetData()
 		plot.plots={'i=O.iter':(O.energy,None,'total energy=O.energy.total()')}

=== modified file 'py/tests/cohesive-chain.py'
--- py/tests/cohesive-chain.py	2011-01-03 07:11:41 +0000
+++ py/tests/cohesive-chain.py	2012-02-16 16:11:06 +0000
@@ -34,9 +34,8 @@
 			[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True)],
 			[Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]),
 		## Apply gravity
-		GravityEngine(gravity=[0,-9.81,0]),
 		## Motion equation
-		NewtonIntegrator(damping=0.15)
+		NewtonIntegrator(damping=0.15,gravity=[0,-9.81,0])
 		]
 		#Generate a spiral
 		Ne=10

=== modified file 'py/tests/core.py'
--- py/tests/core.py	2011-01-31 19:09:24 +0000
+++ py/tests/core.py	2012-02-16 16:11:06 +0000
@@ -22,7 +22,7 @@
 	def setUp(self): O.reset()
 	def testSubstepping(self):
 		'Loop: substepping'
-		O.engines=[ForceResetter(),PyRunner(initRun=True,iterPeriod=1,command='pass'),GravityEngine()]
+		O.engines=[ForceResetter(),PyRunner(initRun=True,iterPeriod=1,command='pass')]
 		# value outside the loop
 		self.assert_(O.subStep==-1)
 		# O.subStep is meaningful when substepping

=== modified file 'scripts/test/checks/checkGravity.py'
--- scripts/test/checks/checkGravity.py	2011-07-16 18:59:53 +0000
+++ scripts/test/checks/checkGravity.py	2012-02-16 16:11:06 +0000
@@ -44,8 +44,7 @@
     [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
     [Law2_ScGeom_ViscElPhys_Basic()],
   ),
-  GravityEngine(gravity=[0,g,0]),
-  NewtonIntegrator(damping=0),
+  NewtonIntegrator(damping=0,gravity=[0,g,0]),
   PyRunner(command='checkPos()',iterPeriod=10000),
 ]
 

=== modified file 'scripts/test/checks/checkWeight.py'
--- scripts/test/checks/checkWeight.py	2011-03-15 08:17:29 +0000
+++ scripts/test/checks/checkWeight.py	2012-02-16 16:11:06 +0000
@@ -39,8 +39,7 @@
 		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
 		[Law2_ScGeom_ViscElPhys_Basic()],
 	),
-	GravityEngine(gravity=[0.0,0.0,-9.81]),
-	NewtonIntegrator(damping=0.0)
+	NewtonIntegrator(damping=0.0,gravity=[0.0,0.0,-9.81])
 ]