Differentiable programming has emerged as a structural prerequisite for gradient-based inverse problems and end-to-end hybrid physics--machine learning in computational fluid dynamics. However, existing differentiable CFD platforms are confined to structured Cartesian grids, excluding the geometrically complex domains where body-conforming unstructured discretizations are indispensable. We present DiFVM, the first GPU-accelerated, end-to-end differentiable finite-volume CFD solver operating natively on unstructured polyhedral meshes. The key enabling insight is a structural isomorphism between finite-volume discretization and graph neural network message-passing: by reformulating all FVM operators as static scatter/gather primitives on the mesh connectivity graph, DiFVM transforms irregular unstructured connectivity into a first-class GPU data structure. All operations are implemented in JAX/XLA, providing just-in-time compilation, operator fusion, and automatic differentiation through the complete simulation pipeline. Differentiable Windkessel outlet boundary conditions are provided for cardiovascular applications, and DiFVM accepts standard OpenFOAM case directories without modification for seamless adoption in existing workflows. Forward validation across benchmarks spanning canonical flows to patient-specific hemodynamics demonstrates close agreement with OpenFOAM, and end-to-end differentiability is demonstrated through inference of Windkessel parameters from sparse observations. DiFVM bridges the critical gap between differentiable programming and unstructured-mesh CFD, enabling gradient-based inverse problems and physics-integrated machine learning on complex engineering geometries.
翻译:可微分编程已成为计算流体动力学中基于梯度的反问题及端到端混合物理-机器学习方法的结构性前提。然而,现有可微分CFD平台受限于结构化笛卡尔网格,无法处理几何复杂域——此类场景必须采用贴体非结构离散化。本文提出DiFVM,首个在非结构多面体网格上原生运行的GPU加速端到端可微分有限体积CFD求解器。其关键实现思路在于揭示有限体积离散化与图神经网络消息传递间的结构同构性:通过将所有FVM算子重构为网格连接图上的静态散射/聚集原语,DiFVM将不规则非结构连接转化为一等GPU数据结构。所有运算均基于JAX/XLA实现,支持通过完整模拟流程的即时编译、算子融合与自动微分。系统提供适用于心血管应用的可微分Windkessel出口边界条件,且DiFVM可直接读取标准OpenFOAM案例目录而无需修改,实现现有工作流的无缝衔接。从经典流场到患者特异性血流动力学的基准测试验证表明,其正向计算结果与OpenFOAM高度吻合;通过稀疏观测数据反演Windkessel参数的实验,验证了系统的端到端可微性。DiFVM填补了可微分编程与非结构网格CFD之间的关键空白,为复杂工程几何形态上的梯度反问题及物理融合机器学习研究提供了技术基础。