yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #08808
Re: [Question #241137]: Memory error in plotDirections()
Question #241137 on Yade changed:
https://answers.launchpad.net/yade/+question/241137
Status: Answered => Open
Abhineet Agarwal is still having a problem:
# -*- coding: utf-8 -*-
#*************************************************************************
# Copyright (C) 2010 by Bruno Chareyre *
# bruno.chareyre_at_grenoble-inp.fr *
# *
# This program is free software; it is licensed under the terms of the *
# GNU General Public License v2 or later. See file LICENSE for details. *
#*************************************************************************/
## This script details the simulation of a triaxial test on sphere packings using Yade
## See the associated pdf file for detailed exercises
## the algorithms presented here have been used in published papers, namely:
## * Chareyre et al. 2002 (http://www.geosyntheticssociety.org/Resources/Archive/GI/src/V9I2/GI-V9-N2-Paper1.pdf)
## * Chareyre and Villard 2005 (https://yade-dem.org/w/images/1/1b/Chareyre&Villard2005_licensed.pdf)
## * Scholtès et al. 2009 (http://dx.doi.org/10.1016/j.ijengsci.2008.07.002)
## * Tong et al.2012 (http://dx.doi.org/10.2516/ogst/2012032)
##
## Most of the ideas were actually developped during my PhD.
## If you want to know more on micro-macro relations evaluated by triaxial simulations
## AND if you can read some french, it is here: http://tel.archives-ouvertes.fr/docs/00/48/68/07/PDF/Thesis.pdf
from yade import pack
############################################
### DEFINING VARIABLES AND MATERIALS ###
############################################
# The following 5 lines will be used later for batch execution
nRead=readParamsFromTable(
num_spheres=200,# number of spheres
compFricDegree = 30, # contact friction during the confining phase
key='_triax_base_', # put you simulation's name here
unknownOk=True
)
from yade.params import table
num_spheres=table.num_spheres# number of spheres
targetPorosity = 1.05/2.05 #the porosity we want for the packing for void ratio 1.05
compFricDegree = table.compFricDegree # initial contact friction during the confining phase (will be decreased during the REFD compaction process)
finalFricDegree = 30 # contact friction during the deviatoric loading
rate=0.035 # loading rate (strain rate)
damp=0.3 # damping coefficient
stabilityThreshold=0.01 # we test unbalancedForce against this value in different loops (see below)
young=3e9 # contact stiffness
mn,mx=Vector3(0,0,0),Vector3(.1,.1,.1) # corners of the initial packing
key = table.key
## create materials for spheres and plates
O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=0,density=0,label='walls'))
## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)
sp = pack.SpherePack()
sp.makeCloud(mn,mx,0.005,0.003,num_spheres,False, seed=1) #"seed" make the "random" generation always the same
O.bodies.append([sphere(center,rad,material='spheres') for center,rad in sp])
############################
### DEFINING ENGINES ###
############################
triax=TriaxialStressController(
maxMultiplier=1.00066, # spheres growing factor (fast growth)
finalMaxMultiplier=1.0000066, # spheres growing factor (slow growth)
thickness = 0,
stressMask = 7,
internalCompaction=True, # If true the confining pressure is generated by growing particles
)
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()]
),
## We will use the global stiffness of each body to determine an optimal timestep (see https://yade-dem.org/w/images/1/1b/Chareyre&Villard2005_licensed.pdf)
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
triax,
TriaxialStateRecorder(iterPeriod=100,file='WallStresses'+table.key),
newton
]
#Display spheres with 2 colors for seeing rotations better
Gl1_Sphere.stripes=0
triax.goal1=triax.goal2=triax.goal3=10000
while 1:
#the global unbalanced force on dynamic bodies, thus excluding boundaries, which are not at equilibrium
unb=unbalancedForce()
print 'unbalanced force:',unb,' mean stress: ',triax.meanStress
if unb<stabilityThreshold and abs(10000-triax.meanStress)/10000<0.0001:
break
O.run(1000, True)
sp.save("confinedState"+key)
if nRead==0: yade.qt.Controller(), yade.qt.View()
print "### Isotropic state saved ###"
###################################################
##############################
### DEVIATORIC LOADING ###
##############################
##We move to deviatoric loading, let us turn internal compaction off to keep particles sizes constant
triax.internalCompaction=False
## Change contact friction (remember that decreasing it would generate instantaneous instabilities)
setContactFriction(radians(finalFricDegree))
##set stress control on x and z, we will impose strain rate on y
triax.stressMask = 5
##now goal2 is the target strain rate
## we define the lateral stresses during the test, here the same 10kPa as for the initial confinement.
triax.goal1=10000
triax.goal3=10000
newton.damping=0.3
##Save temporary state in live memory. This state will be reloaded from the interface with the "reload" button.
O.saveTmp()
#####################################################
### Example of how to record and plot data ###
#####################################################
from yade import plot
## a function saving variables
def history():
plot.addData(e11=triax.strain[0], e22=triax.strain[1], e33=triax.strain[2],
ev=triax.strain[0]+triax.strain[1]+triax.strain[2],
p = ((triax.strain[1] + triax.strain[0] + triax.strain[2])/3.),
q = (triax.stress(triax.wall_top_id)[1]-triax.stress(triax.wall_front_id)[2]),
s11=triax.stress(triax.wall_right_id)[0],
s22=triax.stress(triax.wall_top_id)[1],
s33=triax.stress(triax.wall_front_id)[2],
ratio = ((triax.strain[1] + triax.strain[0] + triax.strain[2])/3.)/(triax.stress(triax.wall_top_id)[1]-triax.stress(triax.wall_front_id)[2]),
i=O.iter,
z=yade.utils.avgNumInteractions(cutoff=0.0,skipFree=False,considerClumps=True))
if 1:
# include a periodic engine calling that function in the simulation loop
O.engines=O.engines[0:5]+[PyRunner(iterPeriod=1,command='history()',label='recorder')]+O.engines[5:7]
#O.engines.insert(4,PyRunner(iterPeriod=20,command='history()',label='recorder'))
else:
# With the line above, we are recording some variables twice. We could in fact replace the previous
# TriaxialRecorder
# by our periodic engine. Uncomment the following line:
O.engines[4]=PyRunner(iterPeriod=1,command='history()',label='recorder')
cycle = 30
while cycle:
triax.goal2 = -rate
O.run(500,True)
triax.goal2 = rate
O.run(1000,True)
triax.goal2 = -rate
O.run(500,True)
cycle = cycle - 1
yade.utils.plotDirections()
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.