A single file VOF fluid solver implementation in Taichi.
Simply install Taichi and run!
$ python3 -m pip install taichi
$ python3 2dvof.py
In the GUI window, you can press SPACE to switch between visualization methods, or press q on your keyboard to terminate the simulation.
You can execute the script with the following arguments to control its behavior:
$ python3 2dvof.py -ic 1 # ic stands for Initial Condition; Default value is 1
$ python3 2dvof.py -s # Save png files to the ./output/ folder
Currently, there are three types of initial condition settings:
You can also tweak the set_init_F()
kernel to implement your own. Be aware
that the solver might become unstable under various settings. The material
properties are carefully chosed to produce best results.
During the operation, press SPACE to switch visualization method. Currently, the script can display
flow_visualization.py
module)You can follow the steps below if you wish to output a video file:
$ python3 2dvof.py -ic 1 -s # Add -s argument to enable saving
$ cd output
$ ti video # Use Taichi's video utility to generate a mp4 file
$ ti gif -i video.mp4 # Use Taichi's gif utility to generate a gif file
The script in this repo can be easily extended to 3-dimension with minor changes in the implementation.
An experimental dam-break demo is provided in the 3dvof.py
file. The following rendered images are produced by the Taitopia cloud-render.
The VOF field data are exported to .obj
file format using Paraview.
The following 3D animation is created in Blender by rendering the .obj
sequences generated in Paraview:
More details about the 3D implementation will be released in another repo, stay tuned!
WIP.
The code in this repository is jointly developed by @houkensjtu and @zju-zhoucl. The original early version can be found in @zju-zhoucl's repo here.