After seeing this post on r/Simulations that linked to the paper Numerical Simulation of Dendritic crystal growth using phase field method and investigating the effects of different physical parameter on the growth of the dendrite (great name) which includes some Matlab code I was able to add Dendritic Crystal Growth as a new mode in Visions of Chaos.
Also see the original paper referenced which is Ryo Kobayashi’s “Modeling and numerical simulations of dendritic crystal growth“.
Here are some results from the new mode. I have also added an option to give the growths a 3D embossed look.
Here is a sample movie
Bug fix for code
At first my translation of the Matlab code in the paper did not result in anything but boring smooth edged blobs. I don’t own a copy of Matlab to verify the code, but I assumed (as any programmer does when their code doesn’t work) that it must be something I am doing wrong. But after some time checking and double-checking I did find some problems with the code in the paper.
Firstly this line near the end
tnew(i,j) =t(i,j) + lap _t(i,j)*dt + k*(phi(i,j) -phiold);
needs to be changed to
tnew(i,j) =t(i,j) + lap _t(i,j)*dt + k*(phinew(i,j) -phiold);
otherwise the phi-phiold cancels out and k is multiplied by zero.
Secondly the calculations for grad_epsilon_x and grad_epsilon_y
grad_epsilon2_x = (epsilon(ip,j)^2 -epsilon(im,j)^2)/dx; grad_epsilon2_y = (epsilon(i,jp)^2 -epsilon(i,jm)^2)/dy;
should be moved to the second loop before the term1 calculation.
With those two simple fixes my code was generating the correct dendritic structures and created the images in this post.
Dendritic Crystal Growth and two Snowflake modes are now included under the new Dendritic Growth mode menu in Visions of Chaos.