← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2924: 1. update scripts

 

------------------------------------------------------------
revno: 2924
committer: Klaus Thoeni <klaus.thoeni@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2011-10-06 14:29:16 +1100
message:
  1. update scripts
  2. add unbalancedForce to diagram in wirecontacttest.py
modified:
  examples/WireMatPM/wirecontacttest.py
  examples/WireMatPM/wirepackings.py
  examples/WireMatPM/wiretensiltest.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/WireMatPM/wirecontacttest.py'
--- examples/WireMatPM/wirecontacttest.py	2011-04-21 04:48:09 +0000
+++ examples/WireMatPM/wirecontacttest.py	2011-10-06 03:29:16 +0000
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-from yade import utils, plot, pack, qt
+from yade import plot, qt
 
 #### define parameters for the net
 # wire diameter
@@ -40,12 +40,12 @@
 
 
 ##### create packing for net
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=cornerCoord, xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=cornerCoord, xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
 O.bodies.append(netpack)
 
 
 #### get bodies for single wire at the boundary in y-direction and change properties
-bb = utils.uniaxialTestFeatures(axis=0)
+bb = uniaxialTestFeatures(axis=0)
 negIds,posIds=bb['negIds'],bb['posIds']
 
 for id in negIds:
@@ -72,11 +72,11 @@
 
 #### define additional vertical interactions at the boundary for boundary wire
 for i in range(24)[1::2]: # odd - start at second item and take every second item
-	utils.createInteraction(negIds[i],negIds[i+1])
+	createInteraction(negIds[i],negIds[i+1])
 del posIds[1]
 posIds.append(1)
 for i in range(25)[::2]: # even  - start at the beginning at take every second item
-	utils.createInteraction(posIds[i],posIds[i+1])
+	createInteraction(posIds[i],posIds[i+1])
 
 
 #### time step definition for first time step to create links
@@ -84,7 +84,7 @@
 
 
 ##### delete horizontal interactions for corner particles
-bb = utils.uniaxialTestFeatures(axis=1)
+bb = uniaxialTestFeatures(axis=1)
 negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']
 
 
@@ -116,15 +116,16 @@
 
 
 #### import block as a sphere after net has been created
-bloc=O.bodies.append(utils.sphere([1.0,1.0,0.65],radius=0.15,wire=False,highlight=False,color=[1,1,0],material=blocMat))
+bloc=O.bodies.append(sphere([1.0,1.0,0.65],radius=0.15,wire=False,highlight=False,color=[1,1,0],material=blocMat))
 
 
 #### plot some results
-plot.plots={'t':['vz']}
+plot.plots={'t':['vz',None,('f_unbal','g--')]}
+#plot.liveInterval=2.
 plot.plot(noShow=False, subPlots=False)
 
 def addPlotData():
-	plot.addData(t=O.time, vz=-O.bodies[bloc].state.vel[2])
+	plot.addData(t=O.time, vz=-O.bodies[bloc].state.vel[2], f_unbal=unbalancedForce(useMaxForce=False) )
 
 
 #### define engines for simulation
@@ -142,7 +143,7 @@
 	),
 	GravityEngine(gravity=[0,0,-9.81],label='gravity'),
 	NewtonIntegrator(damping=0.2),
-	PyRunner(initRun=True,iterPeriod=1000,command='addPlotData()'),
+	PyRunner(initRun=True,iterPeriod=100,command='addPlotData()'),
 ]
 
 
@@ -151,3 +152,4 @@
 kn = 16115042 # stiffness of single wire from code, has to be changed if you change the stress-strain curve for the wire
 O.dt = 0.2*sqrt(particleMass/(2.*kn))
 
+O.run(200000)

=== modified file 'examples/WireMatPM/wirepackings.py'
--- examples/WireMatPM/wirepackings.py	2011-02-16 05:40:01 +0000
+++ examples/WireMatPM/wirepackings.py	2011-10-06 03:29:16 +0000
@@ -1,8 +1,8 @@
 # encoding: utf-8
-from yade import pack, qt
+from yade import qt
 
 #### short description of script
-print 'This script shows the use of the function pack.hexaNet (interactions are not initialised)'
+print 'This script shows the use of the function hexaNet of module pack (interactions are not initialised)'
 
 #### define parameters for the net
 # mesh geometry
@@ -22,7 +22,7 @@
 kw = {'color':[1,1,0],'wire':True,'highlight':False,'fixed':False,'material':-1}
 
 #### packing 1
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[0,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=True, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[0,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=True, **kw )
 O.bodies.append(netpack)
 print 'Packing 1:'
 print 'Real net length in x-direction [m]: ', lx
@@ -30,7 +30,7 @@
 
 
 #### packing 2
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[0.4,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[0.4,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
 O.bodies.append(netpack)
 print 'Packing 2:'
 print 'Real net length in x-direction [m]: ', lx
@@ -38,7 +38,7 @@
 
 
 #### packing 3
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[0,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=True, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[0,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=True, **kw )
 O.bodies.append(netpack)
 print 'Packing 3:'
 print 'Real net length in x-direction [m]: ', lx
@@ -46,7 +46,7 @@
 
 
 #### packing 4
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[0.4,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[0.4,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=True, isSymmetric=False, **kw )
 O.bodies.append(netpack)
 print 'Packing 4:'
 print 'Real net length in x-direction [m]: ', lx
@@ -57,7 +57,7 @@
 kw = {'color':[1,0,0],'wire':True,'highlight':False,'fixed':False,'material':-1}
 
 #### packing 1
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[1,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=True, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[1,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=True, **kw )
 O.bodies.append(netpack)
 print 'Packing 1:'
 print 'Real net length in x-direction [m]: ', lx
@@ -65,7 +65,7 @@
 
 
 #### packing 2
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[1.4,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=False, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[1.4,0,0], xLength=Lx, yLength=Ly, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=False, **kw )
 O.bodies.append(netpack)
 print 'Packing 2:'
 print 'Real net length in x-direction [m]: ', lx
@@ -73,7 +73,7 @@
 
 
 #### packing 3
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[1,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=True, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[1,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=True, **kw )
 O.bodies.append(netpack)
 print 'Packing 3:'
 print 'Real net length in x-direction [m]: ', lx
@@ -81,7 +81,7 @@
 
 
 #### packing 4
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[1.4,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=False, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[1.4,-0.4,0], xLength=Lx, yLength=Ly+0.05, mos=mos, a=a, b=b, startAtCorner=False, isSymmetric=False, **kw )
 O.bodies.append(netpack)
 print 'Packing 4:'
 print 'Real net length in x-direction [m]: ', lx

=== modified file 'examples/WireMatPM/wiretensiltest.py'
--- examples/WireMatPM/wiretensiltest.py	2011-04-19 06:08:59 +0000
+++ examples/WireMatPM/wiretensiltest.py	2011-10-06 03:29:16 +0000
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-from yade import utils, pack, plot
+from yade import plot
 
 #### short description of script
 print 'This script shows a tensile test of a net by using the UniaxialStrainer'
@@ -27,14 +27,14 @@
 
 #### get net packing
 kw = {'color':[1,1,0],'wire':True,'highlight':False,'fixed':False,'material':netMat}
-[netpack,lx,ly] = pack.hexaNet( radius=radius, cornerCoord=[0,0,0], xLength=1.0, yLength=0.55, mos=0.08, a=0.04, b=0.04, startAtCorner=False, isSymmetric=True, **kw )
+[netpack,lx,ly] = hexaNet( radius=radius, cornerCoord=[0,0,0], xLength=1.0, yLength=0.55, mos=0.08, a=0.04, b=0.04, startAtCorner=False, isSymmetric=True, **kw )
 O.bodies.append(netpack)
 print 'Real net length in x-direction [m]: ', lx
 print 'Real net length in y-direction [m]: ', ly
 
 
 #### get bodies for single wire at the boundary in y-direction and change properties
-bb = utils.uniaxialTestFeatures(axis=0)
+bb = uniaxialTestFeatures(axis=0)
 negIds,posIds=bb['negIds'],bb['posIds']
 
 for id in negIds:
@@ -59,28 +59,28 @@
 ]
 
 #### define additional vertical interactions at the boundary
-utils.createInteraction(negIds[0],negIds[2])
-utils.createInteraction(negIds[3],negIds[4])
-utils.createInteraction(negIds[5],negIds[6])
-utils.createInteraction(negIds[7],negIds[1])
-utils.createInteraction(posIds[0],posIds[2])
-utils.createInteraction(posIds[3],posIds[4])
-utils.createInteraction(posIds[5],posIds[6])
-utils.createInteraction(posIds[7],posIds[1])
+createInteraction(negIds[0],negIds[2])
+createInteraction(negIds[3],negIds[4])
+createInteraction(negIds[5],negIds[6])
+createInteraction(negIds[7],negIds[1])
+createInteraction(posIds[0],posIds[2])
+createInteraction(posIds[3],posIds[4])
+createInteraction(posIds[5],posIds[6])
+createInteraction(posIds[7],posIds[1])
 
 #### time step definition for first time step to create links
 O.step()
 
 
 #### initialize values for UniaxialStrainer
-bb = utils.uniaxialTestFeatures(axis=1)
+bb = uniaxialTestFeatures(axis=1)
 negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']
 strainRateTension = 0.1
 setSpeeds = True
 
 
 ##### delete horizontal interactions for corner particles
-bb = utils.uniaxialTestFeatures(axis=1)
+bb = uniaxialTestFeatures(axis=1)
 negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']