How to access the porosity once the compaction is finished in triaxial test?

Asked by Rong Zhao on 2019-09-04

Hello, everyboday!

I am learning a tutorial of Periodic triaxial test (https://yade-dem.org/doc/tutorial-examples.html#periodic-triaxial-test). Here is the code:

from __future__ import print_function
sigmaIso=-1e5

#import matplotlib
#matplotlib.use('Agg')

# generate loose packing
from yade import pack, qt, plot

O.periodic=True
sp=pack.SpherePack()
if 0:
 ## uniform distribution
 sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.3,periodic=True)
else:
 ## create packing from clumps
 # configuration of one clump
 c1=pack.SpherePack([((0,0,0),.03333),((.03,0,0),.017),((0,.03,0),.017)])
 # make cloud using the configuration c1 (there could c2, c3, ...; selection between them would be random)
 sp.makeClumpCloud((0,0,0),(2,2,2),[c1],periodic=True,num=500)

# setup periodic boundary, insert the packing
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',
  # specify target values and whether they are strains or stresses
  goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
  # type of servo-control
  dynCell=True,maxStrainRate=(10,10,10),
  # wait until the unbalanced force goes below this value
  maxUnbalanced=.1,relStressTol=1e-3,
  # call this function when goal is reached and the packing is stable
  doneHook='compactionFinished()'
 ),
 NewtonIntegrator(damping=.2),
 PyRunner(command='addPlotData()',iterPeriod=100),
]
O.dt=.5*PWaveTimeStep()

def addPlotData():
 plot.addData(unbalanced=unbalancedForce(),i=O.iter,
  sxx=triax.stress[0],syy=triax.stress[1],szz=triax.stress[2],
  exx=triax.strain[0],eyy=triax.strain[1],ezz=triax.strain[2],
  # save all available energy data
  Etot=O.energy.total(),**O.energy
 )

# enable energy tracking in the code
O.trackEnergy=True

# define what to plot
plot.plots={'i':('unbalanced',),'i ':('sxx','syy','szz'),' i':('exx','eyy','ezz'),
 # energy plot
 ' i ':(O.energy.keys,None,'Etot'),
}
# show the plot
plot.plot()

def compactionFinished():
 # set the current cell configuration to be the reference one
 O.cell.trsf=Matrix3.Identity
 # change control type: keep constant confinement in x,y, 20% compression in z
 triax.goal=(sigmaIso,sigmaIso,-.2)
 triax.stressMask=3
 # allow faster deformation along x,y to better maintain stresses
 triax.maxStrainRate=(1.,1.,.1)
 # next time, call triaxFinished instead of compactionFinished
 triax.doneHook='triaxFinished()'
 # do not wait for stabilization before calling triaxFinished
 triax.maxUnbalanced=10

def triaxFinished():
 print('Finished')
 O.pause()

The triaxial consists of 2 stages, one of the stages is isotropic compaction. I want to know whether the porosity is accessed once the compaction is finished. If can, how to access the porosity once the compaction is finished in triaxial test? Or whether I can specify the porosity during the compaction?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Rong Zhao
Solved:
2019-09-23
Last query:
2019-09-23
Last reply:
2019-09-20
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Jan Stránský (honzik) said : #2

Hi,

utils.porosity() # [1] ?

cheers
Jan

[1] https://yade-dem.org/doc/yade.utils.html#yade._utils.porosity

Rong Zhao (zhaorong) said : #3

Thank you for your reply, Jan Stránský! But I am facing new problems.

I am trying to specify porosity value after the compaction in periodic triaxial test base on the following codes, but there is something wrong with it.
First, I am not sure whether porosity can be specified after the compaction in a periodic triaxial test like the example of the triaxial test using TriaxialStressController.

Second, when I try to realize it in the periodic triaxial test using PeriTriaxController(), there is something wrong with it( local variable 'compFricDegree' referenced before assignment). Here is my conde.

====================================
# Specify the porosity in periodic triaxial test

from yade import pack, qt, plot

sigmaIso=-1e5
targetPorosity = 0.3
compFricDegree = 30
young = 5e6
num_spheres = 1000
mn, mx = Vector3(0,0,0), Vector3(1,1,1)

# generate loose packing

O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.periodic=True
sp=pack.SpherePack()
sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.95,seed=1)
sp.toSimulation()

# Set simulation loop
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 PeriTriaxController(label='triax',
  # specify target values and whether they are strains or stresses
  goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
  # type of servo-control
  dynCell=True,maxStrainRate=(10,10,10),
  # wait until the unbalanced force goes below this value
  maxUnbalanced=.1,relStressTol=1e-3,
  # call this function when goal is reached and the packing is stable
  doneHook='compactionFinished()'
 ),
 NewtonIntegrator(damping=.2),
]

O.dt=.5*PWaveTimeStep()

def compactionFinished():
 print('Compaction Finished')
 O.pause()
 pc = utils.porosity()
 print("Porosity after compaction: " + str(pc))
 # Reach a Specified Porosity precisely
 import sys #this is only for the flush() below
 while pc > targetPorosity:
     # we decrease friction value and apply it to all the bodies and contacts
     compFricDegree = 0.95*compFricDegree
     setContactFriction(radians(compFricDegree))
     pc = utils.porosity()
     print "\r Friction: ",compFricDegree," porosity:",utils.porosity()
     sys.stdout.flush()
     O.run(500,1)
 return pc

Jan Stránský (honzik) said : #4

> But I am facing new problems.

then please open a new question for each problem [1] :-)

cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Rong Zhao (zhaorong) said : #5

I am sorry for asking the question in an inappropriate way to append new questions after an older question. You actually solved my problem that how to access the porosity once the compaction is finished in the triaxial test.

Rong Zhao (zhaorong) said : #6

Thanks, Jan Stránský!You actually solved my problem that how to access the porosity once the compaction is finished in the triaxial test.