Combining Machine Learning with Computational Fluid Dynamics using OpenFOAM and SmartSim
Tomislav Maric, Mohammed Elwardi Fadeli, Alessandro Rigazzi, Andrew Shao, Andre Weiner
TL;DR
OpenFOAM-based CFD simulations face data-exchange and compute-heterogeneity challenges when integrating with ML at scale. The authors adopt a loosely coupled CFD+ML framework using SmartSim as an orchestration layer and SmartRedis as an in-memory data hub, bridging OpenFOAM with ML backends through a lightweight API; they also illustrate a distributed SVD workflow where the data matrix $X \\in \\mathbb{R}^{M\\times N}$ is partitioned into $S$ blocks and merged to recover the global SVD. Three educational use cases—Bayesian optimization for turbulence parameters, partitioned SVD on streaming CFD data, and AI-in-the-loop mesh motion with an ANN—demonstrate the approach on heterogeneous HPC resources. The work provides open-source implementations, an OpenFOAM sub-module, and tutorials to accelerate adoption of scalable CFD+ML workflows.
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. We provide an effective and scalable solution to developing CFD+ML algorithms using open source software OpenFOAM and SmartSim. SmartSim provides an Orchestrator that significantly simplifies the programming of CFD+ML algorithms and a Redis database that ensures highly scalable data exchange between ML and CFD clients. We show how to leverage SmartSim to effectively couple different segments of OpenFOAM with ML, including pre/post-processing applications, solvers, function objects, and mesh motion solvers. We additionally provide an OpenFOAM sub-module with examples that can be used as starting points for real-world applications in CFD+ML.
