Cubble: Flowing foam coarsening simulator using c++/CUDA

The mechanics of foams exhibit dynamical behavior familiar from other jammed materials, such as granular matter. These are so called yield stress fluids i.e. their flow requires external stress that exceeds a paricular value, called the yield stress. On the other hand, foams differ from other materials by their internal structure development, coarsening, where while the gas concentration of the foam remains constant, the gas diffuses between the bubbles. The larger bubbles grow at the expense of the smaller ones.

This module provides the capability to run dynamical coarsening on flowing systems to the Cubble: Static foam coarsening simulator using c++/CUDA module.

Purpose of Module

This module implements background flow to the Cubble simulator. Implementation includes flow by enforcing bubble velocity to all bubbles inside a defined regime. Implementation includes viscous dissipation at the boundaries.

Background Information

The code runs as a standalone simulation on a cluster (triton.aalto.fi) environment. It is developed mostly on NVidia’s Tesla P100 and V100 GPUs.

Building and Testing

The binary is built using a build automation tool Make. The dimensionality of the simulation is controlled from within the makefile. Each make target is built into a separate directory: final, default or debug. Each of these directories has its own makefile and all the targets are built/cleaned in the same way:

make
make clean
  • final target is the one that should be run when doing simulations. It’s the fastest and most optimized.
  • default target is built with -O2 flag so it’s quite fast, but some internal debug capabilities are still on and it’s significantly slower than the final target. Mostly for testing some new capabilities.
  • debug is built with -O0 and debug capabilities, only meant for debugging and therefore it is very slow.

In addition to the options above, there are some extra parameters in the makefile which can be used to e.g. turn profiling on/off.

The program can be run by typing

make run

or by manually writing the path to the executable and the io files, e.g.

final/bin/cubble input_parameters.json output_parameters.json

We include a set of reference parameters in input_parameters.json

The program runs until a certain amount of bubbles is left. After this, the program writes one final data file and returns. The parameter that controls the amount of bubbles (called MinNumBubbles) should always be larger than the number of bubbles in one cell multiplied by 3^NumDim. In other words, if the number of bubbles in a cell is 32 and the dimensionality of the program is 2 (2D simulation), then the minimum number of bubbles should be larger than 32 * 3^2 = 32 * 3 * 3 = 288. For 3D this would be 864. 300 and 900 are nice round numbers for MinNumBubbles.

The reason for this is that the neighbor search is done in a manner that assumes at least 3 cells in each dimension. If there are less than 3 cells per dimension, some cells are searched through more than once, leading to bubbles having the same bubble as a neighbor multiple times. The implementation should and could be improved to circumvent this, but “in the mean time” just follow the above rule.

Source Code

The source code is freely available for download at Cubble sources <https://github.com/KJLankinen/cubble> and the module refers to the repository version with commit 0830686ac628d884d23666560ddded5361b7f606.