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

2011-10-05 Thread noreply

revno: 2924
committer: Klaus Thoeni klaus.tho...@gmail.com
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 +
+++ examples/WireMatPM/wirecontacttest.py	2011-10-06 03:29:16 +
@@ -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(20)

=== modified file 'examples/WireMatPM/wirepackings.py'
--- examples/WireMatPM/wirepackings.py	2011-02-16 05:40:01 +
+++ examples/WireMatPM/wirepackings.py	2011-10-06 03:29:16 +
@@ -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, 

[Yade-dev] Strange behaviour of function unbalancedForce

2011-10-05 Thread Klaus Thoeni
Hi guys,

I just wanted to use the function unbalancedForce in one of my scripts. And 
look what is happening: running the same simulation several times after each 
other gives different results for the unbalancedForce. Well either some values 
which seem all right or just zero. The script I used is: 
examples/WireMatPM/wirecontacttest.py

Even using different computers and different versions of yade gives this 
problem. However, it doesn't happen all the time. It seems like you have to 
try several times to get the wrog value (which is zero) for unbalancedForce 
and if I use Bruno's collide2 branch it seems to work all the time.

So I don't know if it is a problem with my script or a problem of the current 
trunk version. Can anyone reproduce this problem?

Thanks
Klaus

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] Strange behaviour of function unbalancedForce

2011-10-05 Thread Anton Gladky
Hi Klaus,
try to start your script with -j1 option.
There are sometimes some issues with numerical error in multi-thread mode.

Anton




On Thu, Oct 6, 2011 at 6:40 AM, Klaus Thoeni klaus.tho...@gmail.com wrote:
 Hi guys,

 I just wanted to use the function unbalancedForce in one of my scripts. And
 look what is happening: running the same simulation several times after each
 other gives different results for the unbalancedForce. Well either some values
 which seem all right or just zero. The script I used is:
 examples/WireMatPM/wirecontacttest.py

 Even using different computers and different versions of yade gives this
 problem. However, it doesn't happen all the time. It seems like you have to
 try several times to get the wrog value (which is zero) for unbalancedForce
 and if I use Bruno's collide2 branch it seems to work all the time.

 So I don't know if it is a problem with my script or a problem of the current
 trunk version. Can anyone reproduce this problem?

 Thanks
 Klaus

 ___
 Mailing list: https://launchpad.net/~yade-dev
 Post to     : yade-dev@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~yade-dev
 More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


[Yade-dev] [Bug 826176] Re: Problem with saveVars

2011-10-05 Thread Anton Gladky
The simulation needs to be saved and then loaded to use this function.

https://answers.launchpad.net/yade/+question/167511

** Changed in: yade
   Status: New = Invalid

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/826176

Title:
  Problem with saveVars

Status in Yet Another Dynamic Engine:
  Invalid

Bug description:
  Hi,

  I want to save some variables with utils.saveVars() and load it in
  another script with utils.loadVars().

  test script 1:

  #!/usr/bin/python
  # -*- coding: utf-8 -*-
  a = 1

  b = 2

  c = 3
  utils.saveVars('savedVars',a=a,b=b,c=c)

  test script 2:

  #!/usr/bin/python
  # -*- coding: utf-8 -*-
  utils.loadVars('savedVars')

  error message:

  Running script save-vars-test2.py
  Traceback (most recent call last):
File /home/me/YADE/bin/yade-bzr2877, line 183, in runScript
  execfile(script,globals())
File save-vars-test2.py, line 3, in module
  utils.loadVars('savedVars')
File /home/me/YADE/lib/yade-bzr2877/py/yade/utils.py, line 67, in loadVars
  d=cPickle.loads(Omega().tags['pickledPythonVariablesDictionary'+mark])
  KeyError: 'Invalid key: pickledPythonVariablesDictionarysavedVars.xml.'

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/826176/+subscriptions

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] Strange behaviour of function unbalancedForce

2011-10-05 Thread Klaus Thoeni
Hi Anton,

I tired it already (I know this issue), still the same behaviour. And now 
actually I got zero for Bruno's branch as well. Very strange :-(
Not sure what the problem is. Would be great if someone could try if he/she 
gets the same behaviour.

Thanks,
Klaus

On Thu, 6 Oct 2011 04:30:53 PM Anton Gladky wrote:
 Hi Klaus,
 try to start your script with -j1 option.
 There are sometimes some issues with numerical error in multi-thread
 mode.
 
 Anton
 
 On Thu, Oct 6, 2011 at 6:40 AM, Klaus Thoeni klaus.tho...@gmail.com wrote:
  Hi guys,
  
  I just wanted to use the function unbalancedForce in one of my scripts.
  And look what is happening: running the same simulation several times
  after each other gives different results for the unbalancedForce. Well
  either some values which seem all right or just zero. The script I used
  is:
  examples/WireMatPM/wirecontacttest.py
  
  Even using different computers and different versions of yade gives this
  problem. However, it doesn't happen all the time. It seems like you have
  to try several times to get the wrog value (which is zero) for
  unbalancedForce and if I use Bruno's collide2 branch it seems to work
  all the time.
  
  So I don't know if it is a problem with my script or a problem of the
  current trunk version. Can anyone reproduce this problem?
  
  Thanks
  Klaus
  
  ___
  Mailing list: https://launchpad.net/~yade-dev
  Post to : yade-dev@lists.launchpad.net
  Unsubscribe : https://launchpad.net/~yade-dev
  More help   : https://help.launchpad.net/ListHelp
 
 ___
 Mailing list: https://launchpad.net/~yade-dev
 Post to : yade-dev@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~yade-dev
 More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp