John Conway, prof. Lin, nature and Cordelia, who loved nature more than anyone.

What it does

Simulates snowflake formation with cellular automata

How I built it

The grid is a square 2D python array, if the value is above 1 the cell is ice, otherwise the value tells us how humid the cell is. This grid is made into a hexagonal grid by imagining that every even row is spacially displaced by one-half cell-width to the left; this is what how the discrete diff-eq updates the cells.

There are three parameters: alpha tells us the diffusion constant, which models the heat; beta models the humidity in the plane; gamma is a constant the we add on to the ice each turn, it models the water that accretes onto the snow-flake from outside the plane.

I put these the torus so that the diffusion would wrap around the humidity on the boarders would behave nicely, so the grid is $\Z/n\Z \times \Z/n\Z$

See the README in my github project for a fuller description.

Challenges I ran into

I didn't pick this because it was particularly challenging, I picked it because it was beautiful and because I wanted to do a good job.

Speed, efficiency, I want to make it faster; so I overcame this temporarily with a meta-hack, I would have several simulations run in parallel the background while I coded more features.

Accomplishments that I'm proud of

I'm proud of the insight I gained about snowflakes - when I was a kid I used to examine snowflakes under a magnifying glass with my brother and we would wonder endlessly about how come they where all beautiful and how come no two that we examined looked the same.

Also this is the first time I've gotten to play with cellular automata (excluding playing with Conway's game of life).

What I learned

I'm taking an introductory PDEs course, we had a look at probability distributions of random walks on Z^2 and how the can be modeled using the heat equation. Here I did the opposite, I turned the diffusion equation into a discrete equation.

What's next for cellular automomata snowflake model

There are so many things I want to do with this.

First of all I want to translate my code into Julia so that it runs faster than in python.

Then I want to introduce drift and play with different seed minerals. I want to make the equation time-dependent, i.e. change the parameters with time to see if I can get more physical results, for instance changing the humidity and random constant with time, like every k time-steps - the easiest to implement would be to change the constant alpha with time, I'll start with that.

I want to ask my gf if I can add these snowflakes as avatars for users of her chrome extension. Perhaps each user could have their own unique snowflake, with parameters based on their name.

Built With

Share this project: