Sphere packing¶
The goal of sphere packing is to initialize the tessellation. Packing is performed in spatially three-dimensional periodic domain. Sphere centers are used as cell seeds and sphere diameters are used as cell weights.
Packing determines the number of cells and their size distribution in the generated foam.
Inputs¶
Number of cells and shape and scale parameters of log-normal size distribution should be provided either through CLI or configurational file (otherwise default values are taken).
Execution¶
Default packing can be achieved by running:
foamgen -p
This produces packing similar to this one (you need to add --pack.render
flag if you want to create the image):
Outputs¶
The main output is the *Packing.csv
file, which contains center position
(x
, y
, and z
) and diameter (d
) of each sphere.
Size distribution¶
Note that sphere size distribution does not exactly copy prescribed continual size distribution (especially for low number of spheres - image below is for 27 cells).
Log-normal sphere size distribution is influenced by shape (--pack.shape
)
and scale (--pack.scale
). It is defined as
where \(\delta\) is sphere size, \(\sigma\) is standard deviation, and \(\mu\) is mean. Shape is identical to standard deviation. Scale, \(\phi\), is defined as
Shape equal to zero corresponds to uniform size distribution. Shape larger than 0.5 corresponds to wide size distribution.
Algorithms¶
It is possible to choose between several sphere packing algorithms using
--pack.alg
flag. simple
is a naive packing algorithm that is
implemented directly. ls
, fba
, lsgd
, lsebc
, ojt
, kjt
are more robust algorithms from packing-generation library. fba
provides good compromise between speed and packing density. Use of simple
algorithm is discouraged.