Generation of efficient adjoint lattice Boltzmann methods with algorithmic differentiation
28 Pages Posted: 1 Apr 2026
Abstract
Adjoint-based optimization is widely used to address large-scale flow control problems with distributed control variables, as the computational cost of gradient evaluation is independent of the dimension of the control space. Within this context, the lattice Boltzmann method (LBM) represents an attractive discretization scheme, as it not only reduces the computational expense within optimization iteration loops but also exposes Jacobian expressions through its explicit operator-split formulation, thereby simplifying adjoint analysis. Despite these advantages, most existing adjoint LBM approaches rely on manual derivation of the adjoint system, lack automation, and are highly case-specific. High-level frameworks based on automatic differentiation (AD) address this limitation by enabling generic gradient computation but often compromise numerical performance. In this work, we present a novel framework implemented in the open-source LBM library OpenLB that enables the automated generation of discrete adjoint LBM collision kernels. AD is applied locally to evaluate the Jacobians of the adjoint system, eliminating manual derivations. Code generation combined with common subexpression elimination (CSE) removes the runtime overhead of AD tapes, allowing efficient adjoint collision kernels to be generated from their primal implementations. We conduct a detailed kernel-level performance analysis that is rarely addressed in the literature, where the arithmetically preferred AD mode for adjoint LBM kernels is identified within the proposed approach, and roofline analysis evaluates performance rather than strong and weak scaling tests, which primarily reflect communication overhead. The impact of CSE is investigated across different hardware architectures and floating-point precisions, demonstrating speedups of up to a factor of seven for adjoint collision kernels for double precision on GPUs.
Keywords: Lattice Boltzmann Method, computational fluid dynamics, Adjoint analysis, Algorithmic differentiation, Code generation
Suggested Citation: Suggested Citation