local variable 'compFricDegree' referenced before assignment
Hello, everyone!
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 TriaxialStressC
Second, when I try to realize it in the periodic triaxial test using PeriTriaxContro
# 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.
O.periodic=True
sp=pack.
sp.makeCloud(
sp.toSimulation()
# Set simulation loop
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
PeriTriaxContr
# specify target values and whether they are strains or stresses
goal=
# type of servo-control
dynCell=
# wait until the unbalanced force goes below this value
maxUnbalanced
# call this function when goal is reached and the packing is stable
doneHook=
),
NewtonIntegrat
]
O.dt=.5*
def compactionFinis
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
setContact
pc = utils.porosity()
print "\r Friction: ",compFricDegree," porosity:
sys.
O.run(500,1)
return pc
Thanks!
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Rong Zhao for more information if necessary.