JAX-FEM: A differentiable GPU-accelerated 3D finite element solver for automatic inverse design and mechanistic data science

Tianju Xue, Shuheng Liao, Zhengtao Gan, Chanwook Park, Xiaoyu Xie, Wing Kam Liu, Jian Cao

Introduction

This paper introduces JAX-FEM, an open-source library that brings the high-performance capabilities of Google’s JAX—specifically GPU acceleration and automatic differentiation (AD)—to the world of 3D Finite Element Method (FEM) simulation. By implementing FEM in a differentiable framework, JAX-FEM provides a unified platform for solving massive forward simulations, complex inverse design problems, and "mechanistic data science" (the integration of machine learning with physical laws).

Addressing Bottlenecks in Traditional FEA

Traditional Finite Element Analysis (FEA) workflows suffer from two primary bottlenecks that JAX-FEM aims to resolve:

  1. Computational Efficiency: Solving large-scale 3D problems with millions of degrees of freedom (DOF) is computationally expensive. Traditional CPU-based parallelization (MPI) often hits scaling limits due to communication overhead.
  2. Human Productivity: Implementing inverse problems, such as topology optimization or material parameter identification, requires calculating gradients (sensitivities). Manually deriving and coding these for complex, nonlinear materials is tedious and error-prone. Furthermore, integrating machine learning (ML) models into traditional FEM software usually requires a fragmented workflow of data export and external training.

Methodology

JAX-FEM is built on top of Google JAX, utilizing several key technical features to achieve high performance and flexibility:

  • Array Programming & JIT: By using jax.vmap for vectorization and XLA (Accelerated Linear Algebra) for Just-In-Time compilation, the library achieves high performance on GPUs despite being written in pure Python.
  • Automatic Differentiation (AD): JAX-FEM uses AD to automatically linearize nonlinear problems for Newton’s method and compute gradients for optimization. This removes the need for users to manually derive element stiffness matrices or adjoint equations.
  • Adjoint Method: For inverse problems where the number of design parameters is much larger than the objective, the library implements the adjoint method via AD to compute gradients efficiently.
  • Unified Ecosystem: Because it is built on JAX, neural networks can be used as constitutive models directly within the FEM loop using libraries like Flax or Haiku.
Validation of JAX-FEM against FEniCSx for various material models: (a) cylinder mesh, (b) linear elasticity, (c) hyperelasticity, and (d) plasticity.

Key Results and Insights

The authors evaluate JAX-FEM using standard benchmarks, including linear elasticity, hyperelasticity (neo-Hookean), and J2-plasticity models, validated against established solvers like FEniCSx and Abaqus.

Performance and Scalability

In a 3D tensile loading problem with 7.7 million DOFs using an ASTM D638 specimen mesh, JAX-FEM on an NVIDIA Quadro RTX 8000 achieved a 9.1x speedup compared to Abaqus running on 24 CPU cores. This demonstrates that for very large problems, the message-passing delays of traditional CPU-based MPI become a major bottleneck, whereas a single high-end GPU can handle millions of DOFs with much higher efficiency.

Inverse Design and ML Integration

  • Topology Optimization: The solver successfully optimized a 3-hole bracket, achieving a 64.2% reduction in compliance compared to a standard human design while maintaining the same material volume.
  • Mechanistic Data Science: In a multi-scale composite material example, a neural network surrogate model was trained and deployed to solve a macroscopic problem. The NN-based model used only 25,000 cells to achieve results comparable to a Direct Numerical Simulation (DNS) using 200,000 cells, significantly reducing computational cost.

Conclusion and Future Work

JAX-FEM represents a significant step forward by automating the derivation of sensitivities, allowing researchers to experiment with complex nonlinear materials in inverse design without weeks of mathematical derivation. While currently limited by its element library (primarily hexahedral) and basic linear solvers, future work will focus on multi-GPU support to exceed the ~10 million DOF limit of single GPUs and interfacing with robust libraries like PETSc for improved preconditioning.

Summary updated

BibTeX
@article{xue2023jax,
  author = {Tianju Xue and Shuheng Liao and Zhengtao Gan and Chanwook Park and Xiaoyu Xie and Wing Kam Liu and Jian Cao},
  title = {{JAX-FEM: A differentiable GPU-accelerated 3D finite element solver for automatic inverse design and mechanistic data science}},
  journal = {Comput. Phys. Commun.},
  year = {2023},
  doi = {10.1016/j.cpc.2023.108802},
}
Figure