yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #21712
Re: [Question #688070]: save the evolution of the average kinetic energy of the grains and their average distance
Question #688070 on Yade changed:
https://answers.launchpad.net/yade/+question/688070
Status: Needs information => Open
hafsa gave more information on the question:
hello Jan,
I divided my problem in two codes, the first is an initialization of configuration periodic channel without inclination:
#!/usr/bin/python
#Import libraries
from yade import pack, qt ,utils ,plot
# Material of Particles and walls
r_Prt=0.5 #radius of the particles
r_Prt_base=0.05 #radius of the particles which made the bunpy base
O.materials.append(ViscElMat(cn=33.5, cs=16.75, density=1.91,
frictionAngle=0.4637, kn=2e5, ks=1e5, label='Mat'))
#Configuration:
length=40 #Streamwise length of the periodic cell, in diameter
width=40 #Spanwise length of the periodic cell, in diameter
height=2*length #heigth of the periodic cell
gravityVector = Vector3(0,0,-1) #Gravity vector
#Definition of the semi-periodic cell
O.periodic = True
O.cell.setBox(length,width,height)
# Reference walls: build two planes
wall_1=O.bodies.append(box(center=(20,0.1,9.5),extents=(20,0,9),fixed=True,wire=False,color=(1,0,1),material='Mat'))
wall_2=O.bodies.append(box(center=(20,39.9,9.5),extents=(20,0,9),fixed=True,wire=False,color=(1,0,1),material='Mat'))
# Build bumpy base made by particles
for i in range(1,81,1):
for j in range(2,82,1):
O.bodies.append([utils.sphere(center=(i*0.5,j*0.5,1),radius=r_Prt_base,fixed=True,color=(1,1,0))])
j=+1
i=+1
#Create a loose cloud of particle inside the cell
partCloud = pack.SpherePack()
partCloud.makeCloud(minCorner=(2,2,14),maxCorner=(length-5,width-5,height),rRelFuzz=0.,rMean=r_Prt,num =7200)
partCloud.toSimulation(material='Mat') #Send this packing to simulation with material Mat
# Simulation LOOP
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Wall_Aabb(), Bo1_Facet_Aabb(),Bo1_Box_Aabb()],label='contactDetection',allowBiggerThanPeriod = True),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Box_Sphere_ScGeom()],
[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
[Law2_ScGeom_ViscElPhys_Basic()],label = 'interactionLoop'),
# Integrate the equation and calculate the new position/velocities...
NewtonIntegrator(damping=0.2, gravity=gravityVector, label='newtonIntegr'),
PyRunner(iterPeriod=21000,command='AddData()')
]
def AddData():
O.save('/home/hafsa/doctorat d1/init_channel_40w.yade.gz')
#Timestep
O.dt=.1e-2
qt.View()
O.run(21500)
O.saveTmp('init_channel.xml.bz2')
In the second, i add the inclination with saving evolution of the average kinetic energy of the grains and their average distance in a file and when i open it i found that the kinitic energy=2 in all the simulation, this is my problem.
#!/usr/bin/python
#Import libraries
from yade import qt ,plot
# load the initial congiguration
O.load('/home/hafsa/doctorat d1/init_channel_40w.yade.gz')
#Inclination angle of the channel slope
slope=35
#Evolution of the kinetic energies of the flow over the average distance traveled by the grains.
n=7200 # number of spheres
# interactions
O.engines=O.engines+[NewtonIntegrator(damping=0.2, gravity=Vector3(-1*sin(slope),0.0,-1*cos(slope)), label='newtonIntegr'),
PyRunner(iterPeriod=500,command='AddData()'),#save every 500 periode of simulation
PyRunner(iterPeriod=23607,command='Data()'),# end of simulation
]
""" open file"""
fil=open('inclined_channel_40w_.dat', 'w')
fil.write('#Ec\t x \n')
def AddData():
x_g=0
for b in O.bodies:
if isinstance(b.shape,Sphere) and b.shape.radius==0.5:
plot.addData(i=O.iter,e=kineticEnergy()/n,**O.energy) #energy kenetic
x_g=x_g+b.state.pos[0]
fil.write('%d %.3f\n' % (e,x_g/n))
#saving simulation
def Data():
O.save('/home/hafsa/doctorat d1/inclined_channel_40w.yade.gz')
#Timestep
O.dt=.1e-2
O.run(23707)
qt.View()
#utils.waitIfBatch()
--
You received this question notification because your team yade-users is
an answer contact for Yade.