The snippet performs filesystem write operations using std::ofstream. As far as I can tell without seeing the full code, this is not restricted to the rank 0 process (where the reduced data is communicated to by BlockReduction2D2D). Thus all processes execute this the std::ofstream code and write to the same file. When using e.g. OpenLB’s default VTK writer this is resolved transparently in the background.