The scientific code generation package lbmpy supports the automated design and the efficient implementation of lattice Boltzmann methods (LBMs) through metaprogramming. It is based on a new, concise calculus for describing multiple relaxation-time LBMs, including techniques that enable the numerically advantageous subtraction of the constant background component from the populations. These techniques are generalized to a wide range of collision spaces and equilibrium distributions. The article contains an overview of lbmpy's front-end and its code generation pipeline, which implements the new LBM calculus by means of symbolic formula manipulation tools and object-oriented programming. The generated codes have only a minimal number of arithmetic operations. Their automatic derivation rests on two novel Chimera transforms that have been specifically developed for efficiently computing raw and central moments. Information contained in the symbolic representation of the methods is further exploited in a customized sequence of algebraic simplifications, further reducing computational cost. When combined, these algebraic transformations lead to concise and compact numerical kernels. Specifically, with these optimizations, the advanced central moment- and cumulant-based methods can be realized with only little additional cost as when compared with the simple BGK method. The effectiveness and flexibility of the new lbmpy code generation system is demonstrated in simulating Taylor-Green vortex decay and the automatic derivation of an LBM algorithm to solve the shallow water equations.
翻译:科学代码生成软件包 lbmpy 支持通过元程序化来自动设计和高效实施 lattice Boltzmann 方法(LBMs) 的自动设计和高效实施, 其基础是描述多个放松时间 LBM 的新的、 简明的计算计算法, 包括能够从人群中从常态背景组件中进行数字上有利的扣减的技术。 这些技术被广泛推广到一系列碰撞空间和均衡分布。 文章包含对 lbmpy 前端及其代码生成管道的概览, 通过象征性公式操纵工具和面向目标的编程来实施新的 LBM 计算法。 生成的代码只有少量的算术操作。 其自动衍生依据是两种新的奇梅拉变法, 这些变法是专门为高效地计算原始和中心时所开发的。 这些方法的象征性表示方式被进一步用于一个定制的平面简化程序, 进一步降低计算成本。 当这些平面变形转换导致精细的数字内核。 具体来说, 只有在这些精细的中央- 和精细的递的递变式计算法方法下, 才能实现成本化的系统, 和精细的精细的递的递的递的精确的递化的系统, 。