MeshDQN: A Deep Reinforcement Learning Framework for Improving Meshes in Computational Fluid Dynamics

Cooper Lorsung, Amir Barati FarimaniarXiv 2022 · DOI

Abstract

MeshDQN is a novel framework that leverages deep reinforcement learning (DRL) to automate the coarsening of computational fluid dynamics (CFD) meshes. By representing meshes as graphs and employing a Double Deep Q-Network (DQN) integrated with graph neural networks (GNNs), the system learns to identify and remove redundant vertices while preserving critical simulation accuracy. A key innovation of this approach is the use of piecewise interpolation to estimate rewards, which significantly reduces the computational overhead by bypassing expensive CFD re-simulations during the training process. Experimental evaluations on 2D airfoil geometries demonstrate that MeshDQN can achieve substantial vertex reduction with negligible errors in key physical properties such as drag and lift.

Introduction

In Computational Fluid Dynamics (CFD), the quality and resolution of the mesh—the discrete grid where physical equations are solved—are paramount. A mesh that is too coarse leads to inaccurate results, while an excessively fine mesh incurs prohibitive computational costs. Traditionally, Adaptive Mesh Refinement (AMR) is used to balance these trade-offs, but these methods often require specialized solvers or extensive human expertise. Mesh generation remains a significant bottleneck, lacking general-purpose, autonomous tools capable of optimizing mesh density based on local flow physics without constant human intervention or massive pre-calculated datasets.

Methodology

The authors propose MeshDQN, a framework that treats mesh coarsening as a sequential decision-making process. The mesh is represented as a graph where nodes correspond to vertices and edges represent connectivity.

Deep Reinforcement Learning Architecture

The core of the system is a Double Deep Q-Network (DQN) agent. In each step, the agent observes the current state of the mesh and selects an action—specifically, which vertex to remove. To process the graph-structured data, the framework utilizes a GNN architecture based on GraphSAGE and GCN layers. This allows the model to capture spatial relationships and physical properties (e.g., velocity, pressure) at each node to inform its decisions.

Overview of the MeshDQN framework showing the reinforcement learning loop from graph state to vertex removal and reward calculation.

The Interpolation Shortcut

A major challenge in applying RL to CFD is the time required for a full simulation to evaluate a new mesh. MeshDQN addresses this by using piecewise interpolation. Instead of re-solving the physics equations after every vertex removal, the framework maps the previous solution onto the modified mesh. This provides a near-instantaneous estimate of the physical properties, allowing the agent to receive immediate feedback (rewards) and making the training process computationally feasible.

Reward Function

The agent's reward function is designed to balance efficiency and accuracy. It rewards the removal of vertices while penalizing deviations in calculated physical properties, such as drag, from the initial high-fidelity "ground truth" simulation.

Experimental Results

The framework was evaluated using 2D airfoil geometries (YS930 and AH93W145) from the UIUC Airfoil Database, with simulations performed using the FEniCS platform.

MeshDQN successfully removed over 5% of vertices from initial meshes while maintaining exceptional accuracy. For the YS930 airfoil, the drag error was limited to 0.039%, and the lift error was a mere 0.002%. Crucially, the meshes produced by MeshDQN outperformed standard meshes generated via traditional Delaunay triangulation and smoothing at equivalent vertex counts.

Comparison of drag accuracy versus the number of vertices, showing how MeshDQN (Refined Airfoil) maintains accuracy close to the converged value while reducing vertex count.

Discussion and Key Insights

MeshDQN demonstrates that meshing can be effectively framed as a game, allowing AI to discover non-obvious coarsening strategies. The agent naturally learned to preserve high mesh density at the leading and trailing edges of airfoils—where flow gradients are steepest—while thinning out regions with more uniform flow.

Furthermore, the framework is solver-agnostic and requires only a single full simulation prior to the coarsening process, making it highly portable and efficient compared to other machine learning approaches that require thousands of training simulations.

Conclusion and Future Work

While MeshDQN represents a significant step toward autonomous mesh optimization, several challenges remain. Future work will focus on extending the framework to 3D geometries, which involves a much larger action space. Additionally, the authors aim to adapt the system for turbulent flows, which feature more complex, multi-scale structures. Finally, expanding the agent's capabilities to include mesh refinement (adding nodes) would create a truly comprehensive adaptive meshing tool.

Summary updated

BibTeX
@misc{lorsung2022meshdqn,
  author = {Cooper Lorsung and Amir Barati Farimani},
  title = {{MeshDQN: A Deep Reinforcement Learning Framework for Improving Meshes in Computational Fluid Dynamics}},
  year = {2022},
  eprint = {2212.01428},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.01428},
}
Figure