Adaptive Swarm Mesh Refinement using Deep Reinforcement Learning with Local Rewards

Niklas Freymuth, Philipp Dahlinger, Tobias Würth, Simon Reisch, Luise Kärger, Gerhard Neumann · DOI

Abstract

Numerical simulations using the Finite Element Method (FEM) are essential in engineering but are often constrained by the trade-off between mesh resolution and computational efficiency. Traditional Adaptive Mesh Refinement (AMR) relies on heuristics that may not generalize well or account for long-term simulation accuracy. We present ASMR++, a multi-agent reinforcement learning (MARL) approach that treats mesh elements as a collaborative swarm. By employing local max-error rewards and a hierarchical agent mapping, ASMR++ matches the performance of expensive oracle-based methods while achieving up to 100x speedups over uniform refinement. The method demonstrates strong zero-shot generalization to complex geometries and varying physical domains.

Introduction

The Finite Element Method (FEM) is the standard for simulating physical phenomena, yet its efficiency is limited by the mesh structure. A fine mesh provides accuracy at high computational cost, while a coarse mesh is fast but prone to error. Adaptive Mesh Refinement (AMR) attempts to balance these by refining the mesh only where necessary. However, classical AMR strategies often rely on local, greedy heuristics that ignore the global impact of refinements over multiple steps.

Existing machine learning approaches to AMR face challenges in scaling to large meshes and handling dynamic state spaces where the number of agents (elements) changes as they split. ASMR++ addresses these issues by formulating the problem as an Adaptive Swarm Markov Decision Process (ASMDP), enabling stable training and efficient inference across diverse partial differential equations (PDEs).

Methodology: The ASMR++ Framework

The core of ASMR++ is the treatment of each mesh element as an autonomous agent within a swarm. These agents interact via a Message Passing Network (MPN) to share local information and decide whether to split.

Overview of the ASMR++ iterative refinement loop, showing the transition from a current mesh to a refined mesh guided by the policy.

Adaptive Swarm Markov Decision Process

In the ASMDP framework, the state of the mesh is represented as an observation graph $\mathcal{G}_{\Omega^t}$. Each agent $i$ observes its local features and neighborhood context. The policy $\pi(\mathbf{a}|\mathcal{G}_{\Omega^t})$ outputs a binary action for each agent: to refine (split) or stay.

Hierarchical Agent Mapping and Credit Assignment

A significant challenge in MARL for AMR is the changing number of agents. When an element splits, it produces "children" agents. ASMR++ introduces a responsibility mapping $\phi$ that links these generations. This mapping allows rewards to be propagated back from children to parents, ensuring that early-stage refinements are credited for later improvements in simulation accuracy.

Hierarchical refinement process and the corresponding agent mapping $\phi$, illustrating how rewards propagate through the refinement tree.

Local Max-Error Rewards and the $\alpha$ Penalty

To ensure global accuracy, ASMR++ uses local rewards based on the reduction of the maximum local error. This focus prevents the policy from ignoring critical high-error regions. Additionally, the policy is conditioned on a scalar penalty $\alpha$. By adjusting $\alpha$ at inference time, users can control the mesh density—effectively trading off accuracy for speed without retraining the model.

Experimental Results

The researchers evaluated ASMR++ across several physical benchmarks, including Laplace, Poisson, Stokes Flow, and Linear Elasticity equations in both 2D and 3D.

Performance and Efficiency

ASMR++ consistently outperformed traditional heuristics like the Zienkiewicz-Zhu (ZZ) error estimator. In complex scenarios such as Stokes Flow, ASMR++ generated meshes that allowed for simulations 30x to 100x faster than uniform refinement for the same error level. Notably, the method matched the accuracy of "Oracle" strategies that utilize ground-truth solutions, which are unavailable in real-world applications.

Generalization and Scalability

One of the most striking results is the zero-shot scaling capability. Policies trained on simple $1 \times 1$ square domains successfully generalized to complex $20 \times 20$ spiral geometries containing over 50,000 elements. This demonstrates that the local swarm-based approach captures fundamental refinement principles that are independent of the global domain shape.

Conclusion

ASMR++ represents a significant advancement in AI-driven engineering simulations. By framing mesh refinement as a multi-agent swarm problem with local rewards, it overcomes the limitations of previous RL methods regarding scalability and stability. While current limitations include the necessity of a PDE solver during the refinement loop and the lack of element coarsening, future work aims to incorporate merging operations to handle transient simulations where regions of interest move over time.

Summary updated

BibTeX
@misc{freymuth2024adaptive,
  author = {Niklas Freymuth and Philipp Dahlinger and Tobias Würth and Simon Reisch and Luise Kärger and Gerhard Neumann},
  title = {{Adaptive Swarm Mesh Refinement using Deep Reinforcement Learning with Local Rewards}},
  year = {2024},
  eprint = {2406.08440},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.08440},
}
Figure