tum-pbs/PhiFlow

A differentiable PDE solving framework for machine learning

Python

1,947

3,343 commits

updated Jul 16, 2026

See the code

README

PhiFlow

Build Status PyPI pyversions PyPI license Code Coverage Google Collab Book

Φ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.

Examples

Grids

Fluid logoWake flowLid-driven cavityTaylor-Green
Smoke plumeVariable boundariesParallel simulationsMoving obstacles
Rotating barMulti-grid fluidHigher-order KolmogorovHeat flow
Burgers' equationReaction-diffusionWavesJulia Set

Mesh

Backward facing stepHeat flowMesh constructionWake flow

Particles

SPHFLIPStreamlinesTerrain
GravityBilliardsRopes

Optimization & Networks

Gradient DescentOptimize throwLearning to throwPIV
Close packingLearning Φ(x,y)Differentiable pressure

Installation

Installation with pip on Python 3.6 and above:

$ pip install phiflow

Install PyTorch, TensorFlow or Jax in addition to ΦFlow to enable machine learning capabilities and GPU execution. To enable the web UI, also install Dash. For optimal GPU performance, you may compile the custom CUDA operators, see the detailed installation instructions.

You can verify your installation by running

$ python3 -c "import phi; phi.verify()"

This will check for compatible PyTorch, Jax and TensorFlow installations as well.

Features

  • Tight integration with PyTorch, Jax and TensorFlow for straightforward neural network training with fully differentiable simulations that can run on the GPU.
  • Built-in PDE operations with focus on fluid phenomena, allowing for concise formulation of simulations.
  • 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.

📖 Documentation and Tutorials

Documentation Overview   •   ▶ YouTube Tutorials   •   API   •   Demos   •   Playground

Φ-Flow builds on the tensor functionality from ΦML. To understand how ΦFlow works, check named and typed dimensions first.

Getting started

Physics

Fields

Geometry

Tensors

Other

📄 Citation

Please use the following citation:

@inproceedings{holl2024phiflow,
  title={${\Phi}_{\text{Flow}}$ ({PhiFlow}): Differentiable Simulations for PyTorch, TensorFlow and Jax},
  author={Holl, Philipp and Thuerey, Nils},
  booktitle={International Conference on Machine Learning},
  year={2024},
  organization={PMLR}
}

Publications

We will upload a whitepaper, soon. In the meantime, please cite the ICLR 2020 paper.

Benchmarks & Data Sets

ΦFlow has been used in the creation of various public data sets, such as PDEBench and PDEarena.

See more packages that use ΦFlow

🕒 Version History

The Version history lists all major changes since release. The releases are also listed on PyPI.

👥 Contributions

Contributions are welcome! Check out this document for guidelines.

Acknowledgements

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

deep-learning
differentiable-simulations
fluid-simulations
neural-networks
pde-solver

tum-pbs/PhiFlow

A differentiable PDE solving framework for machine learning

Python

1,947

3,343 commits

updated Jul 16, 2026

See the code

README

PhiFlow

Build Status PyPI pyversions PyPI license Code Coverage Google Collab Book

Φ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.

Examples

Grids

Fluid logoWake flowLid-driven cavityTaylor-Green
Smoke plumeVariable boundariesParallel simulationsMoving obstacles
Rotating barMulti-grid fluidHigher-order KolmogorovHeat flow
Burgers' equationReaction-diffusionWavesJulia Set

Mesh

Backward facing stepHeat flowMesh constructionWake flow

Particles

SPHFLIPStreamlinesTerrain
GravityBilliardsRopes

Optimization & Networks

Gradient DescentOptimize throwLearning to throwPIV
Close packingLearning Φ(x,y)Differentiable pressure

Installation

Installation with pip on Python 3.6 and above:

$ pip install phiflow

Install PyTorch, TensorFlow or Jax in addition to ΦFlow to enable machine learning capabilities and GPU execution. To enable the web UI, also install Dash. For optimal GPU performance, you may compile the custom CUDA operators, see the detailed installation instructions.

You can verify your installation by running

$ python3 -c "import phi; phi.verify()"

This will check for compatible PyTorch, Jax and TensorFlow installations as well.

Features

  • Tight integration with PyTorch, Jax and TensorFlow for straightforward neural network training with fully differentiable simulations that can run on the GPU.
  • Built-in PDE operations with focus on fluid phenomena, allowing for concise formulation of simulations.
  • 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.

📖 Documentation and Tutorials

Documentation Overview   •   ▶ YouTube Tutorials   •   API   •   Demos   •   Playground

Φ-Flow builds on the tensor functionality from ΦML. To understand how ΦFlow works, check named and typed dimensions first.

Getting started

Physics

Fields

Geometry

Tensors

Other

📄 Citation

Please use the following citation:

@inproceedings{holl2024phiflow,
  title={${\Phi}_{\text{Flow}}$ ({PhiFlow}): Differentiable Simulations for PyTorch, TensorFlow and Jax},
  author={Holl, Philipp and Thuerey, Nils},
  booktitle={International Conference on Machine Learning},
  year={2024},
  organization={PMLR}
}

Publications

We will upload a whitepaper, soon. In the meantime, please cite the ICLR 2020 paper.

Benchmarks & Data Sets

ΦFlow has been used in the creation of various public data sets, such as PDEBench and PDEarena.

See more packages that use ΦFlow

🕒 Version History

The Version history lists all major changes since release. The releases are also listed on PyPI.

👥 Contributions

Contributions are welcome! Check out this document for guidelines.

Acknowledgements

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

deep-learning
differentiable-simulations
fluid-simulations
neural-networks
pde-solver

Project health

Overall

4.0/10

Maintained

0/10

Code review

8/10
OpenSSF Scorecard

Latest release

3.4.0 · Aug 2, 2025

Releases this year

0

Significant stargazers

Tianyu Zhang

79 followers · starred Jun 2023

Soumith Chintala

13,725 followers · starred May 2020

Nico Schlömer

2,516 followers · starred Dec 2019

Max Ku

198 followers · starred Oct 2025