yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05116
Re: [Branch ~yade-dev/yade/trunk] Rev 2325: 1. LIVE PLOTTING (thanks to Janek for the idea and the suggestion of mtTkinter). Report bugs.
-
To:
yade-dev@xxxxxxxxxxxxxxxxxxx
-
From:
Janek Kozicki <janek_listy@xxxxx>
-
Date:
Wed, 7 Jul 2010 17:25:48 +0200
-
Face:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUBAQEtLS1KSkpRUVFXV1dYWFhjY2Nzc3N3d3eHh4eKioqdnZ24uLjLy8vc3NxVIagyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH2AIVEzgS1fgQtQAAAjRJREFUOMtt1DFv00AUAOAzFQNbjigSyoQaRaBMhKgLUyKXpVNNeUpk9vyDqFJhQ1kiBuaqAwJCqvPtSLY7RlTn5+5IdnYkkt/AOyfxXVLe5vf53Z1875kd34tOEax8djmj6GyjhB5bxz50GdsVZr9fqRjZwAtKOJw5Wqs2MMZ16ALHsaDncF7xAHix1oEFHAB8f+pRjcO4gfZDykcYzbiucRolOLUJ6kjA0xtVt+A6TySlM0RajIpK6DzwKZ/nOYbF/gclHMo1ZOHYY/+Ha+AWuM+3oMS4eeqYzZ8FiCltgUqI8cd2wwAVpJk+8LWYjBtnJdQpHQqJMd4Oxt4bU9ESiFGc5hkqaH74asAX4iabP5I5gZ+qjgGlJCqZa3h3lxhoeVcSE1qLQC4sqKOK9MGW9E3izFqqHokoztLFEgXg31sbZEKnWi2T74A4NxfVQqlkjKtcAWD+zcArFEES01dR0E/nnV0IgugmDd/2L84sOAouRBBHEc7gtc8teDkRlE0iNQPo2w3Xhh/D4TCIQ4LRLoTvgwjj6RRgavdurxYGMaIuGOyAW/PpNlCcU9/93AHenAWYjPoAwa+G3e3to/MgFNTAEKvKDjzuCzHTnY3qqdXtx24VijzQfZ0yewZ5cwRFQaa+mIYr1uI0I76+3W4xhlvoVRwOA0Fdl64HlJnxP6T8YpX/Lga4Wv4A3ErrU5oTfN7Mu/llXMl8RXEPji/lQkN3H7qXqgC2By47EXeU/7PJ/wPxRKMnuZwIeAAAAABJRU5ErkJggg==
-
In-reply-to:
<20100706113320.28895.73420.launchpad@loganberry.canonical.com>
noreply@xxxxxxxxxxxxx said: (by the date of Tue, 06 Jul 2010 11:33:20 -0000)
> 1. LIVE PLOTTING (thanks to Janek for the idea and the suggestion of mtTkinter). Report bugs.
OK, I double checked this. bzr2324 runs fine:
janek@atak:~/tmp/YY/bin/bin$ ./yade-trunk -j 3 ./triaxial-test.py
Welcome to Yade bzr2324
TCP python prompt on localhost:9000, auth cookie `ucasey'
TCP info provider on localhost:21000
Running script ./triaxial-test.py
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.6/pylab.py, but /usr/lib/pymodules/python2.6 is being added to sys.path
from pkg_resources import resource_stream
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]: import yade.plot; yade.plot.plot();
Yade [2]: import yade.plot; yade.plot.plot();
Yade [3]: import yade.plot; yade.plot.plot();
Yade [4]: zsh: quit ./yade-trunk -j 3 ./triaxial-test.py
While bzr2326 does not:
janek@atak:~/tmp/YY/bin/bin$ ./yade-trunk -j 3 ./triaxial-test.py
Welcome to Yade bzr2326
TCP python prompt on localhost:9001, auth cookie `aucesy'
TCP info provider on localhost:21001
Running script ./triaxial-test.py
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.6/pylab.py, but /usr/lib/pymodules/python2.6 is being added to sys.path
from pkg_resources import resource_stream
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]: import yade.plot; yade.plot.plot();
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/janek/tmp/YY/bin/lib/yade-trunk/py/yade/__init__.pyc in <module>()
----> 1
2
3
4
5
/home/janek/tmp/YY/bin/lib/yade-trunk/py/yade/plot.py in plot(noShow)
200 to save the figure to file automatically.
201 """
--> 202 createPlots()
203 global currLineRefs
204 if not noShow:
/home/janek/tmp/YY/bin/lib/yade-trunk/py/yade/plot.py in createPlots()
145 # create y1 lines
146 for d in plots_p_y1:
--> 147 line,=pylab.plot(data[p],data[d[0]],d[1])
148 currLineRefs.append(LineRef(line,data[p],data[d[0]]))
149 # create the legend
/usr/lib/pymodules/python2.6/matplotlib/pyplot.pyc in plot(*args, **kwargs)
2139 ax.hold(hold)
2140 try:
-> 2141 ret = ax.plot(*args, **kwargs)
2142 draw_if_interactive()
2143 finally:
/usr/lib/pymodules/python2.6/matplotlib/axes.pyc in plot(self, *args, **kwargs)
3430 lines = []
3431
-> 3432 for line in self._get_lines(*args, **kwargs):
3433 self.add_line(line)
3434 lines.append(line)
/usr/lib/pymodules/python2.6/matplotlib/axes.pyc in _grab_next_args(self, *args, **kwargs)
309 return
310 if len(remaining) <= 3:
--> 311 for seg in self._plot_args(remaining, kwargs):
312 yield seg
313 return
/usr/lib/pymodules/python2.6/matplotlib/axes.pyc in _plot_args(self, tup, kwargs)
279 kw[k] = v
280
--> 281 y = np.atleast_1d(tup[-1])
282
283 if len(tup) == 2:
/usr/lib/python2.6/dist-packages/numpy/lib/shape_base.pyc in atleast_1d(*arys)
292 res = []
293 for ary in arys:
--> 294 res.append(array(ary,copy=False,subok=True,ndmin=1))
295 if len(res) == 1:
296 return res[0]
ValueError: setting an array element with a sequence.
Yade [2]:
Do you really want to exit ([y]/n)? y
Yade: normal exit.
Also, this error does not occur in bzr2324 (this time the plot data
is empty - nothing to plot, so I am avoiding previous crash). This
happens when closing the plot windows. I suppose that it is introduced
by mtTkinter which tries to call something that doesn't exist
anymore:
Welcome to Yade bzr2326
TCP python prompt on localhost:9001, auth cookie `kecydu'
TCP info provider on localhost:21001
Running script ./triaxial-test.py
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module pylab was already imported from /usr/lib/pymodules/python2.6/pylab.py, but /usr/lib/pymodules/python2.6 is being added to sys.path
from pkg_resources import resource_stream
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]: import yade.plot; yade.plot.plot();
Yade [2]: invalid command name "139800048206304callit"
while executing
"139800048206304callit"
("after" script)
Do you really want to exit ([y]/n)? y
Yade: normal exit.
I am attaching the script. I was trying to reproduce bug in uniax.py,
but I could not. Strange, could be that I've done some mistake in ma
script. And without liveplot it was handled gracefully.
best regards
--
Janek Kozicki http://janek.kozicki.pl/ |
#!/usr/local/bin/yade-trunk
# -*- coding: utf-8 -*-
# -*- encoding=utf-8 -*-
# Script to perform a typical triaxial test
#-----------------------------------------------------
# simulation parameters
#-----------------------------------------------------
size=(0.1,0.1,0.1)
young=15000000
local_poisson=0.5
frictionAngle=30
number_of_spheres=2000
std_dev_radius=0.5
avg_radius=0.0025
max_compression=0.3
iso_compaction=50000
lateral_confinement=50000
#-----------------------------------------------------
# materials
#-----------------------------------------------------
O.materials.append(FrictMat( young=young,
poisson=local_poisson,
frictionAngle=radians(0), # is set to zero for generating sample with low porosity. triax will set it later to good value, search for frictionAngle
density=2600,
label='granular_material'))
O.materials.append(FrictMat( young=young,
poisson=local_poisson,
frictionAngle=radians(0),
density=2600,
label='frictionless_material'))
#-----------------------------------------------------
# geometry
#-----------------------------------------------------
from yade import pack
sphere_cloud=pack.SpherePack()
# add the walls
walls=yade.utils.aabbWalls( extrema=((0,0,0),size),
thickness=.001,
oversizeFactor=1.2,
material='frictionless_material')
wallIds=O.bodies.append(walls)
# add the cloud of spheres
sphere_cloud.makeCloud( minCorner=(0,0,0),
maxCorner=size,
rMean=avg_radius,
rRelFuzz=std_dev_radius,
num=number_of_spheres,
periodic=False,
porosity=-1)
O.bodies.append([utils.sphere( center,
rad,
material='granular_material')
for center,rad in sphere_cloud])
#-----------------------------------------------------
# list of engines
#-----------------------------------------------------
triax=TriaxialCompressionEngine(
wall_left_id=wallIds[0],
wall_right_id=wallIds[1],
wall_bottom_id=wallIds[2],
wall_top_id=wallIds[3],
wall_back_id=wallIds[4],
wall_front_id=wallIds[5],
internalCompaction=0,
autoCompressionActivation=1,
sigmaIsoCompaction=iso_compaction,
sigmaLateralConfinement=lateral_confinement,
max_vel=1,
StabilityCriterion=0.01,
strainRate=0.1,
frictionAngleDegree=frictionAngle,
fixedPorosity=1, # ??
epsilonMax=max_compression,
thickness=0.001,
autoUnload=1,
autoStopSimulation=0,
noFiles=0,
maxMultiplier=1.01,
finalMaxMultiplier=1.001,
radiusControlInterval=10,
stiffnessUpdateInterval=10,
fixedPoroCompaction=0
)
O.engines=[
ForceResetter(),
BoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
InsertionSortCollider(nBins=5,sweepLength=avg_radius*0.05),
InteractionDispatchers(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_Basic()]
),
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=50),
triax,
NewtonIntegrator(damping=.3),
PeriodicPythonRunner(iterPeriod=10,command='plot1()'),
]
#-----------------------------------------------------
# time step
#-----------------------------------------------------
#O.dt=-1.
O.dt=.5*utils.PWaveTimeStep() # initial timestep, to not explode right away
#-----------------------------------------------------
# plot some results
#-----------------------------------------------------
from yade import plot
def void_ratio():
p=triax.porosity # p=Vo/V
V=triax.boxVolume
Vo=p*V
Vs=V-Vo
#Vs=triax.spheresVolume
#V=triax.boxVolume
#Vo=V-Vs
return Vo/Vs
plot.plots={'epsilon_1':('sigma_1',None,'porosity','void_ratio')}
#plot.labels={'sigma_1':'$\sigma_{1}$' , 'epsilon_1':'$\epsilon_{1}$' , 'void_ratio':'void ratio'}
def plot1():
if(triax.currentState==3): ## - make the plot only after compression has started
plot.addData(
sigma_1=triax.stress(1),
epsilon_1=triax.strain[1],
porosity=triax.porosity,
void_ratio=void_ratio(),
)
#-----------------------------------------------------
# run!
#-----------------------------------------------------
from yade import qt
qt.View()
qt.Controller()
O.run(100,True)
O.dt=-1
O.run()
#O.wait()
#plot.plot()
Follow ups
References