← Back to team overview

yade-users team mailing list archive

Re: Simulation model


> There is a new function for utils. Would like you to ask to check and
> commit it.  I know, that you dont like this style, but I was trying to
> do it by your way with no success: difficult to get indexes of Z-axis
> array.

Hi, I found a better approach for this type of problems: separately
define function that generates the grid within given part of space and
separately have function that clips the resulting grid to the exact
solid shape ("predicate", because it tells whether a point is inside or
outside). For example:

from yade import pack

will return list of spheres of radius .1 hexagonaly arranged (without
gaps) within spherical domain centered at 0,0,4 and with radius 2.

I am sorry that it will probably break your older code, but it seems
just so much more elegant and extensible.

If you want to define new shape that you want to fill with spheres (e.g.
an ellipsoid), you only have to define a new ellipsoid predicate and
pass it to the pack.regularOrtho / pack.regularHexa functions. They ask
the predicate for its bounding box, generate orthogonal/hexagonal grid
and return sphere at points of the grid where the predicate was true
(i.e. points inside the solid).

If you want to define new packing type (e.g. orthogonal in plane but
planes moved at every layer to make it denser; or even irregular
packing, e.g. from a periodic packing that you have ready somewhere),
you can use already existing predicates with the new one.

For packing, we have ortho/hexa now, for predicates, there is sphere,
axis-aligned box and non-aligned cylinder. It is demonstrated in

Best, Vaclav

Follow ups