← Back to team overview

yade-users team mailing list archive

Re: [Question #691828]: Deactivate triaxial stress controller

 

Question #691828 on Yade changed:
https://answers.launchpad.net/yade/+question/691828

    Status: Answered => Open

Yuxuan Wang is still having a problem:
Thanks for the clarification, Chu and Jan! I am still quite new to
python and struggled to understand the error message. It's clear now!

I hoped to use "triaxialStressEngine.dead" to stop the walls from
compressing the particles while O.engines is still running. Now although
it returns “true” when I ask for “In [3]: controller.dead” in the
terminal, the walls don’t stop compressing. Is it because
“triaxialStressEngine.dead” isn’t the way to accomplish it or are there
other errors in my code?

I have done some slight modifications on “stop()” and
“gravityDeposition()” at the end of my code.

Really appreciate your help! 
-Yuxuan
----------------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import print_function
import matplotlib; matplotlib.rc('axes',grid=True)
import pylab
from yade import pack, plot, qt
from yade import export

############################################
### DEFINING VARIABLES AND MATERIALS ###
############################################

#geometry definition
Ri,Rs,Ro=6.5,8.5,10.5
H=3.5
p=H/2
k=0.01 
Hs=H*k 
hs=Hs/2 
Rx=2*Ro
Hx=2*H

c1=geom.facetCylinder(center=(0,0,p),radius=Ro, height=H, segmentsNumber=20, wallMask=6) 
c2=geom.facetCylinder(center=(0,0,hs),radius=Rs, height=Hs, segmentsNumber=20, wallMask=7)
c3=geom.facetCylinder(center=(0,0,p),radius=Ri, height=H, segmentsNumber=20, wallMask=7)


nRead=readParamsFromTable(
 num_spheres=5000,
 compFricDegree = 30, 
 unknownOk=True
)

from yade.params import table
num_spheres=table.num_spheres
compFricDegree = table.compFricDegree 
damp=0.2 
young=5e6 # contact stiffness
mn,mx=Vector3(-50,-50,-50),Vector3(50,50,50) # corners of the initial packing

## create materials for spheres and plates
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))

## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

## use a SpherePack object to generate a psd loose particles packing
global sp
sp=pack.SpherePack()
sp.makeCloud(mn,mx,num=6000,psdSizes=[1,2,2.25,2.5,3,4,6],psdCumm=[0.,0.1,0.3,0.3,.3,.7,1.]) 
sp.toSimulation(material='spheres')

############################
### DEFINING ENGINES ###
############################

triax=TriaxialStressController(
 thickness = 0,
 stressMask = 7,
 internalCompaction=False, 
 label='controller'
)

newton=NewtonIntegrator(damping=damp)

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),

 PyRunner(command='stop()',iterPeriod=10,label='checker'),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
 triax,
 newton
]

#Display spheres with 2 colors for seeing rotations better
Gl1_Sphere.stripes=0
if nRead==0: yade.qt.Controller(), yade.qt.View()

#######################################
### APPLYING CONFINING PRESSURE ###
#######################################
 
triax.goal1=triax.goal2=triax.goal3=-10000

def stop():
 if O.iter<100:return
 else:
  controller.dead=True
  #O.pause()
  checker.command='gravityDeposition()'

def gravityDeposition():
 if O.iter<103:
  pred=pack.inCylinder((0,0,0),(0,0,H),Ro)-pack.inCylinder((0,0,0),(0,0,Hs),Rs)-pack.inCylinder((0,0,0),(0,0,H),Ri)
  assembly=pack.filterSpherePack(pred,sp,True)
  assembly.toSimulation()
 else: 
  print ('done')
  #O.pause()
#...connect to next steps in simulation

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