particle position data

Asked by Jinny Kim on 2019-09-16

Hi all,

I have a question on the data for z position of particles.
I am trying to save z position for all particles in the simulation by using the code below and pyrunner.

for p in range(p_num):
       f1.write("%d\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\n" % (pkdID[p][0],p_mass[p][0],p_radii[p][0],x_pos[p][0],y_pos[p][0],z_pos[p][0],x_vel[p][0],y_vel[p][0],z_vel[p][0],x_ang[p][0],y_ang[p][0],z_ang[p][0]))
   f1.close()

I've attached some part of data for one particle.

-57.5695100000000 -59.8987800000000 -62.2748500000000 -64.6975900000000 -67.1669000000000 -69.6826200000000 -72.2446200000000 -74.8527100000000 -77.5067100000000 -80.2064300000000 0.155653600000000 -82.9516500000000 -85.7421600000000 -88.5777200000000 -91.4581100000000 -94.3830700000000 -97.3523800000000 -100.365800000000 -103.423100000000 -106.524000000000 -109.668400000000 0.155660900000000 -112.855900000000 -116.086600000000 -119.360100000000

Here, the z position decreases. It makes sense because there is only force, gravity with a negative z direction. but it looks like having dumb data like 0.155653600000000. Do you have any ideas why I got these weird data? Also, these weird data look like having the same frequency for all particles.

Thank you for your help in advance.

Jinny Kim

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2019-09-16
Last reply:
2019-10-02
Jan Stránský (honzik) said : #1

Hello,
please provide a complete MWE [1], otherwise we can just guess..
thanks
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Jinny Kim (jinnyk) said : #2

Hello, Jan Stránský,

I am sorry for this inconvenience. I have attached the simple version of my simulation code below. It also have the same issue with mine.... It looks like having weird data at iteration of 14, 25, 36, 47 .... (I am using Yade 1.20.0.)

#################################
import math
import numpy as np
import sys
import os.path
def saveData():
   global ids
   global i
   p_num=ids+1
   pkdID=np.zeros((p_num,1))
   p_radii=np.zeros((p_num,1))
   x_pos=np.zeros((p_num,1))
   y_pos=np.zeros((p_num,1))
   z_pos=np.zeros((p_num,1))
   x_vel=np.zeros((p_num,1))
   y_vel=np.zeros((p_num,1))
   z_vel=np.zeros((p_num,1))
   x_ang=np.zeros((p_num,1))
   y_ang=np.zeros((p_num,1))
   z_ang=np.zeros((p_num,1))
   p_mass=np.zeros((p_num,1))
   eflag=np.zeros((p_num,1))
   print(p_num)
   for k in range(p_num):
       pkdID[k][0]=O.bodies[k].id
       x_pos[k][0]=O.bodies[k].state.pos[0]
       y_pos[k][0]=O.bodies[k].state.pos[1]
       z_pos[k][0]=O.bodies[k].state.pos[2]
       x_vel[k][0]=O.bodies[k].state.vel[0]
       y_vel[k][0]=O.bodies[k].state.vel[1]
       z_vel[k][0]=O.bodies[k].state.vel[2]
       x_ang[k][0]=O.bodies[k].state.angVel[0]
       y_ang[k][0]=O.bodies[k].state.angVel[1]
       z_ang[k][0]=O.bodies[k].state.angVel[2]
       p_mass[k][0]=O.bodies[k].state.mass
       p_radii[k][0]=O.bodies[k].shape.radius
   f1=open(os.path.join("/home/ae_h1/yzk0056/Desktop/Semesters/2019 Summer Semester/DEM Project/DEMsimulation/Obtain_initial_position/Sim_regular_rotation_Apophis/constant_gravity_2/","Output_"+str(i)+".txt"),"w")
   for p in range(p_num):
       f1.write("%d\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\n" % (pkdID[p][0],p_mass[p][0],p_radii[p][0],x_pos[p][0],y_pos[p][0],z_pos[p][0],x_vel[p][0],y_vel[p][0],z_vel[p][0],x_ang[p][0],y_ang[p][0],z_ang[p][0]))
   f1.close()
   i+=1
Density=2900
Young=3.3e7
poisson=0.3
c_r = 0.1
r_fc = 0.0 #1st case: low angle of repose
frictionAngle=radians(35)
sphereColor = (.8,.8,0.)#dirty yellow
i=0
from yade import pack, plot, ymport, export
## Import particles
iron_ore=FrictMat(young=Young,poisson=poisson,density=Density,frictionAngle=frictionAngle)
Mat=O.materials.append(iron_ore)
from yade import pack, plot, ymport, export
sp=pack.SpherePack()
ids=sp.makeCloud(minCorner=(-0.4,-0.2,0.01),maxCorner=(0.4,0.2,1),rMean=2.0e-2,rRelFuzz=0.,num=250000,periodic=False)
sp.toSimulation(material=Mat)
for pp in O.bodies:
   ids=pp.id
## Import wall's geometry
O.materials.append(FrictMat(young=Young,poisson=poisson,density=Density,frictionAngle=frictionAngle,label='frictionlessWalls'))
fctIds = O.bodies.append(geom.facetBox((0.,0.,-0.01),(0.8,0.4,0.0),wallMask=0b110011,color=(1,0,0),wire=False))
g=6.5e-2
itr_num=30000
## Engines
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
       [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
       [Ip2_FrictMat_FrictMat_MindlinCapillaryPhys(krot=r_fc,en=c_r,es=c_r)],
       [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
       ),
   NewtonIntegrator(damping=0,gravity=(0,0,-g),label='NI'),
   PyRunner(iterPeriod=itr_num,command='saveData()')
]
## time step (how to run the script)
O.dt=2.0e-4 # should be 1.0e-6
O.run(14400000)
from yade import qt
qt.View()
#####################################################

Thank you for your help in advance.

Sincerely,
Jinny Kim

Jan Stránský (honzik) said : #3

Hello,
I have tried your code (using Yade 2018.02b), but found no "weird data" (did not try too much, thought).. Please be more specific (I don't want to check 2500 lines of data file to find one discrepancy :-)
It would help, if you could create a MWE [1], i.e. minimal from point of both code and simulation (number of particles, running time).
cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Launchpad Janitor (janitor) said : #4

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.