# yade-users team mailing list archive

## [Question #679661]: plot diagram in PeriTriaxController

```New question #679661 on Yade:

Hello all,

I encountered to a problem in plotting diagram in PeriTriaxController. I want to simulate a triaxial test with below code. The simulation consist of tow part. 1. isotropic compaction and 2. deviatoric compaction. but when I plotted strain vs stress in compaction direction (szz-ezz), it plotted both isotropic and deviatoric part, but I want just the deviatoric part. Could you please help me to find how can I plot the diagram just for deviatoric part?

Best regards

Alireza

P.S. the code is:

from datetime import datetime

qtr=qt.Renderer()
qtr.bgColor=(1,1,1)

#===========================================================
#==================set a periodic boundary==================
#===========================================================

O.periodic=True
O.cell.refSize=(2e-1,2e-1,2e-1)

#==============================================================
#================= define the materials =======================
#==============================================================

O.materials.append(CohFrictMat(normalCohesion= 1e20, shearCohesion= 1e20, isCohesive= True, young=6.81e8, density=1377.5e2, poisson=0.3, frictionAngle= 0.31, fragile=False, label='Coke'))

#===============================================================
#=================== define packing ============================
#===============================================================

nums=['t']

mats=['Coke']

coke=(5e-3,200)

nums=pack.SpherePack()

nums.makeCloud((0,0,0),(2e-1,2e-1,2e-1),rMean=coke[0],rRelFuzz=1e-4,num=coke[1])

O.bodies.append([utils.sphere(c,r,material=mats[0],color=(0,0,1)) for c,r in nums])

#===============================================================
#=================== define Engine =============================
#===============================================================
sigmaIso=-1e6

O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),

PeriTriaxController(label='triax',
dynCell=True,maxStrainRate=(1,1,1),
maxUnbalanced=.1,relStressTol=1e-3,
doneHook='compactionFinished()'
),

NewtonIntegrator(damping=0.4),

PyRunner(command='history()',iterPeriod=10,label='recorder'),

]

O.dt=0.5*PWaveTimeStep()

O.saveTmp()

def history():
sxx=triax.stress[0],syy=triax.stress[1],szz=-triax.stress[2],
exx=triax.strain[0],eyy=triax.strain[1],ezz=-triax.strain[2],
sxz=-0.5*(triax.stress[2]+triax.stress[0]), ev=-(triax.strain[2]-triax.strain[0]),
q=-(triax.stress[2]-triax.stress[1]), p=-(triax.stress[2]+triax.stress[1]+triax.stress[0])/3 ,
R=3*(triax.stress[2]-triax.stress[1])/(triax.stress[2]+triax.stress[1]+triax.stress[0]+1e-2),
por=porosity(),i=O.iter,)
print 'stress difference:', -(triax.stress[2]-triax.stress[1])
print 'mean stress:',-(triax.stress[2]+triax.stress[1]+triax.stress[0])/3
print 'porosity:', porosity()

def compactionFinished():

O.cell.trsf=Matrix3.Identity

triax.goal=(sigmaIso,sigmaIso,-0.2)

triax.maxStrainRate=(.1,.1,.1)

triax.doneHook='triaxFinished()'

triax.maxUnbalanced=10

O.run(400000,True)

plot.plots={'ezz':('szz')}
plot.plot()

def triaxFinished():
O.run(30000,True)
print 'Finished'
O.pause()

--