This MR introduces an extension to the pystencils/lbmpy code generation system of waLBerla, providing an intuitive interface to generate the Even/Odd-timestep alternating sweeps required for in-place LBM streaming patterns, like the AA-Pattern and EsoTwist.
pystencils_walberla codegen module is extended by the generation of selective sweeps, where multiple kernels are compiled into the same sweep class. The kernel to be executed is then selected at runtime by a generated
if/else cascade, according to a number of selection arguments passed to the sweep.
generate_alternating_lbm_sweep uses the selective sweep codegen interface to generate an Even/Odd alternating LBM sweep. The correct kernel is selected according to an integer argument. A high-level interface to the sweep hides this argument by instead accepting an instance of the
walberla::lbm::TimestepTracker class, which tracks Even/Odd timesteps in the waLBerla timeloop.
Selective Sweep Codegen for Sweeps
Alternating LB Sweep
Selective Sweep Codegen for Boundaries
Alternating LB boundary
Flow Around Sphere Benchmark App