yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #29244
Re: [Question #706067]: replace with a clump
Question #706067 on Yade changed:
https://answers.launchpad.net/yade/+question/706067
Description changed to:
Hello, I am a beginner in Yade. I have two series of seeds, small and
large. For some reason, at the beginning of the code, I add both series
of seeds to the simulation. I want to replace a clamp with only small
seeds. Please tell me from which command. I should use.thank you for
your response.
from yade import pack
############################################
### DEFINING VARIABLES AND MATERIALS ###
############################################
# The following 5 lines will be used later for batch execution
nRead=readParamsFromTable(
num_spheres=1000,# 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
key=table.key
targetPorosity = 0.28#the porosity we want for the packing
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.02 # loading rate (strain rate)
damp=0.2 # damping coefficient
stabilityThreshold=0.01 # we test unbalancedForce against this value in different loops (see below)
young=1e9 # contact stiffness
mn,mx=Vector3(0,0,0),Vector3(.37,.37,6) # corners of the initial packing
ConPre=-10000
## create materials for spheres and trash and wall
O.materials.append(CohFrictMat(young=young,poisson=0.15,frictionAngle=radians(compFricDegree),density=2600,isCohesive=False,label='spheres'))
O.materials.append(CohFrictMat(young=1e6,poisson=0.48,density=1500,label='trash',frictionAngle=radians(compFricDegree),
isCohesive=True,
normalCohesion=50000000,
shearCohesion=50000000,
))
O.materials.append(CohFrictMat(young=1e9,poisson=0.2,density=1500,isCohesive=False,frictionAngle=0,label='walls'))
## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0)
wallIds=O.bodies.append(walls)
sp=pack.SpherePack()
spSmall = pack.SpherePack()
spBig = pack.SpherePack()
sp.makeCloud((0,0,0),(.37,.37,6),psdSizes=[.01,.0105,.011,.078,.08,.081],psdCumm=[0,.97,.9868,.987,.99,1],distributeMass=False,seed=1)
for ss in sp: #split SpherePack into two other packs based on the particle size
r = ss[1]
if r > .07/2:# please note that you feed diameters nor radii in psdSizes, that is why I divide it by 2
spBig.add(ss[0],ss[1])
else:
spSmall.add(ss[0],ss[1])
spSmall.toSimulation(material='spheres')
spBig.toSimulation(material='trash')
#############################
### DEFINING ENGINES ###
############################
triax=TriaxialStressController(
## TriaxialStressController will be used to control stress and strain. It controls particles size and plates positions.
## this control of boundary conditions was used for instance in http://dx.doi.org/10.1016/j.ijengsci.2008.07.002
maxMultiplier=1.+2e4/young, # spheres growing factor (fast growth)
finalMaxMultiplier=1.+2e3/young, # spheres growing factor (slow growth)
thickness = 0,
## switch stress/strain control using a bitmask. What is a bitmask, huh?!
## Say x=1 if stess is controlled on x, else x=0. Same for for y and z, which are 1 or 0.
## Then an integer uniquely defining the combination of all these tests is: mask = x*1 + y*2 + z*4
## to put it differently, the mask is the integer whose binary representation is xyz, i.e.
## "100" (1) means "x", "110" (3) means "x and y", "111" (7) means "x and y and z", etc.
stressMask = 4,
internalCompaction=False, # 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_ScGeom6D(interactionDetectionFactor=1.12),Ig2_Box_Sphere_ScGeom6D()],
[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(
setCohesionNow=True,
setCohesionOnNewContacts=False,
)],
[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),Law2_ScGeom_FrictPhys_CundallStrack()]
),
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8,maxDt=1e-6),
triax,
TriaxialStateRecorder(iterPeriod=100,file='WallStresses'+table.key),
newton
]
#######################################
### APPLYING CONFINING PRESSURE ###
#######################################
#the value of (isotropic) confining stress defines the target stress to be applied in all three directions
triax.goal1=triax.goal2=0
triax.goal3=ConPre
O.dt=1e-6
while 1:
print(O.iter)
O.run(10000, True)
##the global unbalanced force on dynamic bodies, thus excluding boundaries, which are not at equilibrium
unb=unbalancedForce()
print ('unbalanced force:',unb,' Z stress: ',triax.stress(5)[2])
if unb<stabilityThreshold and abs(ConPre-triax.stress(5)[2])/-ConPre<0.004:
break
print('confining finished')
O.save('confinedState'+key+'.yade.gz')
#print ("### Isotropic state saved ###")
##here I want to replace by below clump but just for small sphere. I don't know to do this since replaceByClumps runs on O.bodies
please guide me .thanks
relRadList1 = [0.2882557656,0.406619778,0.3688555312,0.26]
relPosList1 = [[0,-0.187117,-0.09206748],[0,0.00806748,-0.0344172],[0,0.190184,0],[0.12,0,-0.18]]
relRadList2 = [0.29,0.27,0.3,0.28]
relPosList2 = [[0,-0.14,0.08],[0,-0.12,-0.2],[0,0.06,0.18],[0,0.07,-0.15]]
relRadList3 = [0.21,0.23,0.23,0.31,0.23,0.29,0.22]
relPosList3 = [[0,-0.26,0.07],[0,-0.09,-0.12],[0,-0.08,0.16],[0,0.02,0],[0,0.1,-0.27],[0,0.16,0.15],[0,0.22,-0.11]]
templates= []
templates.append(clumpTemplate(relRadii=relRadList1,relPositions=relPosList1))
templates.append(clumpTemplate(relRadii=relRadList2,relPositions=relPosList2))
templates.append(clumpTemplate(relRadii=relRadList3,relPositions=relPosList3))
O.bodies.replaceByClumps(templates,[0.3,0.2,0.5],discretization = 20,material='sphere')
--
You received this question notification because your team yade-users is
an answer contact for Yade.