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

#9059
Danial.Khazaeipoul
Participant

Thank you Adrian, for the detailed explanation and also the important notes on parallelization aspects.

I am working on a verification case involving a single bubble rising in a liquid column, using free-surface dynamics. The example works so far, with reasonable errors compared to experimental data. However, OpenLB’s free-surface implementation lacks a bubble model that enforces constant bubble pressure, which may explain the discrepancies observed. I am now attempting to implement a bubble model, starting with detecting bubbles in the domain by assigning a unique tag to cells belonging to each bubble. To achieve this, I plan to implement an algorithm like flood-fill to detect connected regions (neighboring gas and interface cells) and store their IDs in a global shared structure. Here’s the pseudo-code outlining the algorithm:

// Start tagging process
int currentTag = 1;

for each cell in cells
{
if ((cell.isGasOrInterface()) && (!cell.hasTag()))
{
// Add the cell to the queue and assign it a unique tag
queue.push(cell);

// Process the queue
while (!queue.empty())
{
// Get the next cell from the queue
Cell currentCell = queue.front();
currentCell.setTag(currentTag);
queue.pop();

// Get the face neighbors of the current cell
for each neighbor in currentCell.getFaceNeighbors()
{
if ((neighbor.isGasOrInterface()) && (!neighbor.hasTag()))
{
// If the neighbor is gas or interface and has no tag, add to queue
queue.push(neighbor);
}
}
}

// Increment the tag for the next group of cells
currentTag++;
}
}

So the purpose of the list is to enable searching for the connected cells, if they are gas or interface.

Best regards,
Danial