To actually create those shapes, one has to first understand the physical phenomenon. I have not research this topic, but it seems to be the collection of sand at the valleys of certain eigenform of a circular plate, i.e. the contour at a lower z-coordinate.
Geometrically this is not so hard, once the eigenform has been found. Nearly all FE packages have the eigenmodes natively implemented. So I would try out Alpaca4D (free, open source) or Karamba3D.
Some years ago I made a small Christmas present, by simulating the eigenform of a rectangular plate with certain supports and just milled the result. I guess the shape you are after are just valleys of those shapes - but I might be wrong.