yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05011
TriaxialStateRecorder vs. python
-
To:
yade-dev@xxxxxxxxxxxxxxxxxxx
-
From:
Janek Kozicki <janek_listy@xxxxx>
-
Date:
Sun, 4 Jul 2010 20:22:43 +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==
Hello,
I was trying to use python plot.plot() instead of TriaxialStateRecorder.
I had problems with reading wall stresses. They are accessed from
TriaxialStateRecorder with following lines:
<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_right][0] ) << " "
<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_top][1] ) << " "
<< lexical_cast<string> ( triaxialStressController->stress[triaxialStressController->wall_front][2] ) << " "
But in python a similar thing didn't work. The TriaxialStressController.stress[6]
is not exposed to python. And python actually cannot parse this type.
So I made some changes in TriaxialStressController.[ch]pp so that the
attached script will work. Python cannot also parse type Real[3], so
I replaced it with Vector3r, for strain.
Bruno, can you have a look at what I have changed? Is that OK? I hope
that this change is backward compatible.
please try attached script, after doing `bzr up`
--
Janek Kozicki http://janek.kozicki.pl/ |
#!/usr/local/bin/yade-trunk -x
# -*- coding: utf-8 -*-
# -*- encoding=utf-8 -*-
TriaxialTest(numberOfGrains=200).load()
O.engines += [PeriodicPythonRunner(iterPeriod=10,command='plot1()')]
triaxialStressController=O.engines[5]
def sigma_1():
return triaxialStressController.wall_stress[1]
def epsilon_1():
return triaxialStressController.strain[1]
from yade import qt
qt.View()
qt.Controller()
# plot some results
from math import *
from yade import plot
plot.plots={'epsilon_1':'sigma_1'}
def plot1():
plot.addData(sigma_1=sigma_1(),
epsilon_1=epsilon_1())
O.run(10000,True)
plot.plot()
Follow ups