Snowflake growth simulation in BlocksCAD
by arpruss, published
Liked ByView All
Give a Shout Out
If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.Print Thing Tag
This implements a modification of Reiter's hex cell snowflake growth algorithm in BlocksCAD. The algorithm uses a real-valued cellular automaton modeling the diffusion and accretion of moisture. When run at high resolution, the model can produce surprisingly lifelike snowflakes, but BlocksCAD can't handle more than about radius 50 (and even that is laggy) of hex grid for the evolution.
I strongly recommend using Firefox instead of Chrome for these large BlocksCAD projects. Firefox is much more responsive.
The model has these main parameters:
alpha: controls moisture diffusion speed
beta: controls background moisture level (with optional random local variation)
gamma: controls accretion rate at frozen locations (with optional random temporal variation)
The random variation modifications, which aren't in the original Reiter algorithm, have ended up producing very nice effects--or at least the beta variation has (the gamma variation seems not to do as much).
There are four versions of the BlocksCAD code: radius 20, radius 30, radius 40 and radius 50. Up to radius 40, it works fine on Firefox, and on Chrome up to radius 30. Radius 50 is laggy on Firefox, and I haven't even tried it on Chrome. Firefox is much faster for BlocksCAD.
You can vary the thickness of the snowflake based on the simulated mass value at a given point for a further 3D effect (change the min_thickness to be less than the max_thickness for this effect), or you can introduce symmetric ridges for a pleasing visual 3D effect (make the ridge_angle be something like 3-10 degrees).
The snowflakes are readily printable--see photos. I recommend a thickness of about 2.5mm, and using a razor to scrape the flake off the printer bed.
The Thingiverse customizer was produced by exporting the code from BlocksCAD to OpenSCAD and moving the parameters to the top. Exported OpenSCAD code also generated the animation and the mosaic.
BlocksCAD does not support arrays. And it's a functional language. The evolution is thus handled by having a gigantic
evolve module, which takes 421 arguments (in the radius 40 version): the iteration count, and the data for all the 420 cells being simulated (only 1/12 of the full board needs to be simulated--the rest is reconstructed by symmetry). The module then calls itself recursively, with a decremented iteration count and with evolved cells. Because of the lack of arrays, each cell's evolution has a hard-coded call to a cell evolution function. Once iteration count reaches zero, all the cells that count as frozen (data value at least 1) are drawn, as well as their (typically) 11 symmetric copies, by the
There is also a big
go module that initializes the arguments for
While one could, though it would be crazy to, drag-and-drop all the hard-coded evolution code, I just wrote a python script (included: the main code is reiter.scad) that generates the BlocksCAD xml for the
go modules. The drawing code, the individual cell evolution code, and the parameter initialization code was hand-written in BlocksCAD.
Upgrade this Thing with Thingiverse AppsCustomization
Edit, personalize, or revise this ThingPrint Fulfilment
Order a print of this ThingTools and Utilities
Repair, slice, or enhance this Thing
Snowflake growth simulation in BlocksCAD by arpruss is licensed under the Creative Commons - Attribution license.
What does this mean?
- You must attribute (give credit) to the creator of this Thing.
- Remixing or Changing this Thing is allowed.
- Commercial use is allowed.
Show Some Love
Say thanks by giving arpruss a tip and help them continue to share amazing Things with the Thingiverse community.Tip Designer
We're sure arpruss would love to see what you've printed. Please document your print and share a Make with the community.
To post a Make simply visit this Thing again and click I Made One to start uploading your photo. It’s even easier to post a Make via the Thingiverse Mobile app (available via Google Play and Apple App Store).