Skip to content
Research-oriented differentiable fluid simulation framework
JavaScript Python C++
Branch: master
Clone or download
Latest commit 94c7f39 Dec 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
documentation Update web interface documentation, add 'Help' link Dec 16, 2019
phi Update web interface documentation, add 'Help' link Dec 16, 2019
tests Merge branch 'develop' into gui-2.0 Dec 12, 2019
webglviewer Update WebGL viewer Dec 15, 2019
.flake8 include flake8 configuration Oct 24, 2019
.gitignore world.add(X) replaces all world.X, move fields/ into physics/ Nov 4, 2019
.travis.yml PyLint config, remove unused import Dec 4, 2019
LICENSE.txt Add MIT license Dec 3, 2019 Add WebGL resources to PhiFlow installation Dec 11, 2019 Update web interface documentation, add 'Help' link Dec 16, 2019
setup.cfg Add setup.cfg Dec 16, 2019 Update Dec 16, 2019


Build Status PyPI pyversions PyPI license image Run in Google Colab


ΦFlow is a research-oriented, open-source fluid simulation toolkit. It is written mostly in Python and can use both NumPy and TensorFlow for execution.

Having all functionality of a fluid simulation running in TensorFlow opens up the possibility of back-propagating gradients through the simulation as well as running the simulation on GPUs.


  • Support for a variety of differentiable simulation types, from Burgers over Navier-Stokes to the Schrödinger equation.
  • Tight integration with TensorFlow allowing for straightforward network training with fully differentiable simulations that run on the GPU.
  • Object-oriented architecture enabling concise and expressive code, designed for ease of use and extensibility.
  • Reusable simulation code, independent of backend and dimensionality, i.e. the exact same code can run a 2D fluid sim using NumPy and a 3D fluid sim on the GPU using TensorFlow.
  • Flexible, easy-to-use web interface featuring live visualizations and interactive controls that can affect simulations or network training on the fly.


The following commands will get you ΦFlow + browser-GUI + NumPy execution:

$ pip install phiflow[gui]

See the detailed installation instructions on how to install ΦFlow with TensorFlow support.

Documentation and Guides

Index Demos / Tests Source image Fluids Tutorial / Playground

If you would like to get right into it and have a look at some code, check out the tutorial notebook on Google Colab. It lets you run fluid simulations with ΦFlow in the browser.

The following introductory demos are also helpful to get started with writing your own app using ΦFlow:

  • Runs a fluid simulation and displays it in the browser
  • Uses TensorFlow to optimize a velocity channel. TensorBoard can be started from the GUI and displays the loss.

Running simulations

The simulation overview explains how to run predefined simulations using either the NumPy or TensorFlow backend. It also introduces the GUI.

To learn how specific simulations are implemented, check out the documentation for Fluids or read about staggered grids or pressure solvers.

Writing a ΦFlow Application introduces the high-level classes and explains how to use the ΦFlow GUI for displaying a simulation.

For I/O and data management, see the data documentation or the scene format specification.

Optimization and Learning

For training machine learning models, this document gives an introduction into writing a GUI-enabled application.


The simulation code design documentation provides a deeper look into the object-oriented code design of simulations.

All simulations of continuous systems are based on the Field API and underlying all states is the struct API.

The software architecture documentation shows the building blocks of ΦFlow and the module dependencies.

Version History

The Version history lists all major changes since release.

Known Issues

TensorBoard: Live supervision does not work when running a local app that writes to a remote directory.

Resampling / Advection: NumPy interpolation handles the boundaries slightly differently than TensorFlow.


Contributions are welcome! Check out this document for some guidelines.


This work is supported by the ERC Starting Grant realFlow (StG-2015-637014) and the Intel Intelligent Systems Lab.

You can’t perform that action at this time.