plot diagram in PeriTriaxController

Asked by Alireza Sadeghi

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?
Thank you very much for your help in advance.

Best regards

Alireza

P.S. the code is:

from yade import utils, plot
from yade import pack, qt
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',
  goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
  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():
 plot.addData(unbalanced=unbalancedForce(),
  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.stressMask=3

 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()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Alireza Sadeghi
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

there are several options, depending on your specific needs and situation:
- use another program for plotting (excel, gnuplot...) with filtered values
- if you do not need data from the iso part, set PyRunner dead=True by default and set dead=False in compationFinished function
- reset plot.data in compationFinished function (shown below)
###
...
def compactionFinished():
   ...
   dataOld = plot.data # if needed to manipulate the data from iso part
   plot.daveDataTxt(...) # you can save the data from iso part
   plot.data = {} # reset plot.data
   plot.plot() # start plotting from here?
...
plot.plots={'ezz':('szz')}
# plot.plot() # comment/delete this? to plot nothing before deviatoric part..
...
###

cheers
Jan

Revision history for this message
Alireza Sadeghi (asadeghime) said :
#2

Dear Jan,

Thank you for your help. Your help works great.

Best Regards

Alireza