Combining Machine Learning with Computational Fluid Dynamics using OpenFOAM and SmartSim

Tomislav Maric,Mohammed Elwardi Fadeli,Alessandro Rigazzi,Andrew Shao,Andre Weiner
DOI: https://doi.org/10.1007/s11012-024-01797-z
2024-04-24
Abstract:Combining machine learning (ML) with computational fluid dynamics (CFD) opens many possibilities for improving simulations of technical and natural systems. However, CFD+ML algorithms require exchange of data, synchronization, and calculation on heterogeneous hardware, making their implementation for large-scale problems exceptionally challenging.
Machine Learning,Fluid Dynamics
What problem does this paper attempt to address?
This paper discusses how to combine machine learning (ML) with computational fluid dynamics (CFD) to improve the efficiency of technology and natural system simulations. The authors point out that implementing CFD+ML algorithms in large-scale problems poses challenges, mainly involving data exchange, synchronization, and computation on heterogeneous hardware. To address this, they propose an efficient and scalable solution using the open-source software OpenFOAM and SmartSim. SmartSim provides an Orchestrator that simplifies the programming of CFD+ML algorithms and enables scalable data exchange between ML and CFD clients. The paper demonstrates how to effectively couple different parts of OpenFOAM, such as preprocessing applications, function objects, and grid motion solvers, using SmartSim. Additionally, an OpenFOAM submodule and examples are provided as starting points for real-world applications. The paper focuses on three questions: 1. How to embed ML into OpenFOAM as part of the simulation? 2. Which computational architecture is effective in utilizing CPU and GPU resources for CPU-based codes like OpenFOAM? 3. What is the basic workflow design pattern for building complex CFD+ML applications? To overcome these challenges, the paper suggests a loosely coupled assumption, where scientific simulations and ML algorithms maintain loose coupling on the software and computational levels, leveraging a centralized, computation-enabled database for data sharing. The paper provides three examples to illustrate this loosely coupled approach, including using Bayesian optimization to adjust turbulence model parameters, streaming CFD data from simulations for calculating reduced bases, and approximating grid point displacements using online training and inference. The paper's structure consists of an introduction, architecture, integration of OpenFOAM and SmartSim, implementation and results of use cases. Using SmartSim and the SmartRedis library, the paper demonstrates how to implement these loosely coupled CFD+ML workflows in the OpenFOAM environment, highlighting their adaptability and scalability to high-performance computing.