← Back to team overview

yade-users team mailing list archive

Re: [Question #155725]: Plot data

 

Question #155725 on Yade changed:
https://answers.launchpad.net/yade/+question/155725

    Status: Open => Answered

Anton Gladky proposed the following answer:
But variables should be named differently:

def saveData():
 plot.addData(t1=O.time,t2=O.time)

plot.plots={'t1':('t2')}
plot.plot()

This example should work for you.
Also, if you use ubuntu, you need to update your python-matplotlib
package from our ppa:

sudo add-apt-repository ppa:yade-users/external
sudo apt-get update
sudo apt-get upgrade

Hope, that helps.

Anton



On Wed, May 4, 2011 at 5:48 PM, Arthur Mercier
<question155725@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Question #155725 on Yade changed:
> https://answers.launchpad.net/yade/+question/155725
>
>    Status: Answered => Open
>
> Arthur Mercier is still having a problem:
> Still the error message
> "NameError: name 'saveData' is not defined"
>
> Here is my script, does my script work in yours ?
>
> "import numpy, plot, pack, geom, matplotlib
>
> from yade import utils,plot,pack
>
>
> # radius, number and distance of spheres
> rad,num=.1,15; dist=1.9999*rad
>
> idConcrete=O.materials.append(CpmMat(
> G_over_E=0.2,
> density=4800,
> poisson=0.19,
> young=30e9,
> dmgRateExp=0.3,
> dmgTau=1000,
> epsCrackOnset=0.0001,
> isoPrestress=0,
> neverDamage=False,
> plRateExp=0,
> plTau=-1,
> relDuctility=30,
> sigmaT=3e6,
> frictionAngle=0.7))
>
> len(O.materials)
>
> # create rectangular box from facets
> O.bodies.append(geom.facetBox((.5,-.5,.25),(.5,.5,.5),wallMask=63))
> O.bodies.append(geom.facetBox((5,-.5,.25),(.5,.5,.5),wallMask=63))
> O.bodies.append(geom.facetBox((3,1.2,.25),(.5,.5,.5),wallMask=63))
>
> O.bodies.append([utils.sphere((x,.1,0),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.1,.2),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.1,.4),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.3,0),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.3,.2),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.3,.4),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.5,0),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.5,.2),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
> O.bodies.append([utils.sphere((x,.5,.4),rad,wire=True,material=0) for x in numpy.arange(0,55*rad,dist)])
>
> O.dt=.5*utils.PWaveTimeStep()
>
>
> O.engines=[
>        ForceResetter(),
>        InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
>        InteractionLoop(
>                [Ig2_Sphere_Sphere_Dem3DofGeom(),Ig2_Facet_Sphere_Dem3DofGeom()],
>                [Ip2_CpmMat_CpmMat_CpmPhys()],
>                [Law2_Dem3DofGeom_CpmPhys_Cpm()]),
>        GravityEngine(gravity=(0,-20,0)),
>        TranslationEngine(translationAxis=(0,-1,0),velocity=1,ids=[24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]),
>        NewtonIntegrator(damping=0.1),
>        PyRunner(iterPeriod=100,command='saveData()'),
> ]
>
> def saveData():
>  plot.addData({'t':O.time,'t':O.time})
>
> plot.plots={'t':('t')}
> yade.qt.Controller();
> O.saveTmp()"
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.