Abstract

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. Program summaryProgram Title: NNPredCPC Library link to program files:https://doi.org/10.17632/v2jzcyjn8v.1Developer's repository link:https://github.com/Weishuo93/NN_PredLicensing provisions: MIT1, LGPL2, Apache-2.03Programming language: C++, FortranNature of problem: Coupling machine learning models with CFD programs with minimal modifications to facilitate the study of data-driven modeling methods (e.g., rapid modeling from experimental data, turbulence closure modeling, etc) with MPI supports.Solution method: First, an interfacing library is developed to bridge ML modeling and a CFD solver. The library supports different ML backends and provides flexible data I/O methods when interfacing with CFD codes. The API of this library can be accessed through C++ and Fortran, which are two most commonly used languages in the CFD community. Secondly, two data-driven modeling cases are demonstrated with the library's implementation details in OpenFOAM and CFL3D. The first case shows a semi-empirical modeling problem in heat transfer with assumed experimental data, whereas the second case reproduces the results of DNS with an ML-integrated turbulence model in two different CFD software (OpenFOAM and CFL3D). Finally, parallel computation is conducted using a homogeneous Message Passing Interface, which is adopted by most mainstream CFD programs. The extra costs are observed limited, and therefore users could validate their ideas on data-driven models with great convenience on parallel programs.Additional comments including restrictions and unusual features: Heterogeneous parallel strategy with GPU and associated applications need to be further developed.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call