← Back to team overview

yade-users team mailing list archive

Re: [Question #706005]: I am trying to create a simulation within yade with different sphere radius to fall by gravity into a container

 

Question #706005 on Yade changed:
https://answers.launchpad.net/yade/+question/706005

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> V packing and V cylinder are calculated as 0
> Why does the calculation is calculated as 0?

it is not computed as 0, it is just printed as 0.00
Change "{:.2f}" e.g. to "{:e}" or even just "{}" to see the actual value [1,3]
:.2f rounds the number to two decimal numbers, but the actual value is much less, so 0.00 is printed, even if the number is not zero.

> Is there any guide on how to make the sphere pack better in the
container?

See gravity deposition tutorial [2]

> the simulation doesn't fully packed
> O.run(1000)

because it runs too little time (?)

Also consider using
###
O.run(1000,wait=True)
###
or
###
O.run(1000)
O.wait()
###
If you have a python code after O.run(1000), it is executed "immediately", i.e. at a random time w.r.t. running simulation

Or go in the [3] style with checkUnbalanced-like stop condition.


A few not important notes:

> print("Number of spheres:", "{:.2f}".format(num_spheres))

"{:d}" makes much more sense for number (integer)
Also consider using f-strings [3]

> cylinder = yade.geom.facetCylinder(..., radius=0.06, ...)
> volume_cylinder = math.pi * 0.06**2 * 0.0605

you have repeated value 0.06
It is a good practice to make it a variable then
###
radius = 0.06
cylinder = yade.geom.facetCylinder(..., radius=radius, ...)
volume_cylinder = math.pi * radius**2 * 0.0605
###
This way, if you want to change the radius, you just change it in one place (reducing the possible error by forgetting some place in the case where the value is at multiple places).
Same for other repeated values (e.g. height)

Cheers
Jan

[1] https://docs.python.org/3/library/string.html#formatstrings
[2] https://yade-dem.org/doc/tutorial-examples.html#gravity-deposition
[3] https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals

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