I did a very simple (in fact over-simple) snowflake simulator with `CellularAutomaton`

years before. It's based on the hexagonal grid:

and range-1 rules:

## Initial code

First we'll need some functions to display our snowflakes:

```
Clear[vertexFunc]
vertexFunc = Compile[{{para, _Real, 1}},
Module[{center, ratio},
center = para[[1 ;; 2]];
ratio = para[[3]];
{Re[#], Im[#]} + {{1, -(1/2)},{0, Sqrt[3]/2}}.Reverse[{-1, 1} center + {3, 0}] & /@
(ratio 1/Sqrt[3] E^(I π/6) E^(I Range[6] π/3))
],
RuntimeAttributes -> {Listable}, Parallelization -> True,
RuntimeOptions -> "Speed"
(*, CompilationTarget->"C"*)];
Clear[displayfunc]
displayfunc[array_, ratio_] := Graphics[{
FaceForm[{ColorData["DeepSeaColors"][3]}],
EdgeForm[{ColorData["DeepSeaColors"][4]}],
Polygon[vertexFunc[Append[#, ratio]] & /@ Position[array, 1]]
}, Background -> ColorData["DeepSeaColors"][0]]
```

## Main body

Consider 0/1 bistable states for every node on the hexagonal grid, where $0$ stands for empty nodes and $1$ stands for frozen nodes. Then, excluding all-zero case, there are 13 possible arrangements on the 6 vertices of a hexagon(those who are identical under rotation and reflection are considered as the same arrangement):

```
stateSet = Tuples[{0, 1}, 6] // Rest;
gatherTestFunc = Function[lst, Sort[RotateLeft[lst, # - 1] & /@ Flatten[Position[lst, 1]]]];
stateClsSet = Sort /@ Gather[stateSet, gatherTestFunc[#1] == gatherTestFunc[#2] &];
stateClsSetHomogeneous = ArrayPad[#, {{0, 6 - Length@#}, {0, 0}}] & /@ stateClsSet;
```

And the simplest physical rule might be linking different arrangement to different probability of freezing(from $0$ to $1$) or melting(from $1$ to $0$).

Those 26 probabilities, `pFreeze`

and `pMelt`

, can be determined by some serious physical models, or can be chosen randomly just for fun. Then they can be used to establish rule function for `CellularAutomaton`

:

```
Clear[ruleFunc2Comp]
ruleFunc2Comp = With[{
stateClsSetHomogeneous = stateClsSetHomogeneous,
seedSet = RandomInteger[{0, 1000}, 1000],
pFreeze = {1, 0.2, 0.1, 0, 0.2, 0.1, 0.1, 0, 0.1, 0.1, 1, 1, 0},
pMelt = {0, 0.7, 0.5, 0.5, 0, 0, 0, 0.3, 0.5, 0, 0.2, 0.1, 0}
},
Compile[{{neighborarry, _Integer, 2}, {step, _Integer}},
Module[{cv, neighborlst, cls, rand},
cv = neighborarry[[2, 2]];
neighborlst = {#[[1, 2]], #[[1, 3]], #[[2, 3]], #[[3, 2]], #[[3, 1]], #[[2, 1]]}&[neighborarry];
If[Total[neighborlst] == 0, cv,
cls = Position[stateClsSetHomogeneous, neighborlst][[1, 1]];
SeedRandom[seedSet[[step + 1]]];
rand = RandomReal[];
Boole@If[cv== 0, rand < pFreeze[[cls]], rand > pMelt[[cls]]]
]
],
RuntimeAttributes -> {Listable}, Parallelization -> True, RuntimeOptions -> "Speed"(*,CompilationTarget -> "C"*)
]
];
```

Apply `ruleFunc2Comp`

on some initial state for some steps:

```
dataSet = Module[{rule,
initM = {{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}, 0},
rspec = {1, 1},
tmin = 0, tmax = 50, dt = 1
},
rule = {ruleFunc2Comp, {}, rspec};
CellularAutomaton[rule, initM, {{tmin, tmax, dt}}]
];
```

You can see how the snowflake grows:

```
Manipulate[
Rotate[displayfunc[dataSet[[k]], .99], 90°],
{k, 1, Length[dataSet], 1}]
```

## More snowflakes

Some other examples generated with different `pFreeze`

, `pMelt`

and `tmax`

:

1

I don't want to kill the fun but.., did you see this?

– Öskå – 2013-12-24T14:28:02.713@Öskå, yes, I was aware of this method of generating snowflake-like fractals. And it is one welcome method, of course, but I wish to find more 'physically' oriented answers. Also, the more 'real-life', the better. (This is an holiday post, let's have some fun). – Peltio – 2013-12-24T15:05:01.427

Nice fractal art here http://www.deviantart.com/morelikethis/317568361?offset=25#skins

– Dr. belisarius – 2013-12-24T15:05:57.170Regarding my previous comment, here is a bit of code doing the job.

– Öskå – 2013-12-24T15:06:42.667Anyone familiar with implementing non-fractal solutions? This certainly seems possible in MMA.

– bobthechemist – 2013-12-24T15:34:15.287@MichaelE2, never mind. I am about to incorporate the above comment in the question, then I'll remove the comment. Silvia appears to have killed the thread with her beatiful answer, but I still hope in some other approach. I'll wait a bit before accepting the answer. – Peltio – 2013-12-24T21:36:29.683

Yep, it's Christmas: miracles happen. :-) – Peltio – 2013-12-24T21:46:41.707

1

Have you seen this

– Silvia – 2013-12-25T11:11:39.170Gravner-Griffeath Snowfakes? I think they are kind of what you're looking for.@Silvia, amazing! Yes, that's something I would love to see implemented in Mathematica. After all a great deal of the references in the first papers are on Wolfram's cellular automata articles. (Don't get me wrong, I really like your answer) – Peltio – 2013-12-25T16:13:18.973

1On Christmas day, this W

`Integer`

Wonderland post has 5 answers, 50 votes and 5 thousands views. It's fivelous! :-) I believe I will wait until New Year's day to accept an answer. – Peltio – 2013-12-25T16:45:24.647I really tried hard implementing them in MMA, but that is a lot of work. Most importantly, it needs massive computation, which is beyond my old PC's ability... Maybe you should put the link in your question and hope someone will do it :) – Silvia – 2013-12-25T16:55:20.130

@Silvia, this is a fun post, it should not become 'work'. I have no practical need for such a code, I only hoped to collect here some code to produce visual marvels, something other people (and most notably all the younger minds that have now MMA for free on their RasPi) could use to embellish their season's greetings cards or simply to be amazed by the beauty of a snowflake, even if virtual or just something that looks like it (a snowfake as they call it). I will add link in my next edit. I am confident that sooner or later new implementations will be added. Yours is amazing. – Peltio – 2013-12-25T17:13:53.750

When I said "work" I meant "fun" :P And yes there have been, and there will be more!:D – Silvia – 2013-12-26T01:06:04.523

Random isn't random anymore. Did you know that snowflakes reation could be influenced by thoughts? Some experiments about inner feelings and ice formation are documented. See http://www.whatthebleep.com/water-crystals/ for a starting point.

– Milche Patern – 2013-12-27T04:51:37.220