Awesome
taichi-2d-vof
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.
Usage
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:
- Dam break
- Rising bubble
- Droping liquid
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
- VOF field
- U velocity
- V velocity
- Velocity norm
- Velocity vectors (Implemented in
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
Extension to 3-Dimension
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!
Implementation
WIP.
References
- Volume of Fluid (VOF) Method for the Dynamics of Free Boundaries, C. W. Hirt and B. D. Nichols
- Direct Numerical Simulations of Gas–Liquid Multiphase Flows, Grétar Tryggvason, Ruben Scardovelli, Stéphane Zaleski
- Fully Multidimensional Flux-Corrected Transport Algorithms for Fluids, Steven T. Zalesak
- Volume-Tracking Methods For Interfacial Flow Calculations, Murray Rudman
- A Continuum Method for Modeling Surface Tension, J.U. Brackbill, D.B. Kothe, C. Zemach
Acknowledgement
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.