Transforming CFD Simulations with ML Using NVIDIA Modulus

Share post:

Simulations play a critical role in advancing science and engineering, especially in the vast field of fluid dynamics. However, high-fidelity fluid simulations require extensive computational resources, often constraining practical applications. Accurately simulating complex flows can take weeks of computational effort, slowing down advancements in critical fields such as aerospace and environmental engineering. 

Machine learning (ML) is revolutionizing computational fluid dynamics (CFD) by addressing these challenges. ML algorithms enable researchers to use large-scale datasets and create models that mimic the real-world behavior of complex flow problems with a markedly reduced computational cost.

One promising ML approach in fluid dynamics involves Fourier neural operators (FNOs), which can learn resolution-invariant solution operators. FNOs have opened the possibility of training models for complex flows on low-resolution data that can be dynamically integrated into high-fidelity numerical simulations, which decreases computational costs for many applications. 

NVIDIA Modulus offers an easy way to leverage these advantages of FNOs with its open-source framework designed for building, training, and fine-tuning FNOs and other cutting-edge ML models. With optimized implementations of numerous state-of-the-art ML algorithms, it serves as an exceptionally versatile tool for a variety of applications.

A major focus in the engineering community today is the augmentation of traditional numerical simulations with AI surrogates to combine their respective strengths. To advance this goal, the research team at the Technical University of Munich (TUM), led by Professor Dr. Nikolaus A. Adams, is pioneering innovative methods by integrating ML models into established simulation workflows. 

These hybrid approaches aim to enhance both the accuracy and efficiency of numerical simulations by leveraging the predictive power of AI while maintaining the physical accuracy of traditional numerical methods. 

“For investigating integrated machine-learning simulation workflows, our team has been developing a fully differentiable and highly versatile lattice Boltzmann solver that premises on the algorithmic similarities between simulations and ML models,” said Dr. Adams, head of AER at TU Munich.

“By dynamically integrating ML algorithms, specifically FNOs, into our LBM framework, we achieve performance enhancements with orders-of-magnitude speedups over traditional CFD methods. This hybrid approach is revolutionizing the field, enabling us to solve complex fluid dynamical problems for new applications in record time.”

Using machine learning within numerical methods

The TUM team is developing a hybrid simulation environment based on the lattice Boltzmann method (LBM) that integrates machine learning dynamically into the numerical simulation workflow. The LBM excels at computing multiphase and multicomponent flows in complex geometries, such as porous media flows, enabling the team to investigate complex flows with high numerical efficiency. 

By implementing LBM based on the machine-learning library PyTorch, the research team capitalizes on efficient tensor computing and out-of-the-box GPU hardware acceleration, creating the fast and easy-to-use TorchLBM solver. It provides a modular implementation of state-of-the-art numerical building blocks for LBM simulations of complex single- and multiphase flows, such as the interaction of a droplet with a circular obstacle. 

To further increase the computational efficiency of TorchLBM, the research team developed hybrid approaches that integrated the predictive power of FNOs into the simulation workflow. These hybrid approaches use the fact that the underlying numerical methods require calculating the output of discretized operators, which can be segmented into sequentially connected units, similar to the architecture of many ML models (Figure 1).

Transforming CFD Simulations with ML Using NVIDIA Modulus
Figure 1. Different steps of the computation in an LBM algorithm

Central to the hybrid implementation was the use of NVIDIA Modulus. The platform provides a user-friendly SciML toolkit with novel architectures and utilities tailor-made for CFD use cases and can be integrated seamlessly with existing machine learning workflows, allowing for rapid development and deployment of the hybrid models. NVIDIA Modulus enabled the team to use the FNO model out of the box, facilitating and accelerating their research going forward. 

By extending the TorchLBM solver with the NVIDIA Modulus FNO model, the team created a hybrid machine-learning simulation workflow, focusing on combining the physical accuracy of the LBM with the computational efficiency of FNOs.

AI-augmented differentiable LBM solver

Aiming to develop AI surrogate models that use the FNOs’ independence from the simulation resolution, the researchers showcase their approach for two complex flow problems: 

  • Dynamic evolution of the Kármán Vortex Street
  • Steady-state flow field through porous media

For each case, separate FNOs for the density and velocity field were trained using an NVIDIA RTX A6000 GPU. 

In the Kármán Vortex Street case, the team simulated the flow in 2D. The data was generated for various Reynolds numbers using a purely numerical TorchLBM simulation. Results from advancing the simulation with only FNOs showed some instability after several recursive uses due to hyperparameter tuning challenges.

However, in hybrid simulations, where the simulation was advanced alternately with an FNO and the LBM, the results were stable and benefited from the drastically reduced computational costs, achieving significant speedups. By optimizing the FNOs prediction timestep, computational costs were halved compared to traditional methods.

A visual comparison between flows simulated solely by FNOs and those using hybrid simulations demonstrates these improvements for long-time predictions (Figure 2).  The pipeline combines an AI model with the LBM method.

This image shows the visual comparison of a pure FNO long-term prediction and the hybrid simulation of the Kármán Vortex Street. Towards the end of the simulation, the pure FNO prediction develops instabilities in the flow field while the hybrid simulation remains stable.
Figure 2. Predictions from an AI model and a hybrid simulation pipeline

In the second case, the team simulated the flow through arbitrarily distributed obstacles with periodic boundary conditions. The goal was to use FNOs to predict the steady-state flow field, initialize the simulation using the FNO prediction, and subsequently use the LBM for further iterating toward the steady-state solution. The FNO predictions facilitated efficient initialization of simulations, leading to reductions in time-to-solution by up to 50%, even for high-resolution simulations. 

Diagram shows a 50% reduced time-to-solution for the low-resolution porous media flow (32x32x32). Initialization with the FNO-predicted flow field allows the drastic reduction of the computation cost.
Figure 3. Efficiency gain of the hybrid model compared to the traditional numerical simulation for a low-resolution simulation
Diagram shows a 50% reduced time-to-solution for the high-resolution porous media flow (128x128x128). Also for zero-shot super-resolution, the hybrid workflow drastically reduces the computation cost.
Figure 4. Efficiency gain of the hybrid model compared to the traditional numerical simulation for a super-resolution simulation

The TUM team’s approach demonstrates how hybrid simulations that integrate ML models into traditional numerical methods can maintain stability, reduce computational time, and improve overall efficiency in fluid dynamics research. 

The successful application of FNOs to these test cases highlights the potential for machine learning to revolutionize fluid dynamical simulations and other complex engineering problems. 

A new era of CFD research

TUM’s pioneering work in integrating machine learning dynamically into a fluid dynamical solver sets a new benchmark in the field. Their innovative use of NVIDIA Modulus and the development of hybrid models demonstrate the immense potential of machine learning in transforming fluid dynamics research. 

Moving forward, the team aims to refine these hybrid models, scale up their simulations through multi-GPU setups, and integrate their workflows into NVIDIA Omniverse, further enhancing their proposed approach and exploring new applications.  

The advancements made by the TUM team unveil new possibilities for applications across various industries. As more researchers and engineers adopt similar methodologies, you can anticipate a revolution in fluid dynamical applications across sectors, leading to more efficient designs, improved performance, and accelerated innovation. 

NVIDIA supports the ML research community by providing an enterprise-grade platform with easy-to-use GPU-optimized utilities and models so that advanced AI tools and knowledge are accessible to all.

NVIDIA Modulus plays a crucial role in this transformation. For more information, see the NVIDIA Deep Learning Institute course, Introduction to Physics-Informed Machine Learning with Modulus. Download the latest Modulus container or pip wheels for use in personal environments.

For more information about how to customize and contribute to the framework, see the /NVIDIA/modulus GitHub repo.

Related articles