Reinforcement Learning for Adaptive Mesh Refinement

Jiachen Yang, Tarik Dzanic, Brenden K. Petersen, Jun Kudo, Ketan Mittal, Jean-Sylvain Camier, Vladimir Tomov, Tuo Zhao, Hongyuan Zha, Tzanio Kolev, Robert Anderson, Daniel faissol

Reinforcement Learning for Adaptive Mesh Refinement

Abstract

Adaptive Mesh Refinement (AMR) is a critical technique in computational science for optimizing simulation grids by focusing resolution on regions of high interest. Traditional AMR relies on human-designed heuristics that often fail to account for long-term simulation dynamics. This paper reformulates AMR as a Markov Decision Process (MDP) solved via Deep Reinforcement Learning. We introduce novel neural architectures—Independent Policy, Hypernetwork, and Graph Network policies—that accommodate the dynamic nature of meshes. Our results show that RL-based agents can learn anticipatory refinement strategies that outperform standard heuristics and generalize to simulations much larger than those encountered during training.

Introduction: The AMR Problem

Simulating physical phenomena like fluid dynamics or heat transfer requires discretizing space into a mesh. To balance accuracy and computational cost, researchers use Adaptive Mesh Refinement (AMR): they use a fine grid only where the action is (e.g., around a shockwave) and a coarse grid elsewhere.

The challenge lies in deciding which parts of the mesh to refine. Current simulations mostly rely on "greedy" heuristics—mathematical rules of thumb that react to current error. However, these heuristics are short-sighted and do not account for how a refinement decision now might affect accuracy many steps into the future. This research explores whether Reinforcement Learning (RL) can provide a more effective, "look-ahead" strategy for managing computational budgets.

AMR as a Markov Decision Process

The authors frame the refinement process as a sequential decision-making problem. In this MDP, the state $s_t$ represents the current mesh and the underlying physical field. The agent observes this state and selects an element $i$ to refine (action $a_i$), leading to a new mesh state at the next time step. This formulation allows the agent to optimize for long-term cumulative rewards, such as total error reduction over the entire simulation.

Figure 1: The AMR process formulated as a Markov Decision Process, where an agent observes the mesh state and selects elements for refinement to maximize future rewards.

Specialized Neural Architectures

Standard neural networks require fixed-size inputs, which is incompatible with meshes that grow and change shape. To address this, the authors developed three specialized architectures designed to handle variable-sized inputs:

  1. Independent Policy Network (IPN): Processes each mesh element independently, making it highly scalable and local.
  2. Hypernetwork Policy: Uses a global view of the state to dynamically generate weights for a local network, capturing long-range interactions.
  3. Graph Network Policy: Models the mesh as a graph where elements are nodes and neighbors are connected, using "message passing" to understand spatial relationships.
Figure 5: The three proposed neural architectures for AMR: (a) Independent Policy Network, (b) Hypernetwork policy, and (c) Graph network policy.

Surrogate Rewards and Training Strategy

A key innovation is the use of a surrogate reward. Since the "true" analytical solution is often unknown in real-world engineering problems, the agent is rewarded based on the difference between the solution with and without the refinement. This clever proxy allows the agent to learn effective strategies even on problems where the ground truth is unavailable.

Key Insights and Results

The RL policies were evaluated on several challenges, including static function estimation and dynamic PDEs like the Burgers’ equation.

  • Anticipatory Refinement: Unlike reactive heuristics, RL agents learned to "anticipate" feature movement. In Burgers' equation tests, the RL policy generated a refinement front that tracked moving regions of interest before they arrived.
  • Generalization: A policy trained on a tiny $8 \times 8$ mesh can be successfully deployed on a $200 \times 200$ mesh (a 625x increase in elements). This suggests that the logic of refinement is local and transferable.
  • Performance: RL-based methods matched or outperformed the widely-used Zienkiewicz-Zhu (ZZ) error estimator in 20 out of 24 test cases, showing particular strength in handling sharp discontinuities.

Limitations and Future Directions

While promising, the current model refines only one element per MDP step, which may be inefficient for massive industrial simulations. Additionally, the current work focuses on h-refinement (splitting cells) but does not yet implement derefinement (merging cells). Future work will explore multi-agent approaches and scaling these policies to 3D simulations with more complex fluid dynamics.

Summary updated

Abstract

Large-scale finite element simulations of complex physical systems governed by partial differential equations (PDE) crucially depend on adaptive mesh refinement (AMR) to allocate computational budget to regions where higher resolution is required. Existing scalable AMR methods make heuristic refinement decisions based on instantaneous error estimation and thus do not aim for long-term optimality over an entire simulation. We propose a novel formulation of AMR as a Markov decision process and apply deep reinforcement learning (RL) to train refinement {\it policies} directly from simulation. AMR poses a new problem for RL as both the state dimension and available action set changes at every step, which we solve by proposing new policy architectures with differing generality and inductive bias. The model sizes of these policy architectures are independent of the mesh size and hence can be deployed on larger simulations than those used at train time. We demonstrate in comprehensive experiments on static function estimation and time-dependent equations that RL policies can be trained on problems without using ground truth solutions, are competitive with a widely-used error estimator, and generalize to larger, more complex, and unseen test problems.
BibTeX
@inproceedings{yang2023reinforcement,
  author = {Jiachen Yang and Tarik Dzanic and Brenden K. Petersen and Jun Kudo and Ketan Mittal and Jean-Sylvain Camier and Vladimir Tomov and Tuo Zhao and Hongyuan Zha and Tzanio Kolev and Robert Anderson and Daniel faissol},
  title = {{Reinforcement Learning for Adaptive Mesh Refinement}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
}
Figure