MCPcopy
hub / github.com/tum-pbs/PhiFlow

github.com/tum-pbs/PhiFlow @3.4.0 sqlite

repository ↗ · DeepWiki ↗ · release 3.4.0 ↗
1,808 symbols 6,840 edges 138 files 318 documented · 18%
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 logo Wake flow Lid-driven cavity Taylor-Green
Smoke plume Variable boundaries Parallel simulations Moving obstacles
Rotating bar Multi-grid fluid Higher-order Kolmogorov Heat flow
Burgers' equation Reaction-diffusion Waves Julia Set

Mesh

Backward facing step Heat flow Mesh construction Wake flow

Particles

SPH FLIP Streamlines Terrain
Gravity Billiards Ropes

Optimization & Networks

Gradient Descent Optimize throw Learning to throw PIV
Close packing Learning Φ(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

Core symbols most depended-on inside this repo

CenteredGrid
called by 140
phi/field/_grid.py
append
called by 105
phi/vis/_viewer.py
StaggeredGrid
called by 89
phi/field/_grid.py
without
called by 88
phi/geom/_box.py
stack
called by 87
phi/field/_scene.py
numpy
called by 80
phi/field/_field.py
stack
called by 67
phi/field/_field_math.py
to_phi_t
called by 55
demos/Top_Opt/geom_opt.py

Shape

Method 1,277
Function 385
Class 122
Route 24

Languages

Python100%

Modules by API surface

phi/geom/_geom.py116 symbols
phi/field/_field.py92 symbols
phi/geom/_mesh.py74 symbols
phi/vis/_matplotlib/_matplotlib_plots.py71 symbols
phi/vis/_vis_base.py68 symbols
phi/vis/_dash/_plotly_plots.py62 symbols
phi/geom/_geom_ops.py57 symbols
phi/geom/_spline_solid.py53 symbols
phi/geom/_grid.py50 symbols
phi/geom/_box.py48 symbols
phi/field/_scene.py47 symbols
phi/geom/_heightmap.py44 symbols

For agents

$ claude mcp add PhiFlow \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact