yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #18692
[Question #677437]: Save the txt
New question #677437 on Yade:
https://answers.launchpad.net/yade/+question/677437
Hi,
I want to save the result to txt.I learned the code here,https://answers.launchpad.net/yade/+question/209832.But I found the data in txt.bz2 is just 5000 iter at the beginning.How do I get all the data?
Thanks,
Feng
Here's my code:
######################
# encoding: utf-8
from yade import pack, qt, plot
import matplotlib; matplotlib.rc('axes',grid=True)
from yade import pack
import pylab
import yade.timing;
O.timingEnabled=True
sigmaIso=-25000
O.periodic=True
spheres=O.materials.append(FrictMat(young=64e9,poisson=0.12,density=2650,frictionAngle=0.0005))
s=O.materials.append(FrictMat(young=64e9,poisson=0.12,density=2650,frictionAngle=0.24))
psdSizes,psdCumm=[0.1,0.12,0.15,0.19,0.20,0.23,0.27,0.28,0.30,0.32,0.33,0.50],[0.0001,0.003,0.03,0.11,0.25,0.43,0.70,0.85,0.95,0.97,0.98,1]
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(3,3,3),psdSizes=psdSizes,psdCumm=psdCumm,distributeMass=True,periodic=True)
n=sp.toSimulation(material=spheres)
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
PeriTriaxController(label='triax',
goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
dynCell=True,maxStrainRate=(0.5,0.5,0.5),
maxUnbalanced=1,relStressTol=0.05,
doneHook='compactionFinished()'
),
NewtonIntegrator(damping=.1),
PyRunner(command='addPlotData1()',iterPeriod=200),
]
O.dt=1*PWaveTimeStep()
O.trackEnergy=True
def addPlotData1():
plot.addData(s0=triax.stress[0],s1=triax.stress[1],s2=triax.stress[2],q=triax.stress[2]-0.5*(triax.stress[0]+triax.stress[1]), p=(triax.stress[0]+triax.stress[1]+triax.stress[2])/3)
print('stress1',triax.stress[0],triax.stress[1],triax.stress[2])
print('strain',triax.strain[0],triax.strain[1],triax.strain[2])
print('q',triax.stress[2]-0.5*(triax.stress[0]+triax.stress[1]),'p',(triax.stress[0]+triax.stress[1]+triax.stress[2])/3)
pylab.semilogx(*sp.psd(bins=30,mass=True),label='Mass PSD of (free) %d random spheres'%len(sp))
pylab.legend()
pylab.show()
O.run(5000,True)
plot.plots={'q':('p',)}
plot.plot()
plot.saveDataTxt('pq.txt.bz2')
qt.Controller()
O.saveTmp()
def compactionFinished():
O.cell.trsf=Matrix3.Identity
triax.goal=(sigmaIso,sigmaIso,-800000)
triax.stressMask=4
triax.maxStrainRate=(0,0,0.5)
triax.maxUnbalanced=10
triax.relStressTol=0.05
triax.doneHook='triaxFinished()'
def triaxFinished():
print 'Finished'
print(yade.timing.stats())
O.pause()
--
You received this question notification because your team yade-users is
an answer contact for Yade.