# Control exact size of capsules

0 votes
60 views
asked Nov 16, 2017
I'm using the PsdCapsuleGenerator to generate capsules to fill a column, and I am able to use the shaftRadiusRatio function to control the distribution of shaft to radius ratios, but I would like to be able to control the exact sizes (so length and radius in metres) for the particles. I actually want to fill a column with particles of the same size, so I put the shaftRadiusRatio vector on (3,3) to obtain monodispersed particle sizes. Now I want to know the exact sizes of the capsules and I would like to be able to put values for the radius and shaft length in metres myself. Is there a possibility to do this?

## 1 Answer

0 votes
answered Nov 16, 2017 by (49,070 points)

Hi, do you want all capsules to be the same? Then simply prescribe the PSD function stepwise, something like psdPts=[(5e-3,0),(5e-3,1)] should work, and by hand calculate the shaftRadiusRatio, e.g. (2,2) will make all capsules with cylinder radius 5mm and (2*5mm shaft + 2*5mm on either side) = 20mm long end-to-end. Let me know if this answers your question. All the best, Vaclav.

commented Nov 17, 2017 by (220 points)

Dear Vaclav,

Thank you for your answer! Yes I want them to be the same, which I already managed to do. However I couldn't find an option inside the generator to specify the dimensions, but the way to do it in this case is via the ShaftRadiusRatio? Then how do you know that the radius is 5mm, is that because of the first number in the psdPts?
Also, is it possible to somehow check these dimensions, so writing out the dimensions of the generated particles after the simulation?

It would make sense for me to somehow be able to specify the whole particle somewhere (so shape, material, density, dimensions) and then generate numbers of those particles to fill the column. However these specifications are somehow included in the PsdCapsuleGenerator I think, but how does this work exactly?

For easy reference, I will show you the code I am currently running below. I was also looking at an option to let all particles settle before ending the simulation, because before it just stopped somewhere in the middle while still generating new particles. I put maxNum on 1000 for this purpose, but I would rather like to tell the code something like: wait some time after generating the particles to let them all settle and after that end the simulation. Would this be easily possible?

Thanks in advance for answering all my questions! See the code below:

import woo.core, woo.dem, woo.utils, math, woo.paraviewscript
from minieigen import *
woo.master.usesApi=10103
S=woo.master.scene=woo.core.Scene(
fields=[woo.dem.DemField(
gravity=(0,0,-9.81),
# add bottom and cylinder walls
par=[woo.dem.Wall.make(0,axis=2,glAB=((-1,-1),(1,1)))]+woo.triangulated.cylinder(Vector3(0,0,0),Vector3(0,0,4),radius=1)
)],
engines=woo.dem.DemField.minimalEngines(damping=.4)+[woo.dem.CylinderInlet(
stepPeriod=200,
radius=1,
height=3,
node=woo.core.Node((0,0,0),((0,1,0),-math.pi/2)),
massRate=0,
maxNum=1000,
glSlices=16,
materials=[woo.utils.defaultMaterial()],
generator=woo.dem.PsdCapsuleGenerator(psdPts=[(.2,0),(.2,1)], shaftRadiusRatio=(3,3))
),
woo.core.PyRunner('ubf=woo.utils.unbalancedForce(S)\nprint(ubf)\nif ubf<.05 and S.step>1000: done(S)',400),
])
S.saveTmp()

def done(S):
S.stop()
with open('capsules.txt','w') as out:
for p in S.dem.par:
if not isinstance(p.shape,woo.dem.Capsule): continue
a,b=p.shape.endPt(0),p.shape.endPt(1)
out.write('%g %g %g %g %g %g\n'%(a[0],a[1],a[2],b[0],b[1],b[2]))
vtk=woo.dem.VtkExport(out='capsules-')
vtk(S) # trigger manually writing Paraview data files
# write paraview script and run it
woo.paraviewscript.write('capsules.py',**woo.paraviewscript.kwFromVtkExport(vtk))
woo.paraviewscript.launchPV('capsules.py')

S.run()