# Accelerating FVM-Based Parallel Fluid Simulations with Better Grid Renumbering Methods
## 4 CQ: The Cell-Quotient Grid Renumbering Algorithm for Large-Scale Parallel Fluid Simulations
### Cell-Quotient (CQ) Numbering Algorithm  
The idea of CQ renumbering algorithm proposed in this paper is derived from the AD algorithm [12]. This method belongs to the mathematical induction method. The sparse matrix with good convergence is generated by numbering the CFD grid. Based on the idea of mathematical induction, the final CQ algorithm is formed by summarizing the characteristics of each element such as the sum of neighboring element numbers. Figure 6 shows a comparison of maximum bandwidth and profile of matrix with disordered cell numbers and better cell numbers. Tables 1 and 2 correspond to the better grid numbering, disordered grid numbering of Figure 6, respectively. The CFD grid number has a close relationship with its cell quotient, with a significant positive correlation. Only the cell quotient of the better grid numbering is arranged from smallest to largest. In other words, numbering the mesh according to the ascending sequence of cell quotients will result in better numbered cells, which further results in better sparse matrices. The algorithm proves that it greatly reduces the bandwidth and contour of sparse matrices and may play a great role in matrix multiplication operations such as SpMV in the future. This paper only studies its role in CFD numerical simulations based on the finite volume method. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Cell ID** & \multicolumn{2}{c}{**Optimized Neighboring Cell**} & **Sum of Number** & **CQ** \\ \hline
1 & 2,3 & 5 & 2.5 \\
2 & 1,4 & 5 & 2.5 \\
3 & 1,4,5 & 10 & 3.3 \\
4 & 2,3,6 & 11 & 3.7 \\
5 & 3,6,7 & 16 & 5.3 \\
6 & 4,5,8 & 17 & 5.7 \\
7 & 5,8 & 13 & 6.5 \\
8 & 6,7 & 13 & 6.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The cell quotient calculation method for the better grid. The first column indicates the cell number of the current grid. The second row indicates the neighboring cells corresponding to the cell. The third column indicates the sum of neighboring cells. The fourth column indicates the cell quotient of the cell, which is obtained from _the quotient of the sum of number and the number of neighboring cells_. Figure 6: Comparison of maximum bandwidth and profile of matrix with disordered cell numbers and better cell numbers. The upper part shows from left to right the better cell numbered cases, the matrix of the cases and the bandwidth and contours of the matrix, respectively. The lower part shows the disordered counterpart. Different from the traditional AD algorithm, this paper uses the change relationship between the target grid cell and the sum of neighbor numbers as the judgment criterion for the optimization iteration. The specific steps are as follows:  
1. Set the convergence index \(\epsilon\) of the optimization iteration;
2. Calculate the maximum bandwidth \(\beta_{o}\) under the current number;
3. Calculate the sum of adjacent mesh numbers, the number of related grids, and the number of cell quotient for each grid;
4. Renumber all nodes according to the cell quotient;
5. Calculate the maximum bandwidth \(\beta_{1}\) under the current number;
6. If \(0\leq(\beta_{o}-\beta_{1})/\beta_{o}\leq\epsilon\), abort the optimization iteration process; otherwise, repeat the calculation until convergence. The general program structure of the algorithm is given in Algorithm 2.