PhiFlow

PhiFlow

注重物理模拟与机器学习的开源仿真工具

PhiFlow 是一款开源仿真工具包,专为优化和机器学习应用设计。它主要用 Python 编写,与 NumPy、PyTorch、Jax 和 TensorFlow 深度集成,利用这些框架的自动微分功能,简化涉及学习模型和物理仿真的可微函数构建。PhiFlow 特别适用于流体现象的 PDE 操作,通过联网操作支持实时可视化和交互控制,并支持 GPU 执行,为用户提供简洁、灵活且可扩展的编码体验。

PhiFlow模拟工具包机器学习PythonGPU执行Github开源项目

PhiFlow

构建状态 PyPI py版本 PyPI 许可证 代码覆盖率 Google Colab Book

Φ<sub>Flow</sub> 是一个开源的仿真工具包,专为优化和机器学习应用而构建。 它主要用 Python 编写,可以与 NumPy, PyTorch, JaxTensorFlow 一起使用。 与这些机器学习框架的紧密集成使其能够利用它们的自动微分功能, 使得构建涉及学习模型和物理仿真的端到端可微函数变得容易。

示例

网格

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

安装

使用 pipPython 3.6 及以上版本进行安装:

$ pip install phiflow

此外安装 PyTorchTensorFlowJax 以启用机器学习功能和 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 论文。

基准和数据集

Φ<sub>Flow</sub> 已被用于创建各种公共数据集,如 PDEBenchPDEarena

查看更多使用 Φ<sub>Flow</sub> 的软件包

🕒 版本历史

版本历史 列出了自发布以来的所有主要变更。 这些发布版也列在 PyPI 上。

👥 贡献

欢迎贡献!查看 此文档 获取指南。

致谢

此工作由 ERC 启动拨款 realFlow (StG-2015-637014) 和 Intel 智能系统实验室支持。

编辑推荐精选

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

下拉加载更多