Skip to content

Reply To: Modifying field values for neighboring cells inside a postprocessor

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Modifying field values for neighboring cells inside a postprocessor Reply To: Modifying field values for neighboring cells inside a postprocessor

#9268
Danial.Khazaeipoul
Participant

Thank you Adrian for your detailed response.

The algorithm I’m implementing is a variant of the Connected Component Labeling (CCL) algorithm that eliminates the need for a queue or stack, as used in traditional flood-fill algorithms, which are not feasible on GPUs. Additionally, fixed-size arrays are not optimal in this context. In general, a CCL algorithm consists of three distinct kernels implemented using the apply operator within the freeSurfacePostProcessor3D. In the first two kernels, only local cell data is modified. However, the third kernel modifies a non-local cell data, which can result in overlapping updates, potentially causing a race condition. Therefore, modifications in this kernel need to be atomic. Despite not yet using atomic operations in the third kernel, the algorithm still assigns a unique ID to each connected region. For example, when tested with 15 connected regions, it successfully assigned a unique ID to each one, tested on both CPUs and GPUs.

The only issue at the moment is that if a connected region is split across partitions when the domain is partitioned, each section of the region receives a different unique ID in each partition. However, if the connected region remains entirely within a single partition, the parallel runs work correctly. The problem arises when the region moves and crosses partition boundaries, leading to the scenario where the region gets split and different unique IDs are assigned.

Regarding the OperatorScope::PerBlock method you suggested, running grep -r "OperatorScope::PerBlock" didn’t return many relevant results for me to review. I’ll continue digging deeper to find more information on this topic. In the meantime, I would appreciate it if you could point me to an example that demonstrates the use of this method within OpenLB.