← Back to team overview

yade-users team mailing list archive

[Question #235985]: Highest clump position in clump cloud

 

New question #235985 on Yade:
https://answers.launchpad.net/yade/+question/235985

HIGHEST CLUMP IN CLOUD

Hello Yade mates,

I have made 3 clump clouds, at different heights each one. I'd like to know the position of the highest clump of each cloud at each time step.

To achieve that, I've made a Pyrunner command, as you can read below. I intended to do it by writting different loops.
However, when I run the simulation for a while, and check the Ymax values, their values result the same as prior to the simulation run, they don't vary.
I suppose the problem is related to the first Ymax and HBmax values assigned, but I don't know how to solve it.

Thank you for your advices
Sergio


from yade import pack, qt, plot, ymport, export


#////// MATERIALS \\\\\\
MatBal=O.materials.append(FrictMat(
	young=27e9,poisson=0.30,density=5400,
		frictionAngle=0.7,label='balasto'))

#////// BOUNDARIES (bx - htot - bz) \\\\\\

O.bodies.append(utils.geom.facetBox(

	(0,0,0),(1.5,0.8,1.5),wallMask=55))



#////// SPHERE PACK CREATION \\\\\\\\\\\\\\\\

c1=pack.SpherePack([((0.007,0,0),0.022),((-0.011,0,0),0.0205),
	((0,0.012,0),0.024)

	])

c2=pack.SpherePack([((0,0,0),0.0122),

	((0,0.005,0),0.0122),((0.006,0.0075,0),0.0121),

		((0,0.00875,0),0.0118),
	])



#////// PROPERTIES \\\\\\

###### Layer 1 ######

capa1=pack.SpherePack()

capa1.makeClumpCloud(

	(-0.1,-0.2,-0.1),(0.1,0,0.2),

	[c1,c2],periodic=False)

capa1.toSimulation(material=MatBal,color=(0.3,0.9,1))

len1=len(O.bodies)

HBmax=len(capa1)-1

Ymax1=O.bodies[HBmax].state.pos[1]


##### Layer 2 ########

capa2=pack.SpherePack()
capa2.makeClumpCloud(

	(-0.1,-0.5,-0.1),(0.1,-0.3,0.2),

	[c1,c2],periodic=False)

capa2.toSimulation(material=MatBal,color=(0.9,0.2,1))
len2=len(O.bodies)
HBmax2=len2
Ymax2=O.bodies[HBmax2-1].state.pos[1]


##### Layer 3 #########

capa3=pack.SpherePack()
capa3.makeClumpCloud(

	(-0.1,-0.8,-0.1),(0.1,-0.6,0.2),

	[c1,c2],periodic=False)
capa3.toSimulation(material=MatBal,color=(0.3,0.2,0.1))

len3=len(O.bodies)

HBmax3=len3
Ymax3=O.bodies[HBmax3-1].state.pos[1]



#///////////// Layer heights \\\\\\\\\\\\\\\

def alturasMaximasCapas():

	HBmax= len1-1

	Ymax1=O.bodies[HBmax].state.pos[1]

	HBmax2=len2-1

	Ymax2=O.bodies[HBmax2].state.pos[1]

	HBmax3=len3-1

	Ymax3=O.bodies[HBmax3].state.pos[1]

# Layer heigth 1

	for ii in range(0,len(capa1)):

		if O.bodies[ii].isClump==True:

			if Ymax1<O.bodies[ii].state.pos[1]:

				Ymax1=O.bodies[ii].state.pos[1]

				HBmax=ii

# Layer heigth 2

	for jj in range(len(capa1),len(capa1)+len(capa2)-1):

		if O.bodies[jj].isClump==True:

			if Ymax2<O.bodies[jj].state.pos[1]:

				Ymax2=O.bodies[jj].state.pos[1]

				HBmax2=jj

# Layer heigth 3

	for zz in range(len(capa2),len(capa1)+len(capa2)+len(capa3)-1):

		if O.bodies[zz].isClump==True:

			if Ymax3<O.bodies[zz].state.pos[1]:

				Ymax3=O.bodies[zz].state.pos[1]

				HBmax3=zz

# //////////////////////  Engines \\\\\\\\\\\\\\\\

O.engines=[

	ForceResetter(),

	InsertionSortCollider(

		[Bo1_Sphere_Aabb(),

			Bo1_Facet_Aabb(),

			Bo1_Box_Aabb(),

			Bo1_Wall_Aabb()]),

	InteractionLoop(

		[Ig2_Sphere_Sphere_ScGeom(),

			Ig2_Facet_Sphere_ScGeom(),

			Ig2_Wall_Sphere_ScGeom(),

			Ig2_Box_Sphere_ScGeom()],

		[Ip2_FrictMat_FrictMat_FrictPhys()],

		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),

	PyRunner(command='alturasMaximasCapas()',

			iterPeriod=1,label='checker'),

	NewtonIntegrator(damping=0.5,gravity=[0,-9.81,0],label='newton')

]

factor=1
O.dt=factor*utils.PWaveTimeStep()  #time step



-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.