Coder Social home page Coder Social logo

taichi-2d-vof's Introduction

taichi-2d-vof

A single file VOF fluid solver implementation in Taichi.

VOF blog

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:

  1. Dam break
  2. Rising bubble
  3. 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

  1. VOF field
  2. U velocity
  3. V velocity
  4. Velocity norm
  5. Velocity vectors (Implemented in flow_visualization.py module)

display

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.

Screenshot 2023-09-07 at 22 42 46

The following 3D animation is created in Blender by rendering the .obj sequences generated in Paraview:

ezgif com-crop

More details about the 3D implementation will be released in another repo, stay tuned!

Implementation

WIP.

References

  1. Volume of Fluid (VOF) Method for the Dynamics of Free Boundaries, C. W. Hirt and B. D. Nichols
  2. Direct Numerical Simulations of Gas–Liquid Multiphase Flows, Grétar Tryggvason, Ruben Scardovelli, Stéphane Zaleski
  3. Fully Multidimensional Flux-Corrected Transport Algorithms for Fluids, Steven T. Zalesak
  4. Volume-Tracking Methods For Interfacial Flow Calculations, Murray Rudman
  5. 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.

taichi-2d-vof's People

Contributors

houkensjtu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

taichi-2d-vof's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.