Crystalline growth of dendrite snow simulated by phase field with Taichi-based cross-platform parallel (CPU/GPU) computing
- install Python (3.8+) and pip, then install Taichi and numpy
pip install numpy
pip install taichi
- git clone this repo
- go to the current directory of this repo, run the code in command line by:
python ./snow_dendrite.py
then sub-window will show up the snowflake with dendrite morphology.
Phase field model is utilized to describe the snow dendrite. For snow:
-
Snow is solidified from water vapor. Thus, two phases are involved, the solid phase and the gas phase.
-
Phase field model is employed to describe phase transformation, with
$\phi(\boldsymbol{x})=0$ representing gas phase,$\phi(\boldsymbol{x}) = 1$ representing solid phase, and$0 < \phi(\boldsymbol{x}) < 1$ at solid/gas interface.$\phi(\boldsymbol{x})$ also represents the volume fraction of solid phase at position$\boldsymbol{x}$ .
Two aspects should be considered to generate the directional dendrite:
- Anisotropic interface energy (comes from crystalline (atomic) structure of ice) results in a polyhedron shape of ice nucleation (certain facets of the polyhedron relate to the low-energy interface)
- temperature field with heat conduction (vapor tends to solidify at cooler position, where the solidification itself will release heat) contributes to dendrite formation. The vertex of polyhedron is cooler than the facet of polyhedron (less solidification heat at the vertex) so that vertex tends to grow faster than other places, forming dendrite shape.
These phenomena can be seen from the above animations generated by simulation from this repo.
Free energy contains chemical energy and interface energy.
The chemical energy determines the transition potential between vapor and ice. When temperature is high, ice tends to transform to vapor, indicating that vapor has lower potential than ice; otherwise then temperature is low, vapor tends to solidify to ice, indicating that ice has lower potential than vapor. Thus, the chemical energy density (here we use volume density, different from chemical potential defined by mole density) should be a function of temperature, which can be constructed as [Physica D 63(3-4): 410-423]:
where
Fig. 1 Chemical energy density varies with temperature
You can also see that there is a energy barrier in Fig. 1 between gas and solid phase, so that the transition needs other kinds of energy to overcome this transition barrier, such as the interface energy. For example, vapor tends to solidify at the interface of a nucleus, since the nucleus's interface energy helps overcoming the transition barrier of solidification.
Besides chemical energy, another energy is the gradient energy, expressed as:
where
The total free energy
The governing equation for
where
The solidification will release heat, and the heat conduction will change the temperature distribution, and corresponding change the chemical energy density distribution (change the tendency of solidification or vaporization). The temperature rate can be expressed as:
where the first term relates to heat conduction, and the second term relates to heat source coming from phase transformation, which is also called the latent heat. Using the rates
-
Space discretization and partial differential operators utilize finite difference method (FDM).
-
Time integration scheme utilizes 4th-order Runge-Kutta method (RK4).
- Phase field model of snow dendrite Physica D 63(3-4): 410-423
- introduction of Taichi parallel computing language at github https://github.com/taichi-dev/taichi
- Taichi documentation https://docs.taichi-lang.org/docs