

Φ<sub>Flow</sub> 是一个开源的仿真工具包,专为优化和机器学习应用而构建。
它主要用 Python 编写,可以与
NumPy,
PyTorch,
Jax
或 TensorFlow 一起使用。
与这些机器学习框架的紧密集成使其能够利用它们的自动微分功能,
使得构建涉及学习模型和物理仿真的端到端可微函数变得容易。
示例
网格
<table>
<tbody>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Fluid_Logo.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/01f76e75-3e7e-4d5e-a37b-b603897407d5.gif"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Wake_Flow.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/e56bac2c-cbe9-4dc8-bc9f-9b86edfa0357.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Lid_Driven_Cavity.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/7667012c-b49a-40b1-97b8-553927025cdc.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Taylor_Green.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/e05b00bb-ebeb-468a-aba2-861b7db0c0b5.jpg"></a></td>
</tr>
<tr>
<td align="center">Fluid logo</td>
<td align="center">尾流</td>
<td align="center">驱顶腔</td>
<td align="center">泰勒-格林</td>
</tr>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Smoke_Plume.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/272a44f7-3ac6-4f8f-b8d6-d095cf4dbfe3.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Variable_Boundaries.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/8c3fa2e2-81f7-49bb-b993-64811b7ee91f.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Batched_Smoke.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/defe3c6b-decb-456a-82ab-5591e72191c7.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Moving_Obstacles.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/56a154a3-331b-4190-ad83-982628c3c142.png"></a></td>
</tr>
<tr>
<td align="center">烟羽</td>
<td align="center">可变边界</td>
<td align="center">并行模拟</td>
<td align="center">移动障碍物</td>
</tr>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Rotating_Bar.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/f4680d90-7cb0-4ad1-a317-d558660d2499.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Multi_Grid_Fluid.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/aa145fb2-66a9-40b2-9555-c2375be7ec3c.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Higher_order_Kolmogorov.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/06245f4e-3830-40c4-8d5c-87a5fae7f4fc.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Heat_Flow.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/c4223f9d-cb46-42a1-a647-f171de2b990f.png"></a></td>
</tr>
<tr>
<td align="center">旋转棒</td>
<td align="center">多网格流体</td>
<td align="center">高阶柯尔莫戈罗夫</td>
<td align="center">热流</td>
</tr>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Burgers.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/86ad4184-7600-430e-95c5-ced3fcd39ef6.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Reaction_Diffusion.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/c4f64964-686c-4597-bc22-32d998940c31.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Waves.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/5d654c6f-fd3b-4f25-a36b-cc9c48f24b66.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/grids/Julia_Set.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/6bc0724d-68c2-42f3-806f-ce3cdc2b5e3f.png"></a></td>
</tr>
<tr>
<td align="center">伯格斯方程</td>
<td align="center">反应扩散</td>
<td align="center">波</td>
<td align="center">朱利亚集合</td>
</tr>
</tbody>
</table>
网格
<table>
<tbody>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/mesh/FVM_BackStep.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/f1116290-e991-4fa7-8453-446cc140f8d4.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/mesh/FVM_Heat.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/9870471c-43b9-4403-bf1b-254d8b10e3ed.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/mesh/Build_Mesh.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/1619e908-bc49-4641-b925-3bbcd47cc2e5.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/mesh/FVM_Cylinder_GMsh.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/d22bd10c-9bd3-4372-8d4f-ce638215f987.png"></a></td>
</tr>
<tr>
<td align="center">后向台阶</td>
<td align="center">热流</td>
<td align="center">网格构建</td>
<td align="center">尾流</td>
</tr>
</tbody>
</table>
粒子
<table>
<tbody>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/SPH.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/53b992f0-27e3-4a81-8097-84c301950eb9.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/FLIP.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/bed817d0-3538-48aa-8c4d-883c496b64a9.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/Streamlines.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/ba1ea675-1c84-4396-8acf-dab73aa7c5f6.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/Terrain.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/24417085-45ea-497a-b5b3-8d0497c42646.jpg"></a></td>
</tr>
<tr>
<td align="center">SPH</td>
<td align="center">FLIP</td>
<td align="center">流线</td>
<td align="center">地形</td>
</tr>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/Gravity.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/7ea51e1e-f0e8-49e7-b7c8-bdbf4f47e4b0.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/Billiards.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/052e5f57-3d3e-4058-a78e-32f0c0738242.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/particles/Ropes.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/cf1698e4-a7e3-4d5d-a5a2-5e4190c500c2.png"></a></td>
</tr>
<tr>
<td align="center">重力</td>
<td align="center">台球</td>
<td align="center">绳索</td>
</tr>
</tbody>
</table>
优化与网络
<table>
<tbody>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Gradient_Descent.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/1337cb71-e3d1-4a6b-b70f-252d5a0763ee.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Optimize_Throw.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/0c7a846f-fd7f-454d-88b9-89c481a59d4f.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Learn_Throw.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/7c6f638d-6583-4c9d-9d51-09f3e617f3d9.jpg"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/PIV.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/ebc91339-8cd8-4b84-839c-542b2b1172a0.jpg"></a></td>
</tr>
<tr>
<td align="center">梯度下降</td>
<td align="center">优化投掷</td>
<td align="center">学习投掷</td>
<td align="center">PIV</td>
</tr>
<tr>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Close_Packing.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/67e8d05c-0e88-4894-b6ee-454e301b27f6.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Learn_Potential.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/1cf612c6-15fb-4f7b-a5e2-9c5bb65c237b.png"></a></td>
<td style="width: 25%;"><a href="https://tum-pbs.github.io/PhiFlow/examples/optim/Differentiable_Pressure.html"><img src="https://yellow-cdn.veclightyear.com/35dd4d3f/c6616cbc-590c-4298-9ebd-add9cda52232.jpg"></a></td>
</tr>
<tr>
<td align="center">密堆</td>
<td align="center">学习Φ(x,y)</td>
<td align="center">可微分压力</td>
</tr>
</tbody>
</table>
安装
使用 pip 在 Python 3.6 及以上版本进行安装:
$ pip install phiflow
此外安装 PyTorch、TensorFlow 或 Jax 以启用机器学习功能和 GPU 执行。
要启用网页用户界面,还可以安装 Dash。
为了达到最佳 GPU 性能,您可能需要编译自定义的 CUDA 操作符,详见 安装详细说明。
您可以运行
$ python3 -c "import phi; phi.verify()"
来验证您的安装。
这将检查兼容的 PyTorch、Jax 和 TensorFlow 安装。
特性
- 与 PyTorch、Jax 和 TensorFlow 紧密集成,可轻松进行神经网络训练,并支持完全可微分的模拟,可以在 GPU 上运行。
- 内置偏微分方程 (PDE) 操作,重点关注流体现象,允许运用简洁的方式进行模拟。
- 灵活、易于使用的 网络界面,具备实时可视化和交互控制功能,可以实时影响模拟或网络训练。
- 面向对象的向量化设计,可编写具有表现力的代码,易于使用,灵活且可扩展。
- 可重用的模拟代码,独立于后端和维度,换句话说,同样的代码可以使用 NumPy 运行 2D 流体模拟,也可以使用 TensorFlow 或 PyTorch 在 GPU 上运行 3D 流体模拟。
- 高级线性方程求解器,支持自动生成稀疏矩阵。
📖 文档与教程
文档概览
• ▶ YouTube 教程
• API
• 演示
• <img src="https://yellow-cdn.veclightyear.com/35dd4d3f/c8ec9ada-20cb-4e47-96b7-6ff37551a9b3.png" height=16> 实验场
Φ-Flow 基于 Φ<sub>ML</sub> 的张量功能。
要了解 Φ<sub>Flow</sub> 的工作原理,请首先查看命名和类型化维度。
入门
物理
场
几何
张量
其他
📄 引用
请使用以下引用:
@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}
}
出版物
我们很快会上传一篇白皮书。
同时,请引用 ICLR 2020 论文。
- 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。
- Φ<sub>Flow</sub>: A Differentiable PDE Solving Framework for Deep Learning via Physical Simulations,Nils Thuerey, Kiwon Um, Philipp Holl,NeurIPS 2020 的 DiffCVGP 研讨会。
- Physics-based Deep Learning (书籍),Nils Thuerey, Philipp Holl, Maximilian Mueller, Patrick Schnell, Felix Trost, Kiwon Um,NeurIPS 2020 的 DiffCVGP 研讨会。
- Half-Inverse Gradients for Physical Deep Learning,Patrick Schnell, Philipp Holl, Nils Thuerey,ICLR 2022。
- Scale-invariant Learning by Physics Inversion,Philipp Holl, Vladlen Koltun, Nils Thuerey,NeurIPS 2022。
基准和数据集
Φ<sub>Flow</sub> 已被用于创建各种公共数据集,如
PDEBench 和 PDEarena。
查看更多使用 Φ<sub>Flow</sub> 的软件包
🕒 版本历史
版本历史 列出了自发布以来的所有主要变更。
这些发布版也列在 PyPI 上。
👥 贡献
欢迎贡献!查看 此文档 获取指南。
致谢
此工作由 ERC 启动拨款 realFlow (StG-2015-637014) 和 Intel 智能系统实验室支持。