ΦFlow is an open-source simulation toolkit built for optimization and machine learning applications. It is written mostly in Python and can be used with NumPy, PyTorch, Jax or TensorFlow. The close integration with these machine learning frameworks allows it to leverage their automatic differentiation functionality, making it easy to build end-to-end differentiable functions involving both learning models and physics simulations.
Fluids Tutorial • ΦFlow to Blender | Animation Gallery • Solar System • Learning to Throw |
- Variety of built-in PDE operations with focus on fluid phenomena, allowing for concise formulation of simulations.
- Tight integration with PyTorch, Jax and TensorFlow for straightforward neural network training with fully differentiable simulations that can run on the GPU.
- Flexible, easy-to-use web interface featuring live visualizations and interactive controls that can affect simulations or network training on the fly.
- Object-oriented, vectorized design for expressive code, ease of use, flexibility 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 or PyTorch.
- High-level linear equation solver with automated sparse matrix generation.
Installation with pip on Python 3.6 and above:
$ pip install phiflow dash
Install PyTorch, TensorFlow or Jax in addition to ΦFlow to enable machine learning capabilities and GPU execution. See the detailed installation instructions on how to compile the custom CUDA operators and verify your installation.
Documentation Overview • ▶ YouTube Tutorials • API • Demos • Playground
To get started, check out our YouTube tutorial series and the following Jupyter notebooks:
- Fluids: Introduction to core classes and fluid-related functions.
- Solar System: Visualize a many-body system with Newtonian gravity.
- Learning to Throw: Train a neural network to hit a target, comparing supervised and differentiable physics losses.
If you like to work with an IDE, like PyCharm or VS Code, the following demos will also be helpful:
- smoke_plume.py runs a smoke simulation and displays it in the web interface.
- optimize_pressure.py uses TensorFlow to optimize a velocity field and displays it in the web interface.
We have recently submitted a whitepaper. In the meantime, please cite the ICLR 2020 paper.
- Learning to Control PDEs with Differentiable Physics, Philipp Holl, Vladlen Koltun, Nils Thuerey, ICLR 2020.
- Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers, Kiwon Um, Raymond Fei, Philipp Holl, Robert Brand, Nils Thuerey, NeurIPS 2020.
- ΦFlow: A Differentiable PDE Solving Framework for Deep Learning via Physical Simulations, Nils Thuerey, Kiwon Um, Philipp Holl, DiffCVGP workshop at NeurIPS 2020.
- Half-Inverse Gradients for Physical Deep Learning, Patrick Schnell, Philipp Holl, Nils Thuerey, ICLR 2022.
The Version history lists all major changes since release. The releases are also listed on PyPI.
Contributions are welcome! Check out this document for guidelines.
This work is supported by the ERC Starting Grant realFlow (StG-2015-637014) and the Intel Intelligent Systems Lab.