I am looking for packing spheres (can be monodisperse or polydisperse with known radii distribtuions) inside a geometry. I am sure this is a well explored scientific problem with applications in different fields. This being the case, is there anyone who knows a library/code which can achieve this?

Note: The packing need not be the highest solids volume fraction possible for the given geometry.

  • $\begingroup$ It's a really difficult problem. Do you want to achieve a certain packing density? If yes, that needs some sort of simulations. Do you know that maximum packing density is when you put the spheres in a FCC lattice? Also, your geometry is just a cube or you have a fancy irregular shape geometry? You missed a lot of information here. $\endgroup$ – Alone Programmer Jan 23 '20 at 20:35
  • $\begingroup$ The objective is to achieve a specified packing density with a max limit of 0.6. The geometry would be arbitrary and not just cube. Otherwise, I can write a script for FCC lattice which can achieve about 0.74 max packing. $\endgroup$ – SKPS Jan 23 '20 at 20:40
  • $\begingroup$ That's a really tough problem to reach packing density of 0.6. With simple random putting the spheres in a cube you could achieve a packing density of 0.3 right away, but beyond 0.3, you need to do mechanical simulation of packing the spheres and that needs lots of information about their mechanical properties and more importantly their contact mechanics information. $\endgroup$ – Alone Programmer Jan 23 '20 at 20:44
  • $\begingroup$ Yes, I could understand. I am not looking for writing a program for this. Question is if there are packages/libraries to achieve this packing. For example, this. $\endgroup$ – SKPS Jan 23 '20 at 20:47
  • $\begingroup$ The answer is no! $\endgroup$ – Alone Programmer Jan 23 '20 at 20:49

A possibility is to use Lloyd's method [1], it works as follows:

  1. Choose N points randomly in the input geometry
  2. Compute the Voronoi diagram of the points clipped by the input geometry
  3. Replace each point by the centroid of its Voronoi cell
  4. If not converged, goto 2

The algorithm is implemented in my geogram library [2] (works for an arbitrary geometry, bounded by a closed triangulated surface). An in-browser demo is available for a cube geometry [3] (or "flat torus" periodic space).

Note: it evenly distribute the points in the input geometry, but does not necessarily generates a tight packing.

[1] https://en.wikipedia.org/wiki/Centroidal_Voronoi_tessellation

[2] http://alice.loria.fr/software/geogram/doc/html/index.html

[3] https://homepages.loria.fr/BLevy/GEOGRAM/geogram_demo_Delaunay3d.html


The packing of spheres (or non-spherical particles) within a geometry can be achieved quite reliably using the Discrete Element Method. I refer you to the following introduction article (written by me and co-workers) on the topic: https://onlinelibrary.wiley.com/doi/full/10.1002/cjce.23501

Briefly, the discrete element method (DEM) is a molecular dynamics inspired techniques where you calculate the motion of each individual particles by integration Newton's law of motion for each of them. The particle-particle and particle-wall contacts are handled by allowing for minute overlap between the particles (which are very small). These overlaps are then used within simple contact models. These models may be simple (linear spring) or more complex (hertzian spring + damping) and they have parameters which you have to tune to reproduce the mechanical behavior of your particles. These parameters are generally the static coefficient of friction or the rolling coefficient of friction.

DEM is relatively computationnaly intensive because you need to track all particles. However, using MPI, you can generally simulation a large amount of particles (over a million). There are also extensions of DEM to non-spherical particles.

There are some good open source codes such as :

DEM can even be coupled to CFD in what is referred to as CFD-DEM. You can look at the following journal article for a short introduction to it (written by my PhD student and I): https://onlinelibrary.wiley.com/doi/full/10.1002/cjce.23686

You can look at the following online movies made by my group for an illustration. For pure DEM : https://www.youtube.com/watch?v=__5UGx4fQps

For CFD-DEM: https://www.youtube.com/watch?v=0IQo1Yq-_x8

  • $\begingroup$ Thanks for the detailed answer. You missed mfix :) I work in the core team here. The reason I posted here is see if there are any open source code that is based not on DEM by itself. Since my concern here is just packing but not the collision mechanisms leading to it. I am curious if this can be achieved by any non-DEM approach. $\endgroup$ – SKPS Jan 27 '20 at 22:35
  • $\begingroup$ You are right :). Would you mind editing my answer and adding some information about MFIX ? :). I know little about it. $\endgroup$ – BlaB Jan 29 '20 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.