/TaichiSimplicialFluid

Interactive surface flow toy implemented in Taichi

Primary LanguagePython

Project logo

Interactive Surface Flow in Taichi

Welcome to my interactive toy of surface flow implemented in Taichi Lang. It creates a real-time fluid simulation on the surface of a triangle mesh manifold with genus 0 based on a slightly modified version of Elcott's Simplicial Fluids.

Here are some examples of what it does. It solves the Euler equations in real-time on the mesh surface, and use both colorful dyes and particles to visualize the fluid. I also wrote something over here that briefly explained how my implementation differ from Elcott's algorithm. See below for user guide.

bunny.mp4
cow.mp4

User Guide

Important: This program is based on Taichi, its GGUI and MeshTaichi extension (See details in https://github.com/taichi-dev/meshtaichi). Please make sure your machine satisfies their requirements. Also make sure to install Taichi first!

How to Run

Install the latest Taichi and MeshTaichi extension by:

python3 -m pip install —U taichi meshtaichi_patcher

How to Play

Run with python3 fluid.py --model meshes/bunny.obj (or other obj files in meshes folder) with --arch [cpu/cuda] to select backend platforms.

  • Hold your left mouse button to splat dye and splat force on to the system.
  • Press r to reset the simulation.
  • Press p to pause.
  • Press esc to exit.
  • Press x to take a snap shot.
  • Toggle c to disable or enable changing dye's color.
  • Toggle v to disable or enable advecting particles to visualize the flow.
  • Use w,a,s,d to move camera, and use your right mouse button to rotate camera.

Notes

The fluid is advected using an implicit scheme, which is stable. However, excessively adding forces still could result in a very unstable system. If you see "Warning: Does not meet Courant–Friedrichs–Lewy condition!" being printed out, it means that you have added too much energy to the system in too short of a period time.

The mesh quality plays a huge part on the behavior of this program, and you should only run this program on meshes that are manifold with no holes.