Wall Distance
Wall distance is the distance from a cell center to the nearest wall. These values are calculated and held in each cell if the GE-RANS turbulence is activated. There are three methods available in CMPS to calculate wall distances:
- Parallel Modified Fast Marching Method (FMM) with breadth-first search (BFS) algorithm.
- PDE method based on the solution of the Poisson Equation.
- Direct search.
MFMM with BFS
CMPS implements a parallel version of the Fast Marching Method (FMM) algorithm with the Breadth-First Search (BFS) algorithm for computing wall distances. The FMM is a widely used numerical method for solving the Eikonal equation, which gives the distance to the nearest wall from each cell of the grid. Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a certain property. It starts at the root of the tree and searches all nodes at the current depth before moving to nodes at the next depth level.
In CMPS, FMM and BFS are used together to calculate wall distances. The basic idea of these methods is to start from the walls and transfer the required information layer by layer over the entire grid.
First, CMPS begins by iterating over the wall faces and updating the distance information for the adjacent cells. To do this, it calculates the distance between the wall face and the adjacent cell and compares it to the current distance. If the new distance is smaller, the distance information for the neighboring cell is updated.
CMPS then distributes the updated distance information to neighboring cells that are not adjacent to a wall. It then performs a series of passes over the grid, each pass updating the spacing information for the cells that are adjacent to the cells that were updated in the previous pass. This continues until all cells have been updated. In this phase, the CMPS implements a BFS algorithm. The BFS algorithm starts at a particular starting node (in this case, the starting position on the grid) and examines all of its neighbors at a distance of 1 (face neighbor cells) from the starting node. It then examines all neighbors at a distance of 2, then 3, and so on, until all nodes (cells) in the graph (grid connectivity data) have been examined. The grid is represented as a graph (connections are held in cell face connectivity), where each cell of the grid is a node in the graph. The neighbors of each node are the neighboring cells that are not walls. The distance between each node is 1.
To calculate the wall distances, the BFS algorithm is slightly modified. Instead of simply exploring all the neighbors of each node, the algorithm tracks the distance from the starting node to each visited node. When it encounters a plot node, the distance to that wall node is recorded.
This process continues until all nodes in the graph have been visited. At the end, the algorithm returns a vector of the same size as the input grid, in which each element indicates the distance to the nearest wall for the corresponding cell in the input grid.
This method is faster than PDE methods and calculates exact wall distances. The implicit tree methods used in some commercial solvers are effective when only the geometric data of the surfaces is available as CAD data, but they can still return incorrect values for complex geometries because the global tree data can result in incorrect branches.
PDE Method with Poisson Equation
The PDE wall distance calculation uses a pure Poisson-type diffusion equation for a distance-related variable φ.
∇2φ = -1
This equation is solved with an iterative implicit method with the boundary conditions for this equation, which are:
- φ = 0 at wall boundaries.
- ∇ ⋅ n = 0 at all other boundaries, where n is the normal vector from the boundary.
Then wall distances d are computed with the following equation:
d = -|∇φ| + √(|∇φ|2 + 2φ)
This method may pose some problems for large and complex grids. The parallel solution raises some problems with large partitions and never computes exact values. This method should be used only if MFMM fails with the BFS method.
Direct Search
Direct search is a simple search algorithm that is too slow for most applications. However, it is the most reliable method, and the results can be used to validate other methods.