← Back to team overview

yade-users team mailing list archive

[Question #402934]: SpherePack slicing

 

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

Are there any rules to slicing/manipulating SpherePack objects? I am having difficulty using a pack I sliced from a larger pack to run simulations on.

What I am trying to do, is to take a large packing of spheres and create a smaller random "subsample" from it. However, when I do so the simulation fails with the walls seemingly disappearing after the second step.

Here is my code to take a large pack and create random smaller samples from it:

======================================================================
from yade import pack
import numpy as np
############################################
###  EXTRACT RANDOM SUBSAMPLES FROM PACK ###
############################################
numSubs=100# number of random subsamples
num_spheres=30000 # number of spheres in subpack

sp=pack.SpherePack()
sp2=pack.SpherePack()
sp.load('largeSP.txt')

spList=sp.toList()
maxSize=len(spList) # number of spheres in large pack

for i in range(0,numSubs):
  spIndex=np.random.choice(maxSize, num_spheres)
  spIndex.sort()
  spList2=[spList[j] for j in spIndex]
  sp2.fromList(spList2)
  sp2.save('sp'+str(i)+'.txt')
======================================================================


This succeeds in creating SpherePack text files that I can then successfully load. This is the output I get before I run any steps:

SP aabb:  Vector3(4.993299999999998e-6,1.2135000000000046e-6,3.5300000000000153e-6) Vector3(0.147353214,0.147346008,0.1473542216) (Vector3(4.993299999999998e-6,1.2135000000000046e-6,3.5300000000000153e-6), Vector3(0.147353214,0.147346008,0.1473542216))
SP packing center:  Vector3(0.07367910365000001,0.07367361075000001,0.0736788758)
SP relative density:  0.000127509388154
Triax particle volume: 0.000000000
Triax box volume: 0.000000000
Triax height: 0.000000000 height0: 0.000000000
Triax width: 0.000000000 width0: 0.000000000
Triax depth: 0.000000000 depth0: 0.000000000
aabbExtrema:  (Vector3(4.993299999999998e-6,1.2135000000000046e-6,3.5300000000000153e-6), Vector3(0.147353214,0.147346008,0.1473542216))
aabbDim:  (0.1473482207, 0.1473447945, 0.1473506916)
Wall  0  coordinates:  Vector3(4.993299999999998e-6,0.07367361075000001,0.0736788758)
Wall  1  coordinates:  Vector3(0.147353214,0.07367361075000001,0.0736788758)
Wall  2  coordinates:  Vector3(0.07367910365000001,1.2135000000000046e-6,0.0736788758)
Wall  3  coordinates:  Vector3(0.07367910365000001,0.147346008,0.0736788758)
Wall  4  coordinates:  Vector3(0.07367910365000001,0.07367361075000001,3.5300000000000153e-6)
Wall  5  coordinates:  Vector3(0.07367910365000001,0.07367361075000001,0.1473542216)

Output after the first step

Triax particle volume: 0.000000409
Triax box volume: 0.003199130
Triax height: 0.147344794 height0: 0.147344794
Triax width: 0.147348221 width0: 0.147348221
Triax depth: 0.147350692 depth0: 0.147350692
aabbExtrema:  (Vector3(nan,nan,nan), Vector3(nan,nan,nan))
aabbDim:  (nan, nan, nan)
Wall  0  coordinates:  Vector3(nan,nan,nan)
Wall  1  coordinates:  Vector3(nan,nan,nan)
Wall  2  coordinates:  Vector3(nan,nan,nan)
Wall  3  coordinates:  Vector3(nan,nan,nan)
Wall  4  coordinates:  Vector3(nan,nan,nan)
Wall  5  coordinates:  Vector3(nan,nan,nan)

Output after the second step

Triax particle volume: 0.000000409
Triax box volume: nan
Triax height: nan height0: 0.147344794
Triax width: nan width0: 0.147348221
Triax depth: nan depth0: 0.147350692
aabbExtrema:  (Vector3(nan,nan,nan), Vector3(nan,nan,nan))
aabbDim:  (nan, nan, nan)
Wall  0  coordinates:  Vector3(nan,nan,nan)
Wall  1  coordinates:  Vector3(nan,nan,nan)
Wall  2  coordinates:  Vector3(nan,nan,nan)
Wall  3  coordinates:  Vector3(nan,nan,nan)
Wall  4  coordinates:  Vector3(nan,nan,nan)
Wall  5  coordinates:  Vector3(nan,nan,nan)

And so it goes on after that. 

I can also post the actual triaxial loading script, but do not wish to drown my initial question. I will state that if I do makeCloud() followed by sp.save() and then sp.load(), the script works fine. The problem seems to be only with the SP files I sliced using the script above.

Thanks,
Gary

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.