• Stars
    star
    1,468
  • Rank 32,033 (Top 0.7 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A differentiable PDE solving framework for machine learning

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.

Fluids Tutorial   •   ΦFlow to Blender Animation Gallery   •   Solar System   •   Learning to Throw

Features

  • 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

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.

Documentation and Tutorials

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

To get started, check out our YouTube tutorial series and the following Jupyter notebooks:

  • Tensors: Introduction to tensors.
  • Fluids: Introduction to core classes and fluid-related functions.
  • Solar System: Visualize a many-body system with Newtonian gravity.
  • Learn 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.

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.

More Repositories

1

pbdl-book

Welcome to the Physics-based Deep Learning Book (v0.2)
Jupyter Notebook
992
star
2

Solver-in-the-Loop

Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers
Python
145
star
3

PhiML

Intuitive scientific computing with dimension types for Jax, PyTorch, TensorFlow & NumPy
Python
68
star
4

autoreg-pde-diffusion

Benchmarking Autoregressive Conditional Diffusion Models for Turbulent Flow Simulation
Jupyter Notebook
68
star
5

DMCF

Guaranteed Conservation of Momentum for Learning Particle-based Fluid Dynamics (NeurIPS '22)
Python
49
star
6

Diffusion-based-Flow-Prediction

Official implementation of the AIAA Journal paper "Uncertainty-aware Surrogate Models for Airfoil Flow Simulations with Denoising Diffusion Probabilistic Models"
Jupyter Notebook
43
star
7

differentiable-piso

Code repository for "Learned Turbulence Modelling with Differentiable Fluid Solvers"
JavaScript
35
star
8

dl-surrogates

C++
31
star
9

LSIM

LSiM is a learned metric to compute distance values for 2D data from numerical simulations
Python
27
star
10

coord-trans-encoding

This is the source code for our paper "Towards high-accuracy deep learning inference of compressible turbulent flows over aerofoils"
Python
26
star
11

CG-Solver-in-the-Loop

Conjugate Gradient related code for "Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers"
Python
24
star
12

ConFIG

Official implementation of Conflict-Free Inverse Gradients Method
Python
24
star
13

SMDP

Solving Inverse Physics Problems with Score Matching
Jupyter Notebook
21
star
14

Global-Flow-Transport

Repository for our CVPR 2021 Global Flow Transport Paper
C++
19
star
15

half-inverse-gradients

Source code for the ICLR'22 paper on "Half-Inverse Gradients"
Python
17
star
16

VOLSIM

VolSiM, a CNN-based metric to compute the similarity of 3D data from numerical simulations
Python
15
star
17

SIP

Scale-invariant Learning by Physics Inversion (NeurIPS 2022)
Python
10
star
18

DiffPhys-CylinderWakeFlow

Jupyter Notebook
9
star
19

StableBPTT

The source code the for the ICLR'24 paper "Stabilizing Backpropagation Through Time to Learn Complex Physics"
Python
9
star
20

unrolling

Python
6
star
21

reconstructScalarFlows

ScalarFlow Reconstruction for Large-Scale Volumetric Data Sets of Real-world Scalar Transport Flows
5
star
22

SFBC

ICLR'24: Symmetric basis convolutions for learning lagrangian fluid mechanics
Jupyter Notebook
5
star
23

racecar

Data-driven Regularization via Racecar Training for Generalizing Neural Networks
Python
3
star
24

two-way-coupled-control

Python
2
star
25

Neural-Global-Transport

Repository for the ICLR '23 paper on Neural-Global-Transport
C++
2
star
26

Hybrid-Solver-for-Reactive-Flows

Python
1
star