Dyverso's getNeighbors()
Posted: Tue Jan 23, 2018 7:14 am
I was working on some script and got strange issue with Dyverso's getNeighbors(Vector, float) function.
I created a sheet of particles (22x22 particles, resolution of Domain is 10). No external forces. Width of the sheet is 1m x 1m. So, the distance between particles is around 0.045. Emitter is not emitting.
Here is part of the code that I made for a test:
for particle in pList:
pPos = particle.getPosition()
pId = particle.getId()
#scene.message(str(pPos))
nList = dom.getNeighbors(pPos, 0.755) #searching distance 0.755
scene.message(str(len(nList)) + " neighbors of the particle " + str(particle.getId()))
if (nList > 0 ):
for nparticle in nList:
npPos = nparticle.getPosition()
dist = (npPos-pPos)
#scene.message("distance from particle " + str(nparticle.getId()) + " to the particle " + str(pId) + ": " + str(dist.module()))
So, the problem is that if I use searching distance that is 0.05 or so, the result is zero neighbors. I had to increase the radius dramatically. Even though, the result more then just strange. Most particles have zero neighbors, but some have 20-30 and more neighbors. I checked distance between a particle and it's neighbors. The distance is much much smaller then searching radius which is not surprising for me. I also tried very extreme radius value, 1.5, which is more then the width of the sheet of particles I've created. So, it should show me that each particle has 483 (22*22(particles in the domain) - 1(for this particle we are searching neighbors) = 483). The result is different. some particles have NO neighbors.
Pretty much the same code works well with Standard particles. With distance 0.05 it shows me 3-5 neighbors for each particle.
One more thing Voxelization() have no effect on simulation at all. Maybe I'm doing something wrong. Unfortunately, there is almost no information about Voxelization() function in Help. Maybe someone knows where it should be placed in a code?
Any ideas how to solve the problem or, at least, why it happens?
Thanks guys,
Andrey
I created a sheet of particles (22x22 particles, resolution of Domain is 10). No external forces. Width of the sheet is 1m x 1m. So, the distance between particles is around 0.045. Emitter is not emitting.
Here is part of the code that I made for a test:
for particle in pList:
pPos = particle.getPosition()
pId = particle.getId()
#scene.message(str(pPos))
nList = dom.getNeighbors(pPos, 0.755) #searching distance 0.755
scene.message(str(len(nList)) + " neighbors of the particle " + str(particle.getId()))
if (nList > 0 ):
for nparticle in nList:
npPos = nparticle.getPosition()
dist = (npPos-pPos)
#scene.message("distance from particle " + str(nparticle.getId()) + " to the particle " + str(pId) + ": " + str(dist.module()))
So, the problem is that if I use searching distance that is 0.05 or so, the result is zero neighbors. I had to increase the radius dramatically. Even though, the result more then just strange. Most particles have zero neighbors, but some have 20-30 and more neighbors. I checked distance between a particle and it's neighbors. The distance is much much smaller then searching radius which is not surprising for me. I also tried very extreme radius value, 1.5, which is more then the width of the sheet of particles I've created. So, it should show me that each particle has 483 (22*22(particles in the domain) - 1(for this particle we are searching neighbors) = 483). The result is different. some particles have NO neighbors.
Pretty much the same code works well with Standard particles. With distance 0.05 it shows me 3-5 neighbors for each particle.
One more thing Voxelization() have no effect on simulation at all. Maybe I'm doing something wrong. Unfortunately, there is almost no information about Voxelization() function in Help. Maybe someone knows where it should be placed in a code?
Any ideas how to solve the problem or, at least, why it happens?
Thanks guys,
Andrey