NNPred: Deploying neural networks in computational fluid dynamics codes to facilitate data-driven modeling studies
收藏资源简介:
Data-driven modeling has contributed significantly to the field of computational fluid dynamics (CFD), but integrating machine-learning (ML) models into a CFD workflow still remains to be a challenging task. In this paper, we introduce an interface library for the deployment of ML models in CFD codes. The library supports multiple ML backends with binary interface compatibility and provides flexible data input/output (I/O) methods to match the type and layout of the data between ML models and CFD codes. For the convenience of CFD users, the library provides application programming interfaces for two widely used languages (i.e., C++ and Fortran), simplifying the deployment and prediction to only a few lines of code. Two data-driven modeling cases are demonstrated, along with the implementation details of the library in open-source CFD codes (i.e., OpenFOAM and CFL3D). The first case presents a simple heat-transfer problem with assumed experimental data of unknown emissivity, where the basic use of the library in OpenFOAM is demonstrated by solving a diffusive equation with the source term modeled by various ML algorithms. The second case discusses the modeling of turbulence in channel flow, and applies an ML-integrated closure model in both OpenFOAM and CFL3D. In both software, the ML-RANS model reproduces almost identical results to the reference data and favorable extrapolation performance is maintained. In addition, the parallel efficiency is compared with the traditional closure model under the same homogeneous parallel architecture, and only limited additional cost is imposed by running the ML prediction. This library could benefit CFD researchers in rapidly testing data-driven models in their CFD solvers.
数据驱动建模在计算流体动力学(Computational Fluid Dynamics, CFD)领域已取得显著进展,但将机器学习(Machine Learning, ML)模型集成至CFD工作流仍极具挑战性。本文介绍一款用于在CFD代码中部署ML模型的接口库,该库支持多种具备二进制接口兼容性的ML后端,并提供灵活的数据输入/输出(Input/Output, I/O)方法,可匹配ML模型与CFD代码间的数据类型与布局。为方便CFD用户使用,该库针对C++与Fortran这两种广泛应用的编程语言提供了应用程序编程接口(Application Programming Interface, API),仅需数行代码即可完成模型部署与预测流程。本文展示了两个数据驱动建模案例,并介绍了该库在两款开源CFD代码(即OpenFOAM与CFL3D)中的实现细节:第一个案例为简易传热问题,采用了未知发射率的假设实验数据,通过在OpenFOAM中使用各类ML算法构建源项以求解扩散方程,演示了该库的基础使用方法;第二个案例针对槽道流湍流建模,在OpenFOAM与CFL3D中均集成了ML封闭模型,在两款软件中,ML-RANS模型的预测结果与参考数据几乎完全一致,且保持了优异的外推性能。此外,本文在相同的同构并行架构下,对比了该方案与传统封闭模型的并行效率,结果显示运行ML预测仅带来了有限的额外计算开销。该库可帮助CFD研究人员快速在其CFD求解器中测试数据驱动模型。




