← Back to team overview

yade-users team mailing list archive

[Question #678257]: export fabric tensor in txt

 

New question #678257 on Yade:
https://answers.launchpad.net/yade/+question/678257

Hi,

I want to export fabric tensor in TXT.

>If i use fabTot=utils.fabricTensor(splitTensor=False) in plot.addData, resulting in an error.

ValueError: plot.addData given unhandled sequence type (is a tuple, must be number or Vector2/Vector3/Matrix3)

>If i use fabTot=utils.fabricTensor(splitTensor=False)[0] in plot.addData, resulting in an error.

KeyError: 'f'

So,how can i save it in txt.

Thanks,

James

################################
# encoding: utf-8
from yade import pack, qt

sigmaIso=-25000
O.periodic=True

sp=pack.SpherePack()
sp.makeCloud((0,0,0),(3,3,3),rMean=.1,rRelFuzz=.3,periodic=True)
sp.toSimulation()

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=(1,1,1),
      maxUnbalanced=.1,relStressTol=1e-3,
      doneHook='triaxFinished()'
   ),
   NewtonIntegrator(damping=.1),
   PyRunner(command='addPlotData()',iterPeriod=1000),
]
O.dt=.5*PWaveTimeStep()

def addPlotData():
   	plot.addData(
                 fabTot=utils.fabricTensor(splitTensor=False)[0],
	)
	print(fabricTensor(0.5))
	plot.saveDataTxt('f.dat',vars=('fabTot'))

def triaxFinished():
   O.pause()


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.