Bauer M, Rüde U (2016)
Publication Language: English
Publication Type: Conference contribution, Abstract of lecture
Publication year: 2016
In the proposed talk we present a Python extension to the massively parallel HPC simulation toolkit waLBerla. waLBerla is a framework for stencil based algorithms operating on block-structured grids with the main application field being fluid simulations in complex geometries using the lattice Boltzmann method. Additionally, a free-surface extension based on a volume-of-fluid approach and phase-field methods have been implemented in this framework. Careful performance engineering results in excellent node performance and good scalability to over 400,000 cores. To increase the usability and flexibility of the C++ framework, a Python interface was developed.
We embed the Python interpreter in existing waLBerla C++ application, providing the possibility to call Python functions from C++ code. These callbacks are used at all stages of the simulation pipeline: They simplify and automate scenario setup, evaluation, and plotting. We show how our Python interface outperforms the existing text-file-based configuration mechanism, providing features like automatic nondimensionalization of physical quantities and handling of complex parameter dependencies. Furthermore, Python is used to process and evaluate results while the simulation is running, leading to smaller output files and the possibility to adjust parameters dependent on the current simulation state.
waLBerla's central C++ data structures are exported such that a seamless interfacing to other numerical Python libraries like numpy or scipy is possible. This is achieved by implemented the Buffer Protocol for waLBerla's structured grids, such that they can be accessed in Python without having to copy them.
Besides embedding the Python interpreter in C++ applications, we additionally package the waLBerla framework as a Python module, such that Python can be the driving language of the simulation. The module is distributed using the conda package manager, and interactive Python notebooks are available as tutorial.
The flexibility and expressive power of Python enables the user to develop code faster compared to C++. It is therefore also suitable for prototyping of new methods or boundary conditions, a task that previously was done using tools like Matlab. The Python interface of waLBerla makes the framework more attractive for domain experts, which typically are not familiar with C++ programming.
Bauer, M., & Rüde, U. (2016). Lattice Boltzmann Fluid Simulations with the waLBerla Framework. Paper presentation at EuroSciPy, Erlangen, DE.
Bauer, Martin, and Ulrich Rüde. "Lattice Boltzmann Fluid Simulations with the waLBerla Framework." Presented at EuroSciPy, Erlangen 2016.